/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value2) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value: value2 }) : obj[key] = value2;
var __spreadValues = (a4, b10) => {
for (var prop in b10 || (b10 = {}))
if (__hasOwnProp.call(b10, prop))
__defNormalProp(a4, prop, b10[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b10)) {
if (__propIsEnum.call(b10, prop))
__defNormalProp(a4, prop, b10[prop]);
}
return a4;
};
var __spreadProps = (a4, b10) => __defProps(a4, __getOwnPropDescs(b10));
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __esm = (fn2, res) => function __init() {
return fn2 && (res = (0, fn2[Object.keys(fn2)[0]])(fn2 = 0)), res;
};
var __commonJS = (cb, mod3) => function __require() {
return mod3 || (0, cb[Object.keys(cb)[0]])((mod3 = { exports: {} }).exports, mod3), mod3.exports;
};
var __export = (target, all) => {
__markAsModule(target);
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __reExport = (target, module2, desc) => {
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
for (let key of __getOwnPropNames(module2))
if (!__hasOwnProp.call(target, key) && key !== "default")
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
}
return target;
};
var __toModule = (module2) => {
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
};
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value2) => {
try {
step(generator.next(value2));
} catch (e4) {
reject(e4);
}
};
var rejected = (value2) => {
try {
step(generator.throw(value2));
} catch (e4) {
reject(e4);
}
};
var step = (x6) => x6.done ? resolve(x6.value) : Promise.resolve(x6.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
// node_modules/preact/dist/preact.module.js
function a(n3, l4) {
for (var u3 in l4)
n3[u3] = l4[u3];
return n3;
}
function h(n3) {
var l4 = n3.parentNode;
l4 && l4.removeChild(n3);
}
function v(l4, u3, i4) {
var t4, r4, o3, f3 = {};
for (o3 in u3)
o3 == "key" ? t4 = u3[o3] : o3 == "ref" ? r4 = u3[o3] : f3[o3] = u3[o3];
if (arguments.length > 2 && (f3.children = arguments.length > 3 ? n2.call(arguments, 2) : i4), typeof l4 == "function" && l4.defaultProps != null)
for (o3 in l4.defaultProps)
f3[o3] === void 0 && (f3[o3] = l4.defaultProps[o3]);
return y(l4, f3, t4, r4, null);
}
function y(n3, i4, t4, r4, o3) {
var f3 = { type: n3, props: i4, key: t4, ref: r4, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, __h: null, constructor: void 0, __v: o3 == null ? ++u : o3 };
return o3 == null && l2.vnode != null && l2.vnode(f3), f3;
}
function p2() {
return { current: null };
}
function d(n3) {
return n3.children;
}
function _(n3, l4) {
this.props = n3, this.context = l4;
}
function k(n3, l4) {
if (l4 == null)
return n3.__ ? k(n3.__, n3.__.__k.indexOf(n3) + 1) : null;
for (var u3; l4 < n3.__k.length; l4++)
if ((u3 = n3.__k[l4]) != null && u3.__e != null)
return u3.__e;
return typeof n3.type == "function" ? k(n3) : null;
}
function b(n3) {
var l4, u3;
if ((n3 = n3.__) != null && n3.__c != null) {
for (n3.__e = n3.__c.base = null, l4 = 0; l4 < n3.__k.length; l4++)
if ((u3 = n3.__k[l4]) != null && u3.__e != null) {
n3.__e = n3.__c.base = u3.__e;
break;
}
return b(n3);
}
}
function m(n3) {
(!n3.__d && (n3.__d = true) && t2.push(n3) && !g.__r++ || o !== l2.debounceRendering) && ((o = l2.debounceRendering) || r2)(g);
}
function g() {
for (var n3; g.__r = t2.length; )
n3 = t2.sort(function(n4, l4) {
return n4.__v.__b - l4.__v.__b;
}), t2 = [], n3.some(function(n4) {
var l4, u3, i4, t4, r4, o3;
n4.__d && (r4 = (t4 = (l4 = n4).__v).__e, (o3 = l4.__P) && (u3 = [], (i4 = a({}, t4)).__v = t4.__v + 1, j(o3, t4, i4, l4.__n, o3.ownerSVGElement !== void 0, t4.__h != null ? [r4] : null, u3, r4 == null ? k(t4) : r4, t4.__h), z(u3, t4), t4.__e != r4 && b(t4)));
});
}
function w(n3, l4, u3, i4, t4, r4, o3, f3, s4, a4) {
var h3, v3, p4, _8, b10, m4, g4, w4 = i4 && i4.__k || c2, A4 = w4.length;
for (u3.__k = [], h3 = 0; h3 < l4.length; h3++)
if ((_8 = u3.__k[h3] = (_8 = l4[h3]) == null || typeof _8 == "boolean" ? null : typeof _8 == "string" || typeof _8 == "number" || typeof _8 == "bigint" ? y(null, _8, null, null, _8) : Array.isArray(_8) ? y(d, { children: _8 }, null, null, null) : _8.__b > 0 ? y(_8.type, _8.props, _8.key, null, _8.__v) : _8) != null) {
if (_8.__ = u3, _8.__b = u3.__b + 1, (p4 = w4[h3]) === null || p4 && _8.key == p4.key && _8.type === p4.type)
w4[h3] = void 0;
else
for (v3 = 0; v3 < A4; v3++) {
if ((p4 = w4[v3]) && _8.key == p4.key && _8.type === p4.type) {
w4[v3] = void 0;
break;
}
p4 = null;
}
j(n3, _8, p4 = p4 || e2, t4, r4, o3, f3, s4, a4), b10 = _8.__e, (v3 = _8.ref) && p4.ref != v3 && (g4 || (g4 = []), p4.ref && g4.push(p4.ref, null, _8), g4.push(v3, _8.__c || b10, _8)), b10 != null ? (m4 == null && (m4 = b10), typeof _8.type == "function" && _8.__k === p4.__k ? _8.__d = s4 = x(_8, s4, n3) : s4 = P(n3, _8, p4, w4, b10, s4), typeof u3.type == "function" && (u3.__d = s4)) : s4 && p4.__e == s4 && s4.parentNode != n3 && (s4 = k(p4));
}
for (u3.__e = m4, h3 = A4; h3--; )
w4[h3] != null && (typeof u3.type == "function" && w4[h3].__e != null && w4[h3].__e == u3.__d && (u3.__d = k(i4, h3 + 1)), N(w4[h3], w4[h3]));
if (g4)
for (h3 = 0; h3 < g4.length; h3++)
M(g4[h3], g4[++h3], g4[++h3]);
}
function x(n3, l4, u3) {
for (var i4, t4 = n3.__k, r4 = 0; t4 && r4 < t4.length; r4++)
(i4 = t4[r4]) && (i4.__ = n3, l4 = typeof i4.type == "function" ? x(i4, l4, u3) : P(u3, i4, i4, t4, i4.__e, l4));
return l4;
}
function A(n3, l4) {
return l4 = l4 || [], n3 == null || typeof n3 == "boolean" || (Array.isArray(n3) ? n3.some(function(n4) {
A(n4, l4);
}) : l4.push(n3)), l4;
}
function P(n3, l4, u3, i4, t4, r4) {
var o3, f3, e4;
if (l4.__d !== void 0)
o3 = l4.__d, l4.__d = void 0;
else if (u3 == null || t4 != r4 || t4.parentNode == null)
n:
if (r4 == null || r4.parentNode !== n3)
n3.appendChild(t4), o3 = null;
else {
for (f3 = r4, e4 = 0; (f3 = f3.nextSibling) && e4 < i4.length; e4 += 2)
if (f3 == t4)
break n;
n3.insertBefore(t4, r4), o3 = r4;
}
return o3 !== void 0 ? o3 : t4.nextSibling;
}
function C(n3, l4, u3, i4, t4) {
var r4;
for (r4 in u3)
r4 === "children" || r4 === "key" || r4 in l4 || H(n3, r4, null, u3[r4], i4);
for (r4 in l4)
t4 && typeof l4[r4] != "function" || r4 === "children" || r4 === "key" || r4 === "value" || r4 === "checked" || u3[r4] === l4[r4] || H(n3, r4, l4[r4], u3[r4], i4);
}
function $(n3, l4, u3) {
l4[0] === "-" ? n3.setProperty(l4, u3) : n3[l4] = u3 == null ? "" : typeof u3 != "number" || s2.test(l4) ? u3 : u3 + "px";
}
function H(n3, l4, u3, i4, t4) {
var r4;
n:
if (l4 === "style")
if (typeof u3 == "string")
n3.style.cssText = u3;
else {
if (typeof i4 == "string" && (n3.style.cssText = i4 = ""), i4)
for (l4 in i4)
u3 && l4 in u3 || $(n3.style, l4, "");
if (u3)
for (l4 in u3)
i4 && u3[l4] === i4[l4] || $(n3.style, l4, u3[l4]);
}
else if (l4[0] === "o" && l4[1] === "n")
r4 = l4 !== (l4 = l4.replace(/Capture$/, "")), l4 = l4.toLowerCase() in n3 ? l4.toLowerCase().slice(2) : l4.slice(2), n3.l || (n3.l = {}), n3.l[l4 + r4] = u3, u3 ? i4 || n3.addEventListener(l4, r4 ? T : I, r4) : n3.removeEventListener(l4, r4 ? T : I, r4);
else if (l4 !== "dangerouslySetInnerHTML") {
if (t4)
l4 = l4.replace(/xlink[H:h]/, "h").replace(/sName$/, "s");
else if (l4 !== "href" && l4 !== "list" && l4 !== "form" && l4 !== "tabIndex" && l4 !== "download" && l4 in n3)
try {
n3[l4] = u3 == null ? "" : u3;
break n;
} catch (n4) {
}
typeof u3 == "function" || (u3 != null && (u3 !== false || l4[0] === "a" && l4[1] === "r") ? n3.setAttribute(l4, u3) : n3.removeAttribute(l4));
}
}
function I(n3) {
this.l[n3.type + false](l2.event ? l2.event(n3) : n3);
}
function T(n3) {
this.l[n3.type + true](l2.event ? l2.event(n3) : n3);
}
function j(n3, u3, i4, t4, r4, o3, f3, e4, c5) {
var s4, h3, v3, y5, p4, k4, b10, m4, g4, x6, A4, P4 = u3.type;
if (u3.constructor !== void 0)
return null;
i4.__h != null && (c5 = i4.__h, e4 = u3.__e = i4.__e, u3.__h = null, o3 = [e4]), (s4 = l2.__b) && s4(u3);
try {
n:
if (typeof P4 == "function") {
if (m4 = u3.props, g4 = (s4 = P4.contextType) && t4[s4.__c], x6 = s4 ? g4 ? g4.props.value : s4.__ : t4, i4.__c ? b10 = (h3 = u3.__c = i4.__c).__ = h3.__E : ("prototype" in P4 && P4.prototype.render ? u3.__c = h3 = new P4(m4, x6) : (u3.__c = h3 = new _(m4, x6), h3.constructor = P4, h3.render = O), g4 && g4.sub(h3), h3.props = m4, h3.state || (h3.state = {}), h3.context = x6, h3.__n = t4, v3 = h3.__d = true, h3.__h = []), h3.__s == null && (h3.__s = h3.state), P4.getDerivedStateFromProps != null && (h3.__s == h3.state && (h3.__s = a({}, h3.__s)), a(h3.__s, P4.getDerivedStateFromProps(m4, h3.__s))), y5 = h3.props, p4 = h3.state, v3)
P4.getDerivedStateFromProps == null && h3.componentWillMount != null && h3.componentWillMount(), h3.componentDidMount != null && h3.__h.push(h3.componentDidMount);
else {
if (P4.getDerivedStateFromProps == null && m4 !== y5 && h3.componentWillReceiveProps != null && h3.componentWillReceiveProps(m4, x6), !h3.__e && h3.shouldComponentUpdate != null && h3.shouldComponentUpdate(m4, h3.__s, x6) === false || u3.__v === i4.__v) {
h3.props = m4, h3.state = h3.__s, u3.__v !== i4.__v && (h3.__d = false), h3.__v = u3, u3.__e = i4.__e, u3.__k = i4.__k, u3.__k.forEach(function(n4) {
n4 && (n4.__ = u3);
}), h3.__h.length && f3.push(h3);
break n;
}
h3.componentWillUpdate != null && h3.componentWillUpdate(m4, h3.__s, x6), h3.componentDidUpdate != null && h3.__h.push(function() {
h3.componentDidUpdate(y5, p4, k4);
});
}
h3.context = x6, h3.props = m4, h3.state = h3.__s, (s4 = l2.__r) && s4(u3), h3.__d = false, h3.__v = u3, h3.__P = n3, s4 = h3.render(h3.props, h3.state, h3.context), h3.state = h3.__s, h3.getChildContext != null && (t4 = a(a({}, t4), h3.getChildContext())), v3 || h3.getSnapshotBeforeUpdate == null || (k4 = h3.getSnapshotBeforeUpdate(y5, p4)), A4 = s4 != null && s4.type === d && s4.key == null ? s4.props.children : s4, w(n3, Array.isArray(A4) ? A4 : [A4], u3, i4, t4, r4, o3, f3, e4, c5), h3.base = u3.__e, u3.__h = null, h3.__h.length && f3.push(h3), b10 && (h3.__E = h3.__ = null), h3.__e = false;
} else
o3 == null && u3.__v === i4.__v ? (u3.__k = i4.__k, u3.__e = i4.__e) : u3.__e = L(i4.__e, u3, i4, t4, r4, o3, f3, c5);
(s4 = l2.diffed) && s4(u3);
} catch (n4) {
u3.__v = null, (c5 || o3 != null) && (u3.__e = e4, u3.__h = !!c5, o3[o3.indexOf(e4)] = null), l2.__e(n4, u3, i4);
}
}
function z(n3, u3) {
l2.__c && l2.__c(u3, n3), n3.some(function(u4) {
try {
n3 = u4.__h, u4.__h = [], n3.some(function(n4) {
n4.call(u4);
});
} catch (n4) {
l2.__e(n4, u4.__v);
}
});
}
function L(l4, u3, i4, t4, r4, o3, f3, c5) {
var s4, a4, v3, y5 = i4.props, p4 = u3.props, d3 = u3.type, _8 = 0;
if (d3 === "svg" && (r4 = true), o3 != null) {
for (; _8 < o3.length; _8++)
if ((s4 = o3[_8]) && "setAttribute" in s4 == !!d3 && (d3 ? s4.localName === d3 : s4.nodeType === 3)) {
l4 = s4, o3[_8] = null;
break;
}
}
if (l4 == null) {
if (d3 === null)
return document.createTextNode(p4);
l4 = r4 ? document.createElementNS("http://www.w3.org/2000/svg", d3) : document.createElement(d3, p4.is && p4), o3 = null, c5 = false;
}
if (d3 === null)
y5 === p4 || c5 && l4.data === p4 || (l4.data = p4);
else {
if (o3 = o3 && n2.call(l4.childNodes), a4 = (y5 = i4.props || e2).dangerouslySetInnerHTML, v3 = p4.dangerouslySetInnerHTML, !c5) {
if (o3 != null)
for (y5 = {}, _8 = 0; _8 < l4.attributes.length; _8++)
y5[l4.attributes[_8].name] = l4.attributes[_8].value;
(v3 || a4) && (v3 && (a4 && v3.__html == a4.__html || v3.__html === l4.innerHTML) || (l4.innerHTML = v3 && v3.__html || ""));
}
if (C(l4, p4, y5, r4, c5), v3)
u3.__k = [];
else if (_8 = u3.props.children, w(l4, Array.isArray(_8) ? _8 : [_8], u3, i4, t4, r4 && d3 !== "foreignObject", o3, f3, o3 ? o3[0] : i4.__k && k(i4, 0), c5), o3 != null)
for (_8 = o3.length; _8--; )
o3[_8] != null && h(o3[_8]);
c5 || ("value" in p4 && (_8 = p4.value) !== void 0 && (_8 !== y5.value || _8 !== l4.value || d3 === "progress" && !_8) && H(l4, "value", _8, y5.value, false), "checked" in p4 && (_8 = p4.checked) !== void 0 && _8 !== l4.checked && H(l4, "checked", _8, y5.checked, false));
}
return l4;
}
function M(n3, u3, i4) {
try {
typeof n3 == "function" ? n3(u3) : n3.current = u3;
} catch (n4) {
l2.__e(n4, i4);
}
}
function N(n3, u3, i4) {
var t4, r4;
if (l2.unmount && l2.unmount(n3), (t4 = n3.ref) && (t4.current && t4.current !== n3.__e || M(t4, null, u3)), (t4 = n3.__c) != null) {
if (t4.componentWillUnmount)
try {
t4.componentWillUnmount();
} catch (n4) {
l2.__e(n4, u3);
}
t4.base = t4.__P = null;
}
if (t4 = n3.__k)
for (r4 = 0; r4 < t4.length; r4++)
t4[r4] && N(t4[r4], u3, typeof n3.type != "function");
i4 || n3.__e == null || h(n3.__e), n3.__e = n3.__d = void 0;
}
function O(n3, l4, u3) {
return this.constructor(n3, u3);
}
function S(u3, i4, t4) {
var r4, o3, f3;
l2.__ && l2.__(u3, i4), o3 = (r4 = typeof t4 == "function") ? null : t4 && t4.__k || i4.__k, f3 = [], j(i4, u3 = (!r4 && t4 || i4).__k = v(d, null, [u3]), o3 || e2, e2, i4.ownerSVGElement !== void 0, !r4 && t4 ? [t4] : o3 ? null : i4.firstChild ? n2.call(i4.childNodes) : null, f3, !r4 && t4 ? t4 : o3 ? o3.__e : i4.firstChild, r4), z(f3, u3);
}
function q(n3, l4) {
S(n3, l4, q);
}
function B(l4, u3, i4) {
var t4, r4, o3, f3 = a({}, l4.props);
for (o3 in u3)
o3 == "key" ? t4 = u3[o3] : o3 == "ref" ? r4 = u3[o3] : f3[o3] = u3[o3];
return arguments.length > 2 && (f3.children = arguments.length > 3 ? n2.call(arguments, 2) : i4), y(l4.type, f3, t4 || l4.key, r4 || l4.ref, null);
}
function D(n3, l4) {
var u3 = { __c: l4 = "__cC" + f++, __: n3, Consumer: function(n4, l5) {
return n4.children(l5);
}, Provider: function(n4) {
var u4, i4;
return this.getChildContext || (u4 = [], (i4 = {})[l4] = this, this.getChildContext = function() {
return i4;
}, this.shouldComponentUpdate = function(n5) {
this.props.value !== n5.value && u4.some(m);
}, this.sub = function(n5) {
u4.push(n5);
var l5 = n5.componentWillUnmount;
n5.componentWillUnmount = function() {
u4.splice(u4.indexOf(n5), 1), l5 && l5.call(n5);
};
}), n4.children;
} };
return u3.Provider.__ = u3.Consumer.contextType = u3;
}
var n2, l2, u, i2, t2, r2, o, f, e2, c2, s2;
var init_preact_module = __esm({
"node_modules/preact/dist/preact.module.js"() {
e2 = {};
c2 = [];
s2 = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
n2 = c2.slice, l2 = { __e: function(n3, l4) {
for (var u3, i4, t4; l4 = l4.__; )
if ((u3 = l4.__c) && !u3.__)
try {
if ((i4 = u3.constructor) && i4.getDerivedStateFromError != null && (u3.setState(i4.getDerivedStateFromError(n3)), t4 = u3.__d), u3.componentDidCatch != null && (u3.componentDidCatch(n3), t4 = u3.__d), t4)
return u3.__E = u3;
} catch (l5) {
n3 = l5;
}
throw n3;
} }, u = 0, i2 = function(n3) {
return n3 != null && n3.constructor === void 0;
}, _.prototype.setState = function(n3, l4) {
var u3;
u3 = this.__s != null && this.__s !== this.state ? this.__s : this.__s = a({}, this.state), typeof n3 == "function" && (n3 = n3(a({}, u3), this.props)), n3 && a(u3, n3), n3 != null && this.__v && (l4 && this.__h.push(l4), m(this));
}, _.prototype.forceUpdate = function(n3) {
this.__v && (this.__e = true, n3 && this.__h.push(n3), m(this));
}, _.prototype.render = d, t2 = [], r2 = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, g.__r = 0, f = 0;
}
});
// node_modules/preact/hooks/dist/hooks.module.js
function m2(t4, r4) {
l2.__h && l2.__h(u2, t4, o2 || r4), o2 = 0;
var i4 = u2.__H || (u2.__H = { __: [], __h: [] });
return t4 >= i4.__.length && i4.__.push({}), i4.__[t4];
}
function l3(n3) {
return o2 = 1, p3(w2, n3);
}
function p3(n3, r4, o3) {
var i4 = m2(t3++, 2);
return i4.t = n3, i4.__c || (i4.__ = [o3 ? o3(r4) : w2(void 0, r4), function(n4) {
var t4 = i4.t(i4.__[0], n4);
i4.__[0] !== t4 && (i4.__ = [t4, i4.__[1]], i4.__c.setState({}));
}], i4.__c = u2), i4.__;
}
function y2(r4, o3) {
var i4 = m2(t3++, 3);
!l2.__s && k2(i4.__H, o3) && (i4.__ = r4, i4.__H = o3, u2.__H.__h.push(i4));
}
function h2(r4, o3) {
var i4 = m2(t3++, 4);
!l2.__s && k2(i4.__H, o3) && (i4.__ = r4, i4.__H = o3, u2.__h.push(i4));
}
function s3(n3) {
return o2 = 5, d2(function() {
return { current: n3 };
}, []);
}
function _2(n3, t4, u3) {
o2 = 6, h2(function() {
typeof n3 == "function" ? n3(t4()) : n3 && (n3.current = t4());
}, u3 == null ? u3 : u3.concat(n3));
}
function d2(n3, u3) {
var r4 = m2(t3++, 7);
return k2(r4.__H, u3) && (r4.__ = n3(), r4.__H = u3, r4.__h = n3), r4.__;
}
function A2(n3, t4) {
return o2 = 8, d2(function() {
return n3;
}, t4);
}
function F(n3) {
var r4 = u2.context[n3.__c], o3 = m2(t3++, 9);
return o3.c = n3, r4 ? (o3.__ == null && (o3.__ = true, r4.sub(u2)), r4.props.value) : n3.__;
}
function T2(t4, u3) {
l2.useDebugValue && l2.useDebugValue(u3 ? u3(t4) : t4);
}
function q2(n3) {
var r4 = m2(t3++, 10), o3 = l3();
return r4.__ = n3, u2.componentDidCatch || (u2.componentDidCatch = function(n4) {
r4.__ && r4.__(n4), o3[1](n4);
}), [o3[0], function() {
o3[1](void 0);
}];
}
function x2() {
var t4;
for (i3.sort(function(n3, t5) {
return n3.__v.__b - t5.__v.__b;
}); t4 = i3.pop(); )
if (t4.__P)
try {
t4.__H.__h.forEach(g2), t4.__H.__h.forEach(j2), t4.__H.__h = [];
} catch (u3) {
t4.__H.__h = [], l2.__e(u3, t4.__v);
}
}
function g2(n3) {
var t4 = u2, r4 = n3.__c;
typeof r4 == "function" && (n3.__c = void 0, r4()), u2 = t4;
}
function j2(n3) {
var t4 = u2;
n3.__c = n3.__(), u2 = t4;
}
function k2(n3, t4) {
return !n3 || n3.length !== t4.length || t4.some(function(t5, u3) {
return t5 !== n3[u3];
});
}
function w2(n3, t4) {
return typeof t4 == "function" ? t4(n3) : t4;
}
var t3, u2, r3, o2, i3, c3, f2, e3, a2, v2, b2;
var init_hooks_module = __esm({
"node_modules/preact/hooks/dist/hooks.module.js"() {
init_preact_module();
o2 = 0;
i3 = [];
c3 = l2.__b;
f2 = l2.__r;
e3 = l2.diffed;
a2 = l2.__c;
v2 = l2.unmount;
l2.__b = function(n3) {
u2 = null, c3 && c3(n3);
}, l2.__r = function(n3) {
f2 && f2(n3), t3 = 0;
var r4 = (u2 = n3.__c).__H;
r4 && (r4.__h.forEach(g2), r4.__h.forEach(j2), r4.__h = []);
}, l2.diffed = function(t4) {
e3 && e3(t4);
var o3 = t4.__c;
o3 && o3.__H && o3.__H.__h.length && (i3.push(o3) !== 1 && r3 === l2.requestAnimationFrame || ((r3 = l2.requestAnimationFrame) || function(n3) {
var t5, u3 = function() {
clearTimeout(r4), b2 && cancelAnimationFrame(t5), setTimeout(n3);
}, r4 = setTimeout(u3, 100);
b2 && (t5 = requestAnimationFrame(u3));
})(x2)), u2 = null;
}, l2.__c = function(t4, u3) {
u3.some(function(t5) {
try {
t5.__h.forEach(g2), t5.__h = t5.__h.filter(function(n3) {
return !n3.__ || j2(n3);
});
} catch (r4) {
u3.some(function(n3) {
n3.__h && (n3.__h = []);
}), u3 = [], l2.__e(r4, t5.__v);
}
}), a2 && a2(t4, u3);
}, l2.unmount = function(t4) {
v2 && v2(t4);
var u3, r4 = t4.__c;
r4 && r4.__H && (r4.__H.__.forEach(function(n3) {
try {
g2(n3);
} catch (n4) {
u3 = n4;
}
}), u3 && l2.__e(u3, r4.__v));
};
b2 = typeof requestAnimationFrame == "function";
}
});
// node_modules/preact/compat/dist/compat.module.js
var compat_module_exports = {};
__export(compat_module_exports, {
Children: () => k3,
Component: () => _,
Fragment: () => d,
PureComponent: () => E,
StrictMode: () => fn,
Suspense: () => L2,
SuspenseList: () => M2,
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: () => X,
cloneElement: () => rn,
createContext: () => D,
createElement: () => v,
createFactory: () => tn,
createPortal: () => W,
createRef: () => p2,
default: () => compat_module_default,
findDOMNode: () => on,
flushSync: () => cn,
forwardRef: () => x3,
hydrate: () => $2,
isValidElement: () => en,
lazy: () => F2,
memo: () => g3,
render: () => B2,
unmountComponentAtNode: () => un,
unstable_batchedUpdates: () => ln,
useCallback: () => A2,
useContext: () => F,
useDebugValue: () => T2,
useEffect: () => y2,
useErrorBoundary: () => q2,
useImperativeHandle: () => _2,
useLayoutEffect: () => h2,
useMemo: () => d2,
useReducer: () => p3,
useRef: () => s3,
useState: () => l3,
version: () => nn
});
function S2(n3, t4) {
for (var e4 in t4)
n3[e4] = t4[e4];
return n3;
}
function C2(n3, t4) {
for (var e4 in n3)
if (e4 !== "__source" && !(e4 in t4))
return true;
for (var r4 in t4)
if (r4 !== "__source" && n3[r4] !== t4[r4])
return true;
return false;
}
function E(n3) {
this.props = n3;
}
function g3(n3, t4) {
function e4(n4) {
var e6 = this.props.ref, r5 = e6 == n4.ref;
return !r5 && e6 && (e6.call ? e6(null) : e6.current = null), t4 ? !t4(this.props, n4) || !r5 : C2(this.props, n4);
}
function r4(t5) {
return this.shouldComponentUpdate = e4, v(n3, t5);
}
return r4.displayName = "Memo(" + (n3.displayName || n3.name) + ")", r4.prototype.isReactComponent = true, r4.__f = true, r4;
}
function x3(n3) {
function t4(t5, e4) {
var r4 = S2({}, t5);
return delete r4.ref, n3(r4, (e4 = t5.ref || e4) && (typeof e4 != "object" || "current" in e4) ? e4 : null);
}
return t4.$$typeof = R, t4.render = t4, t4.prototype.isReactComponent = t4.__f = true, t4.displayName = "ForwardRef(" + (n3.displayName || n3.name) + ")", t4;
}
function L2() {
this.__u = 0, this.t = null, this.__b = null;
}
function U(n3) {
var t4 = n3.__.__c;
return t4 && t4.__e && t4.__e(n3);
}
function F2(n3) {
var t4, e4, r4;
function u3(u4) {
if (t4 || (t4 = n3()).then(function(n4) {
e4 = n4.default || n4;
}, function(n4) {
r4 = n4;
}), r4)
throw r4;
if (!e4)
throw t4;
return v(e4, u4);
}
return u3.displayName = "Lazy", u3.__f = true, u3;
}
function M2() {
this.u = null, this.o = null;
}
function D2(n3) {
return this.getChildContext = function() {
return n3.context;
}, n3.children;
}
function I2(n3) {
var t4 = this, e4 = n3.i;
t4.componentWillUnmount = function() {
S(null, t4.l), t4.l = null, t4.i = null;
}, t4.i && t4.i !== e4 && t4.componentWillUnmount(), n3.__v ? (t4.l || (t4.i = e4, t4.l = { nodeType: 1, parentNode: e4, childNodes: [], appendChild: function(n4) {
this.childNodes.push(n4), t4.i.appendChild(n4);
}, insertBefore: function(n4, e6) {
this.childNodes.push(n4), t4.i.appendChild(n4);
}, removeChild: function(n4) {
this.childNodes.splice(this.childNodes.indexOf(n4) >>> 1, 1), t4.i.removeChild(n4);
} }), S(v(D2, { context: t4.context }, n3.__v), t4.l)) : t4.l && t4.componentWillUnmount();
}
function W(n3, t4) {
return v(I2, { __v: n3, i: t4 });
}
function B2(n3, t4, e4) {
return t4.__k == null && (t4.textContent = ""), S(n3, t4), typeof e4 == "function" && e4(), n3 ? n3.__c : null;
}
function $2(n3, t4, e4) {
return q(n3, t4), typeof e4 == "function" && e4(), n3 ? n3.__c : null;
}
function Z() {
}
function Y() {
return this.cancelBubble;
}
function q3() {
return this.defaultPrevented;
}
function tn(n3) {
return v.bind(null, n3);
}
function en(n3) {
return !!n3 && n3.$$typeof === j3;
}
function rn(n3) {
return en(n3) ? B.apply(null, arguments) : n3;
}
function un(n3) {
return !!n3.__k && (S(null, n3), true);
}
function on(n3) {
return n3 && (n3.base || n3.nodeType === 1 && n3) || null;
}
var w3, R, N2, k3, A3, O2, T3, j3, P2, V, z2, H2, G, J, K, Q, X, nn, ln, cn, fn, compat_module_default;
var init_compat_module = __esm({
"node_modules/preact/compat/dist/compat.module.js"() {
init_hooks_module();
init_hooks_module();
init_preact_module();
init_preact_module();
(E.prototype = new _()).isPureReactComponent = true, E.prototype.shouldComponentUpdate = function(n3, t4) {
return C2(this.props, n3) || C2(this.state, t4);
};
w3 = l2.__b;
l2.__b = function(n3) {
n3.type && n3.type.__f && n3.ref && (n3.props.ref = n3.ref, n3.ref = null), w3 && w3(n3);
};
R = typeof Symbol != "undefined" && Symbol.for && Symbol.for("react.forward_ref") || 3911;
N2 = function(n3, t4) {
return n3 == null ? null : A(A(n3).map(t4));
};
k3 = { map: N2, forEach: N2, count: function(n3) {
return n3 ? A(n3).length : 0;
}, only: function(n3) {
var t4 = A(n3);
if (t4.length !== 1)
throw "Children.only";
return t4[0];
}, toArray: A };
A3 = l2.__e;
l2.__e = function(n3, t4, e4) {
if (n3.then) {
for (var r4, u3 = t4; u3 = u3.__; )
if ((r4 = u3.__c) && r4.__c)
return t4.__e == null && (t4.__e = e4.__e, t4.__k = e4.__k), r4.__c(n3, t4);
}
A3(n3, t4, e4);
};
O2 = l2.unmount;
l2.unmount = function(n3) {
var t4 = n3.__c;
t4 && t4.__R && t4.__R(), t4 && n3.__h === true && (n3.type = null), O2 && O2(n3);
}, (L2.prototype = new _()).__c = function(n3, t4) {
var e4 = t4.__c, r4 = this;
r4.t == null && (r4.t = []), r4.t.push(e4);
var u3 = U(r4.__v), o3 = false, i4 = function() {
o3 || (o3 = true, e4.__R = null, u3 ? u3(l4) : l4());
};
e4.__R = i4;
var l4 = function() {
if (!--r4.__u) {
if (r4.state.__e) {
var n4 = r4.state.__e;
r4.__v.__k[0] = function n5(t6, e6, r5) {
return t6 && (t6.__v = null, t6.__k = t6.__k && t6.__k.map(function(t7) {
return n5(t7, e6, r5);
}), t6.__c && t6.__c.__P === e6 && (t6.__e && r5.insertBefore(t6.__e, t6.__d), t6.__c.__e = true, t6.__c.__P = r5)), t6;
}(n4, n4.__c.__P, n4.__c.__O);
}
var t5;
for (r4.setState({ __e: r4.__b = null }); t5 = r4.t.pop(); )
t5.forceUpdate();
}
}, c5 = t4.__h === true;
r4.__u++ || c5 || r4.setState({ __e: r4.__b = r4.__v.__k[0] }), n3.then(i4, i4);
}, L2.prototype.componentWillUnmount = function() {
this.t = [];
}, L2.prototype.render = function(n3, t4) {
if (this.__b) {
if (this.__v.__k) {
var e4 = document.createElement("div"), r4 = this.__v.__k[0].__c;
this.__v.__k[0] = function n4(t5, e6, r5) {
return t5 && (t5.__c && t5.__c.__H && (t5.__c.__H.__.forEach(function(n5) {
typeof n5.__c == "function" && n5.__c();
}), t5.__c.__H = null), (t5 = S2({}, t5)).__c != null && (t5.__c.__P === r5 && (t5.__c.__P = e6), t5.__c = null), t5.__k = t5.__k && t5.__k.map(function(t6) {
return n4(t6, e6, r5);
})), t5;
}(this.__b, e4, r4.__O = r4.__P);
}
this.__b = null;
}
var u3 = t4.__e && v(d, null, n3.fallback);
return u3 && (u3.__h = null), [v(d, null, t4.__e ? null : n3.children), u3];
};
T3 = function(n3, t4, e4) {
if (++e4[1] === e4[0] && n3.o.delete(t4), n3.props.revealOrder && (n3.props.revealOrder[0] !== "t" || !n3.o.size))
for (e4 = n3.u; e4; ) {
for (; e4.length > 3; )
e4.pop()();
if (e4[1] < e4[0])
break;
n3.u = e4 = e4[2];
}
};
(M2.prototype = new _()).__e = function(n3) {
var t4 = this, e4 = U(t4.__v), r4 = t4.o.get(n3);
return r4[0]++, function(u3) {
var o3 = function() {
t4.props.revealOrder ? (r4.push(u3), T3(t4, n3, r4)) : u3();
};
e4 ? e4(o3) : o3();
};
}, M2.prototype.render = function(n3) {
this.u = null, this.o = new Map();
var t4 = A(n3.children);
n3.revealOrder && n3.revealOrder[0] === "b" && t4.reverse();
for (var e4 = t4.length; e4--; )
this.o.set(t4[e4], this.u = [1, 0, this.u]);
return n3.children;
}, M2.prototype.componentDidUpdate = M2.prototype.componentDidMount = function() {
var n3 = this;
this.o.forEach(function(t4, e4) {
T3(n3, e4, t4);
});
};
j3 = typeof Symbol != "undefined" && Symbol.for && Symbol.for("react.element") || 60103;
P2 = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/;
V = typeof document != "undefined";
z2 = function(n3) {
return (typeof Symbol != "undefined" && typeof Symbol() == "symbol" ? /fil|che|rad/i : /fil|che|ra/i).test(n3);
};
_.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(n3) {
Object.defineProperty(_.prototype, n3, { configurable: true, get: function() {
return this["UNSAFE_" + n3];
}, set: function(t4) {
Object.defineProperty(this, n3, { configurable: true, writable: true, value: t4 });
} });
});
H2 = l2.event;
l2.event = function(n3) {
return H2 && (n3 = H2(n3)), n3.persist = Z, n3.isPropagationStopped = Y, n3.isDefaultPrevented = q3, n3.nativeEvent = n3;
};
J = { configurable: true, get: function() {
return this.class;
} };
K = l2.vnode;
l2.vnode = function(n3) {
var t4 = n3.type, e4 = n3.props, r4 = e4;
if (typeof t4 == "string") {
var u3 = t4.indexOf("-") === -1;
for (var o3 in r4 = {}, e4) {
var i4 = e4[o3];
V && o3 === "children" && t4 === "noscript" || o3 === "value" && "defaultValue" in e4 && i4 == null || (o3 === "defaultValue" && "value" in e4 && e4.value == null ? o3 = "value" : o3 === "download" && i4 === true ? i4 = "" : /ondoubleclick/i.test(o3) ? o3 = "ondblclick" : /^onchange(textarea|input)/i.test(o3 + t4) && !z2(e4.type) ? o3 = "oninput" : /^onfocus$/i.test(o3) ? o3 = "onfocusin" : /^onblur$/i.test(o3) ? o3 = "onfocusout" : /^on(Ani|Tra|Tou|BeforeInp)/.test(o3) ? o3 = o3.toLowerCase() : u3 && P2.test(o3) ? o3 = o3.replace(/[A-Z0-9]/, "-$&").toLowerCase() : i4 === null && (i4 = void 0), r4[o3] = i4);
}
t4 == "select" && r4.multiple && Array.isArray(r4.value) && (r4.value = A(e4.children).forEach(function(n4) {
n4.props.selected = r4.value.indexOf(n4.props.value) != -1;
})), t4 == "select" && r4.defaultValue != null && (r4.value = A(e4.children).forEach(function(n4) {
n4.props.selected = r4.multiple ? r4.defaultValue.indexOf(n4.props.value) != -1 : r4.defaultValue == n4.props.value;
})), n3.props = r4, e4.class != e4.className && (J.enumerable = "className" in e4, e4.className != null && (r4.class = e4.className), Object.defineProperty(r4, "className", J));
}
n3.$$typeof = j3, K && K(n3);
};
Q = l2.__r;
l2.__r = function(n3) {
Q && Q(n3), G = n3.__c;
};
X = { ReactCurrentDispatcher: { current: { readContext: function(n3) {
return G.__n[n3.__c].props.value;
} } } };
nn = "17.0.2";
ln = function(n3, t4) {
return n3(t4);
};
cn = function(n3, t4) {
return n3(t4);
};
fn = d;
compat_module_default = { useState: l3, useReducer: p3, useEffect: y2, useLayoutEffect: h2, useRef: s3, useImperativeHandle: _2, useMemo: d2, useCallback: A2, useContext: F, useDebugValue: T2, version: "17.0.2", Children: k3, render: B2, hydrate: $2, unmountComponentAtNode: un, createPortal: W, createElement: v, createContext: D, createFactory: tn, cloneElement: rn, createRef: p2, Fragment: d, isValidElement: en, findDOMNode: on, Component: _, PureComponent: E, memo: g3, forwardRef: x3, flushSync: cn, unstable_batchedUpdates: ln, StrictMode: d, Suspense: L2, SuspenseList: M2, lazy: F2, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: X };
}
});
// node_modules/tslib/tslib.js
var require_tslib = __commonJS({
"node_modules/tslib/tslib.js"(exports, module2) {
var __extends15;
var __assign30;
var __rest46;
var __decorate4;
var __param4;
var __metadata4;
var __awaiter7;
var __generator5;
var __exportStar4;
var __values4;
var __read4;
var __spread4;
var __spreadArrays4;
var __spreadArray4;
var __await4;
var __asyncGenerator4;
var __asyncDelegator4;
var __asyncValues4;
var __makeTemplateObject4;
var __importStar4;
var __importDefault4;
var __classPrivateFieldGet4;
var __classPrivateFieldSet4;
var __createBinding4;
(function(factory) {
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
if (typeof define === "function" && define.amd) {
define("tslib", ["exports"], function(exports2) {
factory(createExporter(root, createExporter(exports2)));
});
} else if (typeof module2 === "object" && typeof module2.exports === "object") {
factory(createExporter(root, createExporter(module2.exports)));
} else {
factory(createExporter(root));
}
function createExporter(exports2, previous) {
if (exports2 !== root) {
if (typeof Object.create === "function") {
Object.defineProperty(exports2, "__esModule", { value: true });
} else {
exports2.__esModule = true;
}
}
return function(id, v3) {
return exports2[id] = previous ? previous(id, v3) : v3;
};
}
})(function(exporter) {
var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b10) {
d3.__proto__ = b10;
} || function(d3, b10) {
for (var p4 in b10)
if (Object.prototype.hasOwnProperty.call(b10, p4))
d3[p4] = b10[p4];
};
__extends15 = function(d3, b10) {
if (typeof b10 !== "function" && b10 !== null)
throw new TypeError("Class extends value " + String(b10) + " is not a constructor or null");
extendStatics(d3, b10);
function __() {
this.constructor = d3;
}
d3.prototype = b10 === null ? Object.create(b10) : (__.prototype = b10.prototype, new __());
};
__assign30 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
return t4;
};
__rest46 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
__decorate4 = function(decorators, target, key, desc) {
var c5 = arguments.length, r4 = c5 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r4 = Reflect.decorate(decorators, target, key, desc);
else
for (var i4 = decorators.length - 1; i4 >= 0; i4--)
if (d3 = decorators[i4])
r4 = (c5 < 3 ? d3(r4) : c5 > 3 ? d3(target, key, r4) : d3(target, key)) || r4;
return c5 > 3 && r4 && Object.defineProperty(target, key, r4), r4;
};
__param4 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
__metadata4 = function(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(metadataKey, metadataValue);
};
__awaiter7 = function(thisArg, _arguments, P4, generator) {
function adopt(value2) {
return value2 instanceof P4 ? value2 : new P4(function(resolve) {
resolve(value2);
});
}
return new (P4 || (P4 = Promise))(function(resolve, reject) {
function fulfilled(value2) {
try {
step(generator.next(value2));
} catch (e4) {
reject(e4);
}
}
function rejected(value2) {
try {
step(generator["throw"](value2));
} catch (e4) {
reject(e4);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
__generator5 = function(thisArg, body) {
var _8 = { label: 0, sent: function() {
if (t4[0] & 1)
throw t4[1];
return t4[1];
}, trys: [], ops: [] }, f3, y5, t4, g4;
return g4 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g4[Symbol.iterator] = function() {
return this;
}), g4;
function verb(n3) {
return function(v3) {
return step([n3, v3]);
};
}
function step(op) {
if (f3)
throw new TypeError("Generator is already executing.");
while (_8)
try {
if (f3 = 1, y5 && (t4 = op[0] & 2 ? y5["return"] : op[0] ? y5["throw"] || ((t4 = y5["return"]) && t4.call(y5), 0) : y5.next) && !(t4 = t4.call(y5, op[1])).done)
return t4;
if (y5 = 0, t4)
op = [op[0] & 2, t4.value];
switch (op[0]) {
case 0:
case 1:
t4 = op;
break;
case 4:
_8.label++;
return { value: op[1], done: false };
case 5:
_8.label++;
y5 = op[1];
op = [0];
continue;
case 7:
op = _8.ops.pop();
_8.trys.pop();
continue;
default:
if (!(t4 = _8.trys, t4 = t4.length > 0 && t4[t4.length - 1]) && (op[0] === 6 || op[0] === 2)) {
_8 = 0;
continue;
}
if (op[0] === 3 && (!t4 || op[1] > t4[0] && op[1] < t4[3])) {
_8.label = op[1];
break;
}
if (op[0] === 6 && _8.label < t4[1]) {
_8.label = t4[1];
t4 = op;
break;
}
if (t4 && _8.label < t4[2]) {
_8.label = t4[2];
_8.ops.push(op);
break;
}
if (t4[2])
_8.ops.pop();
_8.trys.pop();
continue;
}
op = body.call(thisArg, _8);
} catch (e4) {
op = [6, e4];
y5 = 0;
} finally {
f3 = t4 = 0;
}
if (op[0] & 5)
throw op[1];
return { value: op[0] ? op[1] : void 0, done: true };
}
};
__exportStar4 = function(m4, o3) {
for (var p4 in m4)
if (p4 !== "default" && !Object.prototype.hasOwnProperty.call(o3, p4))
__createBinding4(o3, m4, p4);
};
__createBinding4 = Object.create ? function(o3, m4, k4, k22) {
if (k22 === void 0)
k22 = k4;
Object.defineProperty(o3, k22, { enumerable: true, get: function() {
return m4[k4];
} });
} : function(o3, m4, k4, k22) {
if (k22 === void 0)
k22 = k4;
o3[k22] = m4[k4];
};
__values4 = function(o3) {
var s4 = typeof Symbol === "function" && Symbol.iterator, m4 = s4 && o3[s4], i4 = 0;
if (m4)
return m4.call(o3);
if (o3 && typeof o3.length === "number")
return {
next: function() {
if (o3 && i4 >= o3.length)
o3 = void 0;
return { value: o3 && o3[i4++], done: !o3 };
}
};
throw new TypeError(s4 ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
__read4 = function(o3, n3) {
var m4 = typeof Symbol === "function" && o3[Symbol.iterator];
if (!m4)
return o3;
var i4 = m4.call(o3), r4, ar = [], e4;
try {
while ((n3 === void 0 || n3-- > 0) && !(r4 = i4.next()).done)
ar.push(r4.value);
} catch (error) {
e4 = { error };
} finally {
try {
if (r4 && !r4.done && (m4 = i4["return"]))
m4.call(i4);
} finally {
if (e4)
throw e4.error;
}
}
return ar;
};
__spread4 = function() {
for (var ar = [], i4 = 0; i4 < arguments.length; i4++)
ar = ar.concat(__read4(arguments[i4]));
return ar;
};
__spreadArrays4 = function() {
for (var s4 = 0, i4 = 0, il = arguments.length; i4 < il; i4++)
s4 += arguments[i4].length;
for (var r4 = Array(s4), k4 = 0, i4 = 0; i4 < il; i4++)
for (var a4 = arguments[i4], j4 = 0, jl = a4.length; j4 < jl; j4++, k4++)
r4[k4] = a4[j4];
return r4;
};
__spreadArray4 = function(to, from, pack2) {
if (pack2 || arguments.length === 2)
for (var i4 = 0, l4 = from.length, ar; i4 < l4; i4++) {
if (ar || !(i4 in from)) {
if (!ar)
ar = Array.prototype.slice.call(from, 0, i4);
ar[i4] = from[i4];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
__await4 = function(v3) {
return this instanceof __await4 ? (this.v = v3, this) : new __await4(v3);
};
__asyncGenerator4 = function(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator)
throw new TypeError("Symbol.asyncIterator is not defined.");
var g4 = generator.apply(thisArg, _arguments || []), i4, q4 = [];
return i4 = {}, verb("next"), verb("throw"), verb("return"), i4[Symbol.asyncIterator] = function() {
return this;
}, i4;
function verb(n3) {
if (g4[n3])
i4[n3] = function(v3) {
return new Promise(function(a4, b10) {
q4.push([n3, v3, a4, b10]) > 1 || resume(n3, v3);
});
};
}
function resume(n3, v3) {
try {
step(g4[n3](v3));
} catch (e4) {
settle(q4[0][3], e4);
}
}
function step(r4) {
r4.value instanceof __await4 ? Promise.resolve(r4.value.v).then(fulfill, reject) : settle(q4[0][2], r4);
}
function fulfill(value2) {
resume("next", value2);
}
function reject(value2) {
resume("throw", value2);
}
function settle(f3, v3) {
if (f3(v3), q4.shift(), q4.length)
resume(q4[0][0], q4[0][1]);
}
};
__asyncDelegator4 = function(o3) {
var i4, p4;
return i4 = {}, verb("next"), verb("throw", function(e4) {
throw e4;
}), verb("return"), i4[Symbol.iterator] = function() {
return this;
}, i4;
function verb(n3, f3) {
i4[n3] = o3[n3] ? function(v3) {
return (p4 = !p4) ? { value: __await4(o3[n3](v3)), done: n3 === "return" } : f3 ? f3(v3) : v3;
} : f3;
}
};
__asyncValues4 = function(o3) {
if (!Symbol.asyncIterator)
throw new TypeError("Symbol.asyncIterator is not defined.");
var m4 = o3[Symbol.asyncIterator], i4;
return m4 ? m4.call(o3) : (o3 = typeof __values4 === "function" ? __values4(o3) : o3[Symbol.iterator](), i4 = {}, verb("next"), verb("throw"), verb("return"), i4[Symbol.asyncIterator] = function() {
return this;
}, i4);
function verb(n3) {
i4[n3] = o3[n3] && function(v3) {
return new Promise(function(resolve, reject) {
v3 = o3[n3](v3), settle(resolve, reject, v3.done, v3.value);
});
};
}
function settle(resolve, reject, d3, v3) {
Promise.resolve(v3).then(function(v4) {
resolve({ value: v4, done: d3 });
}, reject);
}
};
__makeTemplateObject4 = function(cooked, raw) {
if (Object.defineProperty) {
Object.defineProperty(cooked, "raw", { value: raw });
} else {
cooked.raw = raw;
}
return cooked;
};
var __setModuleDefault = Object.create ? function(o3, v3) {
Object.defineProperty(o3, "default", { enumerable: true, value: v3 });
} : function(o3, v3) {
o3["default"] = v3;
};
__importStar4 = function(mod3) {
if (mod3 && mod3.__esModule)
return mod3;
var result = {};
if (mod3 != null) {
for (var k4 in mod3)
if (k4 !== "default" && Object.prototype.hasOwnProperty.call(mod3, k4))
__createBinding4(result, mod3, k4);
}
__setModuleDefault(result, mod3);
return result;
};
__importDefault4 = function(mod3) {
return mod3 && mod3.__esModule ? mod3 : { "default": mod3 };
};
__classPrivateFieldGet4 = function(receiver, state2, kind, f3) {
if (kind === "a" && !f3)
throw new TypeError("Private accessor was defined without a getter");
if (typeof state2 === "function" ? receiver !== state2 || !f3 : !state2.has(receiver))
throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f3 : kind === "a" ? f3.call(receiver) : f3 ? f3.value : state2.get(receiver);
};
__classPrivateFieldSet4 = function(receiver, state2, value2, kind, f3) {
if (kind === "m")
throw new TypeError("Private method is not writable");
if (kind === "a" && !f3)
throw new TypeError("Private accessor was defined without a setter");
if (typeof state2 === "function" ? receiver !== state2 || !f3 : !state2.has(receiver))
throw new TypeError("Cannot write private member to an object whose class did not declare it");
return kind === "a" ? f3.call(receiver, value2) : f3 ? f3.value = value2 : state2.set(receiver, value2), value2;
};
exporter("__extends", __extends15);
exporter("__assign", __assign30);
exporter("__rest", __rest46);
exporter("__decorate", __decorate4);
exporter("__param", __param4);
exporter("__metadata", __metadata4);
exporter("__awaiter", __awaiter7);
exporter("__generator", __generator5);
exporter("__exportStar", __exportStar4);
exporter("__createBinding", __createBinding4);
exporter("__values", __values4);
exporter("__read", __read4);
exporter("__spread", __spread4);
exporter("__spreadArrays", __spreadArrays4);
exporter("__spreadArray", __spreadArray4);
exporter("__await", __await4);
exporter("__asyncGenerator", __asyncGenerator4);
exporter("__asyncDelegator", __asyncDelegator4);
exporter("__asyncValues", __asyncValues4);
exporter("__makeTemplateObject", __makeTemplateObject4);
exporter("__importStar", __importStar4);
exporter("__importDefault", __importDefault4);
exporter("__classPrivateFieldGet", __classPrivateFieldGet4);
exporter("__classPrivateFieldSet", __classPrivateFieldSet4);
});
}
});
// node_modules/@antv/adjust/node_modules/tslib/tslib.js
var require_tslib2 = __commonJS({
"node_modules/@antv/adjust/node_modules/tslib/tslib.js"(exports, module2) {
var __extends15;
var __assign30;
var __rest46;
var __decorate4;
var __param4;
var __metadata4;
var __awaiter7;
var __generator5;
var __exportStar4;
var __values4;
var __read4;
var __spread4;
var __spreadArrays4;
var __await4;
var __asyncGenerator4;
var __asyncDelegator4;
var __asyncValues4;
var __makeTemplateObject4;
var __importStar4;
var __importDefault4;
var __classPrivateFieldGet4;
var __classPrivateFieldSet4;
var __createBinding4;
(function(factory) {
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
if (typeof define === "function" && define.amd) {
define("tslib", ["exports"], function(exports2) {
factory(createExporter(root, createExporter(exports2)));
});
} else if (typeof module2 === "object" && typeof module2.exports === "object") {
factory(createExporter(root, createExporter(module2.exports)));
} else {
factory(createExporter(root));
}
function createExporter(exports2, previous) {
if (exports2 !== root) {
if (typeof Object.create === "function") {
Object.defineProperty(exports2, "__esModule", { value: true });
} else {
exports2.__esModule = true;
}
}
return function(id, v3) {
return exports2[id] = previous ? previous(id, v3) : v3;
};
}
})(function(exporter) {
var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b10) {
d3.__proto__ = b10;
} || function(d3, b10) {
for (var p4 in b10)
if (b10.hasOwnProperty(p4))
d3[p4] = b10[p4];
};
__extends15 = function(d3, b10) {
extendStatics(d3, b10);
function __() {
this.constructor = d3;
}
d3.prototype = b10 === null ? Object.create(b10) : (__.prototype = b10.prototype, new __());
};
__assign30 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
return t4;
};
__rest46 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
__decorate4 = function(decorators, target, key, desc) {
var c5 = arguments.length, r4 = c5 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r4 = Reflect.decorate(decorators, target, key, desc);
else
for (var i4 = decorators.length - 1; i4 >= 0; i4--)
if (d3 = decorators[i4])
r4 = (c5 < 3 ? d3(r4) : c5 > 3 ? d3(target, key, r4) : d3(target, key)) || r4;
return c5 > 3 && r4 && Object.defineProperty(target, key, r4), r4;
};
__param4 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
__metadata4 = function(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(metadataKey, metadataValue);
};
__awaiter7 = function(thisArg, _arguments, P4, generator) {
function adopt(value2) {
return value2 instanceof P4 ? value2 : new P4(function(resolve) {
resolve(value2);
});
}
return new (P4 || (P4 = Promise))(function(resolve, reject) {
function fulfilled(value2) {
try {
step(generator.next(value2));
} catch (e4) {
reject(e4);
}
}
function rejected(value2) {
try {
step(generator["throw"](value2));
} catch (e4) {
reject(e4);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
__generator5 = function(thisArg, body) {
var _8 = { label: 0, sent: function() {
if (t4[0] & 1)
throw t4[1];
return t4[1];
}, trys: [], ops: [] }, f3, y5, t4, g4;
return g4 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g4[Symbol.iterator] = function() {
return this;
}), g4;
function verb(n3) {
return function(v3) {
return step([n3, v3]);
};
}
function step(op) {
if (f3)
throw new TypeError("Generator is already executing.");
while (_8)
try {
if (f3 = 1, y5 && (t4 = op[0] & 2 ? y5["return"] : op[0] ? y5["throw"] || ((t4 = y5["return"]) && t4.call(y5), 0) : y5.next) && !(t4 = t4.call(y5, op[1])).done)
return t4;
if (y5 = 0, t4)
op = [op[0] & 2, t4.value];
switch (op[0]) {
case 0:
case 1:
t4 = op;
break;
case 4:
_8.label++;
return { value: op[1], done: false };
case 5:
_8.label++;
y5 = op[1];
op = [0];
continue;
case 7:
op = _8.ops.pop();
_8.trys.pop();
continue;
default:
if (!(t4 = _8.trys, t4 = t4.length > 0 && t4[t4.length - 1]) && (op[0] === 6 || op[0] === 2)) {
_8 = 0;
continue;
}
if (op[0] === 3 && (!t4 || op[1] > t4[0] && op[1] < t4[3])) {
_8.label = op[1];
break;
}
if (op[0] === 6 && _8.label < t4[1]) {
_8.label = t4[1];
t4 = op;
break;
}
if (t4 && _8.label < t4[2]) {
_8.label = t4[2];
_8.ops.push(op);
break;
}
if (t4[2])
_8.ops.pop();
_8.trys.pop();
continue;
}
op = body.call(thisArg, _8);
} catch (e4) {
op = [6, e4];
y5 = 0;
} finally {
f3 = t4 = 0;
}
if (op[0] & 5)
throw op[1];
return { value: op[0] ? op[1] : void 0, done: true };
}
};
__createBinding4 = function(o3, m4, k4, k22) {
if (k22 === void 0)
k22 = k4;
o3[k22] = m4[k4];
};
__exportStar4 = function(m4, exports2) {
for (var p4 in m4)
if (p4 !== "default" && !exports2.hasOwnProperty(p4))
exports2[p4] = m4[p4];
};
__values4 = function(o3) {
var s4 = typeof Symbol === "function" && Symbol.iterator, m4 = s4 && o3[s4], i4 = 0;
if (m4)
return m4.call(o3);
if (o3 && typeof o3.length === "number")
return {
next: function() {
if (o3 && i4 >= o3.length)
o3 = void 0;
return { value: o3 && o3[i4++], done: !o3 };
}
};
throw new TypeError(s4 ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
__read4 = function(o3, n3) {
var m4 = typeof Symbol === "function" && o3[Symbol.iterator];
if (!m4)
return o3;
var i4 = m4.call(o3), r4, ar = [], e4;
try {
while ((n3 === void 0 || n3-- > 0) && !(r4 = i4.next()).done)
ar.push(r4.value);
} catch (error) {
e4 = { error };
} finally {
try {
if (r4 && !r4.done && (m4 = i4["return"]))
m4.call(i4);
} finally {
if (e4)
throw e4.error;
}
}
return ar;
};
__spread4 = function() {
for (var ar = [], i4 = 0; i4 < arguments.length; i4++)
ar = ar.concat(__read4(arguments[i4]));
return ar;
};
__spreadArrays4 = function() {
for (var s4 = 0, i4 = 0, il = arguments.length; i4 < il; i4++)
s4 += arguments[i4].length;
for (var r4 = Array(s4), k4 = 0, i4 = 0; i4 < il; i4++)
for (var a4 = arguments[i4], j4 = 0, jl = a4.length; j4 < jl; j4++, k4++)
r4[k4] = a4[j4];
return r4;
};
__await4 = function(v3) {
return this instanceof __await4 ? (this.v = v3, this) : new __await4(v3);
};
__asyncGenerator4 = function(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator)
throw new TypeError("Symbol.asyncIterator is not defined.");
var g4 = generator.apply(thisArg, _arguments || []), i4, q4 = [];
return i4 = {}, verb("next"), verb("throw"), verb("return"), i4[Symbol.asyncIterator] = function() {
return this;
}, i4;
function verb(n3) {
if (g4[n3])
i4[n3] = function(v3) {
return new Promise(function(a4, b10) {
q4.push([n3, v3, a4, b10]) > 1 || resume(n3, v3);
});
};
}
function resume(n3, v3) {
try {
step(g4[n3](v3));
} catch (e4) {
settle(q4[0][3], e4);
}
}
function step(r4) {
r4.value instanceof __await4 ? Promise.resolve(r4.value.v).then(fulfill, reject) : settle(q4[0][2], r4);
}
function fulfill(value2) {
resume("next", value2);
}
function reject(value2) {
resume("throw", value2);
}
function settle(f3, v3) {
if (f3(v3), q4.shift(), q4.length)
resume(q4[0][0], q4[0][1]);
}
};
__asyncDelegator4 = function(o3) {
var i4, p4;
return i4 = {}, verb("next"), verb("throw", function(e4) {
throw e4;
}), verb("return"), i4[Symbol.iterator] = function() {
return this;
}, i4;
function verb(n3, f3) {
i4[n3] = o3[n3] ? function(v3) {
return (p4 = !p4) ? { value: __await4(o3[n3](v3)), done: n3 === "return" } : f3 ? f3(v3) : v3;
} : f3;
}
};
__asyncValues4 = function(o3) {
if (!Symbol.asyncIterator)
throw new TypeError("Symbol.asyncIterator is not defined.");
var m4 = o3[Symbol.asyncIterator], i4;
return m4 ? m4.call(o3) : (o3 = typeof __values4 === "function" ? __values4(o3) : o3[Symbol.iterator](), i4 = {}, verb("next"), verb("throw"), verb("return"), i4[Symbol.asyncIterator] = function() {
return this;
}, i4);
function verb(n3) {
i4[n3] = o3[n3] && function(v3) {
return new Promise(function(resolve, reject) {
v3 = o3[n3](v3), settle(resolve, reject, v3.done, v3.value);
});
};
}
function settle(resolve, reject, d3, v3) {
Promise.resolve(v3).then(function(v4) {
resolve({ value: v4, done: d3 });
}, reject);
}
};
__makeTemplateObject4 = function(cooked, raw) {
if (Object.defineProperty) {
Object.defineProperty(cooked, "raw", { value: raw });
} else {
cooked.raw = raw;
}
return cooked;
};
__importStar4 = function(mod3) {
if (mod3 && mod3.__esModule)
return mod3;
var result = {};
if (mod3 != null) {
for (var k4 in mod3)
if (Object.hasOwnProperty.call(mod3, k4))
result[k4] = mod3[k4];
}
result["default"] = mod3;
return result;
};
__importDefault4 = function(mod3) {
return mod3 && mod3.__esModule ? mod3 : { "default": mod3 };
};
__classPrivateFieldGet4 = function(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
};
__classPrivateFieldSet4 = function(receiver, privateMap, value2) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value2);
return value2;
};
exporter("__extends", __extends15);
exporter("__assign", __assign30);
exporter("__rest", __rest46);
exporter("__decorate", __decorate4);
exporter("__param", __param4);
exporter("__metadata", __metadata4);
exporter("__awaiter", __awaiter7);
exporter("__generator", __generator5);
exporter("__exportStar", __exportStar4);
exporter("__createBinding", __createBinding4);
exporter("__values", __values4);
exporter("__read", __read4);
exporter("__spread", __spread4);
exporter("__spreadArrays", __spreadArrays4);
exporter("__await", __await4);
exporter("__asyncGenerator", __asyncGenerator4);
exporter("__asyncDelegator", __asyncDelegator4);
exporter("__asyncValues", __asyncValues4);
exporter("__makeTemplateObject", __makeTemplateObject4);
exporter("__importStar", __importStar4);
exporter("__importDefault", __importDefault4);
exporter("__classPrivateFieldGet", __classPrivateFieldGet4);
exporter("__classPrivateFieldSet", __classPrivateFieldSet4);
});
}
});
// node_modules/@antv/attr/node_modules/tslib/tslib.js
var require_tslib3 = __commonJS({
"node_modules/@antv/attr/node_modules/tslib/tslib.js"(exports, module2) {
var __extends15;
var __assign30;
var __rest46;
var __decorate4;
var __param4;
var __metadata4;
var __awaiter7;
var __generator5;
var __exportStar4;
var __values4;
var __read4;
var __spread4;
var __spreadArrays4;
var __await4;
var __asyncGenerator4;
var __asyncDelegator4;
var __asyncValues4;
var __makeTemplateObject4;
var __importStar4;
var __importDefault4;
var __classPrivateFieldGet4;
var __classPrivateFieldSet4;
var __createBinding4;
(function(factory) {
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
if (typeof define === "function" && define.amd) {
define("tslib", ["exports"], function(exports2) {
factory(createExporter(root, createExporter(exports2)));
});
} else if (typeof module2 === "object" && typeof module2.exports === "object") {
factory(createExporter(root, createExporter(module2.exports)));
} else {
factory(createExporter(root));
}
function createExporter(exports2, previous) {
if (exports2 !== root) {
if (typeof Object.create === "function") {
Object.defineProperty(exports2, "__esModule", { value: true });
} else {
exports2.__esModule = true;
}
}
return function(id, v3) {
return exports2[id] = previous ? previous(id, v3) : v3;
};
}
})(function(exporter) {
var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b10) {
d3.__proto__ = b10;
} || function(d3, b10) {
for (var p4 in b10)
if (b10.hasOwnProperty(p4))
d3[p4] = b10[p4];
};
__extends15 = function(d3, b10) {
extendStatics(d3, b10);
function __() {
this.constructor = d3;
}
d3.prototype = b10 === null ? Object.create(b10) : (__.prototype = b10.prototype, new __());
};
__assign30 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
return t4;
};
__rest46 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
__decorate4 = function(decorators, target, key, desc) {
var c5 = arguments.length, r4 = c5 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r4 = Reflect.decorate(decorators, target, key, desc);
else
for (var i4 = decorators.length - 1; i4 >= 0; i4--)
if (d3 = decorators[i4])
r4 = (c5 < 3 ? d3(r4) : c5 > 3 ? d3(target, key, r4) : d3(target, key)) || r4;
return c5 > 3 && r4 && Object.defineProperty(target, key, r4), r4;
};
__param4 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
__metadata4 = function(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(metadataKey, metadataValue);
};
__awaiter7 = function(thisArg, _arguments, P4, generator) {
function adopt(value2) {
return value2 instanceof P4 ? value2 : new P4(function(resolve) {
resolve(value2);
});
}
return new (P4 || (P4 = Promise))(function(resolve, reject) {
function fulfilled(value2) {
try {
step(generator.next(value2));
} catch (e4) {
reject(e4);
}
}
function rejected(value2) {
try {
step(generator["throw"](value2));
} catch (e4) {
reject(e4);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
__generator5 = function(thisArg, body) {
var _8 = { label: 0, sent: function() {
if (t4[0] & 1)
throw t4[1];
return t4[1];
}, trys: [], ops: [] }, f3, y5, t4, g4;
return g4 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g4[Symbol.iterator] = function() {
return this;
}), g4;
function verb(n3) {
return function(v3) {
return step([n3, v3]);
};
}
function step(op) {
if (f3)
throw new TypeError("Generator is already executing.");
while (_8)
try {
if (f3 = 1, y5 && (t4 = op[0] & 2 ? y5["return"] : op[0] ? y5["throw"] || ((t4 = y5["return"]) && t4.call(y5), 0) : y5.next) && !(t4 = t4.call(y5, op[1])).done)
return t4;
if (y5 = 0, t4)
op = [op[0] & 2, t4.value];
switch (op[0]) {
case 0:
case 1:
t4 = op;
break;
case 4:
_8.label++;
return { value: op[1], done: false };
case 5:
_8.label++;
y5 = op[1];
op = [0];
continue;
case 7:
op = _8.ops.pop();
_8.trys.pop();
continue;
default:
if (!(t4 = _8.trys, t4 = t4.length > 0 && t4[t4.length - 1]) && (op[0] === 6 || op[0] === 2)) {
_8 = 0;
continue;
}
if (op[0] === 3 && (!t4 || op[1] > t4[0] && op[1] < t4[3])) {
_8.label = op[1];
break;
}
if (op[0] === 6 && _8.label < t4[1]) {
_8.label = t4[1];
t4 = op;
break;
}
if (t4 && _8.label < t4[2]) {
_8.label = t4[2];
_8.ops.push(op);
break;
}
if (t4[2])
_8.ops.pop();
_8.trys.pop();
continue;
}
op = body.call(thisArg, _8);
} catch (e4) {
op = [6, e4];
y5 = 0;
} finally {
f3 = t4 = 0;
}
if (op[0] & 5)
throw op[1];
return { value: op[0] ? op[1] : void 0, done: true };
}
};
__createBinding4 = function(o3, m4, k4, k22) {
if (k22 === void 0)
k22 = k4;
o3[k22] = m4[k4];
};
__exportStar4 = function(m4, exports2) {
for (var p4 in m4)
if (p4 !== "default" && !exports2.hasOwnProperty(p4))
exports2[p4] = m4[p4];
};
__values4 = function(o3) {
var s4 = typeof Symbol === "function" && Symbol.iterator, m4 = s4 && o3[s4], i4 = 0;
if (m4)
return m4.call(o3);
if (o3 && typeof o3.length === "number")
return {
next: function() {
if (o3 && i4 >= o3.length)
o3 = void 0;
return { value: o3 && o3[i4++], done: !o3 };
}
};
throw new TypeError(s4 ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
__read4 = function(o3, n3) {
var m4 = typeof Symbol === "function" && o3[Symbol.iterator];
if (!m4)
return o3;
var i4 = m4.call(o3), r4, ar = [], e4;
try {
while ((n3 === void 0 || n3-- > 0) && !(r4 = i4.next()).done)
ar.push(r4.value);
} catch (error) {
e4 = { error };
} finally {
try {
if (r4 && !r4.done && (m4 = i4["return"]))
m4.call(i4);
} finally {
if (e4)
throw e4.error;
}
}
return ar;
};
__spread4 = function() {
for (var ar = [], i4 = 0; i4 < arguments.length; i4++)
ar = ar.concat(__read4(arguments[i4]));
return ar;
};
__spreadArrays4 = function() {
for (var s4 = 0, i4 = 0, il = arguments.length; i4 < il; i4++)
s4 += arguments[i4].length;
for (var r4 = Array(s4), k4 = 0, i4 = 0; i4 < il; i4++)
for (var a4 = arguments[i4], j4 = 0, jl = a4.length; j4 < jl; j4++, k4++)
r4[k4] = a4[j4];
return r4;
};
__await4 = function(v3) {
return this instanceof __await4 ? (this.v = v3, this) : new __await4(v3);
};
__asyncGenerator4 = function(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator)
throw new TypeError("Symbol.asyncIterator is not defined.");
var g4 = generator.apply(thisArg, _arguments || []), i4, q4 = [];
return i4 = {}, verb("next"), verb("throw"), verb("return"), i4[Symbol.asyncIterator] = function() {
return this;
}, i4;
function verb(n3) {
if (g4[n3])
i4[n3] = function(v3) {
return new Promise(function(a4, b10) {
q4.push([n3, v3, a4, b10]) > 1 || resume(n3, v3);
});
};
}
function resume(n3, v3) {
try {
step(g4[n3](v3));
} catch (e4) {
settle(q4[0][3], e4);
}
}
function step(r4) {
r4.value instanceof __await4 ? Promise.resolve(r4.value.v).then(fulfill, reject) : settle(q4[0][2], r4);
}
function fulfill(value2) {
resume("next", value2);
}
function reject(value2) {
resume("throw", value2);
}
function settle(f3, v3) {
if (f3(v3), q4.shift(), q4.length)
resume(q4[0][0], q4[0][1]);
}
};
__asyncDelegator4 = function(o3) {
var i4, p4;
return i4 = {}, verb("next"), verb("throw", function(e4) {
throw e4;
}), verb("return"), i4[Symbol.iterator] = function() {
return this;
}, i4;
function verb(n3, f3) {
i4[n3] = o3[n3] ? function(v3) {
return (p4 = !p4) ? { value: __await4(o3[n3](v3)), done: n3 === "return" } : f3 ? f3(v3) : v3;
} : f3;
}
};
__asyncValues4 = function(o3) {
if (!Symbol.asyncIterator)
throw new TypeError("Symbol.asyncIterator is not defined.");
var m4 = o3[Symbol.asyncIterator], i4;
return m4 ? m4.call(o3) : (o3 = typeof __values4 === "function" ? __values4(o3) : o3[Symbol.iterator](), i4 = {}, verb("next"), verb("throw"), verb("return"), i4[Symbol.asyncIterator] = function() {
return this;
}, i4);
function verb(n3) {
i4[n3] = o3[n3] && function(v3) {
return new Promise(function(resolve, reject) {
v3 = o3[n3](v3), settle(resolve, reject, v3.done, v3.value);
});
};
}
function settle(resolve, reject, d3, v3) {
Promise.resolve(v3).then(function(v4) {
resolve({ value: v4, done: d3 });
}, reject);
}
};
__makeTemplateObject4 = function(cooked, raw) {
if (Object.defineProperty) {
Object.defineProperty(cooked, "raw", { value: raw });
} else {
cooked.raw = raw;
}
return cooked;
};
__importStar4 = function(mod3) {
if (mod3 && mod3.__esModule)
return mod3;
var result = {};
if (mod3 != null) {
for (var k4 in mod3)
if (Object.hasOwnProperty.call(mod3, k4))
result[k4] = mod3[k4];
}
result["default"] = mod3;
return result;
};
__importDefault4 = function(mod3) {
return mod3 && mod3.__esModule ? mod3 : { "default": mod3 };
};
__classPrivateFieldGet4 = function(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
};
__classPrivateFieldSet4 = function(receiver, privateMap, value2) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value2);
return value2;
};
exporter("__extends", __extends15);
exporter("__assign", __assign30);
exporter("__rest", __rest46);
exporter("__decorate", __decorate4);
exporter("__param", __param4);
exporter("__metadata", __metadata4);
exporter("__awaiter", __awaiter7);
exporter("__generator", __generator5);
exporter("__exportStar", __exportStar4);
exporter("__createBinding", __createBinding4);
exporter("__values", __values4);
exporter("__read", __read4);
exporter("__spread", __spread4);
exporter("__spreadArrays", __spreadArrays4);
exporter("__await", __await4);
exporter("__asyncGenerator", __asyncGenerator4);
exporter("__asyncDelegator", __asyncDelegator4);
exporter("__asyncValues", __asyncValues4);
exporter("__makeTemplateObject", __makeTemplateObject4);
exporter("__importStar", __importStar4);
exporter("__importDefault", __importDefault4);
exporter("__classPrivateFieldGet", __classPrivateFieldGet4);
exporter("__classPrivateFieldSet", __classPrivateFieldSet4);
});
}
});
// node_modules/size-sensor/lib/id.js
var require_id = __commonJS({
"node_modules/size-sensor/lib/id.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var id = 1;
var _default2 = function _default3() {
return "".concat(id++);
};
exports["default"] = _default2;
}
});
// node_modules/size-sensor/lib/debounce.js
var require_debounce = __commonJS({
"node_modules/size-sensor/lib/debounce.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _default2 = function _default3(fn2) {
var delay = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 60;
var timer3 = null;
return function() {
var _this = this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
clearTimeout(timer3);
timer3 = setTimeout(function() {
fn2.apply(_this, args);
}, delay);
};
};
exports["default"] = _default2;
}
});
// node_modules/size-sensor/lib/constant.js
var require_constant = __commonJS({
"node_modules/size-sensor/lib/constant.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SensorTabIndex = exports.SensorClassName = exports.SizeSensorId = void 0;
var SizeSensorId = "size-sensor-id";
exports.SizeSensorId = SizeSensorId;
var SensorClassName = "size-sensor-object";
exports.SensorClassName = SensorClassName;
var SensorTabIndex = "-1";
exports.SensorTabIndex = SensorTabIndex;
}
});
// node_modules/size-sensor/lib/sensors/object.js
var require_object = __commonJS({
"node_modules/size-sensor/lib/sensors/object.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createSensor = void 0;
var _debounce = _interopRequireDefault(require_debounce());
var _constant = require_constant();
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { "default": obj };
}
var createSensor = function createSensor2(element) {
var sensor = void 0;
var listeners = [];
var newSensor = function newSensor2() {
if (getComputedStyle(element).position === "static") {
element.style.position = "relative";
}
var obj = document.createElement("object");
obj.onload = function() {
obj.contentDocument.defaultView.addEventListener("resize", resizeListener);
resizeListener();
};
obj.style.display = "block";
obj.style.position = "absolute";
obj.style.top = "0";
obj.style.left = "0";
obj.style.height = "100%";
obj.style.width = "100%";
obj.style.overflow = "hidden";
obj.style.pointerEvents = "none";
obj.style.zIndex = "-1";
obj.style.opacity = "0";
obj.setAttribute("class", _constant.SensorClassName);
obj.setAttribute("tabindex", _constant.SensorTabIndex);
obj.type = "text/html";
element.appendChild(obj);
obj.data = "about:blank";
return obj;
};
var resizeListener = (0, _debounce["default"])(function() {
listeners.forEach(function(listener) {
listener(element);
});
});
var bind3 = function bind4(cb) {
if (!sensor) {
sensor = newSensor();
}
if (listeners.indexOf(cb) === -1) {
listeners.push(cb);
}
};
var destroy = function destroy2() {
if (sensor && sensor.parentNode) {
if (sensor.contentDocument) {
sensor.contentDocument.defaultView.removeEventListener("resize", resizeListener);
}
sensor.parentNode.removeChild(sensor);
sensor = void 0;
listeners = [];
}
};
var unbind2 = function unbind3(cb) {
var idx = listeners.indexOf(cb);
if (idx !== -1) {
listeners.splice(idx, 1);
}
if (listeners.length === 0 && sensor) {
destroy();
}
};
return {
element,
bind: bind3,
destroy,
unbind: unbind2
};
};
exports.createSensor = createSensor;
}
});
// node_modules/size-sensor/lib/sensors/resizeObserver.js
var require_resizeObserver = __commonJS({
"node_modules/size-sensor/lib/sensors/resizeObserver.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createSensor = void 0;
var _debounce = _interopRequireDefault(require_debounce());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { "default": obj };
}
var createSensor = function createSensor2(element) {
var sensor = void 0;
var listeners = [];
var resizeListener = (0, _debounce["default"])(function() {
listeners.forEach(function(listener) {
listener(element);
});
});
var newSensor = function newSensor2() {
var s4 = new ResizeObserver(resizeListener);
s4.observe(element);
resizeListener();
return s4;
};
var bind3 = function bind4(cb) {
if (!sensor) {
sensor = newSensor();
}
if (listeners.indexOf(cb) === -1) {
listeners.push(cb);
}
};
var destroy = function destroy2() {
sensor.disconnect();
listeners = [];
sensor = void 0;
};
var unbind2 = function unbind3(cb) {
var idx = listeners.indexOf(cb);
if (idx !== -1) {
listeners.splice(idx, 1);
}
if (listeners.length === 0 && sensor) {
destroy();
}
};
return {
element,
bind: bind3,
destroy,
unbind: unbind2
};
};
exports.createSensor = createSensor;
}
});
// node_modules/size-sensor/lib/sensors/index.js
var require_sensors = __commonJS({
"node_modules/size-sensor/lib/sensors/index.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createSensor = void 0;
var _object = require_object();
var _resizeObserver = require_resizeObserver();
var createSensor = typeof ResizeObserver !== "undefined" ? _resizeObserver.createSensor : _object.createSensor;
exports.createSensor = createSensor;
}
});
// node_modules/size-sensor/lib/sensorPool.js
var require_sensorPool = __commonJS({
"node_modules/size-sensor/lib/sensorPool.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.removeSensor = exports.getSensor = void 0;
var _id = _interopRequireDefault(require_id());
var _sensors = require_sensors();
var _constant = require_constant();
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { "default": obj };
}
var Sensors = {};
var getSensor = function getSensor2(element) {
var sensorId = element.getAttribute(_constant.SizeSensorId);
if (sensorId && Sensors[sensorId]) {
return Sensors[sensorId];
}
var newId = (0, _id["default"])();
element.setAttribute(_constant.SizeSensorId, newId);
var sensor = (0, _sensors.createSensor)(element);
Sensors[newId] = sensor;
return sensor;
};
exports.getSensor = getSensor;
var removeSensor = function removeSensor2(sensor) {
var sensorId = sensor.element.getAttribute(_constant.SizeSensorId);
sensor.element.removeAttribute(_constant.SizeSensorId);
sensor.destroy();
if (sensorId && Sensors[sensorId]) {
delete Sensors[sensorId];
}
};
exports.removeSensor = removeSensor;
}
});
// node_modules/size-sensor/lib/index.js
var require_lib = __commonJS({
"node_modules/size-sensor/lib/index.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ver = exports.clear = exports.bind = void 0;
var _sensorPool = require_sensorPool();
var bind3 = function bind4(element, cb) {
var sensor = (0, _sensorPool.getSensor)(element);
sensor.bind(cb);
return function() {
sensor.unbind(cb);
};
};
exports.bind = bind3;
var clear = function clear2(element) {
var sensor = (0, _sensorPool.getSensor)(element);
(0, _sensorPool.removeSensor)(sensor);
};
exports.clear = clear;
var ver = "1.0.1";
exports.ver = ver;
}
});
// node_modules/d3-regression/dist/d3-regression.js
var require_d3_regression = __commonJS({
"node_modules/d3-regression/dist/d3-regression.js"(exports, module2) {
(function(global2, factory) {
typeof exports === "object" && typeof module2 !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = global2 || self, factory(global2.d3 = {}));
})(exports, function(exports2) {
"use strict";
function _slicedToArray2(arr, i4) {
return _arrayWithHoles2(arr) || _iterableToArrayLimit2(arr, i4) || _nonIterableRest2();
}
function _arrayWithHoles2(arr) {
if (Array.isArray(arr))
return arr;
}
function _iterableToArrayLimit2(arr, i4) {
var _arr = [];
var _n = true;
var _d = false;
var _e = void 0;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i4 && _arr.length === i4)
break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null)
_i["return"]();
} finally {
if (_d)
throw _e;
}
}
return _arr;
}
function _nonIterableRest2() {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
function points(data3, x6, y5, sort2) {
data3 = data3.filter(function(d4, i5) {
var u3 = x6(d4, i5), v3 = y5(d4, i5);
return u3 != null && isFinite(u3) && v3 != null && isFinite(v3);
});
if (sort2) {
data3.sort(function(a4, b10) {
return x6(a4) - x6(b10);
});
}
var n3 = data3.length, X2 = new Float64Array(n3), Y2 = new Float64Array(n3);
var ux = 0, uy = 0, xv, yv, d3;
for (var i4 = 0; i4 < n3; ) {
d3 = data3[i4];
X2[i4] = xv = +x6(d3, i4, data3);
Y2[i4] = yv = +y5(d3, i4, data3);
++i4;
ux += (xv - ux) / i4;
uy += (yv - uy) / i4;
}
for (var _i = 0; _i < n3; ++_i) {
X2[_i] -= ux;
Y2[_i] -= uy;
}
return [X2, Y2, ux, uy];
}
function visitPoints(data3, x6, y5, cb) {
var iterations = 0;
for (var i4 = 0, n3 = data3.length; i4 < n3; i4++) {
var d3 = data3[i4], dx = +x6(d3, i4, data3), dy = +y5(d3, i4, data3);
if (dx != null && isFinite(dx) && dy != null && isFinite(dy)) {
cb(dx, dy, iterations++);
}
}
}
function determination(data3, x6, y5, uY, predict) {
var SSE = 0, SST = 0;
visitPoints(data3, x6, y5, function(dx, dy) {
var sse = dy - predict(dx), sst = dy - uY;
SSE += sse * sse;
SST += sst * sst;
});
return 1 - SSE / SST;
}
function angle3(line2) {
return Math.atan2(line2[1][1] - line2[0][1], line2[1][0] - line2[0][0]) * 180 / Math.PI;
}
function midpoint(line2) {
return [(line2[0][0] + line2[1][0]) / 2, (line2[0][1] + line2[1][1]) / 2];
}
function interpose(xmin, xmax, predict) {
var l4 = Math.log(xmax - xmin) * Math.LOG10E + 1 | 0;
var precision = 1 * Math.pow(10, -l4 / 2 - 1), maxIter = 1e4;
var points2 = [px(xmin), px(xmax)], iter = 0;
while (find4(points2) && iter < maxIter) {
}
return points2;
function px(x6) {
return [x6, predict(x6)];
}
function find4(points3) {
iter++;
var n3 = points3.length;
var found = false;
for (var i4 = 0; i4 < n3 - 1; i4++) {
var p0 = points3[i4], p1 = points3[i4 + 1], m4 = midpoint([p0, p1]), mp = px(m4[0]), a0 = angle3([p0, m4]), a1 = angle3([p0, mp]), a4 = Math.abs(a0 - a1);
if (a4 > precision) {
points3.splice(i4 + 1, 0, mp);
found = true;
}
}
return found;
}
}
function ols(uX, uY, uXY, uX2) {
var delta = uX2 - uX * uX, slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta, intercept = uY - slope * uX;
return [intercept, slope];
}
function exponential2() {
var x6 = function x7(d3) {
return d3[0];
}, y5 = function y6(d3) {
return d3[1];
}, domain;
function exponential3(data3) {
var n3 = 0, Y2 = 0, YL = 0, XY = 0, XYL = 0, X2Y = 0, xmin = domain ? +domain[0] : Infinity, xmax = domain ? +domain[1] : -Infinity;
visitPoints(data3, x6, y5, function(dx, dy) {
var ly = Math.log(dy), xy = dx * dy;
++n3;
Y2 += (dy - Y2) / n3;
XY += (xy - XY) / n3;
X2Y += (dx * xy - X2Y) / n3;
YL += (dy * ly - YL) / n3;
XYL += (xy * ly - XYL) / n3;
if (!domain) {
if (dx < xmin)
xmin = dx;
if (dx > xmax)
xmax = dx;
}
});
var _ols = ols(XY / Y2, YL / Y2, XYL / Y2, X2Y / Y2), _ols2 = _slicedToArray2(_ols, 2), a4 = _ols2[0], b10 = _ols2[1];
a4 = Math.exp(a4);
var fn2 = function fn3(x7) {
return a4 * Math.exp(b10 * x7);
}, out = interpose(xmin, xmax, fn2);
out.a = a4;
out.b = b10;
out.predict = fn2;
out.rSquared = determination(data3, x6, y5, Y2, fn2);
return out;
}
exponential3.domain = function(arr) {
return arguments.length ? (domain = arr, exponential3) : domain;
};
exponential3.x = function(fn2) {
return arguments.length ? (x6 = fn2, exponential3) : x6;
};
exponential3.y = function(fn2) {
return arguments.length ? (y5 = fn2, exponential3) : y5;
};
return exponential3;
}
function linear4() {
var x6 = function x7(d3) {
return d3[0];
}, y5 = function y6(d3) {
return d3[1];
}, domain;
function linear5(data3) {
var n3 = 0, X2 = 0, Y2 = 0, XY = 0, X22 = 0, xmin = domain ? +domain[0] : Infinity, xmax = domain ? +domain[1] : -Infinity;
visitPoints(data3, x6, y5, function(dx, dy) {
++n3;
X2 += (dx - X2) / n3;
Y2 += (dy - Y2) / n3;
XY += (dx * dy - XY) / n3;
X22 += (dx * dx - X22) / n3;
if (!domain) {
if (dx < xmin)
xmin = dx;
if (dx > xmax)
xmax = dx;
}
});
var _ols = ols(X2, Y2, XY, X22), _ols2 = _slicedToArray2(_ols, 2), intercept = _ols2[0], slope = _ols2[1], fn2 = function fn3(x7) {
return slope * x7 + intercept;
}, out = [[xmin, fn2(xmin)], [xmax, fn2(xmax)]];
out.a = slope;
out.b = intercept;
out.predict = fn2;
out.rSquared = determination(data3, x6, y5, Y2, fn2);
return out;
}
linear5.domain = function(arr) {
return arguments.length ? (domain = arr, linear5) : domain;
};
linear5.x = function(fn2) {
return arguments.length ? (x6 = fn2, linear5) : x6;
};
linear5.y = function(fn2) {
return arguments.length ? (y5 = fn2, linear5) : y5;
};
return linear5;
}
function median(arr) {
arr.sort(function(a4, b10) {
return a4 - b10;
});
var i4 = arr.length / 2;
return i4 % 1 === 0 ? (arr[i4 - 1] + arr[i4]) / 2 : arr[Math.floor(i4)];
}
var maxiters = 2, epsilon = 1e-12;
function loess() {
var x6 = function x7(d3) {
return d3[0];
}, y5 = function y6(d3) {
return d3[1];
}, bandwidth = 0.3;
function loess2(data3) {
var _points = points(data3, x6, y5, true), _points2 = _slicedToArray2(_points, 4), xv = _points2[0], yv = _points2[1], ux = _points2[2], uy = _points2[3], n3 = xv.length, bw = Math.max(2, ~~(bandwidth * n3)), yhat = new Float64Array(n3), residuals = new Float64Array(n3), robustWeights = new Float64Array(n3).fill(1);
for (var iter = -1; ++iter <= maxiters; ) {
var interval3 = [0, bw - 1];
for (var i4 = 0; i4 < n3; ++i4) {
var dx = xv[i4], i0 = interval3[0], i1 = interval3[1], edge2 = dx - xv[i0] > xv[i1] - dx ? i0 : i1;
var W2 = 0, X2 = 0, Y2 = 0, XY = 0, X22 = 0, denom = 1 / Math.abs(xv[edge2] - dx || 1);
for (var k4 = i0; k4 <= i1; ++k4) {
var xk = xv[k4], yk = yv[k4], w4 = tricube(Math.abs(dx - xk) * denom) * robustWeights[k4], xkw = xk * w4;
W2 += w4;
X2 += xkw;
Y2 += yk * w4;
XY += yk * xkw;
X22 += xk * xkw;
}
var _ols = ols(X2 / W2, Y2 / W2, XY / W2, X22 / W2), _ols2 = _slicedToArray2(_ols, 2), a4 = _ols2[0], b10 = _ols2[1];
yhat[i4] = a4 + b10 * dx;
residuals[i4] = Math.abs(yv[i4] - yhat[i4]);
updateInterval(xv, i4 + 1, interval3);
}
if (iter === maxiters) {
break;
}
var medianResidual = median(residuals);
if (Math.abs(medianResidual) < epsilon)
break;
for (var _i = 0, arg, _w; _i < n3; ++_i) {
arg = residuals[_i] / (6 * medianResidual);
robustWeights[_i] = arg >= 1 ? epsilon : (_w = 1 - arg * arg) * _w;
}
}
return output(xv, yhat, ux, uy);
}
loess2.bandwidth = function(bw) {
return arguments.length ? (bandwidth = bw, loess2) : bandwidth;
};
loess2.x = function(fn2) {
return arguments.length ? (x6 = fn2, loess2) : x6;
};
loess2.y = function(fn2) {
return arguments.length ? (y5 = fn2, loess2) : y5;
};
return loess2;
}
function tricube(x6) {
return (x6 = 1 - x6 * x6 * x6) * x6 * x6;
}
function updateInterval(xv, i4, interval3) {
var val = xv[i4], left2 = interval3[0], right2 = interval3[1] + 1;
if (right2 >= xv.length)
return;
while (i4 > left2 && xv[right2] - val <= val - xv[left2]) {
interval3[0] = ++left2;
interval3[1] = right2;
++right2;
}
}
function output(xv, yhat, ux, uy) {
var n3 = xv.length, out = [];
var i4 = 0, cnt = 0, prev = [], v3;
for (; i4 < n3; ++i4) {
v3 = xv[i4] + ux;
if (prev[0] === v3) {
prev[1] += (yhat[i4] - prev[1]) / ++cnt;
} else {
cnt = 0;
prev[1] += uy;
prev = [v3, yhat[i4]];
out.push(prev);
}
}
prev[1] += uy;
return out;
}
function logarithmic() {
var x6 = function x7(d3) {
return d3[0];
}, y5 = function y6(d3) {
return d3[1];
}, base = Math.E, domain;
function logarithmic2(data3) {
var n3 = 0, X2 = 0, Y2 = 0, XY = 0, X22 = 0, xmin = domain ? +domain[0] : Infinity, xmax = domain ? +domain[1] : -Infinity, lb = Math.log(base);
visitPoints(data3, x6, y5, function(dx, dy) {
var lx = Math.log(dx) / lb;
++n3;
X2 += (lx - X2) / n3;
Y2 += (dy - Y2) / n3;
XY += (lx * dy - XY) / n3;
X22 += (lx * lx - X22) / n3;
if (!domain) {
if (dx < xmin)
xmin = dx;
if (dx > xmax)
xmax = dx;
}
});
var _ols = ols(X2, Y2, XY, X22), _ols2 = _slicedToArray2(_ols, 2), intercept = _ols2[0], slope = _ols2[1], fn2 = function fn3(x7) {
return slope * Math.log(x7) / lb + intercept;
}, out = interpose(xmin, xmax, fn2);
out.a = slope;
out.b = intercept;
out.predict = fn2;
out.rSquared = determination(data3, x6, y5, Y2, fn2);
return out;
}
logarithmic2.domain = function(arr) {
return arguments.length ? (domain = arr, logarithmic2) : domain;
};
logarithmic2.x = function(fn2) {
return arguments.length ? (x6 = fn2, logarithmic2) : x6;
};
logarithmic2.y = function(fn2) {
return arguments.length ? (y5 = fn2, logarithmic2) : y5;
};
logarithmic2.base = function(n3) {
return arguments.length ? (base = n3, logarithmic2) : base;
};
return logarithmic2;
}
function quad() {
var x6 = function x7(d3) {
return d3[0];
}, y5 = function y6(d3) {
return d3[1];
}, domain;
function quadratic(data3) {
var _points = points(data3, x6, y5), _points2 = _slicedToArray2(_points, 4), xv = _points2[0], yv = _points2[1], ux = _points2[2], uy = _points2[3], n3 = xv.length;
var X2 = 0, X3 = 0, X4 = 0, XY = 0, X2Y = 0, i4, dx, dy, x22;
for (i4 = 0; i4 < n3; ) {
dx = xv[i4];
dy = yv[i4++];
x22 = dx * dx;
X2 += (x22 - X2) / i4;
X3 += (x22 * dx - X3) / i4;
X4 += (x22 * x22 - X4) / i4;
XY += (dx * dy - XY) / i4;
X2Y += (x22 * dy - X2Y) / i4;
}
var Y2 = 0, n0 = 0, xmin = domain ? +domain[0] : Infinity, xmax = domain ? +domain[1] : -Infinity;
visitPoints(data3, x6, y5, function(dx2, dy2) {
n0++;
Y2 += (dy2 - Y2) / n0;
if (!domain) {
if (dx2 < xmin)
xmin = dx2;
if (dx2 > xmax)
xmax = dx2;
}
});
var X2X2 = X4 - X2 * X2, d3 = X2 * X2X2 - X3 * X3, a4 = (X2Y * X2 - XY * X3) / d3, b10 = (XY * X2X2 - X2Y * X3) / d3, c5 = -a4 * X2, fn2 = function fn3(x7) {
x7 = x7 - ux;
return a4 * x7 * x7 + b10 * x7 + c5 + uy;
};
var out = interpose(xmin, xmax, fn2);
out.a = a4;
out.b = b10 - 2 * a4 * ux;
out.c = c5 - b10 * ux + a4 * ux * ux + uy;
out.predict = fn2;
out.rSquared = determination(data3, x6, y5, Y2, fn2);
return out;
}
quadratic.domain = function(arr) {
return arguments.length ? (domain = arr, quadratic) : domain;
};
quadratic.x = function(fn2) {
return arguments.length ? (x6 = fn2, quadratic) : x6;
};
quadratic.y = function(fn2) {
return arguments.length ? (y5 = fn2, quadratic) : y5;
};
return quadratic;
}
function polynomial() {
var x6 = function x7(d3) {
return d3[0];
}, y5 = function y6(d3) {
return d3[1];
}, order2 = 3, domain;
function polynomial2(data3) {
if (order2 === 1) {
var o3 = linear4().x(x6).y(y5).domain(domain)(data3);
o3.coefficients = [o3.b, o3.a];
delete o3.a;
delete o3.b;
return o3;
}
if (order2 === 2) {
var _o = quad().x(x6).y(y5).domain(domain)(data3);
_o.coefficients = [_o.c, _o.b, _o.a];
delete _o.a;
delete _o.b;
delete _o.c;
return _o;
}
var _points = points(data3, x6, y5), _points2 = _slicedToArray2(_points, 4), xv = _points2[0], yv = _points2[1], ux = _points2[2], uy = _points2[3], n3 = xv.length, lhs = [], rhs = [], k4 = order2 + 1;
var Y2 = 0, n0 = 0, xmin = domain ? +domain[0] : Infinity, xmax = domain ? +domain[1] : -Infinity;
visitPoints(data3, x6, y5, function(dx, dy) {
++n0;
Y2 += (dy - Y2) / n0;
if (!domain) {
if (dx < xmin)
xmin = dx;
if (dx > xmax)
xmax = dx;
}
});
var i4, j4, l4, v3, c5;
for (i4 = 0; i4 < k4; ++i4) {
for (l4 = 0, v3 = 0; l4 < n3; ++l4) {
v3 += Math.pow(xv[l4], i4) * yv[l4];
}
lhs.push(v3);
c5 = new Float64Array(k4);
for (j4 = 0; j4 < k4; ++j4) {
for (l4 = 0, v3 = 0; l4 < n3; ++l4) {
v3 += Math.pow(xv[l4], i4 + j4);
}
c5[j4] = v3;
}
rhs.push(c5);
}
rhs.push(lhs);
var coef = gaussianElimination(rhs), fn2 = function fn3(x7) {
x7 -= ux;
var y6 = uy + coef[0] + coef[1] * x7 + coef[2] * x7 * x7;
for (i4 = 3; i4 < k4; ++i4) {
y6 += coef[i4] * Math.pow(x7, i4);
}
return y6;
}, out = interpose(xmin, xmax, fn2);
out.coefficients = uncenter(k4, coef, -ux, uy);
out.predict = fn2;
out.rSquared = determination(data3, x6, y5, Y2, fn2);
return out;
}
polynomial2.domain = function(arr) {
return arguments.length ? (domain = arr, polynomial2) : domain;
};
polynomial2.x = function(fn2) {
return arguments.length ? (x6 = fn2, polynomial2) : x6;
};
polynomial2.y = function(fn2) {
return arguments.length ? (y5 = fn2, polynomial2) : y5;
};
polynomial2.order = function(n3) {
return arguments.length ? (order2 = n3, polynomial2) : order2;
};
return polynomial2;
}
function uncenter(k4, a4, x6, y5) {
var z3 = Array(k4);
var i4, j4, v3, c5;
for (i4 = 0; i4 < k4; ++i4) {
z3[i4] = 0;
}
for (i4 = k4 - 1; i4 >= 0; --i4) {
v3 = a4[i4];
c5 = 1;
z3[i4] += v3;
for (j4 = 1; j4 <= i4; ++j4) {
c5 *= (i4 + 1 - j4) / j4;
z3[i4 - j4] += v3 * Math.pow(x6, j4) * c5;
}
}
z3[0] += y5;
return z3;
}
function gaussianElimination(matrix) {
var n3 = matrix.length - 1, coef = [];
var i4, j4, k4, r4, t4;
for (i4 = 0; i4 < n3; ++i4) {
r4 = i4;
for (j4 = i4 + 1; j4 < n3; ++j4) {
if (Math.abs(matrix[i4][j4]) > Math.abs(matrix[i4][r4])) {
r4 = j4;
}
}
for (k4 = i4; k4 < n3 + 1; ++k4) {
t4 = matrix[k4][i4];
matrix[k4][i4] = matrix[k4][r4];
matrix[k4][r4] = t4;
}
for (j4 = i4 + 1; j4 < n3; ++j4) {
for (k4 = n3; k4 >= i4; k4--) {
matrix[k4][j4] -= matrix[k4][i4] * matrix[i4][j4] / matrix[i4][i4];
}
}
}
for (j4 = n3 - 1; j4 >= 0; --j4) {
t4 = 0;
for (k4 = j4 + 1; k4 < n3; ++k4) {
t4 += matrix[k4][j4] * coef[k4];
}
coef[j4] = (matrix[n3][j4] - t4) / matrix[j4][j4];
}
return coef;
}
function power() {
var x6 = function x7(d3) {
return d3[0];
}, y5 = function y6(d3) {
return d3[1];
}, domain;
function power2(data3) {
var n3 = 0, X2 = 0, Y2 = 0, XY = 0, X22 = 0, YS = 0, xmin = domain ? +domain[0] : Infinity, xmax = domain ? +domain[1] : -Infinity;
visitPoints(data3, x6, y5, function(dx, dy) {
var lx = Math.log(dx), ly = Math.log(dy);
++n3;
X2 += (lx - X2) / n3;
Y2 += (ly - Y2) / n3;
XY += (lx * ly - XY) / n3;
X22 += (lx * lx - X22) / n3;
YS += (dy - YS) / n3;
if (!domain) {
if (dx < xmin)
xmin = dx;
if (dx > xmax)
xmax = dx;
}
});
var _ols = ols(X2, Y2, XY, X22), _ols2 = _slicedToArray2(_ols, 2), a4 = _ols2[0], b10 = _ols2[1];
a4 = Math.exp(a4);
var fn2 = function fn3(x7) {
return a4 * Math.pow(x7, b10);
}, out = interpose(xmin, xmax, fn2);
out.a = a4;
out.b = b10;
out.predict = fn2;
out.rSquared = determination(data3, x6, y5, YS, fn2);
return out;
}
power2.domain = function(arr) {
return arguments.length ? (domain = arr, power2) : domain;
};
power2.x = function(fn2) {
return arguments.length ? (x6 = fn2, power2) : x6;
};
power2.y = function(fn2) {
return arguments.length ? (y5 = fn2, power2) : y5;
};
return power2;
}
exports2.regressionExp = exponential2;
exports2.regressionLinear = linear4;
exports2.regressionLoess = loess;
exports2.regressionLog = logarithmic;
exports2.regressionPoly = polynomial;
exports2.regressionPow = power;
exports2.regressionQuad = quad;
Object.defineProperty(exports2, "__esModule", { value: true });
});
}
});
// node_modules/pdfast/src/helper.js
var require_helper = __commonJS({
"node_modules/pdfast/src/helper.js"(exports, module2) {
"use strict";
var self2 = module2.exports;
module2.exports.isNumber = function(x6) {
return typeof x6 === "number";
};
module2.exports.findMin = function(arr) {
if (arr.length === 0) {
return Infinity;
}
var curr = arr[0];
for (var i4 = 1; i4 < arr.length; i4++) {
curr = Math.min(curr, arr[i4]);
}
return curr;
};
module2.exports.findMax = function(arr) {
if (arr.length === 0) {
return -Infinity;
}
var curr = arr[0];
for (var i4 = 1; i4 < arr.length; i4++) {
curr = Math.max(curr, arr[i4]);
}
return curr;
};
module2.exports.findMinMulti = function(arr) {
var curr = self2.findMin(arr[0]);
for (var i4 = 1; i4 < arr.length; i4++) {
curr = Math.min(curr, self2.findMin(arr[i4]));
}
return curr;
};
module2.exports.findMaxMulti = function(arr) {
var curr = self2.findMax(arr[0]);
for (var i4 = 1; i4 < arr.length; i4++) {
curr = Math.max(curr, self2.findMax(arr[i4]));
}
return curr;
};
module2.exports.inside = function(min7, max8, x6) {
return min7 <= x6 && x6 <= max8;
};
}
});
// node_modules/pdfast/src/index.js
var require_src = __commonJS({
"node_modules/pdfast/src/index.js"(exports, module2) {
"use strict";
var DEFAULT_SIZE2 = 50;
var DEFAULT_WIDTH = 2;
var LN_2 = Math.log(2);
var self2 = module2.exports;
var helper2 = require_helper();
function kernel(x6) {
return 1 - Math.abs(x6);
}
module2.exports.getUnifiedMinMax = function(arr, options) {
return self2.getUnifiedMinMaxMulti([arr], options);
};
module2.exports.getUnifiedMinMaxMulti = function(arrMulti, options) {
options = options || {};
var relaxMin = false;
var relaxMax = false;
var width2 = helper2.isNumber(options.width) ? options.width : DEFAULT_WIDTH;
var size2 = helper2.isNumber(options.size) ? options.size : DEFAULT_SIZE2;
var min7 = helper2.isNumber(options.min) ? options.min : (relaxMin = true, helper2.findMinMulti(arrMulti));
var max8 = helper2.isNumber(options.max) ? options.max : (relaxMax = true, helper2.findMaxMulti(arrMulti));
var range = max8 - min7;
var step = range / (size2 - 1);
if (relaxMin) {
min7 = min7 - 2 * width2 * step;
}
if (relaxMax) {
max8 = max8 + 2 * width2 * step;
}
return {
min: min7,
max: max8
};
};
module2.exports.create = function(arr, options) {
options = options || {};
if (!arr || arr.length === 0) {
return [];
}
var size2 = helper2.isNumber(options.size) ? options.size : DEFAULT_SIZE2;
var width2 = helper2.isNumber(options.width) ? options.width : DEFAULT_WIDTH;
var normalizedMinMax = self2.getUnifiedMinMax(arr, {
size: size2,
width: width2,
min: options.min,
max: options.max
});
var min7 = normalizedMinMax.min;
var max8 = normalizedMinMax.max;
var range = max8 - min7;
var step = range / (size2 - 1);
if (range === 0) {
return [{ x: min7, y: 1 }];
}
var buckets = [];
for (var i4 = 0; i4 < size2; i4++) {
buckets.push({
x: min7 + i4 * step,
y: 0
});
}
var xToBucket = function(x6) {
return Math.floor((x6 - min7) / step);
};
var partialArea = generatePartialAreas(kernel, width2);
var fullArea = partialArea[width2];
var c5 = partialArea[width2 - 1] - partialArea[width2 - 2];
var initalValue = 0;
arr.forEach(function(x6) {
var bucket = xToBucket(x6);
if (bucket + width2 < 0 || bucket - width2 >= buckets.length) {
return;
}
var start = Math.max(bucket - width2, 0);
var mid2 = bucket;
var end2 = Math.min(bucket + width2, buckets.length - 1);
var leftBlockCount = start - (bucket - width2);
var rightBlockCount = bucket + width2 - end2;
var spilledAreaLeft = partialArea[-width2 - 1 + leftBlockCount] || 0;
var spilledAreaRight = partialArea[-width2 - 1 + rightBlockCount] || 0;
var weight = fullArea / (fullArea - spilledAreaLeft - spilledAreaRight);
if (leftBlockCount > 0) {
initalValue += weight * (leftBlockCount - 1) * c5;
}
var startGradPos = Math.max(0, bucket - width2 + 1);
if (helper2.inside(0, buckets.length - 1, startGradPos)) {
buckets[startGradPos].y += weight * 1 * c5;
}
if (helper2.inside(0, buckets.length - 1, mid2 + 1)) {
buckets[mid2 + 1].y -= weight * 2 * c5;
}
if (helper2.inside(0, buckets.length - 1, end2 + 1)) {
buckets[end2 + 1].y += weight * 1 * c5;
}
});
var accumulator = initalValue;
var gradAccumulator = 0;
var area2 = 0;
buckets.forEach(function(bucket) {
gradAccumulator += bucket.y;
accumulator += gradAccumulator;
bucket.y = accumulator;
area2 += accumulator;
});
if (area2 > 0) {
buckets.forEach(function(bucket) {
bucket.y /= area2;
});
}
return buckets;
};
function generatePartialAreas(kernel2, width2) {
var partialAreas = {};
var accumulator = 0;
for (var i4 = -width2; i4 <= width2; i4++) {
accumulator += kernel2(i4 / width2);
partialAreas[i4] = accumulator;
}
return partialAreas;
}
module2.exports.getExpectedValueFromPdf = function(pdf2) {
if (!pdf2 || pdf2.length === 0) {
return void 0;
}
var expected = 0;
pdf2.forEach(function(obj) {
expected += obj.x * obj.y;
});
return expected;
};
module2.exports.getXWithLeftTailArea = function(pdf2, area2) {
if (!pdf2 || pdf2.length === 0) {
return void 0;
}
var accumulator = 0;
var last2 = 0;
for (var i4 = 0; i4 < pdf2.length; i4++) {
last2 = i4;
accumulator += pdf2[i4].y;
if (accumulator >= area2) {
break;
}
}
return pdf2[last2].x;
};
module2.exports.getPerplexity = function(pdf2) {
if (!pdf2 || pdf2.length === 0) {
return void 0;
}
var entropy = 0;
pdf2.forEach(function(obj) {
var ln3 = Math.log(obj.y);
if (isFinite(ln3)) {
entropy += obj.y * ln3;
}
});
entropy = -entropy / LN_2;
return Math.pow(2, entropy);
};
}
});
// node_modules/fmin/build/fmin.js
var require_fmin = __commonJS({
"node_modules/fmin/build/fmin.js"(exports, module2) {
(function(global2, factory) {
typeof exports === "object" && typeof module2 !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : factory(global2.fmin = global2.fmin || {});
})(exports, function(exports2) {
"use strict";
function bisect2(f3, a4, b10, parameters) {
parameters = parameters || {};
var maxIterations = parameters.maxIterations || 100, tolerance3 = parameters.tolerance || 1e-10, fA = f3(a4), fB = f3(b10), delta = b10 - a4;
if (fA * fB > 0) {
throw "Initial bisect points must have opposite signs";
}
if (fA === 0)
return a4;
if (fB === 0)
return b10;
for (var i4 = 0; i4 < maxIterations; ++i4) {
delta /= 2;
var mid2 = a4 + delta, fMid = f3(mid2);
if (fMid * fA >= 0) {
a4 = mid2;
}
if (Math.abs(delta) < tolerance3 || fMid === 0) {
return mid2;
}
}
return a4 + delta;
}
function zeros2(x6) {
var r4 = new Array(x6);
for (var i4 = 0; i4 < x6; ++i4) {
r4[i4] = 0;
}
return r4;
}
function zerosM2(x6, y5) {
return zeros2(x6).map(function() {
return zeros2(y5);
});
}
function dot7(a4, b10) {
var ret = 0;
for (var i4 = 0; i4 < a4.length; ++i4) {
ret += a4[i4] * b10[i4];
}
return ret;
}
function norm22(a4) {
return Math.sqrt(dot7(a4, a4));
}
function scale12(ret, value2, c5) {
for (var i4 = 0; i4 < value2.length; ++i4) {
ret[i4] = value2[i4] * c5;
}
}
function weightedSum(ret, w1, v1, w22, v22) {
for (var j4 = 0; j4 < ret.length; ++j4) {
ret[j4] = w1 * v1[j4] + w22 * v22[j4];
}
}
function nelderMead3(f3, x0, parameters) {
parameters = parameters || {};
var maxIterations = parameters.maxIterations || x0.length * 200, nonZeroDelta = parameters.nonZeroDelta || 1.05, zeroDelta = parameters.zeroDelta || 1e-3, minErrorDelta = parameters.minErrorDelta || 1e-6, minTolerance = parameters.minErrorDelta || 1e-5, rho = parameters.rho !== void 0 ? parameters.rho : 1, chi = parameters.chi !== void 0 ? parameters.chi : 2, psi = parameters.psi !== void 0 ? parameters.psi : -0.5, sigma = parameters.sigma !== void 0 ? parameters.sigma : 0.5, maxDiff;
var N3 = x0.length, simplex = new Array(N3 + 1);
simplex[0] = x0;
simplex[0].fx = f3(x0);
simplex[0].id = 0;
for (var i4 = 0; i4 < N3; ++i4) {
var point2 = x0.slice();
point2[i4] = point2[i4] ? point2[i4] * nonZeroDelta : zeroDelta;
simplex[i4 + 1] = point2;
simplex[i4 + 1].fx = f3(point2);
simplex[i4 + 1].id = i4 + 1;
}
function updateSimplex(value2) {
for (var i5 = 0; i5 < value2.length; i5++) {
simplex[N3][i5] = value2[i5];
}
simplex[N3].fx = value2.fx;
}
var sortOrder = function(a4, b10) {
return a4.fx - b10.fx;
};
var centroid = x0.slice(), reflected = x0.slice(), contracted = x0.slice(), expanded = x0.slice();
for (var iteration = 0; iteration < maxIterations; ++iteration) {
simplex.sort(sortOrder);
if (parameters.history) {
var sortedSimplex = simplex.map(function(x6) {
var state2 = x6.slice();
state2.fx = x6.fx;
state2.id = x6.id;
return state2;
});
sortedSimplex.sort(function(a4, b10) {
return a4.id - b10.id;
});
parameters.history.push({
x: simplex[0].slice(),
fx: simplex[0].fx,
simplex: sortedSimplex
});
}
maxDiff = 0;
for (i4 = 0; i4 < N3; ++i4) {
maxDiff = Math.max(maxDiff, Math.abs(simplex[0][i4] - simplex[1][i4]));
}
if (Math.abs(simplex[0].fx - simplex[N3].fx) < minErrorDelta && maxDiff < minTolerance) {
break;
}
for (i4 = 0; i4 < N3; ++i4) {
centroid[i4] = 0;
for (var j4 = 0; j4 < N3; ++j4) {
centroid[i4] += simplex[j4][i4];
}
centroid[i4] /= N3;
}
var worst = simplex[N3];
weightedSum(reflected, 1 + rho, centroid, -rho, worst);
reflected.fx = f3(reflected);
if (reflected.fx < simplex[0].fx) {
weightedSum(expanded, 1 + chi, centroid, -chi, worst);
expanded.fx = f3(expanded);
if (expanded.fx < reflected.fx) {
updateSimplex(expanded);
} else {
updateSimplex(reflected);
}
} else if (reflected.fx >= simplex[N3 - 1].fx) {
var shouldReduce = false;
if (reflected.fx > worst.fx) {
weightedSum(contracted, 1 + psi, centroid, -psi, worst);
contracted.fx = f3(contracted);
if (contracted.fx < worst.fx) {
updateSimplex(contracted);
} else {
shouldReduce = true;
}
} else {
weightedSum(contracted, 1 - psi * rho, centroid, psi * rho, worst);
contracted.fx = f3(contracted);
if (contracted.fx < reflected.fx) {
updateSimplex(contracted);
} else {
shouldReduce = true;
}
}
if (shouldReduce) {
if (sigma >= 1)
break;
for (i4 = 1; i4 < simplex.length; ++i4) {
weightedSum(simplex[i4], 1 - sigma, simplex[0], sigma, simplex[i4]);
simplex[i4].fx = f3(simplex[i4]);
}
}
} else {
updateSimplex(reflected);
}
}
simplex.sort(sortOrder);
return {
fx: simplex[0].fx,
x: simplex[0]
};
}
function wolfeLineSearch(f3, pk, current, next, a4, c1, c22) {
var phi0 = current.fx, phiPrime0 = dot7(current.fxprime, pk), phi2 = phi0, phi_old = phi0, phiPrime = phiPrime0, a0 = 0;
a4 = a4 || 1;
c1 = c1 || 1e-6;
c22 = c22 || 0.1;
function zoom2(a_lo, a_high, phi_lo) {
for (var iteration2 = 0; iteration2 < 16; ++iteration2) {
a4 = (a_lo + a_high) / 2;
weightedSum(next.x, 1, current.x, a4, pk);
phi2 = next.fx = f3(next.x, next.fxprime);
phiPrime = dot7(next.fxprime, pk);
if (phi2 > phi0 + c1 * a4 * phiPrime0 || phi2 >= phi_lo) {
a_high = a4;
} else {
if (Math.abs(phiPrime) <= -c22 * phiPrime0) {
return a4;
}
if (phiPrime * (a_high - a_lo) >= 0) {
a_high = a_lo;
}
a_lo = a4;
phi_lo = phi2;
}
}
return 0;
}
for (var iteration = 0; iteration < 10; ++iteration) {
weightedSum(next.x, 1, current.x, a4, pk);
phi2 = next.fx = f3(next.x, next.fxprime);
phiPrime = dot7(next.fxprime, pk);
if (phi2 > phi0 + c1 * a4 * phiPrime0 || iteration && phi2 >= phi_old) {
return zoom2(a0, a4, phi_old);
}
if (Math.abs(phiPrime) <= -c22 * phiPrime0) {
return a4;
}
if (phiPrime >= 0) {
return zoom2(a4, a0, phi2);
}
phi_old = phi2;
a0 = a4;
a4 *= 2;
}
return a4;
}
function conjugateGradient2(f3, initial, params) {
var current = { x: initial.slice(), fx: 0, fxprime: initial.slice() }, next = { x: initial.slice(), fx: 0, fxprime: initial.slice() }, yk = initial.slice(), pk, temp, a4 = 1, maxIterations;
params = params || {};
maxIterations = params.maxIterations || initial.length * 20;
current.fx = f3(current.x, current.fxprime);
pk = current.fxprime.slice();
scale12(pk, current.fxprime, -1);
for (var i4 = 0; i4 < maxIterations; ++i4) {
a4 = wolfeLineSearch(f3, pk, current, next, a4);
if (params.history) {
params.history.push({
x: current.x.slice(),
fx: current.fx,
fxprime: current.fxprime.slice(),
alpha: a4
});
}
if (!a4) {
scale12(pk, current.fxprime, -1);
} else {
weightedSum(yk, 1, next.fxprime, -1, current.fxprime);
var delta_k = dot7(current.fxprime, current.fxprime), beta_k = Math.max(0, dot7(yk, next.fxprime) / delta_k);
weightedSum(pk, beta_k, pk, -1, next.fxprime);
temp = current;
current = next;
next = temp;
}
if (norm22(current.fxprime) <= 1e-5) {
break;
}
}
if (params.history) {
params.history.push({
x: current.x.slice(),
fx: current.fx,
fxprime: current.fxprime.slice(),
alpha: a4
});
}
return current;
}
function gradientDescent(f3, initial, params) {
params = params || {};
var maxIterations = params.maxIterations || initial.length * 100, learnRate = params.learnRate || 1e-3, current = { x: initial.slice(), fx: 0, fxprime: initial.slice() };
for (var i4 = 0; i4 < maxIterations; ++i4) {
current.fx = f3(current.x, current.fxprime);
if (params.history) {
params.history.push({
x: current.x.slice(),
fx: current.fx,
fxprime: current.fxprime.slice()
});
}
weightedSum(current.x, 1, current.x, -learnRate, current.fxprime);
if (norm22(current.fxprime) <= 1e-5) {
break;
}
}
return current;
}
function gradientDescentLineSearch(f3, initial, params) {
params = params || {};
var current = { x: initial.slice(), fx: 0, fxprime: initial.slice() }, next = { x: initial.slice(), fx: 0, fxprime: initial.slice() }, maxIterations = params.maxIterations || initial.length * 100, learnRate = params.learnRate || 1, pk = initial.slice(), c1 = params.c1 || 1e-3, c22 = params.c2 || 0.1, temp, functionCalls = [];
if (params.history) {
var inner = f3;
f3 = function(x6, fxprime) {
functionCalls.push(x6.slice());
return inner(x6, fxprime);
};
}
current.fx = f3(current.x, current.fxprime);
for (var i4 = 0; i4 < maxIterations; ++i4) {
scale12(pk, current.fxprime, -1);
learnRate = wolfeLineSearch(f3, pk, current, next, learnRate, c1, c22);
if (params.history) {
params.history.push({
x: current.x.slice(),
fx: current.fx,
fxprime: current.fxprime.slice(),
functionCalls,
learnRate,
alpha: learnRate
});
functionCalls = [];
}
temp = current;
current = next;
next = temp;
if (learnRate === 0 || norm22(current.fxprime) < 1e-5)
break;
}
return current;
}
exports2.bisect = bisect2;
exports2.nelderMead = nelderMead3;
exports2.conjugateGradient = conjugateGradient2;
exports2.gradientDescent = gradientDescent;
exports2.gradientDescentLineSearch = gradientDescentLineSearch;
exports2.zeros = zeros2;
exports2.zerosM = zerosM2;
exports2.norm2 = norm22;
exports2.weightedSum = weightedSum;
exports2.scale = scale12;
});
}
});
// node_modules/color-name/index.js
var require_color_name = __commonJS({
"node_modules/color-name/index.js"(exports, module2) {
"use strict";
module2.exports = {
"aliceblue": [240, 248, 255],
"antiquewhite": [250, 235, 215],
"aqua": [0, 255, 255],
"aquamarine": [127, 255, 212],
"azure": [240, 255, 255],
"beige": [245, 245, 220],
"bisque": [255, 228, 196],
"black": [0, 0, 0],
"blanchedalmond": [255, 235, 205],
"blue": [0, 0, 255],
"blueviolet": [138, 43, 226],
"brown": [165, 42, 42],
"burlywood": [222, 184, 135],
"cadetblue": [95, 158, 160],
"chartreuse": [127, 255, 0],
"chocolate": [210, 105, 30],
"coral": [255, 127, 80],
"cornflowerblue": [100, 149, 237],
"cornsilk": [255, 248, 220],
"crimson": [220, 20, 60],
"cyan": [0, 255, 255],
"darkblue": [0, 0, 139],
"darkcyan": [0, 139, 139],
"darkgoldenrod": [184, 134, 11],
"darkgray": [169, 169, 169],
"darkgreen": [0, 100, 0],
"darkgrey": [169, 169, 169],
"darkkhaki": [189, 183, 107],
"darkmagenta": [139, 0, 139],
"darkolivegreen": [85, 107, 47],
"darkorange": [255, 140, 0],
"darkorchid": [153, 50, 204],
"darkred": [139, 0, 0],
"darksalmon": [233, 150, 122],
"darkseagreen": [143, 188, 143],
"darkslateblue": [72, 61, 139],
"darkslategray": [47, 79, 79],
"darkslategrey": [47, 79, 79],
"darkturquoise": [0, 206, 209],
"darkviolet": [148, 0, 211],
"deeppink": [255, 20, 147],
"deepskyblue": [0, 191, 255],
"dimgray": [105, 105, 105],
"dimgrey": [105, 105, 105],
"dodgerblue": [30, 144, 255],
"firebrick": [178, 34, 34],
"floralwhite": [255, 250, 240],
"forestgreen": [34, 139, 34],
"fuchsia": [255, 0, 255],
"gainsboro": [220, 220, 220],
"ghostwhite": [248, 248, 255],
"gold": [255, 215, 0],
"goldenrod": [218, 165, 32],
"gray": [128, 128, 128],
"green": [0, 128, 0],
"greenyellow": [173, 255, 47],
"grey": [128, 128, 128],
"honeydew": [240, 255, 240],
"hotpink": [255, 105, 180],
"indianred": [205, 92, 92],
"indigo": [75, 0, 130],
"ivory": [255, 255, 240],
"khaki": [240, 230, 140],
"lavender": [230, 230, 250],
"lavenderblush": [255, 240, 245],
"lawngreen": [124, 252, 0],
"lemonchiffon": [255, 250, 205],
"lightblue": [173, 216, 230],
"lightcoral": [240, 128, 128],
"lightcyan": [224, 255, 255],
"lightgoldenrodyellow": [250, 250, 210],
"lightgray": [211, 211, 211],
"lightgreen": [144, 238, 144],
"lightgrey": [211, 211, 211],
"lightpink": [255, 182, 193],
"lightsalmon": [255, 160, 122],
"lightseagreen": [32, 178, 170],
"lightskyblue": [135, 206, 250],
"lightslategray": [119, 136, 153],
"lightslategrey": [119, 136, 153],
"lightsteelblue": [176, 196, 222],
"lightyellow": [255, 255, 224],
"lime": [0, 255, 0],
"limegreen": [50, 205, 50],
"linen": [250, 240, 230],
"magenta": [255, 0, 255],
"maroon": [128, 0, 0],
"mediumaquamarine": [102, 205, 170],
"mediumblue": [0, 0, 205],
"mediumorchid": [186, 85, 211],
"mediumpurple": [147, 112, 219],
"mediumseagreen": [60, 179, 113],
"mediumslateblue": [123, 104, 238],
"mediumspringgreen": [0, 250, 154],
"mediumturquoise": [72, 209, 204],
"mediumvioletred": [199, 21, 133],
"midnightblue": [25, 25, 112],
"mintcream": [245, 255, 250],
"mistyrose": [255, 228, 225],
"moccasin": [255, 228, 181],
"navajowhite": [255, 222, 173],
"navy": [0, 0, 128],
"oldlace": [253, 245, 230],
"olive": [128, 128, 0],
"olivedrab": [107, 142, 35],
"orange": [255, 165, 0],
"orangered": [255, 69, 0],
"orchid": [218, 112, 214],
"palegoldenrod": [238, 232, 170],
"palegreen": [152, 251, 152],
"paleturquoise": [175, 238, 238],
"palevioletred": [219, 112, 147],
"papayawhip": [255, 239, 213],
"peachpuff": [255, 218, 185],
"peru": [205, 133, 63],
"pink": [255, 192, 203],
"plum": [221, 160, 221],
"powderblue": [176, 224, 230],
"purple": [128, 0, 128],
"rebeccapurple": [102, 51, 153],
"red": [255, 0, 0],
"rosybrown": [188, 143, 143],
"royalblue": [65, 105, 225],
"saddlebrown": [139, 69, 19],
"salmon": [250, 128, 114],
"sandybrown": [244, 164, 96],
"seagreen": [46, 139, 87],
"seashell": [255, 245, 238],
"sienna": [160, 82, 45],
"silver": [192, 192, 192],
"skyblue": [135, 206, 235],
"slateblue": [106, 90, 205],
"slategray": [112, 128, 144],
"slategrey": [112, 128, 144],
"snow": [255, 250, 250],
"springgreen": [0, 255, 127],
"steelblue": [70, 130, 180],
"tan": [210, 180, 140],
"teal": [0, 128, 128],
"thistle": [216, 191, 216],
"tomato": [255, 99, 71],
"turquoise": [64, 224, 208],
"violet": [238, 130, 238],
"wheat": [245, 222, 179],
"white": [255, 255, 255],
"whitesmoke": [245, 245, 245],
"yellow": [255, 255, 0],
"yellowgreen": [154, 205, 50]
};
}
});
// node_modules/is-arrayish/index.js
var require_is_arrayish = __commonJS({
"node_modules/is-arrayish/index.js"(exports, module2) {
module2.exports = function isArrayish(obj) {
if (!obj || typeof obj === "string") {
return false;
}
return obj instanceof Array || Array.isArray(obj) || obj.length >= 0 && (obj.splice instanceof Function || Object.getOwnPropertyDescriptor(obj, obj.length - 1) && obj.constructor.name !== "String");
};
}
});
// node_modules/simple-swizzle/index.js
var require_simple_swizzle = __commonJS({
"node_modules/simple-swizzle/index.js"(exports, module2) {
"use strict";
var isArrayish = require_is_arrayish();
var concat = Array.prototype.concat;
var slice = Array.prototype.slice;
var swizzle = module2.exports = function swizzle2(args) {
var results = [];
for (var i4 = 0, len5 = args.length; i4 < len5; i4++) {
var arg = args[i4];
if (isArrayish(arg)) {
results = concat.call(results, slice.call(arg));
} else {
results.push(arg);
}
}
return results;
};
swizzle.wrap = function(fn2) {
return function() {
return fn2(swizzle(arguments));
};
};
}
});
// node_modules/color-string/index.js
var require_color_string = __commonJS({
"node_modules/color-string/index.js"(exports, module2) {
var colorNames = require_color_name();
var swizzle = require_simple_swizzle();
var hasOwnProperty4 = Object.hasOwnProperty;
var reverseNames = {};
for (name in colorNames) {
if (hasOwnProperty4.call(colorNames, name)) {
reverseNames[colorNames[name]] = name;
}
}
var name;
var cs = module2.exports = {
to: {},
get: {}
};
cs.get = function(string) {
var prefix2 = string.substring(0, 3).toLowerCase();
var val;
var model;
switch (prefix2) {
case "hsl":
val = cs.get.hsl(string);
model = "hsl";
break;
case "hwb":
val = cs.get.hwb(string);
model = "hwb";
break;
default:
val = cs.get.rgb(string);
model = "rgb";
break;
}
if (!val) {
return null;
}
return { model, value: val };
};
cs.get.rgb = function(string) {
if (!string) {
return null;
}
var abbr = /^#([a-f0-9]{3,4})$/i;
var hex2 = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;
var rgba2 = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
var keyword = /^(\w+)$/;
var rgb2 = [0, 0, 0, 1];
var match;
var i4;
var hexAlpha;
if (match = string.match(hex2)) {
hexAlpha = match[2];
match = match[1];
for (i4 = 0; i4 < 3; i4++) {
var i22 = i4 * 2;
rgb2[i4] = parseInt(match.slice(i22, i22 + 2), 16);
}
if (hexAlpha) {
rgb2[3] = parseInt(hexAlpha, 16) / 255;
}
} else if (match = string.match(abbr)) {
match = match[1];
hexAlpha = match[3];
for (i4 = 0; i4 < 3; i4++) {
rgb2[i4] = parseInt(match[i4] + match[i4], 16);
}
if (hexAlpha) {
rgb2[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;
}
} else if (match = string.match(rgba2)) {
for (i4 = 0; i4 < 3; i4++) {
rgb2[i4] = parseInt(match[i4 + 1], 0);
}
if (match[4]) {
if (match[5]) {
rgb2[3] = parseFloat(match[4]) * 0.01;
} else {
rgb2[3] = parseFloat(match[4]);
}
}
} else if (match = string.match(per)) {
for (i4 = 0; i4 < 3; i4++) {
rgb2[i4] = Math.round(parseFloat(match[i4 + 1]) * 2.55);
}
if (match[4]) {
if (match[5]) {
rgb2[3] = parseFloat(match[4]) * 0.01;
} else {
rgb2[3] = parseFloat(match[4]);
}
}
} else if (match = string.match(keyword)) {
if (match[1] === "transparent") {
return [0, 0, 0, 0];
}
if (!hasOwnProperty4.call(colorNames, match[1])) {
return null;
}
rgb2 = colorNames[match[1]];
rgb2[3] = 1;
return rgb2;
} else {
return null;
}
for (i4 = 0; i4 < 3; i4++) {
rgb2[i4] = clamp2(rgb2[i4], 0, 255);
}
rgb2[3] = clamp2(rgb2[3], 0, 1);
return rgb2;
};
cs.get.hsl = function(string) {
if (!string) {
return null;
}
var hsl2 = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
var match = string.match(hsl2);
if (match) {
var alpha = parseFloat(match[4]);
var h3 = (parseFloat(match[1]) % 360 + 360) % 360;
var s4 = clamp2(parseFloat(match[2]), 0, 100);
var l4 = clamp2(parseFloat(match[3]), 0, 100);
var a4 = clamp2(isNaN(alpha) ? 1 : alpha, 0, 1);
return [h3, s4, l4, a4];
}
return null;
};
cs.get.hwb = function(string) {
if (!string) {
return null;
}
var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
var match = string.match(hwb);
if (match) {
var alpha = parseFloat(match[4]);
var h3 = (parseFloat(match[1]) % 360 + 360) % 360;
var w4 = clamp2(parseFloat(match[2]), 0, 100);
var b10 = clamp2(parseFloat(match[3]), 0, 100);
var a4 = clamp2(isNaN(alpha) ? 1 : alpha, 0, 1);
return [h3, w4, b10, a4];
}
return null;
};
cs.to.hex = function() {
var rgba2 = swizzle(arguments);
return "#" + hexDouble(rgba2[0]) + hexDouble(rgba2[1]) + hexDouble(rgba2[2]) + (rgba2[3] < 1 ? hexDouble(Math.round(rgba2[3] * 255)) : "");
};
cs.to.rgb = function() {
var rgba2 = swizzle(arguments);
return rgba2.length < 4 || rgba2[3] === 1 ? "rgb(" + Math.round(rgba2[0]) + ", " + Math.round(rgba2[1]) + ", " + Math.round(rgba2[2]) + ")" : "rgba(" + Math.round(rgba2[0]) + ", " + Math.round(rgba2[1]) + ", " + Math.round(rgba2[2]) + ", " + rgba2[3] + ")";
};
cs.to.rgb.percent = function() {
var rgba2 = swizzle(arguments);
var r4 = Math.round(rgba2[0] / 255 * 100);
var g4 = Math.round(rgba2[1] / 255 * 100);
var b10 = Math.round(rgba2[2] / 255 * 100);
return rgba2.length < 4 || rgba2[3] === 1 ? "rgb(" + r4 + "%, " + g4 + "%, " + b10 + "%)" : "rgba(" + r4 + "%, " + g4 + "%, " + b10 + "%, " + rgba2[3] + ")";
};
cs.to.hsl = function() {
var hsla2 = swizzle(arguments);
return hsla2.length < 4 || hsla2[3] === 1 ? "hsl(" + hsla2[0] + ", " + hsla2[1] + "%, " + hsla2[2] + "%)" : "hsla(" + hsla2[0] + ", " + hsla2[1] + "%, " + hsla2[2] + "%, " + hsla2[3] + ")";
};
cs.to.hwb = function() {
var hwba = swizzle(arguments);
var a4 = "";
if (hwba.length >= 4 && hwba[3] !== 1) {
a4 = ", " + hwba[3];
}
return "hwb(" + hwba[0] + ", " + hwba[1] + "%, " + hwba[2] + "%" + a4 + ")";
};
cs.to.keyword = function(rgb2) {
return reverseNames[rgb2.slice(0, 3)];
};
function clamp2(num, min7, max8) {
return Math.min(Math.max(min7, num), max8);
}
function hexDouble(num) {
var str8 = Math.round(num).toString(16).toUpperCase();
return str8.length < 2 ? "0" + str8 : str8;
}
}
});
// node_modules/color-convert/conversions.js
var require_conversions = __commonJS({
"node_modules/color-convert/conversions.js"(exports, module2) {
var cssKeywords = require_color_name();
var reverseKeywords = {};
for (key in cssKeywords) {
if (cssKeywords.hasOwnProperty(key)) {
reverseKeywords[cssKeywords[key]] = key;
}
}
var key;
var convert = module2.exports = {
rgb: { channels: 3, labels: "rgb" },
hsl: { channels: 3, labels: "hsl" },
hsv: { channels: 3, labels: "hsv" },
hwb: { channels: 3, labels: "hwb" },
cmyk: { channels: 4, labels: "cmyk" },
xyz: { channels: 3, labels: "xyz" },
lab: { channels: 3, labels: "lab" },
lch: { channels: 3, labels: "lch" },
hex: { channels: 1, labels: ["hex"] },
keyword: { channels: 1, labels: ["keyword"] },
ansi16: { channels: 1, labels: ["ansi16"] },
ansi256: { channels: 1, labels: ["ansi256"] },
hcg: { channels: 3, labels: ["h", "c", "g"] },
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
gray: { channels: 1, labels: ["gray"] }
};
for (model in convert) {
if (convert.hasOwnProperty(model)) {
if (!("channels" in convert[model])) {
throw new Error("missing channels property: " + model);
}
if (!("labels" in convert[model])) {
throw new Error("missing channel labels property: " + model);
}
if (convert[model].labels.length !== convert[model].channels) {
throw new Error("channel and label counts mismatch: " + model);
}
channels = convert[model].channels;
labels = convert[model].labels;
delete convert[model].channels;
delete convert[model].labels;
Object.defineProperty(convert[model], "channels", { value: channels });
Object.defineProperty(convert[model], "labels", { value: labels });
}
}
var channels;
var labels;
var model;
convert.rgb.hsl = function(rgb2) {
var r4 = rgb2[0] / 255;
var g4 = rgb2[1] / 255;
var b10 = rgb2[2] / 255;
var min7 = Math.min(r4, g4, b10);
var max8 = Math.max(r4, g4, b10);
var delta = max8 - min7;
var h3;
var s4;
var l4;
if (max8 === min7) {
h3 = 0;
} else if (r4 === max8) {
h3 = (g4 - b10) / delta;
} else if (g4 === max8) {
h3 = 2 + (b10 - r4) / delta;
} else if (b10 === max8) {
h3 = 4 + (r4 - g4) / delta;
}
h3 = Math.min(h3 * 60, 360);
if (h3 < 0) {
h3 += 360;
}
l4 = (min7 + max8) / 2;
if (max8 === min7) {
s4 = 0;
} else if (l4 <= 0.5) {
s4 = delta / (max8 + min7);
} else {
s4 = delta / (2 - max8 - min7);
}
return [h3, s4 * 100, l4 * 100];
};
convert.rgb.hsv = function(rgb2) {
var rdif;
var gdif;
var bdif;
var h3;
var s4;
var r4 = rgb2[0] / 255;
var g4 = rgb2[1] / 255;
var b10 = rgb2[2] / 255;
var v3 = Math.max(r4, g4, b10);
var diff2 = v3 - Math.min(r4, g4, b10);
var diffc = function(c5) {
return (v3 - c5) / 6 / diff2 + 1 / 2;
};
if (diff2 === 0) {
h3 = s4 = 0;
} else {
s4 = diff2 / v3;
rdif = diffc(r4);
gdif = diffc(g4);
bdif = diffc(b10);
if (r4 === v3) {
h3 = bdif - gdif;
} else if (g4 === v3) {
h3 = 1 / 3 + rdif - bdif;
} else if (b10 === v3) {
h3 = 2 / 3 + gdif - rdif;
}
if (h3 < 0) {
h3 += 1;
} else if (h3 > 1) {
h3 -= 1;
}
}
return [
h3 * 360,
s4 * 100,
v3 * 100
];
};
convert.rgb.hwb = function(rgb2) {
var r4 = rgb2[0];
var g4 = rgb2[1];
var b10 = rgb2[2];
var h3 = convert.rgb.hsl(rgb2)[0];
var w4 = 1 / 255 * Math.min(r4, Math.min(g4, b10));
b10 = 1 - 1 / 255 * Math.max(r4, Math.max(g4, b10));
return [h3, w4 * 100, b10 * 100];
};
convert.rgb.cmyk = function(rgb2) {
var r4 = rgb2[0] / 255;
var g4 = rgb2[1] / 255;
var b10 = rgb2[2] / 255;
var c5;
var m4;
var y5;
var k4;
k4 = Math.min(1 - r4, 1 - g4, 1 - b10);
c5 = (1 - r4 - k4) / (1 - k4) || 0;
m4 = (1 - g4 - k4) / (1 - k4) || 0;
y5 = (1 - b10 - k4) / (1 - k4) || 0;
return [c5 * 100, m4 * 100, y5 * 100, k4 * 100];
};
function comparativeDistance(x6, y5) {
return Math.pow(x6[0] - y5[0], 2) + Math.pow(x6[1] - y5[1], 2) + Math.pow(x6[2] - y5[2], 2);
}
convert.rgb.keyword = function(rgb2) {
var reversed = reverseKeywords[rgb2];
if (reversed) {
return reversed;
}
var currentClosestDistance = Infinity;
var currentClosestKeyword;
for (var keyword in cssKeywords) {
if (cssKeywords.hasOwnProperty(keyword)) {
var value2 = cssKeywords[keyword];
var distance15 = comparativeDistance(rgb2, value2);
if (distance15 < currentClosestDistance) {
currentClosestDistance = distance15;
currentClosestKeyword = keyword;
}
}
}
return currentClosestKeyword;
};
convert.keyword.rgb = function(keyword) {
return cssKeywords[keyword];
};
convert.rgb.xyz = function(rgb2) {
var r4 = rgb2[0] / 255;
var g4 = rgb2[1] / 255;
var b10 = rgb2[2] / 255;
r4 = r4 > 0.04045 ? Math.pow((r4 + 0.055) / 1.055, 2.4) : r4 / 12.92;
g4 = g4 > 0.04045 ? Math.pow((g4 + 0.055) / 1.055, 2.4) : g4 / 12.92;
b10 = b10 > 0.04045 ? Math.pow((b10 + 0.055) / 1.055, 2.4) : b10 / 12.92;
var x6 = r4 * 0.4124 + g4 * 0.3576 + b10 * 0.1805;
var y5 = r4 * 0.2126 + g4 * 0.7152 + b10 * 0.0722;
var z3 = r4 * 0.0193 + g4 * 0.1192 + b10 * 0.9505;
return [x6 * 100, y5 * 100, z3 * 100];
};
convert.rgb.lab = function(rgb2) {
var xyz = convert.rgb.xyz(rgb2);
var x6 = xyz[0];
var y5 = xyz[1];
var z3 = xyz[2];
var l4;
var a4;
var b10;
x6 /= 95.047;
y5 /= 100;
z3 /= 108.883;
x6 = x6 > 8856e-6 ? Math.pow(x6, 1 / 3) : 7.787 * x6 + 16 / 116;
y5 = y5 > 8856e-6 ? Math.pow(y5, 1 / 3) : 7.787 * y5 + 16 / 116;
z3 = z3 > 8856e-6 ? Math.pow(z3, 1 / 3) : 7.787 * z3 + 16 / 116;
l4 = 116 * y5 - 16;
a4 = 500 * (x6 - y5);
b10 = 200 * (y5 - z3);
return [l4, a4, b10];
};
convert.hsl.rgb = function(hsl2) {
var h3 = hsl2[0] / 360;
var s4 = hsl2[1] / 100;
var l4 = hsl2[2] / 100;
var t1;
var t22;
var t32;
var rgb2;
var val;
if (s4 === 0) {
val = l4 * 255;
return [val, val, val];
}
if (l4 < 0.5) {
t22 = l4 * (1 + s4);
} else {
t22 = l4 + s4 - l4 * s4;
}
t1 = 2 * l4 - t22;
rgb2 = [0, 0, 0];
for (var i4 = 0; i4 < 3; i4++) {
t32 = h3 + 1 / 3 * -(i4 - 1);
if (t32 < 0) {
t32++;
}
if (t32 > 1) {
t32--;
}
if (6 * t32 < 1) {
val = t1 + (t22 - t1) * 6 * t32;
} else if (2 * t32 < 1) {
val = t22;
} else if (3 * t32 < 2) {
val = t1 + (t22 - t1) * (2 / 3 - t32) * 6;
} else {
val = t1;
}
rgb2[i4] = val * 255;
}
return rgb2;
};
convert.hsl.hsv = function(hsl2) {
var h3 = hsl2[0];
var s4 = hsl2[1] / 100;
var l4 = hsl2[2] / 100;
var smin = s4;
var lmin = Math.max(l4, 0.01);
var sv;
var v3;
l4 *= 2;
s4 *= l4 <= 1 ? l4 : 2 - l4;
smin *= lmin <= 1 ? lmin : 2 - lmin;
v3 = (l4 + s4) / 2;
sv = l4 === 0 ? 2 * smin / (lmin + smin) : 2 * s4 / (l4 + s4);
return [h3, sv * 100, v3 * 100];
};
convert.hsv.rgb = function(hsv) {
var h3 = hsv[0] / 60;
var s4 = hsv[1] / 100;
var v3 = hsv[2] / 100;
var hi = Math.floor(h3) % 6;
var f3 = h3 - Math.floor(h3);
var p4 = 255 * v3 * (1 - s4);
var q4 = 255 * v3 * (1 - s4 * f3);
var t4 = 255 * v3 * (1 - s4 * (1 - f3));
v3 *= 255;
switch (hi) {
case 0:
return [v3, t4, p4];
case 1:
return [q4, v3, p4];
case 2:
return [p4, v3, t4];
case 3:
return [p4, q4, v3];
case 4:
return [t4, p4, v3];
case 5:
return [v3, p4, q4];
}
};
convert.hsv.hsl = function(hsv) {
var h3 = hsv[0];
var s4 = hsv[1] / 100;
var v3 = hsv[2] / 100;
var vmin = Math.max(v3, 0.01);
var lmin;
var sl;
var l4;
l4 = (2 - s4) * v3;
lmin = (2 - s4) * vmin;
sl = s4 * vmin;
sl /= lmin <= 1 ? lmin : 2 - lmin;
sl = sl || 0;
l4 /= 2;
return [h3, sl * 100, l4 * 100];
};
convert.hwb.rgb = function(hwb) {
var h3 = hwb[0] / 360;
var wh = hwb[1] / 100;
var bl = hwb[2] / 100;
var ratio = wh + bl;
var i4;
var v3;
var f3;
var n3;
if (ratio > 1) {
wh /= ratio;
bl /= ratio;
}
i4 = Math.floor(6 * h3);
v3 = 1 - bl;
f3 = 6 * h3 - i4;
if ((i4 & 1) !== 0) {
f3 = 1 - f3;
}
n3 = wh + f3 * (v3 - wh);
var r4;
var g4;
var b10;
switch (i4) {
default:
case 6:
case 0:
r4 = v3;
g4 = n3;
b10 = wh;
break;
case 1:
r4 = n3;
g4 = v3;
b10 = wh;
break;
case 2:
r4 = wh;
g4 = v3;
b10 = n3;
break;
case 3:
r4 = wh;
g4 = n3;
b10 = v3;
break;
case 4:
r4 = n3;
g4 = wh;
b10 = v3;
break;
case 5:
r4 = v3;
g4 = wh;
b10 = n3;
break;
}
return [r4 * 255, g4 * 255, b10 * 255];
};
convert.cmyk.rgb = function(cmyk) {
var c5 = cmyk[0] / 100;
var m4 = cmyk[1] / 100;
var y5 = cmyk[2] / 100;
var k4 = cmyk[3] / 100;
var r4;
var g4;
var b10;
r4 = 1 - Math.min(1, c5 * (1 - k4) + k4);
g4 = 1 - Math.min(1, m4 * (1 - k4) + k4);
b10 = 1 - Math.min(1, y5 * (1 - k4) + k4);
return [r4 * 255, g4 * 255, b10 * 255];
};
convert.xyz.rgb = function(xyz) {
var x6 = xyz[0] / 100;
var y5 = xyz[1] / 100;
var z3 = xyz[2] / 100;
var r4;
var g4;
var b10;
r4 = x6 * 3.2406 + y5 * -1.5372 + z3 * -0.4986;
g4 = x6 * -0.9689 + y5 * 1.8758 + z3 * 0.0415;
b10 = x6 * 0.0557 + y5 * -0.204 + z3 * 1.057;
r4 = r4 > 31308e-7 ? 1.055 * Math.pow(r4, 1 / 2.4) - 0.055 : r4 * 12.92;
g4 = g4 > 31308e-7 ? 1.055 * Math.pow(g4, 1 / 2.4) - 0.055 : g4 * 12.92;
b10 = b10 > 31308e-7 ? 1.055 * Math.pow(b10, 1 / 2.4) - 0.055 : b10 * 12.92;
r4 = Math.min(Math.max(0, r4), 1);
g4 = Math.min(Math.max(0, g4), 1);
b10 = Math.min(Math.max(0, b10), 1);
return [r4 * 255, g4 * 255, b10 * 255];
};
convert.xyz.lab = function(xyz) {
var x6 = xyz[0];
var y5 = xyz[1];
var z3 = xyz[2];
var l4;
var a4;
var b10;
x6 /= 95.047;
y5 /= 100;
z3 /= 108.883;
x6 = x6 > 8856e-6 ? Math.pow(x6, 1 / 3) : 7.787 * x6 + 16 / 116;
y5 = y5 > 8856e-6 ? Math.pow(y5, 1 / 3) : 7.787 * y5 + 16 / 116;
z3 = z3 > 8856e-6 ? Math.pow(z3, 1 / 3) : 7.787 * z3 + 16 / 116;
l4 = 116 * y5 - 16;
a4 = 500 * (x6 - y5);
b10 = 200 * (y5 - z3);
return [l4, a4, b10];
};
convert.lab.xyz = function(lab) {
var l4 = lab[0];
var a4 = lab[1];
var b10 = lab[2];
var x6;
var y5;
var z3;
y5 = (l4 + 16) / 116;
x6 = a4 / 500 + y5;
z3 = y5 - b10 / 200;
var y22 = Math.pow(y5, 3);
var x22 = Math.pow(x6, 3);
var z22 = Math.pow(z3, 3);
y5 = y22 > 8856e-6 ? y22 : (y5 - 16 / 116) / 7.787;
x6 = x22 > 8856e-6 ? x22 : (x6 - 16 / 116) / 7.787;
z3 = z22 > 8856e-6 ? z22 : (z3 - 16 / 116) / 7.787;
x6 *= 95.047;
y5 *= 100;
z3 *= 108.883;
return [x6, y5, z3];
};
convert.lab.lch = function(lab) {
var l4 = lab[0];
var a4 = lab[1];
var b10 = lab[2];
var hr;
var h3;
var c5;
hr = Math.atan2(b10, a4);
h3 = hr * 360 / 2 / Math.PI;
if (h3 < 0) {
h3 += 360;
}
c5 = Math.sqrt(a4 * a4 + b10 * b10);
return [l4, c5, h3];
};
convert.lch.lab = function(lch) {
var l4 = lch[0];
var c5 = lch[1];
var h3 = lch[2];
var a4;
var b10;
var hr;
hr = h3 / 360 * 2 * Math.PI;
a4 = c5 * Math.cos(hr);
b10 = c5 * Math.sin(hr);
return [l4, a4, b10];
};
convert.rgb.ansi16 = function(args) {
var r4 = args[0];
var g4 = args[1];
var b10 = args[2];
var value2 = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2];
value2 = Math.round(value2 / 50);
if (value2 === 0) {
return 30;
}
var ansi = 30 + (Math.round(b10 / 255) << 2 | Math.round(g4 / 255) << 1 | Math.round(r4 / 255));
if (value2 === 2) {
ansi += 60;
}
return ansi;
};
convert.hsv.ansi16 = function(args) {
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
};
convert.rgb.ansi256 = function(args) {
var r4 = args[0];
var g4 = args[1];
var b10 = args[2];
if (r4 === g4 && g4 === b10) {
if (r4 < 8) {
return 16;
}
if (r4 > 248) {
return 231;
}
return Math.round((r4 - 8) / 247 * 24) + 232;
}
var ansi = 16 + 36 * Math.round(r4 / 255 * 5) + 6 * Math.round(g4 / 255 * 5) + Math.round(b10 / 255 * 5);
return ansi;
};
convert.ansi16.rgb = function(args) {
var color4 = args % 10;
if (color4 === 0 || color4 === 7) {
if (args > 50) {
color4 += 3.5;
}
color4 = color4 / 10.5 * 255;
return [color4, color4, color4];
}
var mult = (~~(args > 50) + 1) * 0.5;
var r4 = (color4 & 1) * mult * 255;
var g4 = (color4 >> 1 & 1) * mult * 255;
var b10 = (color4 >> 2 & 1) * mult * 255;
return [r4, g4, b10];
};
convert.ansi256.rgb = function(args) {
if (args >= 232) {
var c5 = (args - 232) * 10 + 8;
return [c5, c5, c5];
}
args -= 16;
var rem;
var r4 = Math.floor(args / 36) / 5 * 255;
var g4 = Math.floor((rem = args % 36) / 6) / 5 * 255;
var b10 = rem % 6 / 5 * 255;
return [r4, g4, b10];
};
convert.rgb.hex = function(args) {
var integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
var string = integer.toString(16).toUpperCase();
return "000000".substring(string.length) + string;
};
convert.hex.rgb = function(args) {
var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
if (!match) {
return [0, 0, 0];
}
var colorString = match[0];
if (match[0].length === 3) {
colorString = colorString.split("").map(function(char) {
return char + char;
}).join("");
}
var integer = parseInt(colorString, 16);
var r4 = integer >> 16 & 255;
var g4 = integer >> 8 & 255;
var b10 = integer & 255;
return [r4, g4, b10];
};
convert.rgb.hcg = function(rgb2) {
var r4 = rgb2[0] / 255;
var g4 = rgb2[1] / 255;
var b10 = rgb2[2] / 255;
var max8 = Math.max(Math.max(r4, g4), b10);
var min7 = Math.min(Math.min(r4, g4), b10);
var chroma = max8 - min7;
var grayscale;
var hue;
if (chroma < 1) {
grayscale = min7 / (1 - chroma);
} else {
grayscale = 0;
}
if (chroma <= 0) {
hue = 0;
} else if (max8 === r4) {
hue = (g4 - b10) / chroma % 6;
} else if (max8 === g4) {
hue = 2 + (b10 - r4) / chroma;
} else {
hue = 4 + (r4 - g4) / chroma + 4;
}
hue /= 6;
hue %= 1;
return [hue * 360, chroma * 100, grayscale * 100];
};
convert.hsl.hcg = function(hsl2) {
var s4 = hsl2[1] / 100;
var l4 = hsl2[2] / 100;
var c5 = 1;
var f3 = 0;
if (l4 < 0.5) {
c5 = 2 * s4 * l4;
} else {
c5 = 2 * s4 * (1 - l4);
}
if (c5 < 1) {
f3 = (l4 - 0.5 * c5) / (1 - c5);
}
return [hsl2[0], c5 * 100, f3 * 100];
};
convert.hsv.hcg = function(hsv) {
var s4 = hsv[1] / 100;
var v3 = hsv[2] / 100;
var c5 = s4 * v3;
var f3 = 0;
if (c5 < 1) {
f3 = (v3 - c5) / (1 - c5);
}
return [hsv[0], c5 * 100, f3 * 100];
};
convert.hcg.rgb = function(hcg) {
var h3 = hcg[0] / 360;
var c5 = hcg[1] / 100;
var g4 = hcg[2] / 100;
if (c5 === 0) {
return [g4 * 255, g4 * 255, g4 * 255];
}
var pure = [0, 0, 0];
var hi = h3 % 1 * 6;
var v3 = hi % 1;
var w4 = 1 - v3;
var mg = 0;
switch (Math.floor(hi)) {
case 0:
pure[0] = 1;
pure[1] = v3;
pure[2] = 0;
break;
case 1:
pure[0] = w4;
pure[1] = 1;
pure[2] = 0;
break;
case 2:
pure[0] = 0;
pure[1] = 1;
pure[2] = v3;
break;
case 3:
pure[0] = 0;
pure[1] = w4;
pure[2] = 1;
break;
case 4:
pure[0] = v3;
pure[1] = 0;
pure[2] = 1;
break;
default:
pure[0] = 1;
pure[1] = 0;
pure[2] = w4;
}
mg = (1 - c5) * g4;
return [
(c5 * pure[0] + mg) * 255,
(c5 * pure[1] + mg) * 255,
(c5 * pure[2] + mg) * 255
];
};
convert.hcg.hsv = function(hcg) {
var c5 = hcg[1] / 100;
var g4 = hcg[2] / 100;
var v3 = c5 + g4 * (1 - c5);
var f3 = 0;
if (v3 > 0) {
f3 = c5 / v3;
}
return [hcg[0], f3 * 100, v3 * 100];
};
convert.hcg.hsl = function(hcg) {
var c5 = hcg[1] / 100;
var g4 = hcg[2] / 100;
var l4 = g4 * (1 - c5) + 0.5 * c5;
var s4 = 0;
if (l4 > 0 && l4 < 0.5) {
s4 = c5 / (2 * l4);
} else if (l4 >= 0.5 && l4 < 1) {
s4 = c5 / (2 * (1 - l4));
}
return [hcg[0], s4 * 100, l4 * 100];
};
convert.hcg.hwb = function(hcg) {
var c5 = hcg[1] / 100;
var g4 = hcg[2] / 100;
var v3 = c5 + g4 * (1 - c5);
return [hcg[0], (v3 - c5) * 100, (1 - v3) * 100];
};
convert.hwb.hcg = function(hwb) {
var w4 = hwb[1] / 100;
var b10 = hwb[2] / 100;
var v3 = 1 - b10;
var c5 = v3 - w4;
var g4 = 0;
if (c5 < 1) {
g4 = (v3 - c5) / (1 - c5);
}
return [hwb[0], c5 * 100, g4 * 100];
};
convert.apple.rgb = function(apple) {
return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
};
convert.rgb.apple = function(rgb2) {
return [rgb2[0] / 255 * 65535, rgb2[1] / 255 * 65535, rgb2[2] / 255 * 65535];
};
convert.gray.rgb = function(args) {
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
};
convert.gray.hsl = convert.gray.hsv = function(args) {
return [0, 0, args[0]];
};
convert.gray.hwb = function(gray) {
return [0, 100, gray[0]];
};
convert.gray.cmyk = function(gray) {
return [0, 0, 0, gray[0]];
};
convert.gray.lab = function(gray) {
return [gray[0], 0, 0];
};
convert.gray.hex = function(gray) {
var val = Math.round(gray[0] / 100 * 255) & 255;
var integer = (val << 16) + (val << 8) + val;
var string = integer.toString(16).toUpperCase();
return "000000".substring(string.length) + string;
};
convert.rgb.gray = function(rgb2) {
var val = (rgb2[0] + rgb2[1] + rgb2[2]) / 3;
return [val / 255 * 100];
};
}
});
// node_modules/color-convert/route.js
var require_route = __commonJS({
"node_modules/color-convert/route.js"(exports, module2) {
var conversions = require_conversions();
function buildGraph() {
var graph = {};
var models = Object.keys(conversions);
for (var len5 = models.length, i4 = 0; i4 < len5; i4++) {
graph[models[i4]] = {
distance: -1,
parent: null
};
}
return graph;
}
function deriveBFS(fromModel) {
var graph = buildGraph();
var queue = [fromModel];
graph[fromModel].distance = 0;
while (queue.length) {
var current = queue.pop();
var adjacents = Object.keys(conversions[current]);
for (var len5 = adjacents.length, i4 = 0; i4 < len5; i4++) {
var adjacent = adjacents[i4];
var node = graph[adjacent];
if (node.distance === -1) {
node.distance = graph[current].distance + 1;
node.parent = current;
queue.unshift(adjacent);
}
}
}
return graph;
}
function link(from, to) {
return function(args) {
return to(from(args));
};
}
function wrapConversion(toModel, graph) {
var path = [graph[toModel].parent, toModel];
var fn2 = conversions[graph[toModel].parent][toModel];
var cur = graph[toModel].parent;
while (graph[cur].parent) {
path.unshift(graph[cur].parent);
fn2 = link(conversions[graph[cur].parent][cur], fn2);
cur = graph[cur].parent;
}
fn2.conversion = path;
return fn2;
}
module2.exports = function(fromModel) {
var graph = deriveBFS(fromModel);
var conversion = {};
var models = Object.keys(graph);
for (var len5 = models.length, i4 = 0; i4 < len5; i4++) {
var toModel = models[i4];
var node = graph[toModel];
if (node.parent === null) {
continue;
}
conversion[toModel] = wrapConversion(toModel, graph);
}
return conversion;
};
}
});
// node_modules/color-convert/index.js
var require_color_convert = __commonJS({
"node_modules/color-convert/index.js"(exports, module2) {
var conversions = require_conversions();
var route = require_route();
var convert = {};
var models = Object.keys(conversions);
function wrapRaw(fn2) {
var wrappedFn = function(args) {
if (args === void 0 || args === null) {
return args;
}
if (arguments.length > 1) {
args = Array.prototype.slice.call(arguments);
}
return fn2(args);
};
if ("conversion" in fn2) {
wrappedFn.conversion = fn2.conversion;
}
return wrappedFn;
}
function wrapRounded(fn2) {
var wrappedFn = function(args) {
if (args === void 0 || args === null) {
return args;
}
if (arguments.length > 1) {
args = Array.prototype.slice.call(arguments);
}
var result = fn2(args);
if (typeof result === "object") {
for (var len5 = result.length, i4 = 0; i4 < len5; i4++) {
result[i4] = Math.round(result[i4]);
}
}
return result;
};
if ("conversion" in fn2) {
wrappedFn.conversion = fn2.conversion;
}
return wrappedFn;
}
models.forEach(function(fromModel) {
convert[fromModel] = {};
Object.defineProperty(convert[fromModel], "channels", { value: conversions[fromModel].channels });
Object.defineProperty(convert[fromModel], "labels", { value: conversions[fromModel].labels });
var routes = route(fromModel);
var routeModels = Object.keys(routes);
routeModels.forEach(function(toModel) {
var fn2 = routes[toModel];
convert[fromModel][toModel] = wrapRounded(fn2);
convert[fromModel][toModel].raw = wrapRaw(fn2);
});
});
module2.exports = convert;
}
});
// node_modules/color/index.js
var require_color = __commonJS({
"node_modules/color/index.js"(exports, module2) {
"use strict";
var colorString = require_color_string();
var convert = require_color_convert();
var _slice = [].slice;
var skippedModels = [
"keyword",
"gray",
"hex"
];
var hashedModelKeys = {};
Object.keys(convert).forEach(function(model) {
hashedModelKeys[_slice.call(convert[model].labels).sort().join("")] = model;
});
var limiters = {};
function Color3(obj, model) {
if (!(this instanceof Color3)) {
return new Color3(obj, model);
}
if (model && model in skippedModels) {
model = null;
}
if (model && !(model in convert)) {
throw new Error("Unknown model: " + model);
}
var i4;
var channels;
if (obj == null) {
this.model = "rgb";
this.color = [0, 0, 0];
this.valpha = 1;
} else if (obj instanceof Color3) {
this.model = obj.model;
this.color = obj.color.slice();
this.valpha = obj.valpha;
} else if (typeof obj === "string") {
var result = colorString.get(obj);
if (result === null) {
throw new Error("Unable to parse color from string: " + obj);
}
this.model = result.model;
channels = convert[this.model].channels;
this.color = result.value.slice(0, channels);
this.valpha = typeof result.value[channels] === "number" ? result.value[channels] : 1;
} else if (obj.length) {
this.model = model || "rgb";
channels = convert[this.model].channels;
var newArr = _slice.call(obj, 0, channels);
this.color = zeroArray2(newArr, channels);
this.valpha = typeof obj[channels] === "number" ? obj[channels] : 1;
} else if (typeof obj === "number") {
obj &= 16777215;
this.model = "rgb";
this.color = [
obj >> 16 & 255,
obj >> 8 & 255,
obj & 255
];
this.valpha = 1;
} else {
this.valpha = 1;
var keys2 = Object.keys(obj);
if ("alpha" in obj) {
keys2.splice(keys2.indexOf("alpha"), 1);
this.valpha = typeof obj.alpha === "number" ? obj.alpha : 0;
}
var hashedKeys = keys2.sort().join("");
if (!(hashedKeys in hashedModelKeys)) {
throw new Error("Unable to parse color from object: " + JSON.stringify(obj));
}
this.model = hashedModelKeys[hashedKeys];
var labels = convert[this.model].labels;
var color4 = [];
for (i4 = 0; i4 < labels.length; i4++) {
color4.push(obj[labels[i4]]);
}
this.color = zeroArray2(color4);
}
if (limiters[this.model]) {
channels = convert[this.model].channels;
for (i4 = 0; i4 < channels; i4++) {
var limit = limiters[this.model][i4];
if (limit) {
this.color[i4] = limit(this.color[i4]);
}
}
}
this.valpha = Math.max(0, Math.min(1, this.valpha));
if (Object.freeze) {
Object.freeze(this);
}
}
Color3.prototype = {
toString: function() {
return this.string();
},
toJSON: function() {
return this[this.model]();
},
string: function(places) {
var self2 = this.model in colorString.to ? this : this.rgb();
self2 = self2.round(typeof places === "number" ? places : 1);
var args = self2.valpha === 1 ? self2.color : self2.color.concat(this.valpha);
return colorString.to[self2.model](args);
},
percentString: function(places) {
var self2 = this.rgb().round(typeof places === "number" ? places : 1);
var args = self2.valpha === 1 ? self2.color : self2.color.concat(this.valpha);
return colorString.to.rgb.percent(args);
},
array: function() {
return this.valpha === 1 ? this.color.slice() : this.color.concat(this.valpha);
},
object: function() {
var result = {};
var channels = convert[this.model].channels;
var labels = convert[this.model].labels;
for (var i4 = 0; i4 < channels; i4++) {
result[labels[i4]] = this.color[i4];
}
if (this.valpha !== 1) {
result.alpha = this.valpha;
}
return result;
},
unitArray: function() {
var rgb2 = this.rgb().color;
rgb2[0] /= 255;
rgb2[1] /= 255;
rgb2[2] /= 255;
if (this.valpha !== 1) {
rgb2.push(this.valpha);
}
return rgb2;
},
unitObject: function() {
var rgb2 = this.rgb().object();
rgb2.r /= 255;
rgb2.g /= 255;
rgb2.b /= 255;
if (this.valpha !== 1) {
rgb2.alpha = this.valpha;
}
return rgb2;
},
round: function(places) {
places = Math.max(places || 0, 0);
return new Color3(this.color.map(roundToPlace(places)).concat(this.valpha), this.model);
},
alpha: function(val) {
if (arguments.length) {
return new Color3(this.color.concat(Math.max(0, Math.min(1, val))), this.model);
}
return this.valpha;
},
red: getset("rgb", 0, maxfn(255)),
green: getset("rgb", 1, maxfn(255)),
blue: getset("rgb", 2, maxfn(255)),
hue: getset(["hsl", "hsv", "hsl", "hwb", "hcg"], 0, function(val) {
return (val % 360 + 360) % 360;
}),
saturationl: getset("hsl", 1, maxfn(100)),
lightness: getset("hsl", 2, maxfn(100)),
saturationv: getset("hsv", 1, maxfn(100)),
value: getset("hsv", 2, maxfn(100)),
chroma: getset("hcg", 1, maxfn(100)),
gray: getset("hcg", 2, maxfn(100)),
white: getset("hwb", 1, maxfn(100)),
wblack: getset("hwb", 2, maxfn(100)),
cyan: getset("cmyk", 0, maxfn(100)),
magenta: getset("cmyk", 1, maxfn(100)),
yellow: getset("cmyk", 2, maxfn(100)),
black: getset("cmyk", 3, maxfn(100)),
x: getset("xyz", 0, maxfn(100)),
y: getset("xyz", 1, maxfn(100)),
z: getset("xyz", 2, maxfn(100)),
l: getset("lab", 0, maxfn(100)),
a: getset("lab", 1),
b: getset("lab", 2),
keyword: function(val) {
if (arguments.length) {
return new Color3(val);
}
return convert[this.model].keyword(this.color);
},
hex: function(val) {
if (arguments.length) {
return new Color3(val);
}
return colorString.to.hex(this.rgb().round().color);
},
rgbNumber: function() {
var rgb2 = this.rgb().color;
return (rgb2[0] & 255) << 16 | (rgb2[1] & 255) << 8 | rgb2[2] & 255;
},
luminosity: function() {
var rgb2 = this.rgb().color;
var lum = [];
for (var i4 = 0; i4 < rgb2.length; i4++) {
var chan = rgb2[i4] / 255;
lum[i4] = chan <= 0.03928 ? chan / 12.92 : Math.pow((chan + 0.055) / 1.055, 2.4);
}
return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
},
contrast: function(color22) {
var lum1 = this.luminosity();
var lum2 = color22.luminosity();
if (lum1 > lum2) {
return (lum1 + 0.05) / (lum2 + 0.05);
}
return (lum2 + 0.05) / (lum1 + 0.05);
},
level: function(color22) {
var contrastRatio = this.contrast(color22);
if (contrastRatio >= 7.1) {
return "AAA";
}
return contrastRatio >= 4.5 ? "AA" : "";
},
isDark: function() {
var rgb2 = this.rgb().color;
var yiq = (rgb2[0] * 299 + rgb2[1] * 587 + rgb2[2] * 114) / 1e3;
return yiq < 128;
},
isLight: function() {
return !this.isDark();
},
negate: function() {
var rgb2 = this.rgb();
for (var i4 = 0; i4 < 3; i4++) {
rgb2.color[i4] = 255 - rgb2.color[i4];
}
return rgb2;
},
lighten: function(ratio) {
var hsl2 = this.hsl();
hsl2.color[2] += hsl2.color[2] * ratio;
return hsl2;
},
darken: function(ratio) {
var hsl2 = this.hsl();
hsl2.color[2] -= hsl2.color[2] * ratio;
return hsl2;
},
saturate: function(ratio) {
var hsl2 = this.hsl();
hsl2.color[1] += hsl2.color[1] * ratio;
return hsl2;
},
desaturate: function(ratio) {
var hsl2 = this.hsl();
hsl2.color[1] -= hsl2.color[1] * ratio;
return hsl2;
},
whiten: function(ratio) {
var hwb = this.hwb();
hwb.color[1] += hwb.color[1] * ratio;
return hwb;
},
blacken: function(ratio) {
var hwb = this.hwb();
hwb.color[2] += hwb.color[2] * ratio;
return hwb;
},
grayscale: function() {
var rgb2 = this.rgb().color;
var val = rgb2[0] * 0.3 + rgb2[1] * 0.59 + rgb2[2] * 0.11;
return Color3.rgb(val, val, val);
},
fade: function(ratio) {
return this.alpha(this.valpha - this.valpha * ratio);
},
opaquer: function(ratio) {
return this.alpha(this.valpha + this.valpha * ratio);
},
rotate: function(degrees) {
var hsl2 = this.hsl();
var hue = hsl2.color[0];
hue = (hue + degrees) % 360;
hue = hue < 0 ? 360 + hue : hue;
hsl2.color[0] = hue;
return hsl2;
},
mix: function(mixinColor, weight) {
if (!mixinColor || !mixinColor.rgb) {
throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
}
var color1 = mixinColor.rgb();
var color22 = this.rgb();
var p4 = weight === void 0 ? 0.5 : weight;
var w4 = 2 * p4 - 1;
var a4 = color1.alpha() - color22.alpha();
var w1 = ((w4 * a4 === -1 ? w4 : (w4 + a4) / (1 + w4 * a4)) + 1) / 2;
var w22 = 1 - w1;
return Color3.rgb(w1 * color1.red() + w22 * color22.red(), w1 * color1.green() + w22 * color22.green(), w1 * color1.blue() + w22 * color22.blue(), color1.alpha() * p4 + color22.alpha() * (1 - p4));
}
};
Object.keys(convert).forEach(function(model) {
if (skippedModels.indexOf(model) !== -1) {
return;
}
var channels = convert[model].channels;
Color3.prototype[model] = function() {
if (this.model === model) {
return new Color3(this);
}
if (arguments.length) {
return new Color3(arguments, model);
}
var newAlpha = typeof arguments[channels] === "number" ? channels : this.valpha;
return new Color3(assertArray(convert[this.model][model].raw(this.color)).concat(newAlpha), model);
};
Color3[model] = function(color4) {
if (typeof color4 === "number") {
color4 = zeroArray2(_slice.call(arguments), channels);
}
return new Color3(color4, model);
};
});
function roundTo(num, places) {
return Number(num.toFixed(places));
}
function roundToPlace(places) {
return function(num) {
return roundTo(num, places);
};
}
function getset(model, channel, modifier) {
model = Array.isArray(model) ? model : [model];
model.forEach(function(m4) {
(limiters[m4] || (limiters[m4] = []))[channel] = modifier;
});
model = model[0];
return function(val) {
var result;
if (arguments.length) {
if (modifier) {
val = modifier(val);
}
result = this[model]();
result.color[channel] = val;
return result;
}
result = this[model]().color[channel];
if (modifier) {
result = modifier(result);
}
return result;
};
}
function maxfn(max8) {
return function(v3) {
return Math.max(0, Math.min(max8, v3));
};
}
function assertArray(val) {
return Array.isArray(val) ? val : [val];
}
function zeroArray2(arr, length5) {
for (var i4 = 0; i4 < length5; i4++) {
if (typeof arr[i4] !== "number") {
arr[i4] = 0;
}
}
return arr;
}
module2.exports = Color3;
}
});
// node_modules/tinycolor2/tinycolor.js
var require_tinycolor = __commonJS({
"node_modules/tinycolor2/tinycolor.js"(exports, module2) {
(function(Math2) {
var trimLeft = /^\s+/, trimRight = /\s+$/, tinyCounter = 0, mathRound = Math2.round, mathMin = Math2.min, mathMax = Math2.max, mathRandom = Math2.random;
function tinycolor2(color4, opts) {
color4 = color4 ? color4 : "";
opts = opts || {};
if (color4 instanceof tinycolor2) {
return color4;
}
if (!(this instanceof tinycolor2)) {
return new tinycolor2(color4, opts);
}
var rgb2 = inputToRGB(color4);
this._originalInput = color4, this._r = rgb2.r, this._g = rgb2.g, this._b = rgb2.b, this._a = rgb2.a, this._roundA = mathRound(100 * this._a) / 100, this._format = opts.format || rgb2.format;
this._gradientType = opts.gradientType;
if (this._r < 1) {
this._r = mathRound(this._r);
}
if (this._g < 1) {
this._g = mathRound(this._g);
}
if (this._b < 1) {
this._b = mathRound(this._b);
}
this._ok = rgb2.ok;
this._tc_id = tinyCounter++;
}
tinycolor2.prototype = {
isDark: function() {
return this.getBrightness() < 128;
},
isLight: function() {
return !this.isDark();
},
isValid: function() {
return this._ok;
},
getOriginalInput: function() {
return this._originalInput;
},
getFormat: function() {
return this._format;
},
getAlpha: function() {
return this._a;
},
getBrightness: function() {
var rgb2 = this.toRgb();
return (rgb2.r * 299 + rgb2.g * 587 + rgb2.b * 114) / 1e3;
},
getLuminance: function() {
var rgb2 = this.toRgb();
var RsRGB, GsRGB, BsRGB, R3, G2, B3;
RsRGB = rgb2.r / 255;
GsRGB = rgb2.g / 255;
BsRGB = rgb2.b / 255;
if (RsRGB <= 0.03928) {
R3 = RsRGB / 12.92;
} else {
R3 = Math2.pow((RsRGB + 0.055) / 1.055, 2.4);
}
if (GsRGB <= 0.03928) {
G2 = GsRGB / 12.92;
} else {
G2 = Math2.pow((GsRGB + 0.055) / 1.055, 2.4);
}
if (BsRGB <= 0.03928) {
B3 = BsRGB / 12.92;
} else {
B3 = Math2.pow((BsRGB + 0.055) / 1.055, 2.4);
}
return 0.2126 * R3 + 0.7152 * G2 + 0.0722 * B3;
},
setAlpha: function(value2) {
this._a = boundAlpha(value2);
this._roundA = mathRound(100 * this._a) / 100;
return this;
},
toHsv: function() {
var hsv = rgbToHsv(this._r, this._g, this._b);
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
},
toHsvString: function() {
var hsv = rgbToHsv(this._r, this._g, this._b);
var h3 = mathRound(hsv.h * 360), s4 = mathRound(hsv.s * 100), v3 = mathRound(hsv.v * 100);
return this._a == 1 ? "hsv(" + h3 + ", " + s4 + "%, " + v3 + "%)" : "hsva(" + h3 + ", " + s4 + "%, " + v3 + "%, " + this._roundA + ")";
},
toHsl: function() {
var hsl2 = rgbToHsl(this._r, this._g, this._b);
return { h: hsl2.h * 360, s: hsl2.s, l: hsl2.l, a: this._a };
},
toHslString: function() {
var hsl2 = rgbToHsl(this._r, this._g, this._b);
var h3 = mathRound(hsl2.h * 360), s4 = mathRound(hsl2.s * 100), l4 = mathRound(hsl2.l * 100);
return this._a == 1 ? "hsl(" + h3 + ", " + s4 + "%, " + l4 + "%)" : "hsla(" + h3 + ", " + s4 + "%, " + l4 + "%, " + this._roundA + ")";
},
toHex: function(allow3Char) {
return rgbToHex(this._r, this._g, this._b, allow3Char);
},
toHexString: function(allow3Char) {
return "#" + this.toHex(allow3Char);
},
toHex8: function(allow4Char) {
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
},
toHex8String: function(allow4Char) {
return "#" + this.toHex8(allow4Char);
},
toRgb: function() {
return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };
},
toRgbString: function() {
return this._a == 1 ? "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" : "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")";
},
toPercentageRgb: function() {
return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a };
},
toPercentageRgbString: function() {
return this._a == 1 ? "rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" : "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
},
toName: function() {
if (this._a === 0) {
return "transparent";
}
if (this._a < 1) {
return false;
}
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
},
toFilter: function(secondColor) {
var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
var secondHex8String = hex8String;
var gradientType = this._gradientType ? "GradientType = 1, " : "";
if (secondColor) {
var s4 = tinycolor2(secondColor);
secondHex8String = "#" + rgbaToArgbHex(s4._r, s4._g, s4._b, s4._a);
}
return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
},
toString: function(format2) {
var formatSet = !!format2;
format2 = format2 || this._format;
var formattedString = false;
var hasAlpha = this._a < 1 && this._a >= 0;
var needsAlphaFormat = !formatSet && hasAlpha && (format2 === "hex" || format2 === "hex6" || format2 === "hex3" || format2 === "hex4" || format2 === "hex8" || format2 === "name");
if (needsAlphaFormat) {
if (format2 === "name" && this._a === 0) {
return this.toName();
}
return this.toRgbString();
}
if (format2 === "rgb") {
formattedString = this.toRgbString();
}
if (format2 === "prgb") {
formattedString = this.toPercentageRgbString();
}
if (format2 === "hex" || format2 === "hex6") {
formattedString = this.toHexString();
}
if (format2 === "hex3") {
formattedString = this.toHexString(true);
}
if (format2 === "hex4") {
formattedString = this.toHex8String(true);
}
if (format2 === "hex8") {
formattedString = this.toHex8String();
}
if (format2 === "name") {
formattedString = this.toName();
}
if (format2 === "hsl") {
formattedString = this.toHslString();
}
if (format2 === "hsv") {
formattedString = this.toHsvString();
}
return formattedString || this.toHexString();
},
clone: function() {
return tinycolor2(this.toString());
},
_applyModification: function(fn2, args) {
var color4 = fn2.apply(null, [this].concat([].slice.call(args)));
this._r = color4._r;
this._g = color4._g;
this._b = color4._b;
this.setAlpha(color4._a);
return this;
},
lighten: function() {
return this._applyModification(lighten, arguments);
},
brighten: function() {
return this._applyModification(brighten, arguments);
},
darken: function() {
return this._applyModification(darken, arguments);
},
desaturate: function() {
return this._applyModification(desaturate, arguments);
},
saturate: function() {
return this._applyModification(saturate, arguments);
},
greyscale: function() {
return this._applyModification(greyscale, arguments);
},
spin: function() {
return this._applyModification(spin, arguments);
},
_applyCombination: function(fn2, args) {
return fn2.apply(null, [this].concat([].slice.call(args)));
},
analogous: function() {
return this._applyCombination(analogous, arguments);
},
complement: function() {
return this._applyCombination(complement, arguments);
},
monochromatic: function() {
return this._applyCombination(monochromatic, arguments);
},
splitcomplement: function() {
return this._applyCombination(splitcomplement, arguments);
},
triad: function() {
return this._applyCombination(triad, arguments);
},
tetrad: function() {
return this._applyCombination(tetrad, arguments);
}
};
tinycolor2.fromRatio = function(color4, opts) {
if (typeof color4 == "object") {
var newColor = {};
for (var i4 in color4) {
if (color4.hasOwnProperty(i4)) {
if (i4 === "a") {
newColor[i4] = color4[i4];
} else {
newColor[i4] = convertToPercentage(color4[i4]);
}
}
}
color4 = newColor;
}
return tinycolor2(color4, opts);
};
function inputToRGB(color4) {
var rgb2 = { r: 0, g: 0, b: 0 };
var a4 = 1;
var s4 = null;
var v3 = null;
var l4 = null;
var ok = false;
var format2 = false;
if (typeof color4 == "string") {
color4 = stringInputToObject(color4);
}
if (typeof color4 == "object") {
if (isValidCSSUnit(color4.r) && isValidCSSUnit(color4.g) && isValidCSSUnit(color4.b)) {
rgb2 = rgbToRgb(color4.r, color4.g, color4.b);
ok = true;
format2 = String(color4.r).substr(-1) === "%" ? "prgb" : "rgb";
} else if (isValidCSSUnit(color4.h) && isValidCSSUnit(color4.s) && isValidCSSUnit(color4.v)) {
s4 = convertToPercentage(color4.s);
v3 = convertToPercentage(color4.v);
rgb2 = hsvToRgb(color4.h, s4, v3);
ok = true;
format2 = "hsv";
} else if (isValidCSSUnit(color4.h) && isValidCSSUnit(color4.s) && isValidCSSUnit(color4.l)) {
s4 = convertToPercentage(color4.s);
l4 = convertToPercentage(color4.l);
rgb2 = hslToRgb(color4.h, s4, l4);
ok = true;
format2 = "hsl";
}
if (color4.hasOwnProperty("a")) {
a4 = color4.a;
}
}
a4 = boundAlpha(a4);
return {
ok,
format: color4.format || format2,
r: mathMin(255, mathMax(rgb2.r, 0)),
g: mathMin(255, mathMax(rgb2.g, 0)),
b: mathMin(255, mathMax(rgb2.b, 0)),
a: a4
};
}
function rgbToRgb(r4, g4, b10) {
return {
r: bound01(r4, 255) * 255,
g: bound01(g4, 255) * 255,
b: bound01(b10, 255) * 255
};
}
function rgbToHsl(r4, g4, b10) {
r4 = bound01(r4, 255);
g4 = bound01(g4, 255);
b10 = bound01(b10, 255);
var max8 = mathMax(r4, g4, b10), min7 = mathMin(r4, g4, b10);
var h3, s4, l4 = (max8 + min7) / 2;
if (max8 == min7) {
h3 = s4 = 0;
} else {
var d3 = max8 - min7;
s4 = l4 > 0.5 ? d3 / (2 - max8 - min7) : d3 / (max8 + min7);
switch (max8) {
case r4:
h3 = (g4 - b10) / d3 + (g4 < b10 ? 6 : 0);
break;
case g4:
h3 = (b10 - r4) / d3 + 2;
break;
case b10:
h3 = (r4 - g4) / d3 + 4;
break;
}
h3 /= 6;
}
return { h: h3, s: s4, l: l4 };
}
function hslToRgb(h3, s4, l4) {
var r4, g4, b10;
h3 = bound01(h3, 360);
s4 = bound01(s4, 100);
l4 = bound01(l4, 100);
function hue2rgb(p5, q5, t4) {
if (t4 < 0)
t4 += 1;
if (t4 > 1)
t4 -= 1;
if (t4 < 1 / 6)
return p5 + (q5 - p5) * 6 * t4;
if (t4 < 1 / 2)
return q5;
if (t4 < 2 / 3)
return p5 + (q5 - p5) * (2 / 3 - t4) * 6;
return p5;
}
if (s4 === 0) {
r4 = g4 = b10 = l4;
} else {
var q4 = l4 < 0.5 ? l4 * (1 + s4) : l4 + s4 - l4 * s4;
var p4 = 2 * l4 - q4;
r4 = hue2rgb(p4, q4, h3 + 1 / 3);
g4 = hue2rgb(p4, q4, h3);
b10 = hue2rgb(p4, q4, h3 - 1 / 3);
}
return { r: r4 * 255, g: g4 * 255, b: b10 * 255 };
}
function rgbToHsv(r4, g4, b10) {
r4 = bound01(r4, 255);
g4 = bound01(g4, 255);
b10 = bound01(b10, 255);
var max8 = mathMax(r4, g4, b10), min7 = mathMin(r4, g4, b10);
var h3, s4, v3 = max8;
var d3 = max8 - min7;
s4 = max8 === 0 ? 0 : d3 / max8;
if (max8 == min7) {
h3 = 0;
} else {
switch (max8) {
case r4:
h3 = (g4 - b10) / d3 + (g4 < b10 ? 6 : 0);
break;
case g4:
h3 = (b10 - r4) / d3 + 2;
break;
case b10:
h3 = (r4 - g4) / d3 + 4;
break;
}
h3 /= 6;
}
return { h: h3, s: s4, v: v3 };
}
function hsvToRgb(h3, s4, v3) {
h3 = bound01(h3, 360) * 6;
s4 = bound01(s4, 100);
v3 = bound01(v3, 100);
var i4 = Math2.floor(h3), f3 = h3 - i4, p4 = v3 * (1 - s4), q4 = v3 * (1 - f3 * s4), t4 = v3 * (1 - (1 - f3) * s4), mod3 = i4 % 6, r4 = [v3, q4, p4, p4, t4, v3][mod3], g4 = [t4, v3, v3, q4, p4, p4][mod3], b10 = [p4, p4, t4, v3, v3, q4][mod3];
return { r: r4 * 255, g: g4 * 255, b: b10 * 255 };
}
function rgbToHex(r4, g4, b10, allow3Char) {
var hex2 = [
pad2(mathRound(r4).toString(16)),
pad2(mathRound(g4).toString(16)),
pad2(mathRound(b10).toString(16))
];
if (allow3Char && hex2[0].charAt(0) == hex2[0].charAt(1) && hex2[1].charAt(0) == hex2[1].charAt(1) && hex2[2].charAt(0) == hex2[2].charAt(1)) {
return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0);
}
return hex2.join("");
}
function rgbaToHex(r4, g4, b10, a4, allow4Char) {
var hex2 = [
pad2(mathRound(r4).toString(16)),
pad2(mathRound(g4).toString(16)),
pad2(mathRound(b10).toString(16)),
pad2(convertDecimalToHex(a4))
];
if (allow4Char && hex2[0].charAt(0) == hex2[0].charAt(1) && hex2[1].charAt(0) == hex2[1].charAt(1) && hex2[2].charAt(0) == hex2[2].charAt(1) && hex2[3].charAt(0) == hex2[3].charAt(1)) {
return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0) + hex2[3].charAt(0);
}
return hex2.join("");
}
function rgbaToArgbHex(r4, g4, b10, a4) {
var hex2 = [
pad2(convertDecimalToHex(a4)),
pad2(mathRound(r4).toString(16)),
pad2(mathRound(g4).toString(16)),
pad2(mathRound(b10).toString(16))
];
return hex2.join("");
}
tinycolor2.equals = function(color1, color22) {
if (!color1 || !color22) {
return false;
}
return tinycolor2(color1).toRgbString() == tinycolor2(color22).toRgbString();
};
tinycolor2.random = function() {
return tinycolor2.fromRatio({
r: mathRandom(),
g: mathRandom(),
b: mathRandom()
});
};
function desaturate(color4, amount) {
amount = amount === 0 ? 0 : amount || 10;
var hsl2 = tinycolor2(color4).toHsl();
hsl2.s -= amount / 100;
hsl2.s = clamp01(hsl2.s);
return tinycolor2(hsl2);
}
function saturate(color4, amount) {
amount = amount === 0 ? 0 : amount || 10;
var hsl2 = tinycolor2(color4).toHsl();
hsl2.s += amount / 100;
hsl2.s = clamp01(hsl2.s);
return tinycolor2(hsl2);
}
function greyscale(color4) {
return tinycolor2(color4).desaturate(100);
}
function lighten(color4, amount) {
amount = amount === 0 ? 0 : amount || 10;
var hsl2 = tinycolor2(color4).toHsl();
hsl2.l += amount / 100;
hsl2.l = clamp01(hsl2.l);
return tinycolor2(hsl2);
}
function brighten(color4, amount) {
amount = amount === 0 ? 0 : amount || 10;
var rgb2 = tinycolor2(color4).toRgb();
rgb2.r = mathMax(0, mathMin(255, rgb2.r - mathRound(255 * -(amount / 100))));
rgb2.g = mathMax(0, mathMin(255, rgb2.g - mathRound(255 * -(amount / 100))));
rgb2.b = mathMax(0, mathMin(255, rgb2.b - mathRound(255 * -(amount / 100))));
return tinycolor2(rgb2);
}
function darken(color4, amount) {
amount = amount === 0 ? 0 : amount || 10;
var hsl2 = tinycolor2(color4).toHsl();
hsl2.l -= amount / 100;
hsl2.l = clamp01(hsl2.l);
return tinycolor2(hsl2);
}
function spin(color4, amount) {
var hsl2 = tinycolor2(color4).toHsl();
var hue = (hsl2.h + amount) % 360;
hsl2.h = hue < 0 ? 360 + hue : hue;
return tinycolor2(hsl2);
}
function complement(color4) {
var hsl2 = tinycolor2(color4).toHsl();
hsl2.h = (hsl2.h + 180) % 360;
return tinycolor2(hsl2);
}
function triad(color4) {
var hsl2 = tinycolor2(color4).toHsl();
var h3 = hsl2.h;
return [
tinycolor2(color4),
tinycolor2({ h: (h3 + 120) % 360, s: hsl2.s, l: hsl2.l }),
tinycolor2({ h: (h3 + 240) % 360, s: hsl2.s, l: hsl2.l })
];
}
function tetrad(color4) {
var hsl2 = tinycolor2(color4).toHsl();
var h3 = hsl2.h;
return [
tinycolor2(color4),
tinycolor2({ h: (h3 + 90) % 360, s: hsl2.s, l: hsl2.l }),
tinycolor2({ h: (h3 + 180) % 360, s: hsl2.s, l: hsl2.l }),
tinycolor2({ h: (h3 + 270) % 360, s: hsl2.s, l: hsl2.l })
];
}
function splitcomplement(color4) {
var hsl2 = tinycolor2(color4).toHsl();
var h3 = hsl2.h;
return [
tinycolor2(color4),
tinycolor2({ h: (h3 + 72) % 360, s: hsl2.s, l: hsl2.l }),
tinycolor2({ h: (h3 + 216) % 360, s: hsl2.s, l: hsl2.l })
];
}
function analogous(color4, results, slices) {
results = results || 6;
slices = slices || 30;
var hsl2 = tinycolor2(color4).toHsl();
var part = 360 / slices;
var ret = [tinycolor2(color4)];
for (hsl2.h = (hsl2.h - (part * results >> 1) + 720) % 360; --results; ) {
hsl2.h = (hsl2.h + part) % 360;
ret.push(tinycolor2(hsl2));
}
return ret;
}
function monochromatic(color4, results) {
results = results || 6;
var hsv = tinycolor2(color4).toHsv();
var h3 = hsv.h, s4 = hsv.s, v3 = hsv.v;
var ret = [];
var modification = 1 / results;
while (results--) {
ret.push(tinycolor2({ h: h3, s: s4, v: v3 }));
v3 = (v3 + modification) % 1;
}
return ret;
}
tinycolor2.mix = function(color1, color22, amount) {
amount = amount === 0 ? 0 : amount || 50;
var rgb1 = tinycolor2(color1).toRgb();
var rgb2 = tinycolor2(color22).toRgb();
var p4 = amount / 100;
var rgba2 = {
r: (rgb2.r - rgb1.r) * p4 + rgb1.r,
g: (rgb2.g - rgb1.g) * p4 + rgb1.g,
b: (rgb2.b - rgb1.b) * p4 + rgb1.b,
a: (rgb2.a - rgb1.a) * p4 + rgb1.a
};
return tinycolor2(rgba2);
};
tinycolor2.readability = function(color1, color22) {
var c1 = tinycolor2(color1);
var c22 = tinycolor2(color22);
return (Math2.max(c1.getLuminance(), c22.getLuminance()) + 0.05) / (Math2.min(c1.getLuminance(), c22.getLuminance()) + 0.05);
};
tinycolor2.isReadable = function(color1, color22, wcag2) {
var readability = tinycolor2.readability(color1, color22);
var wcag2Parms, out;
out = false;
wcag2Parms = validateWCAG2Parms(wcag2);
switch (wcag2Parms.level + wcag2Parms.size) {
case "AAsmall":
case "AAAlarge":
out = readability >= 4.5;
break;
case "AAlarge":
out = readability >= 3;
break;
case "AAAsmall":
out = readability >= 7;
break;
}
return out;
};
tinycolor2.mostReadable = function(baseColor, colorList, args) {
var bestColor = null;
var bestScore = 0;
var readability;
var includeFallbackColors, level, size2;
args = args || {};
includeFallbackColors = args.includeFallbackColors;
level = args.level;
size2 = args.size;
for (var i4 = 0; i4 < colorList.length; i4++) {
readability = tinycolor2.readability(baseColor, colorList[i4]);
if (readability > bestScore) {
bestScore = readability;
bestColor = tinycolor2(colorList[i4]);
}
}
if (tinycolor2.isReadable(baseColor, bestColor, { "level": level, "size": size2 }) || !includeFallbackColors) {
return bestColor;
} else {
args.includeFallbackColors = false;
return tinycolor2.mostReadable(baseColor, ["#fff", "#000"], args);
}
};
var names = tinycolor2.names = {
aliceblue: "f0f8ff",
antiquewhite: "faebd7",
aqua: "0ff",
aquamarine: "7fffd4",
azure: "f0ffff",
beige: "f5f5dc",
bisque: "ffe4c4",
black: "000",
blanchedalmond: "ffebcd",
blue: "00f",
blueviolet: "8a2be2",
brown: "a52a2a",
burlywood: "deb887",
burntsienna: "ea7e5d",
cadetblue: "5f9ea0",
chartreuse: "7fff00",
chocolate: "d2691e",
coral: "ff7f50",
cornflowerblue: "6495ed",
cornsilk: "fff8dc",
crimson: "dc143c",
cyan: "0ff",
darkblue: "00008b",
darkcyan: "008b8b",
darkgoldenrod: "b8860b",
darkgray: "a9a9a9",
darkgreen: "006400",
darkgrey: "a9a9a9",
darkkhaki: "bdb76b",
darkmagenta: "8b008b",
darkolivegreen: "556b2f",
darkorange: "ff8c00",
darkorchid: "9932cc",
darkred: "8b0000",
darksalmon: "e9967a",
darkseagreen: "8fbc8f",
darkslateblue: "483d8b",
darkslategray: "2f4f4f",
darkslategrey: "2f4f4f",
darkturquoise: "00ced1",
darkviolet: "9400d3",
deeppink: "ff1493",
deepskyblue: "00bfff",
dimgray: "696969",
dimgrey: "696969",
dodgerblue: "1e90ff",
firebrick: "b22222",
floralwhite: "fffaf0",
forestgreen: "228b22",
fuchsia: "f0f",
gainsboro: "dcdcdc",
ghostwhite: "f8f8ff",
gold: "ffd700",
goldenrod: "daa520",
gray: "808080",
green: "008000",
greenyellow: "adff2f",
grey: "808080",
honeydew: "f0fff0",
hotpink: "ff69b4",
indianred: "cd5c5c",
indigo: "4b0082",
ivory: "fffff0",
khaki: "f0e68c",
lavender: "e6e6fa",
lavenderblush: "fff0f5",
lawngreen: "7cfc00",
lemonchiffon: "fffacd",
lightblue: "add8e6",
lightcoral: "f08080",
lightcyan: "e0ffff",
lightgoldenrodyellow: "fafad2",
lightgray: "d3d3d3",
lightgreen: "90ee90",
lightgrey: "d3d3d3",
lightpink: "ffb6c1",
lightsalmon: "ffa07a",
lightseagreen: "20b2aa",
lightskyblue: "87cefa",
lightslategray: "789",
lightslategrey: "789",
lightsteelblue: "b0c4de",
lightyellow: "ffffe0",
lime: "0f0",
limegreen: "32cd32",
linen: "faf0e6",
magenta: "f0f",
maroon: "800000",
mediumaquamarine: "66cdaa",
mediumblue: "0000cd",
mediumorchid: "ba55d3",
mediumpurple: "9370db",
mediumseagreen: "3cb371",
mediumslateblue: "7b68ee",
mediumspringgreen: "00fa9a",
mediumturquoise: "48d1cc",
mediumvioletred: "c71585",
midnightblue: "191970",
mintcream: "f5fffa",
mistyrose: "ffe4e1",
moccasin: "ffe4b5",
navajowhite: "ffdead",
navy: "000080",
oldlace: "fdf5e6",
olive: "808000",
olivedrab: "6b8e23",
orange: "ffa500",
orangered: "ff4500",
orchid: "da70d6",
palegoldenrod: "eee8aa",
palegreen: "98fb98",
paleturquoise: "afeeee",
palevioletred: "db7093",
papayawhip: "ffefd5",
peachpuff: "ffdab9",
peru: "cd853f",
pink: "ffc0cb",
plum: "dda0dd",
powderblue: "b0e0e6",
purple: "800080",
rebeccapurple: "663399",
red: "f00",
rosybrown: "bc8f8f",
royalblue: "4169e1",
saddlebrown: "8b4513",
salmon: "fa8072",
sandybrown: "f4a460",
seagreen: "2e8b57",
seashell: "fff5ee",
sienna: "a0522d",
silver: "c0c0c0",
skyblue: "87ceeb",
slateblue: "6a5acd",
slategray: "708090",
slategrey: "708090",
snow: "fffafa",
springgreen: "00ff7f",
steelblue: "4682b4",
tan: "d2b48c",
teal: "008080",
thistle: "d8bfd8",
tomato: "ff6347",
turquoise: "40e0d0",
violet: "ee82ee",
wheat: "f5deb3",
white: "fff",
whitesmoke: "f5f5f5",
yellow: "ff0",
yellowgreen: "9acd32"
};
var hexNames = tinycolor2.hexNames = flip(names);
function flip(o3) {
var flipped = {};
for (var i4 in o3) {
if (o3.hasOwnProperty(i4)) {
flipped[o3[i4]] = i4;
}
}
return flipped;
}
function boundAlpha(a4) {
a4 = parseFloat(a4);
if (isNaN(a4) || a4 < 0 || a4 > 1) {
a4 = 1;
}
return a4;
}
function bound01(n3, max8) {
if (isOnePointZero(n3)) {
n3 = "100%";
}
var processPercent = isPercentage(n3);
n3 = mathMin(max8, mathMax(0, parseFloat(n3)));
if (processPercent) {
n3 = parseInt(n3 * max8, 10) / 100;
}
if (Math2.abs(n3 - max8) < 1e-6) {
return 1;
}
return n3 % max8 / parseFloat(max8);
}
function clamp01(val) {
return mathMin(1, mathMax(0, val));
}
function parseIntFromHex(val) {
return parseInt(val, 16);
}
function isOnePointZero(n3) {
return typeof n3 == "string" && n3.indexOf(".") != -1 && parseFloat(n3) === 1;
}
function isPercentage(n3) {
return typeof n3 === "string" && n3.indexOf("%") != -1;
}
function pad2(c5) {
return c5.length == 1 ? "0" + c5 : "" + c5;
}
function convertToPercentage(n3) {
if (n3 <= 1) {
n3 = n3 * 100 + "%";
}
return n3;
}
function convertDecimalToHex(d3) {
return Math2.round(parseFloat(d3) * 255).toString(16);
}
function convertHexToDecimal(h3) {
return parseIntFromHex(h3) / 255;
}
var matchers = function() {
var CSS_INTEGER = "[-\\+]?\\d+%?";
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
return {
CSS_UNIT: new RegExp(CSS_UNIT),
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
};
}();
function isValidCSSUnit(color4) {
return !!matchers.CSS_UNIT.exec(color4);
}
function stringInputToObject(color4) {
color4 = color4.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
var named9 = false;
if (names[color4]) {
color4 = names[color4];
named9 = true;
} else if (color4 == "transparent") {
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
}
var match;
if (match = matchers.rgb.exec(color4)) {
return { r: match[1], g: match[2], b: match[3] };
}
if (match = matchers.rgba.exec(color4)) {
return { r: match[1], g: match[2], b: match[3], a: match[4] };
}
if (match = matchers.hsl.exec(color4)) {
return { h: match[1], s: match[2], l: match[3] };
}
if (match = matchers.hsla.exec(color4)) {
return { h: match[1], s: match[2], l: match[3], a: match[4] };
}
if (match = matchers.hsv.exec(color4)) {
return { h: match[1], s: match[2], v: match[3] };
}
if (match = matchers.hsva.exec(color4)) {
return { h: match[1], s: match[2], v: match[3], a: match[4] };
}
if (match = matchers.hex8.exec(color4)) {
return {
r: parseIntFromHex(match[1]),
g: parseIntFromHex(match[2]),
b: parseIntFromHex(match[3]),
a: convertHexToDecimal(match[4]),
format: named9 ? "name" : "hex8"
};
}
if (match = matchers.hex6.exec(color4)) {
return {
r: parseIntFromHex(match[1]),
g: parseIntFromHex(match[2]),
b: parseIntFromHex(match[3]),
format: named9 ? "name" : "hex"
};
}
if (match = matchers.hex4.exec(color4)) {
return {
r: parseIntFromHex(match[1] + "" + match[1]),
g: parseIntFromHex(match[2] + "" + match[2]),
b: parseIntFromHex(match[3] + "" + match[3]),
a: convertHexToDecimal(match[4] + "" + match[4]),
format: named9 ? "name" : "hex8"
};
}
if (match = matchers.hex3.exec(color4)) {
return {
r: parseIntFromHex(match[1] + "" + match[1]),
g: parseIntFromHex(match[2] + "" + match[2]),
b: parseIntFromHex(match[3] + "" + match[3]),
format: named9 ? "name" : "hex"
};
}
return false;
}
function validateWCAG2Parms(parms) {
var level, size2;
parms = parms || { "level": "AA", "size": "small" };
level = (parms.level || "AA").toUpperCase();
size2 = (parms.size || "small").toLowerCase();
if (level !== "AA" && level !== "AAA") {
level = "AA";
}
if (size2 !== "small" && size2 !== "large") {
size2 = "small";
}
return { "level": level, "size": size2 };
}
if (typeof module2 !== "undefined" && module2.exports) {
module2.exports = tinycolor2;
} else if (typeof define === "function" && define.amd) {
define(function() {
return tinycolor2;
});
} else {
window.tinycolor = tinycolor2;
}
})(Math);
}
});
// node_modules/lodash/lodash.js
var require_lodash = __commonJS({
"node_modules/lodash/lodash.js"(exports, module2) {
(function() {
var undefined2;
var VERSION2 = "4.17.21";
var LARGE_ARRAY_SIZE = 200;
var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
var HASH_UNDEFINED = "__lodash_hash_undefined__";
var MAX_MEMOIZE_SIZE = 500;
var PLACEHOLDER = "__lodash_placeholder__";
var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512;
var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
var HOT_COUNT = 800, HOT_SPAN = 16;
var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
var INFINITY = 1 / 0, MAX_SAFE_INTEGER4 = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN = 0 / 0;
var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
var wrapFlags = [
["ary", WRAP_ARY_FLAG],
["bind", WRAP_BIND_FLAG],
["bindKey", WRAP_BIND_KEY_FLAG],
["curry", WRAP_CURRY_FLAG],
["curryRight", WRAP_CURRY_RIGHT_FLAG],
["flip", WRAP_FLIP_FLAG],
["partial", WRAP_PARTIAL_FLAG],
["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
["rearg", WRAP_REARG_FLAG]
];
var argsTag4 = "[object Arguments]", arrayTag4 = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag4 = "[object Boolean]", dateTag4 = "[object Date]", domExcTag = "[object DOMException]", errorTag4 = "[object Error]", funcTag4 = "[object Function]", genTag = "[object GeneratorFunction]", mapTag4 = "[object Map]", numberTag4 = "[object Number]", nullTag = "[object Null]", objectTag4 = "[object Object]", promiseTag = "[object Promise]", proxyTag = "[object Proxy]", regexpTag4 = "[object RegExp]", setTag5 = "[object Set]", stringTag4 = "[object String]", symbolTag = "[object Symbol]", undefinedTag = "[object Undefined]", weakMapTag4 = "[object WeakMap]", weakSetTag = "[object WeakSet]";
var arrayBufferTag4 = "[object ArrayBuffer]", dataViewTag4 = "[object DataView]", float32Tag4 = "[object Float32Array]", float64Tag4 = "[object Float64Array]", int8Tag4 = "[object Int8Array]", int16Tag4 = "[object Int16Array]", int32Tag4 = "[object Int32Array]", uint8Tag4 = "[object Uint8Array]", uint8ClampedTag4 = "[object Uint8ClampedArray]", uint16Tag4 = "[object Uint16Array]", uint32Tag4 = "[object Uint32Array]";
var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source);
var reTrimStart = /^\s+/;
var reWhitespace = /\s/;
var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
var reEscapeChar = /\\(\\)?/g;
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
var reFlags = /\w*$/;
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
var reIsBinary = /^0b[01]+$/i;
var reIsHostCtor = /^\[object .+?Constructor\]$/;
var reIsOctal = /^0o[0-7]+$/i;
var reIsUint = /^(?:0|[1-9]\d*)$/;
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
var reNoMatch = /($^)/;
var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = "\\u2700-\\u27bf", rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff", rsMathOpRange = "\\xac\\xb1\\xd7\\xf7", rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", rsPunctuationRange = "\\u2000-\\u206f", rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde", rsVarRange = "\\ufe0e\\ufe0f", rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
var rsApos = "['\u2019]", rsAstral = "[" + rsAstralRange + "]", rsBreak = "[" + rsBreakRange + "]", rsCombo = "[" + rsComboRange + "]", rsDigits = "\\d+", rsDingbat = "[" + rsDingbatRange + "]", rsLower = "[" + rsLowerRange + "]", rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[" + rsUpperRange + "]", rsZWJ = "\\u200d";
var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?", rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?", reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
var reApos = RegExp(rsApos, "g");
var reComboMark = RegExp(rsCombo, "g");
var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
var reUnicodeWord = RegExp([
rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
rsUpper + "+" + rsOptContrUpper,
rsOrdUpper,
rsOrdLower,
rsDigits,
rsEmoji
].join("|"), "g");
var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
var contextProps = [
"Array",
"Buffer",
"DataView",
"Date",
"Error",
"Float32Array",
"Float64Array",
"Function",
"Int8Array",
"Int16Array",
"Int32Array",
"Map",
"Math",
"Object",
"Promise",
"RegExp",
"Set",
"String",
"Symbol",
"TypeError",
"Uint8Array",
"Uint8ClampedArray",
"Uint16Array",
"Uint32Array",
"WeakMap",
"_",
"clearTimeout",
"isFinite",
"parseInt",
"setTimeout"
];
var templateCounter = -1;
var typedArrayTags4 = {};
typedArrayTags4[float32Tag4] = typedArrayTags4[float64Tag4] = typedArrayTags4[int8Tag4] = typedArrayTags4[int16Tag4] = typedArrayTags4[int32Tag4] = typedArrayTags4[uint8Tag4] = typedArrayTags4[uint8ClampedTag4] = typedArrayTags4[uint16Tag4] = typedArrayTags4[uint32Tag4] = true;
typedArrayTags4[argsTag4] = typedArrayTags4[arrayTag4] = typedArrayTags4[arrayBufferTag4] = typedArrayTags4[boolTag4] = typedArrayTags4[dataViewTag4] = typedArrayTags4[dateTag4] = typedArrayTags4[errorTag4] = typedArrayTags4[funcTag4] = typedArrayTags4[mapTag4] = typedArrayTags4[numberTag4] = typedArrayTags4[objectTag4] = typedArrayTags4[regexpTag4] = typedArrayTags4[setTag5] = typedArrayTags4[stringTag4] = typedArrayTags4[weakMapTag4] = false;
var cloneableTags = {};
cloneableTags[argsTag4] = cloneableTags[arrayTag4] = cloneableTags[arrayBufferTag4] = cloneableTags[dataViewTag4] = cloneableTags[boolTag4] = cloneableTags[dateTag4] = cloneableTags[float32Tag4] = cloneableTags[float64Tag4] = cloneableTags[int8Tag4] = cloneableTags[int16Tag4] = cloneableTags[int32Tag4] = cloneableTags[mapTag4] = cloneableTags[numberTag4] = cloneableTags[objectTag4] = cloneableTags[regexpTag4] = cloneableTags[setTag5] = cloneableTags[stringTag4] = cloneableTags[symbolTag] = cloneableTags[uint8Tag4] = cloneableTags[uint8ClampedTag4] = cloneableTags[uint16Tag4] = cloneableTags[uint32Tag4] = true;
cloneableTags[errorTag4] = cloneableTags[funcTag4] = cloneableTags[weakMapTag4] = false;
var deburredLetters = {
"\xC0": "A",
"\xC1": "A",
"\xC2": "A",
"\xC3": "A",
"\xC4": "A",
"\xC5": "A",
"\xE0": "a",
"\xE1": "a",
"\xE2": "a",
"\xE3": "a",
"\xE4": "a",
"\xE5": "a",
"\xC7": "C",
"\xE7": "c",
"\xD0": "D",
"\xF0": "d",
"\xC8": "E",
"\xC9": "E",
"\xCA": "E",
"\xCB": "E",
"\xE8": "e",
"\xE9": "e",
"\xEA": "e",
"\xEB": "e",
"\xCC": "I",
"\xCD": "I",
"\xCE": "I",
"\xCF": "I",
"\xEC": "i",
"\xED": "i",
"\xEE": "i",
"\xEF": "i",
"\xD1": "N",
"\xF1": "n",
"\xD2": "O",
"\xD3": "O",
"\xD4": "O",
"\xD5": "O",
"\xD6": "O",
"\xD8": "O",
"\xF2": "o",
"\xF3": "o",
"\xF4": "o",
"\xF5": "o",
"\xF6": "o",
"\xF8": "o",
"\xD9": "U",
"\xDA": "U",
"\xDB": "U",
"\xDC": "U",
"\xF9": "u",
"\xFA": "u",
"\xFB": "u",
"\xFC": "u",
"\xDD": "Y",
"\xFD": "y",
"\xFF": "y",
"\xC6": "Ae",
"\xE6": "ae",
"\xDE": "Th",
"\xFE": "th",
"\xDF": "ss",
"\u0100": "A",
"\u0102": "A",
"\u0104": "A",
"\u0101": "a",
"\u0103": "a",
"\u0105": "a",
"\u0106": "C",
"\u0108": "C",
"\u010A": "C",
"\u010C": "C",
"\u0107": "c",
"\u0109": "c",
"\u010B": "c",
"\u010D": "c",
"\u010E": "D",
"\u0110": "D",
"\u010F": "d",
"\u0111": "d",
"\u0112": "E",
"\u0114": "E",
"\u0116": "E",
"\u0118": "E",
"\u011A": "E",
"\u0113": "e",
"\u0115": "e",
"\u0117": "e",
"\u0119": "e",
"\u011B": "e",
"\u011C": "G",
"\u011E": "G",
"\u0120": "G",
"\u0122": "G",
"\u011D": "g",
"\u011F": "g",
"\u0121": "g",
"\u0123": "g",
"\u0124": "H",
"\u0126": "H",
"\u0125": "h",
"\u0127": "h",
"\u0128": "I",
"\u012A": "I",
"\u012C": "I",
"\u012E": "I",
"\u0130": "I",
"\u0129": "i",
"\u012B": "i",
"\u012D": "i",
"\u012F": "i",
"\u0131": "i",
"\u0134": "J",
"\u0135": "j",
"\u0136": "K",
"\u0137": "k",
"\u0138": "k",
"\u0139": "L",
"\u013B": "L",
"\u013D": "L",
"\u013F": "L",
"\u0141": "L",
"\u013A": "l",
"\u013C": "l",
"\u013E": "l",
"\u0140": "l",
"\u0142": "l",
"\u0143": "N",
"\u0145": "N",
"\u0147": "N",
"\u014A": "N",
"\u0144": "n",
"\u0146": "n",
"\u0148": "n",
"\u014B": "n",
"\u014C": "O",
"\u014E": "O",
"\u0150": "O",
"\u014D": "o",
"\u014F": "o",
"\u0151": "o",
"\u0154": "R",
"\u0156": "R",
"\u0158": "R",
"\u0155": "r",
"\u0157": "r",
"\u0159": "r",
"\u015A": "S",
"\u015C": "S",
"\u015E": "S",
"\u0160": "S",
"\u015B": "s",
"\u015D": "s",
"\u015F": "s",
"\u0161": "s",
"\u0162": "T",
"\u0164": "T",
"\u0166": "T",
"\u0163": "t",
"\u0165": "t",
"\u0167": "t",
"\u0168": "U",
"\u016A": "U",
"\u016C": "U",
"\u016E": "U",
"\u0170": "U",
"\u0172": "U",
"\u0169": "u",
"\u016B": "u",
"\u016D": "u",
"\u016F": "u",
"\u0171": "u",
"\u0173": "u",
"\u0174": "W",
"\u0175": "w",
"\u0176": "Y",
"\u0177": "y",
"\u0178": "Y",
"\u0179": "Z",
"\u017B": "Z",
"\u017D": "Z",
"\u017A": "z",
"\u017C": "z",
"\u017E": "z",
"\u0132": "IJ",
"\u0133": "ij",
"\u0152": "Oe",
"\u0153": "oe",
"\u0149": "'n",
"\u017F": "s"
};
var htmlEscapes = {
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'"
};
var htmlUnescapes = {
"&": "&",
"<": "<",
">": ">",
""": '"',
"'": "'"
};
var stringEscapes = {
"\\": "\\",
"'": "'",
"\n": "n",
"\r": "r",
"\u2028": "u2028",
"\u2029": "u2029"
};
var freeParseFloat = parseFloat, freeParseInt = parseInt;
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
var root = freeGlobal || freeSelf || Function("return this")();
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2;
var moduleExports = freeModule && freeModule.exports === freeExports;
var freeProcess = moduleExports && freeGlobal.process;
var nodeUtil = function() {
try {
var types2 = freeModule && freeModule.require && freeModule.require("util").types;
if (types2) {
return types2;
}
return freeProcess && freeProcess.binding && freeProcess.binding("util");
} catch (e4) {
}
}();
var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, nodeIsDate = nodeUtil && nodeUtil.isDate, nodeIsMap = nodeUtil && nodeUtil.isMap, nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, nodeIsSet = nodeUtil && nodeUtil.isSet, nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
function apply(func, thisArg, args) {
switch (args.length) {
case 0:
return func.call(thisArg);
case 1:
return func.call(thisArg, args[0]);
case 2:
return func.call(thisArg, args[0], args[1]);
case 3:
return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
function arrayAggregator(array, setter, iteratee, accumulator) {
var index2 = -1, length5 = array == null ? 0 : array.length;
while (++index2 < length5) {
var value2 = array[index2];
setter(accumulator, value2, iteratee(value2), array);
}
return accumulator;
}
function arrayEach(array, iteratee) {
var index2 = -1, length5 = array == null ? 0 : array.length;
while (++index2 < length5) {
if (iteratee(array[index2], index2, array) === false) {
break;
}
}
return array;
}
function arrayEachRight(array, iteratee) {
var length5 = array == null ? 0 : array.length;
while (length5--) {
if (iteratee(array[length5], length5, array) === false) {
break;
}
}
return array;
}
function arrayEvery(array, predicate) {
var index2 = -1, length5 = array == null ? 0 : array.length;
while (++index2 < length5) {
if (!predicate(array[index2], index2, array)) {
return false;
}
}
return true;
}
function arrayFilter(array, predicate) {
var index2 = -1, length5 = array == null ? 0 : array.length, resIndex = 0, result = [];
while (++index2 < length5) {
var value2 = array[index2];
if (predicate(value2, index2, array)) {
result[resIndex++] = value2;
}
}
return result;
}
function arrayIncludes(array, value2) {
var length5 = array == null ? 0 : array.length;
return !!length5 && baseIndexOf(array, value2, 0) > -1;
}
function arrayIncludesWith(array, value2, comparator) {
var index2 = -1, length5 = array == null ? 0 : array.length;
while (++index2 < length5) {
if (comparator(value2, array[index2])) {
return true;
}
}
return false;
}
function arrayMap(array, iteratee) {
var index2 = -1, length5 = array == null ? 0 : array.length, result = Array(length5);
while (++index2 < length5) {
result[index2] = iteratee(array[index2], index2, array);
}
return result;
}
function arrayPush(array, values2) {
var index2 = -1, length5 = values2.length, offset = array.length;
while (++index2 < length5) {
array[offset + index2] = values2[index2];
}
return array;
}
function arrayReduce(array, iteratee, accumulator, initAccum) {
var index2 = -1, length5 = array == null ? 0 : array.length;
if (initAccum && length5) {
accumulator = array[++index2];
}
while (++index2 < length5) {
accumulator = iteratee(accumulator, array[index2], index2, array);
}
return accumulator;
}
function arrayReduceRight(array, iteratee, accumulator, initAccum) {
var length5 = array == null ? 0 : array.length;
if (initAccum && length5) {
accumulator = array[--length5];
}
while (length5--) {
accumulator = iteratee(accumulator, array[length5], length5, array);
}
return accumulator;
}
function arraySome(array, predicate) {
var index2 = -1, length5 = array == null ? 0 : array.length;
while (++index2 < length5) {
if (predicate(array[index2], index2, array)) {
return true;
}
}
return false;
}
var asciiSize = baseProperty("length");
function asciiToArray(string) {
return string.split("");
}
function asciiWords(string) {
return string.match(reAsciiWord) || [];
}
function baseFindKey(collection, predicate, eachFunc) {
var result;
eachFunc(collection, function(value2, key, collection2) {
if (predicate(value2, key, collection2)) {
result = key;
return false;
}
});
return result;
}
function baseFindIndex(array, predicate, fromIndex, fromRight) {
var length5 = array.length, index2 = fromIndex + (fromRight ? 1 : -1);
while (fromRight ? index2-- : ++index2 < length5) {
if (predicate(array[index2], index2, array)) {
return index2;
}
}
return -1;
}
function baseIndexOf(array, value2, fromIndex) {
return value2 === value2 ? strictIndexOf(array, value2, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
}
function baseIndexOfWith(array, value2, fromIndex, comparator) {
var index2 = fromIndex - 1, length5 = array.length;
while (++index2 < length5) {
if (comparator(array[index2], value2)) {
return index2;
}
}
return -1;
}
function baseIsNaN(value2) {
return value2 !== value2;
}
function baseMean(array, iteratee) {
var length5 = array == null ? 0 : array.length;
return length5 ? baseSum(array, iteratee) / length5 : NAN;
}
function baseProperty(key) {
return function(object) {
return object == null ? undefined2 : object[key];
};
}
function basePropertyOf(object) {
return function(key) {
return object == null ? undefined2 : object[key];
};
}
function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
eachFunc(collection, function(value2, index2, collection2) {
accumulator = initAccum ? (initAccum = false, value2) : iteratee(accumulator, value2, index2, collection2);
});
return accumulator;
}
function baseSortBy(array, comparer) {
var length5 = array.length;
array.sort(comparer);
while (length5--) {
array[length5] = array[length5].value;
}
return array;
}
function baseSum(array, iteratee) {
var result, index2 = -1, length5 = array.length;
while (++index2 < length5) {
var current = iteratee(array[index2]);
if (current !== undefined2) {
result = result === undefined2 ? current : result + current;
}
}
return result;
}
function baseTimes(n3, iteratee) {
var index2 = -1, result = Array(n3);
while (++index2 < n3) {
result[index2] = iteratee(index2);
}
return result;
}
function baseToPairs(object, props) {
return arrayMap(props, function(key) {
return [key, object[key]];
});
}
function baseTrim(string) {
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
}
function baseUnary(func) {
return function(value2) {
return func(value2);
};
}
function baseValues(object, props) {
return arrayMap(props, function(key) {
return object[key];
});
}
function cacheHas(cache3, key) {
return cache3.has(key);
}
function charsStartIndex(strSymbols, chrSymbols) {
var index2 = -1, length5 = strSymbols.length;
while (++index2 < length5 && baseIndexOf(chrSymbols, strSymbols[index2], 0) > -1) {
}
return index2;
}
function charsEndIndex(strSymbols, chrSymbols) {
var index2 = strSymbols.length;
while (index2-- && baseIndexOf(chrSymbols, strSymbols[index2], 0) > -1) {
}
return index2;
}
function countHolders(array, placeholder) {
var length5 = array.length, result = 0;
while (length5--) {
if (array[length5] === placeholder) {
++result;
}
}
return result;
}
var deburrLetter = basePropertyOf(deburredLetters);
var escapeHtmlChar = basePropertyOf(htmlEscapes);
function escapeStringChar(chr) {
return "\\" + stringEscapes[chr];
}
function getValue3(object, key) {
return object == null ? undefined2 : object[key];
}
function hasUnicode(string) {
return reHasUnicode.test(string);
}
function hasUnicodeWord(string) {
return reHasUnicodeWord.test(string);
}
function iteratorToArray(iterator) {
var data3, result = [];
while (!(data3 = iterator.next()).done) {
result.push(data3.value);
}
return result;
}
function mapToArray(map6) {
var index2 = -1, result = Array(map6.size);
map6.forEach(function(value2, key) {
result[++index2] = [key, value2];
});
return result;
}
function overArg(func, transform18) {
return function(arg) {
return func(transform18(arg));
};
}
function replaceHolders(array, placeholder) {
var index2 = -1, length5 = array.length, resIndex = 0, result = [];
while (++index2 < length5) {
var value2 = array[index2];
if (value2 === placeholder || value2 === PLACEHOLDER) {
array[index2] = PLACEHOLDER;
result[resIndex++] = index2;
}
}
return result;
}
function setToArray(set10) {
var index2 = -1, result = Array(set10.size);
set10.forEach(function(value2) {
result[++index2] = value2;
});
return result;
}
function setToPairs(set10) {
var index2 = -1, result = Array(set10.size);
set10.forEach(function(value2) {
result[++index2] = [value2, value2];
});
return result;
}
function strictIndexOf(array, value2, fromIndex) {
var index2 = fromIndex - 1, length5 = array.length;
while (++index2 < length5) {
if (array[index2] === value2) {
return index2;
}
}
return -1;
}
function strictLastIndexOf(array, value2, fromIndex) {
var index2 = fromIndex + 1;
while (index2--) {
if (array[index2] === value2) {
return index2;
}
}
return index2;
}
function stringSize(string) {
return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
}
function stringToArray(string) {
return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
}
function trimmedEndIndex(string) {
var index2 = string.length;
while (index2-- && reWhitespace.test(string.charAt(index2))) {
}
return index2;
}
var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
function unicodeSize(string) {
var result = reUnicode.lastIndex = 0;
while (reUnicode.test(string)) {
++result;
}
return result;
}
function unicodeToArray(string) {
return string.match(reUnicode) || [];
}
function unicodeWords(string) {
return string.match(reUnicodeWord) || [];
}
var runInContext = function runInContext2(context) {
context = context == null ? root : _8.defaults(root.Object(), context, _8.pick(root, contextProps));
var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto5 = Object2.prototype;
var coreJsData = context["__core-js_shared__"];
var funcToString = funcProto.toString;
var hasOwnProperty4 = objectProto5.hasOwnProperty;
var idCounter = 0;
var maskSrcKey = function() {
var uid2 = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
return uid2 ? "Symbol(src)_1." + uid2 : "";
}();
var nativeObjectToString = objectProto5.toString;
var objectCtorString = funcToString.call(Object2);
var oldDash = root._;
var reIsNative = RegExp2("^" + funcToString.call(hasOwnProperty4).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
var Buffer3 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer3 ? Buffer3.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto5.propertyIsEnumerable, splice3 = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2;
var defineProperty = function() {
try {
var func = getNative(Object2, "defineProperty");
func({}, "", {});
return func;
} catch (e4) {
}
}();
var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer3 ? Buffer3.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
var DataView2 = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap2 = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
var metaMap = WeakMap2 && new WeakMap2();
var realNames = {};
var dataViewCtorString = toSource(DataView2), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2);
var symbolProto = Symbol2 ? Symbol2.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2;
function lodash(value2) {
if (isObjectLike6(value2) && !isArray3(value2) && !(value2 instanceof LazyWrapper)) {
if (value2 instanceof LodashWrapper) {
return value2;
}
if (hasOwnProperty4.call(value2, "__wrapped__")) {
return wrapperClone(value2);
}
}
return new LodashWrapper(value2);
}
var baseCreate = function() {
function object() {
}
return function(proto) {
if (!isObject4(proto)) {
return {};
}
if (objectCreate) {
return objectCreate(proto);
}
object.prototype = proto;
var result2 = new object();
object.prototype = undefined2;
return result2;
};
}();
function baseLodash() {
}
function LodashWrapper(value2, chainAll) {
this.__wrapped__ = value2;
this.__actions__ = [];
this.__chain__ = !!chainAll;
this.__index__ = 0;
this.__values__ = undefined2;
}
lodash.templateSettings = {
"escape": reEscape,
"evaluate": reEvaluate,
"interpolate": reInterpolate,
"variable": "",
"imports": {
"_": lodash
}
};
lodash.prototype = baseLodash.prototype;
lodash.prototype.constructor = lodash;
LodashWrapper.prototype = baseCreate(baseLodash.prototype);
LodashWrapper.prototype.constructor = LodashWrapper;
function LazyWrapper(value2) {
this.__wrapped__ = value2;
this.__actions__ = [];
this.__dir__ = 1;
this.__filtered__ = false;
this.__iteratees__ = [];
this.__takeCount__ = MAX_ARRAY_LENGTH;
this.__views__ = [];
}
function lazyClone() {
var result2 = new LazyWrapper(this.__wrapped__);
result2.__actions__ = copyArray(this.__actions__);
result2.__dir__ = this.__dir__;
result2.__filtered__ = this.__filtered__;
result2.__iteratees__ = copyArray(this.__iteratees__);
result2.__takeCount__ = this.__takeCount__;
result2.__views__ = copyArray(this.__views__);
return result2;
}
function lazyReverse() {
if (this.__filtered__) {
var result2 = new LazyWrapper(this);
result2.__dir__ = -1;
result2.__filtered__ = true;
} else {
result2 = this.clone();
result2.__dir__ *= -1;
}
return result2;
}
function lazyValue() {
var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray3(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end2 = view.end, length5 = end2 - start, index2 = isRight ? end2 : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length5, this.__takeCount__);
if (!isArr || !isRight && arrLength == length5 && takeCount == length5) {
return baseWrapperValue(array, this.__actions__);
}
var result2 = [];
outer:
while (length5-- && resIndex < takeCount) {
index2 += dir;
var iterIndex = -1, value2 = array[index2];
while (++iterIndex < iterLength) {
var data3 = iteratees[iterIndex], iteratee2 = data3.iteratee, type2 = data3.type, computed = iteratee2(value2);
if (type2 == LAZY_MAP_FLAG) {
value2 = computed;
} else if (!computed) {
if (type2 == LAZY_FILTER_FLAG) {
continue outer;
} else {
break outer;
}
}
}
result2[resIndex++] = value2;
}
return result2;
}
LazyWrapper.prototype = baseCreate(baseLodash.prototype);
LazyWrapper.prototype.constructor = LazyWrapper;
function Hash(entries) {
var index2 = -1, length5 = entries == null ? 0 : entries.length;
this.clear();
while (++index2 < length5) {
var entry = entries[index2];
this.set(entry[0], entry[1]);
}
}
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
this.size = 0;
}
function hashDelete(key) {
var result2 = this.has(key) && delete this.__data__[key];
this.size -= result2 ? 1 : 0;
return result2;
}
function hashGet(key) {
var data3 = this.__data__;
if (nativeCreate) {
var result2 = data3[key];
return result2 === HASH_UNDEFINED ? undefined2 : result2;
}
return hasOwnProperty4.call(data3, key) ? data3[key] : undefined2;
}
function hashHas(key) {
var data3 = this.__data__;
return nativeCreate ? data3[key] !== undefined2 : hasOwnProperty4.call(data3, key);
}
function hashSet(key, value2) {
var data3 = this.__data__;
this.size += this.has(key) ? 0 : 1;
data3[key] = nativeCreate && value2 === undefined2 ? HASH_UNDEFINED : value2;
return this;
}
Hash.prototype.clear = hashClear;
Hash.prototype["delete"] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
function ListCache(entries) {
var index2 = -1, length5 = entries == null ? 0 : entries.length;
this.clear();
while (++index2 < length5) {
var entry = entries[index2];
this.set(entry[0], entry[1]);
}
}
function listCacheClear() {
this.__data__ = [];
this.size = 0;
}
function listCacheDelete(key) {
var data3 = this.__data__, index2 = assocIndexOf(data3, key);
if (index2 < 0) {
return false;
}
var lastIndex = data3.length - 1;
if (index2 == lastIndex) {
data3.pop();
} else {
splice3.call(data3, index2, 1);
}
--this.size;
return true;
}
function listCacheGet(key) {
var data3 = this.__data__, index2 = assocIndexOf(data3, key);
return index2 < 0 ? undefined2 : data3[index2][1];
}
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
function listCacheSet(key, value2) {
var data3 = this.__data__, index2 = assocIndexOf(data3, key);
if (index2 < 0) {
++this.size;
data3.push([key, value2]);
} else {
data3[index2][1] = value2;
}
return this;
}
ListCache.prototype.clear = listCacheClear;
ListCache.prototype["delete"] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
function MapCache(entries) {
var index2 = -1, length5 = entries == null ? 0 : entries.length;
this.clear();
while (++index2 < length5) {
var entry = entries[index2];
this.set(entry[0], entry[1]);
}
}
function mapCacheClear() {
this.size = 0;
this.__data__ = {
"hash": new Hash(),
"map": new (Map2 || ListCache)(),
"string": new Hash()
};
}
function mapCacheDelete(key) {
var result2 = getMapData(this, key)["delete"](key);
this.size -= result2 ? 1 : 0;
return result2;
}
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
function mapCacheSet(key, value2) {
var data3 = getMapData(this, key), size3 = data3.size;
data3.set(key, value2);
this.size += data3.size == size3 ? 0 : 1;
return this;
}
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype["delete"] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
function SetCache(values3) {
var index2 = -1, length5 = values3 == null ? 0 : values3.length;
this.__data__ = new MapCache();
while (++index2 < length5) {
this.add(values3[index2]);
}
}
function setCacheAdd(value2) {
this.__data__.set(value2, HASH_UNDEFINED);
return this;
}
function setCacheHas(value2) {
return this.__data__.has(value2);
}
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
function Stack3(entries) {
var data3 = this.__data__ = new ListCache(entries);
this.size = data3.size;
}
function stackClear() {
this.__data__ = new ListCache();
this.size = 0;
}
function stackDelete(key) {
var data3 = this.__data__, result2 = data3["delete"](key);
this.size = data3.size;
return result2;
}
function stackGet(key) {
return this.__data__.get(key);
}
function stackHas(key) {
return this.__data__.has(key);
}
function stackSet(key, value2) {
var data3 = this.__data__;
if (data3 instanceof ListCache) {
var pairs2 = data3.__data__;
if (!Map2 || pairs2.length < LARGE_ARRAY_SIZE - 1) {
pairs2.push([key, value2]);
this.size = ++data3.size;
return this;
}
data3 = this.__data__ = new MapCache(pairs2);
}
data3.set(key, value2);
this.size = data3.size;
return this;
}
Stack3.prototype.clear = stackClear;
Stack3.prototype["delete"] = stackDelete;
Stack3.prototype.get = stackGet;
Stack3.prototype.has = stackHas;
Stack3.prototype.set = stackSet;
function arrayLikeKeys(value2, inherited) {
var isArr = isArray3(value2), isArg = !isArr && isArguments(value2), isBuff = !isArr && !isArg && isBuffer(value2), isType6 = !isArr && !isArg && !isBuff && isTypedArray4(value2), skipIndexes = isArr || isArg || isBuff || isType6, result2 = skipIndexes ? baseTimes(value2.length, String2) : [], length5 = result2.length;
for (var key in value2) {
if ((inherited || hasOwnProperty4.call(value2, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType6 && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length5)))) {
result2.push(key);
}
}
return result2;
}
function arraySample(array) {
var length5 = array.length;
return length5 ? array[baseRandom(0, length5 - 1)] : undefined2;
}
function arraySampleSize(array, n3) {
return shuffleSelf(copyArray(array), baseClamp(n3, 0, array.length));
}
function arrayShuffle(array) {
return shuffleSelf(copyArray(array));
}
function assignMergeValue(object, key, value2) {
if (value2 !== undefined2 && !eq(object[key], value2) || value2 === undefined2 && !(key in object)) {
baseAssignValue(object, key, value2);
}
}
function assignValue(object, key, value2) {
var objValue = object[key];
if (!(hasOwnProperty4.call(object, key) && eq(objValue, value2)) || value2 === undefined2 && !(key in object)) {
baseAssignValue(object, key, value2);
}
}
function assocIndexOf(array, key) {
var length5 = array.length;
while (length5--) {
if (eq(array[length5][0], key)) {
return length5;
}
}
return -1;
}
function baseAggregator(collection, setter, iteratee2, accumulator) {
baseEach(collection, function(value2, key, collection2) {
setter(accumulator, value2, iteratee2(value2), collection2);
});
return accumulator;
}
function baseAssign(object, source) {
return object && copyObject(source, keys2(source), object);
}
function baseAssignIn(object, source) {
return object && copyObject(source, keysIn(source), object);
}
function baseAssignValue(object, key, value2) {
if (key == "__proto__" && defineProperty) {
defineProperty(object, key, {
"configurable": true,
"enumerable": true,
"value": value2,
"writable": true
});
} else {
object[key] = value2;
}
}
function baseAt(object, paths) {
var index2 = -1, length5 = paths.length, result2 = Array2(length5), skip = object == null;
while (++index2 < length5) {
result2[index2] = skip ? undefined2 : get3(object, paths[index2]);
}
return result2;
}
function baseClamp(number, lower, upper) {
if (number === number) {
if (upper !== undefined2) {
number = number <= upper ? number : upper;
}
if (lower !== undefined2) {
number = number >= lower ? number : lower;
}
}
return number;
}
function baseClone(value2, bitmask, customizer, key, object, stack) {
var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
if (customizer) {
result2 = object ? customizer(value2, key, object, stack) : customizer(value2);
}
if (result2 !== undefined2) {
return result2;
}
if (!isObject4(value2)) {
return value2;
}
var isArr = isArray3(value2);
if (isArr) {
result2 = initCloneArray(value2);
if (!isDeep) {
return copyArray(value2, result2);
}
} else {
var tag = getTag(value2), isFunc = tag == funcTag4 || tag == genTag;
if (isBuffer(value2)) {
return cloneBuffer(value2, isDeep);
}
if (tag == objectTag4 || tag == argsTag4 || isFunc && !object) {
result2 = isFlat || isFunc ? {} : initCloneObject(value2);
if (!isDeep) {
return isFlat ? copySymbolsIn(value2, baseAssignIn(result2, value2)) : copySymbols(value2, baseAssign(result2, value2));
}
} else {
if (!cloneableTags[tag]) {
return object ? value2 : {};
}
result2 = initCloneByTag(value2, tag, isDeep);
}
}
stack || (stack = new Stack3());
var stacked = stack.get(value2);
if (stacked) {
return stacked;
}
stack.set(value2, result2);
if (isSet(value2)) {
value2.forEach(function(subValue) {
result2.add(baseClone(subValue, bitmask, customizer, subValue, value2, stack));
});
} else if (isMap(value2)) {
value2.forEach(function(subValue, key2) {
result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value2, stack));
});
}
var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys2;
var props = isArr ? undefined2 : keysFunc(value2);
arrayEach(props || value2, function(subValue, key2) {
if (props) {
key2 = subValue;
subValue = value2[key2];
}
assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value2, stack));
});
return result2;
}
function baseConforms(source) {
var props = keys2(source);
return function(object) {
return baseConformsTo(object, source, props);
};
}
function baseConformsTo(object, source, props) {
var length5 = props.length;
if (object == null) {
return !length5;
}
object = Object2(object);
while (length5--) {
var key = props[length5], predicate = source[key], value2 = object[key];
if (value2 === undefined2 && !(key in object) || !predicate(value2)) {
return false;
}
}
return true;
}
function baseDelay(func, wait, args) {
if (typeof func != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
return setTimeout2(function() {
func.apply(undefined2, args);
}, wait);
}
function baseDifference(array, values3, iteratee2, comparator) {
var index2 = -1, includes2 = arrayIncludes, isCommon = true, length5 = array.length, result2 = [], valuesLength = values3.length;
if (!length5) {
return result2;
}
if (iteratee2) {
values3 = arrayMap(values3, baseUnary(iteratee2));
}
if (comparator) {
includes2 = arrayIncludesWith;
isCommon = false;
} else if (values3.length >= LARGE_ARRAY_SIZE) {
includes2 = cacheHas;
isCommon = false;
values3 = new SetCache(values3);
}
outer:
while (++index2 < length5) {
var value2 = array[index2], computed = iteratee2 == null ? value2 : iteratee2(value2);
value2 = comparator || value2 !== 0 ? value2 : 0;
if (isCommon && computed === computed) {
var valuesIndex = valuesLength;
while (valuesIndex--) {
if (values3[valuesIndex] === computed) {
continue outer;
}
}
result2.push(value2);
} else if (!includes2(values3, computed, comparator)) {
result2.push(value2);
}
}
return result2;
}
var baseEach = createBaseEach(baseForOwn);
var baseEachRight = createBaseEach(baseForOwnRight, true);
function baseEvery(collection, predicate) {
var result2 = true;
baseEach(collection, function(value2, index2, collection2) {
result2 = !!predicate(value2, index2, collection2);
return result2;
});
return result2;
}
function baseExtremum(array, iteratee2, comparator) {
var index2 = -1, length5 = array.length;
while (++index2 < length5) {
var value2 = array[index2], current = iteratee2(value2);
if (current != null && (computed === undefined2 ? current === current && !isSymbol(current) : comparator(current, computed))) {
var computed = current, result2 = value2;
}
}
return result2;
}
function baseFill(array, value2, start, end2) {
var length5 = array.length;
start = toInteger(start);
if (start < 0) {
start = -start > length5 ? 0 : length5 + start;
}
end2 = end2 === undefined2 || end2 > length5 ? length5 : toInteger(end2);
if (end2 < 0) {
end2 += length5;
}
end2 = start > end2 ? 0 : toLength(end2);
while (start < end2) {
array[start++] = value2;
}
return array;
}
function baseFilter(collection, predicate) {
var result2 = [];
baseEach(collection, function(value2, index2, collection2) {
if (predicate(value2, index2, collection2)) {
result2.push(value2);
}
});
return result2;
}
function baseFlatten(array, depth, predicate, isStrict, result2) {
var index2 = -1, length5 = array.length;
predicate || (predicate = isFlattenable);
result2 || (result2 = []);
while (++index2 < length5) {
var value2 = array[index2];
if (depth > 0 && predicate(value2)) {
if (depth > 1) {
baseFlatten(value2, depth - 1, predicate, isStrict, result2);
} else {
arrayPush(result2, value2);
}
} else if (!isStrict) {
result2[result2.length] = value2;
}
}
return result2;
}
var baseFor = createBaseFor();
var baseForRight = createBaseFor(true);
function baseForOwn(object, iteratee2) {
return object && baseFor(object, iteratee2, keys2);
}
function baseForOwnRight(object, iteratee2) {
return object && baseForRight(object, iteratee2, keys2);
}
function baseFunctions(object, props) {
return arrayFilter(props, function(key) {
return isFunction2(object[key]);
});
}
function baseGet(object, path) {
path = castPath(path, object);
var index2 = 0, length5 = path.length;
while (object != null && index2 < length5) {
object = object[toKey(path[index2++])];
}
return index2 && index2 == length5 ? object : undefined2;
}
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result2 = keysFunc(object);
return isArray3(object) ? result2 : arrayPush(result2, symbolsFunc(object));
}
function baseGetTag(value2) {
if (value2 == null) {
return value2 === undefined2 ? undefinedTag : nullTag;
}
return symToStringTag && symToStringTag in Object2(value2) ? getRawTag(value2) : objectToString4(value2);
}
function baseGt(value2, other2) {
return value2 > other2;
}
function baseHas(object, key) {
return object != null && hasOwnProperty4.call(object, key);
}
function baseHasIn(object, key) {
return object != null && key in Object2(object);
}
function baseInRange(number, start, end2) {
return number >= nativeMin(start, end2) && number < nativeMax(start, end2);
}
function baseIntersection(arrays, iteratee2, comparator) {
var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length5 = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = [];
while (othIndex--) {
var array = arrays[othIndex];
if (othIndex && iteratee2) {
array = arrayMap(array, baseUnary(iteratee2));
}
maxLength = nativeMin(array.length, maxLength);
caches[othIndex] = !comparator && (iteratee2 || length5 >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : undefined2;
}
array = arrays[0];
var index2 = -1, seen = caches[0];
outer:
while (++index2 < length5 && result2.length < maxLength) {
var value2 = array[index2], computed = iteratee2 ? iteratee2(value2) : value2;
value2 = comparator || value2 !== 0 ? value2 : 0;
if (!(seen ? cacheHas(seen, computed) : includes2(result2, computed, comparator))) {
othIndex = othLength;
while (--othIndex) {
var cache3 = caches[othIndex];
if (!(cache3 ? cacheHas(cache3, computed) : includes2(arrays[othIndex], computed, comparator))) {
continue outer;
}
}
if (seen) {
seen.push(computed);
}
result2.push(value2);
}
}
return result2;
}
function baseInverter(object, setter, iteratee2, accumulator) {
baseForOwn(object, function(value2, key, object2) {
setter(accumulator, iteratee2(value2), key, object2);
});
return accumulator;
}
function baseInvoke(object, path, args) {
path = castPath(path, object);
object = parent(object, path);
var func = object == null ? object : object[toKey(last2(path))];
return func == null ? undefined2 : apply(func, object, args);
}
function baseIsArguments(value2) {
return isObjectLike6(value2) && baseGetTag(value2) == argsTag4;
}
function baseIsArrayBuffer(value2) {
return isObjectLike6(value2) && baseGetTag(value2) == arrayBufferTag4;
}
function baseIsDate(value2) {
return isObjectLike6(value2) && baseGetTag(value2) == dateTag4;
}
function baseIsEqual(value2, other2, bitmask, customizer, stack) {
if (value2 === other2) {
return true;
}
if (value2 == null || other2 == null || !isObjectLike6(value2) && !isObjectLike6(other2)) {
return value2 !== value2 && other2 !== other2;
}
return baseIsEqualDeep(value2, other2, bitmask, customizer, baseIsEqual, stack);
}
function baseIsEqualDeep(object, other2, bitmask, customizer, equalFunc, stack) {
var objIsArr = isArray3(object), othIsArr = isArray3(other2), objTag = objIsArr ? arrayTag4 : getTag(object), othTag = othIsArr ? arrayTag4 : getTag(other2);
objTag = objTag == argsTag4 ? objectTag4 : objTag;
othTag = othTag == argsTag4 ? objectTag4 : othTag;
var objIsObj = objTag == objectTag4, othIsObj = othTag == objectTag4, isSameTag = objTag == othTag;
if (isSameTag && isBuffer(object)) {
if (!isBuffer(other2)) {
return false;
}
objIsArr = true;
objIsObj = false;
}
if (isSameTag && !objIsObj) {
stack || (stack = new Stack3());
return objIsArr || isTypedArray4(object) ? equalArrays(object, other2, bitmask, customizer, equalFunc, stack) : equalByTag(object, other2, objTag, bitmask, customizer, equalFunc, stack);
}
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
var objIsWrapped = objIsObj && hasOwnProperty4.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty4.call(other2, "__wrapped__");
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other2.value() : other2;
stack || (stack = new Stack3());
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new Stack3());
return equalObjects(object, other2, bitmask, customizer, equalFunc, stack);
}
function baseIsMap(value2) {
return isObjectLike6(value2) && getTag(value2) == mapTag4;
}
function baseIsMatch(object, source, matchData, customizer) {
var index2 = matchData.length, length5 = index2, noCustomizer = !customizer;
if (object == null) {
return !length5;
}
object = Object2(object);
while (index2--) {
var data3 = matchData[index2];
if (noCustomizer && data3[2] ? data3[1] !== object[data3[0]] : !(data3[0] in object)) {
return false;
}
}
while (++index2 < length5) {
data3 = matchData[index2];
var key = data3[0], objValue = object[key], srcValue = data3[1];
if (noCustomizer && data3[2]) {
if (objValue === undefined2 && !(key in object)) {
return false;
}
} else {
var stack = new Stack3();
if (customizer) {
var result2 = customizer(objValue, srcValue, key, object, source, stack);
}
if (!(result2 === undefined2 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result2)) {
return false;
}
}
}
return true;
}
function baseIsNative(value2) {
if (!isObject4(value2) || isMasked(value2)) {
return false;
}
var pattern2 = isFunction2(value2) ? reIsNative : reIsHostCtor;
return pattern2.test(toSource(value2));
}
function baseIsRegExp(value2) {
return isObjectLike6(value2) && baseGetTag(value2) == regexpTag4;
}
function baseIsSet(value2) {
return isObjectLike6(value2) && getTag(value2) == setTag5;
}
function baseIsTypedArray4(value2) {
return isObjectLike6(value2) && isLength4(value2.length) && !!typedArrayTags4[baseGetTag(value2)];
}
function baseIteratee(value2) {
if (typeof value2 == "function") {
return value2;
}
if (value2 == null) {
return identity5;
}
if (typeof value2 == "object") {
return isArray3(value2) ? baseMatchesProperty(value2[0], value2[1]) : baseMatches(value2);
}
return property(value2);
}
function baseKeys(object) {
if (!isPrototype2(object)) {
return nativeKeys(object);
}
var result2 = [];
for (var key in Object2(object)) {
if (hasOwnProperty4.call(object, key) && key != "constructor") {
result2.push(key);
}
}
return result2;
}
function baseKeysIn(object) {
if (!isObject4(object)) {
return nativeKeysIn(object);
}
var isProto = isPrototype2(object), result2 = [];
for (var key in object) {
if (!(key == "constructor" && (isProto || !hasOwnProperty4.call(object, key)))) {
result2.push(key);
}
}
return result2;
}
function baseLt(value2, other2) {
return value2 < other2;
}
function baseMap(collection, iteratee2) {
var index2 = -1, result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
baseEach(collection, function(value2, key, collection2) {
result2[++index2] = iteratee2(value2, key, collection2);
});
return result2;
}
function baseMatches(source) {
var matchData = getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) {
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
}
return function(object) {
return object === source || baseIsMatch(object, source, matchData);
};
}
function baseMatchesProperty(path, srcValue) {
if (isKey(path) && isStrictComparable(srcValue)) {
return matchesStrictComparable(toKey(path), srcValue);
}
return function(object) {
var objValue = get3(object, path);
return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
};
}
function baseMerge(object, source, srcIndex, customizer, stack) {
if (object === source) {
return;
}
baseFor(source, function(srcValue, key) {
stack || (stack = new Stack3());
if (isObject4(srcValue)) {
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
} else {
var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined2;
if (newValue === undefined2) {
newValue = srcValue;
}
assignMergeValue(object, key, newValue);
}
}, keysIn);
}
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
if (stacked) {
assignMergeValue(object, key, stacked);
return;
}
var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2;
var isCommon = newValue === undefined2;
if (isCommon) {
var isArr = isArray3(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray4(srcValue);
newValue = srcValue;
if (isArr || isBuff || isTyped) {
if (isArray3(objValue)) {
newValue = objValue;
} else if (isArrayLikeObject(objValue)) {
newValue = copyArray(objValue);
} else if (isBuff) {
isCommon = false;
newValue = cloneBuffer(srcValue, true);
} else if (isTyped) {
isCommon = false;
newValue = cloneTypedArray(srcValue, true);
} else {
newValue = [];
}
} else if (isPlainObject3(srcValue) || isArguments(srcValue)) {
newValue = objValue;
if (isArguments(objValue)) {
newValue = toPlainObject(objValue);
} else if (!isObject4(objValue) || isFunction2(objValue)) {
newValue = initCloneObject(srcValue);
}
} else {
isCommon = false;
}
}
if (isCommon) {
stack.set(srcValue, newValue);
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
stack["delete"](srcValue);
}
assignMergeValue(object, key, newValue);
}
function baseNth(array, n3) {
var length5 = array.length;
if (!length5) {
return;
}
n3 += n3 < 0 ? length5 : 0;
return isIndex(n3, length5) ? array[n3] : undefined2;
}
function baseOrderBy(collection, iteratees, orders) {
if (iteratees.length) {
iteratees = arrayMap(iteratees, function(iteratee2) {
if (isArray3(iteratee2)) {
return function(value2) {
return baseGet(value2, iteratee2.length === 1 ? iteratee2[0] : iteratee2);
};
}
return iteratee2;
});
} else {
iteratees = [identity5];
}
var index2 = -1;
iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
var result2 = baseMap(collection, function(value2, key, collection2) {
var criteria = arrayMap(iteratees, function(iteratee2) {
return iteratee2(value2);
});
return { "criteria": criteria, "index": ++index2, "value": value2 };
});
return baseSortBy(result2, function(object, other2) {
return compareMultiple(object, other2, orders);
});
}
function basePick(object, paths) {
return basePickBy(object, paths, function(value2, path) {
return hasIn(object, path);
});
}
function basePickBy(object, paths, predicate) {
var index2 = -1, length5 = paths.length, result2 = {};
while (++index2 < length5) {
var path = paths[index2], value2 = baseGet(object, path);
if (predicate(value2, path)) {
baseSet(result2, castPath(path, object), value2);
}
}
return result2;
}
function basePropertyDeep(path) {
return function(object) {
return baseGet(object, path);
};
}
function basePullAll(array, values3, iteratee2, comparator) {
var indexOf4 = comparator ? baseIndexOfWith : baseIndexOf, index2 = -1, length5 = values3.length, seen = array;
if (array === values3) {
values3 = copyArray(values3);
}
if (iteratee2) {
seen = arrayMap(array, baseUnary(iteratee2));
}
while (++index2 < length5) {
var fromIndex = 0, value2 = values3[index2], computed = iteratee2 ? iteratee2(value2) : value2;
while ((fromIndex = indexOf4(seen, computed, fromIndex, comparator)) > -1) {
if (seen !== array) {
splice3.call(seen, fromIndex, 1);
}
splice3.call(array, fromIndex, 1);
}
}
return array;
}
function basePullAt(array, indexes) {
var length5 = array ? indexes.length : 0, lastIndex = length5 - 1;
while (length5--) {
var index2 = indexes[length5];
if (length5 == lastIndex || index2 !== previous) {
var previous = index2;
if (isIndex(index2)) {
splice3.call(array, index2, 1);
} else {
baseUnset(array, index2);
}
}
}
return array;
}
function baseRandom(lower, upper) {
return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
}
function baseRange(start, end2, step, fromRight) {
var index2 = -1, length5 = nativeMax(nativeCeil((end2 - start) / (step || 1)), 0), result2 = Array2(length5);
while (length5--) {
result2[fromRight ? length5 : ++index2] = start;
start += step;
}
return result2;
}
function baseRepeat(string, n3) {
var result2 = "";
if (!string || n3 < 1 || n3 > MAX_SAFE_INTEGER4) {
return result2;
}
do {
if (n3 % 2) {
result2 += string;
}
n3 = nativeFloor(n3 / 2);
if (n3) {
string += string;
}
} while (n3);
return result2;
}
function baseRest(func, start) {
return setToString(overRest(func, start, identity5), func + "");
}
function baseSample(collection) {
return arraySample(values2(collection));
}
function baseSampleSize(collection, n3) {
var array = values2(collection);
return shuffleSelf(array, baseClamp(n3, 0, array.length));
}
function baseSet(object, path, value2, customizer) {
if (!isObject4(object)) {
return object;
}
path = castPath(path, object);
var index2 = -1, length5 = path.length, lastIndex = length5 - 1, nested = object;
while (nested != null && ++index2 < length5) {
var key = toKey(path[index2]), newValue = value2;
if (key === "__proto__" || key === "constructor" || key === "prototype") {
return object;
}
if (index2 != lastIndex) {
var objValue = nested[key];
newValue = customizer ? customizer(objValue, key, nested) : undefined2;
if (newValue === undefined2) {
newValue = isObject4(objValue) ? objValue : isIndex(path[index2 + 1]) ? [] : {};
}
}
assignValue(nested, key, newValue);
nested = nested[key];
}
return object;
}
var baseSetData = !metaMap ? identity5 : function(func, data3) {
metaMap.set(func, data3);
return func;
};
var baseSetToString = !defineProperty ? identity5 : function(func, string) {
return defineProperty(func, "toString", {
"configurable": true,
"enumerable": false,
"value": constant2(string),
"writable": true
});
};
function baseShuffle(collection) {
return shuffleSelf(values2(collection));
}
function baseSlice(array, start, end2) {
var index2 = -1, length5 = array.length;
if (start < 0) {
start = -start > length5 ? 0 : length5 + start;
}
end2 = end2 > length5 ? length5 : end2;
if (end2 < 0) {
end2 += length5;
}
length5 = start > end2 ? 0 : end2 - start >>> 0;
start >>>= 0;
var result2 = Array2(length5);
while (++index2 < length5) {
result2[index2] = array[index2 + start];
}
return result2;
}
function baseSome(collection, predicate) {
var result2;
baseEach(collection, function(value2, index2, collection2) {
result2 = predicate(value2, index2, collection2);
return !result2;
});
return !!result2;
}
function baseSortedIndex(array, value2, retHighest) {
var low = 0, high = array == null ? low : array.length;
if (typeof value2 == "number" && value2 === value2 && high <= HALF_MAX_ARRAY_LENGTH) {
while (low < high) {
var mid2 = low + high >>> 1, computed = array[mid2];
if (computed !== null && !isSymbol(computed) && (retHighest ? computed <= value2 : computed < value2)) {
low = mid2 + 1;
} else {
high = mid2;
}
}
return high;
}
return baseSortedIndexBy(array, value2, identity5, retHighest);
}
function baseSortedIndexBy(array, value2, iteratee2, retHighest) {
var low = 0, high = array == null ? 0 : array.length;
if (high === 0) {
return 0;
}
value2 = iteratee2(value2);
var valIsNaN = value2 !== value2, valIsNull = value2 === null, valIsSymbol = isSymbol(value2), valIsUndefined = value2 === undefined2;
while (low < high) {
var mid2 = nativeFloor((low + high) / 2), computed = iteratee2(array[mid2]), othIsDefined = computed !== undefined2, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed);
if (valIsNaN) {
var setLow = retHighest || othIsReflexive;
} else if (valIsUndefined) {
setLow = othIsReflexive && (retHighest || othIsDefined);
} else if (valIsNull) {
setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
} else if (valIsSymbol) {
setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
} else if (othIsNull || othIsSymbol) {
setLow = false;
} else {
setLow = retHighest ? computed <= value2 : computed < value2;
}
if (setLow) {
low = mid2 + 1;
} else {
high = mid2;
}
}
return nativeMin(high, MAX_ARRAY_INDEX);
}
function baseSortedUniq(array, iteratee2) {
var index2 = -1, length5 = array.length, resIndex = 0, result2 = [];
while (++index2 < length5) {
var value2 = array[index2], computed = iteratee2 ? iteratee2(value2) : value2;
if (!index2 || !eq(computed, seen)) {
var seen = computed;
result2[resIndex++] = value2 === 0 ? 0 : value2;
}
}
return result2;
}
function baseToNumber(value2) {
if (typeof value2 == "number") {
return value2;
}
if (isSymbol(value2)) {
return NAN;
}
return +value2;
}
function baseToString(value2) {
if (typeof value2 == "string") {
return value2;
}
if (isArray3(value2)) {
return arrayMap(value2, baseToString) + "";
}
if (isSymbol(value2)) {
return symbolToString ? symbolToString.call(value2) : "";
}
var result2 = value2 + "";
return result2 == "0" && 1 / value2 == -INFINITY ? "-0" : result2;
}
function baseUniq(array, iteratee2, comparator) {
var index2 = -1, includes2 = arrayIncludes, length5 = array.length, isCommon = true, result2 = [], seen = result2;
if (comparator) {
isCommon = false;
includes2 = arrayIncludesWith;
} else if (length5 >= LARGE_ARRAY_SIZE) {
var set11 = iteratee2 ? null : createSet(array);
if (set11) {
return setToArray(set11);
}
isCommon = false;
includes2 = cacheHas;
seen = new SetCache();
} else {
seen = iteratee2 ? [] : result2;
}
outer:
while (++index2 < length5) {
var value2 = array[index2], computed = iteratee2 ? iteratee2(value2) : value2;
value2 = comparator || value2 !== 0 ? value2 : 0;
if (isCommon && computed === computed) {
var seenIndex = seen.length;
while (seenIndex--) {
if (seen[seenIndex] === computed) {
continue outer;
}
}
if (iteratee2) {
seen.push(computed);
}
result2.push(value2);
} else if (!includes2(seen, computed, comparator)) {
if (seen !== result2) {
seen.push(computed);
}
result2.push(value2);
}
}
return result2;
}
function baseUnset(object, path) {
path = castPath(path, object);
object = parent(object, path);
return object == null || delete object[toKey(last2(path))];
}
function baseUpdate2(object, path, updater, customizer) {
return baseSet(object, path, updater(baseGet(object, path)), customizer);
}
function baseWhile(array, predicate, isDrop, fromRight) {
var length5 = array.length, index2 = fromRight ? length5 : -1;
while ((fromRight ? index2-- : ++index2 < length5) && predicate(array[index2], index2, array)) {
}
return isDrop ? baseSlice(array, fromRight ? 0 : index2, fromRight ? index2 + 1 : length5) : baseSlice(array, fromRight ? index2 + 1 : 0, fromRight ? length5 : index2);
}
function baseWrapperValue(value2, actions) {
var result2 = value2;
if (result2 instanceof LazyWrapper) {
result2 = result2.value();
}
return arrayReduce(actions, function(result3, action) {
return action.func.apply(action.thisArg, arrayPush([result3], action.args));
}, result2);
}
function baseXor(arrays, iteratee2, comparator) {
var length5 = arrays.length;
if (length5 < 2) {
return length5 ? baseUniq(arrays[0]) : [];
}
var index2 = -1, result2 = Array2(length5);
while (++index2 < length5) {
var array = arrays[index2], othIndex = -1;
while (++othIndex < length5) {
if (othIndex != index2) {
result2[index2] = baseDifference(result2[index2] || array, arrays[othIndex], iteratee2, comparator);
}
}
}
return baseUniq(baseFlatten(result2, 1), iteratee2, comparator);
}
function baseZipObject(props, values3, assignFunc) {
var index2 = -1, length5 = props.length, valsLength = values3.length, result2 = {};
while (++index2 < length5) {
var value2 = index2 < valsLength ? values3[index2] : undefined2;
assignFunc(result2, props[index2], value2);
}
return result2;
}
function castArrayLikeObject(value2) {
return isArrayLikeObject(value2) ? value2 : [];
}
function castFunction(value2) {
return typeof value2 == "function" ? value2 : identity5;
}
function castPath(value2, object) {
if (isArray3(value2)) {
return value2;
}
return isKey(value2, object) ? [value2] : stringToPath(toString7(value2));
}
var castRest = baseRest;
function castSlice(array, start, end2) {
var length5 = array.length;
end2 = end2 === undefined2 ? length5 : end2;
return !start && end2 >= length5 ? array : baseSlice(array, start, end2);
}
var clearTimeout2 = ctxClearTimeout || function(id) {
return root.clearTimeout(id);
};
function cloneBuffer(buffer, isDeep) {
if (isDeep) {
return buffer.slice();
}
var length5 = buffer.length, result2 = allocUnsafe ? allocUnsafe(length5) : new buffer.constructor(length5);
buffer.copy(result2);
return result2;
}
function cloneArrayBuffer(arrayBuffer) {
var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer));
return result2;
}
function cloneDataView(dataView, isDeep) {
var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
}
function cloneRegExp(regexp) {
var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp));
result2.lastIndex = regexp.lastIndex;
return result2;
}
function cloneSymbol(symbol) {
return symbolValueOf ? Object2(symbolValueOf.call(symbol)) : {};
}
function cloneTypedArray(typedArray, isDeep) {
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}
function compareAscending(value2, other2) {
if (value2 !== other2) {
var valIsDefined = value2 !== undefined2, valIsNull = value2 === null, valIsReflexive = value2 === value2, valIsSymbol = isSymbol(value2);
var othIsDefined = other2 !== undefined2, othIsNull = other2 === null, othIsReflexive = other2 === other2, othIsSymbol = isSymbol(other2);
if (!othIsNull && !othIsSymbol && !valIsSymbol && value2 > other2 || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
return 1;
}
if (!valIsNull && !valIsSymbol && !othIsSymbol && value2 < other2 || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
return -1;
}
}
return 0;
}
function compareMultiple(object, other2, orders) {
var index2 = -1, objCriteria = object.criteria, othCriteria = other2.criteria, length5 = objCriteria.length, ordersLength = orders.length;
while (++index2 < length5) {
var result2 = compareAscending(objCriteria[index2], othCriteria[index2]);
if (result2) {
if (index2 >= ordersLength) {
return result2;
}
var order2 = orders[index2];
return result2 * (order2 == "desc" ? -1 : 1);
}
}
return object.index - other2.index;
}
function composeArgs(args, partials, holders, isCurried) {
var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array2(leftLength + rangeLength), isUncurried = !isCurried;
while (++leftIndex < leftLength) {
result2[leftIndex] = partials[leftIndex];
}
while (++argsIndex < holdersLength) {
if (isUncurried || argsIndex < argsLength) {
result2[holders[argsIndex]] = args[argsIndex];
}
}
while (rangeLength--) {
result2[leftIndex++] = args[argsIndex++];
}
return result2;
}
function composeArgsRight(args, partials, holders, isCurried) {
var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array2(rangeLength + rightLength), isUncurried = !isCurried;
while (++argsIndex < rangeLength) {
result2[argsIndex] = args[argsIndex];
}
var offset = argsIndex;
while (++rightIndex < rightLength) {
result2[offset + rightIndex] = partials[rightIndex];
}
while (++holdersIndex < holdersLength) {
if (isUncurried || argsIndex < argsLength) {
result2[offset + holders[holdersIndex]] = args[argsIndex++];
}
}
return result2;
}
function copyArray(source, array) {
var index2 = -1, length5 = source.length;
array || (array = Array2(length5));
while (++index2 < length5) {
array[index2] = source[index2];
}
return array;
}
function copyObject(source, props, object, customizer) {
var isNew = !object;
object || (object = {});
var index2 = -1, length5 = props.length;
while (++index2 < length5) {
var key = props[index2];
var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2;
if (newValue === undefined2) {
newValue = source[key];
}
if (isNew) {
baseAssignValue(object, key, newValue);
} else {
assignValue(object, key, newValue);
}
}
return object;
}
function copySymbols(source, object) {
return copyObject(source, getSymbols(source), object);
}
function copySymbolsIn(source, object) {
return copyObject(source, getSymbolsIn(source), object);
}
function createAggregator(setter, initializer) {
return function(collection, iteratee2) {
var func = isArray3(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
return func(collection, setter, getIteratee(iteratee2, 2), accumulator);
};
}
function createAssigner(assigner) {
return baseRest(function(object, sources) {
var index2 = -1, length5 = sources.length, customizer = length5 > 1 ? sources[length5 - 1] : undefined2, guard = length5 > 2 ? sources[2] : undefined2;
customizer = assigner.length > 3 && typeof customizer == "function" ? (length5--, customizer) : undefined2;
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
customizer = length5 < 3 ? undefined2 : customizer;
length5 = 1;
}
object = Object2(object);
while (++index2 < length5) {
var source = sources[index2];
if (source) {
assigner(object, source, index2, customizer);
}
}
return object;
});
}
function createBaseEach(eachFunc, fromRight) {
return function(collection, iteratee2) {
if (collection == null) {
return collection;
}
if (!isArrayLike2(collection)) {
return eachFunc(collection, iteratee2);
}
var length5 = collection.length, index2 = fromRight ? length5 : -1, iterable = Object2(collection);
while (fromRight ? index2-- : ++index2 < length5) {
if (iteratee2(iterable[index2], index2, iterable) === false) {
break;
}
}
return collection;
};
}
function createBaseFor(fromRight) {
return function(object, iteratee2, keysFunc) {
var index2 = -1, iterable = Object2(object), props = keysFunc(object), length5 = props.length;
while (length5--) {
var key = props[fromRight ? length5 : ++index2];
if (iteratee2(iterable[key], key, iterable) === false) {
break;
}
}
return object;
};
}
function createBind(func, bitmask, thisArg) {
var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
function wrapper() {
var fn2 = this && this !== root && this instanceof wrapper ? Ctor : func;
return fn2.apply(isBind ? thisArg : this, arguments);
}
return wrapper;
}
function createCaseFirst(methodName) {
return function(string) {
string = toString7(string);
var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2;
var chr = strSymbols ? strSymbols[0] : string.charAt(0);
var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
return chr[methodName]() + trailing;
};
}
function createCompounder(callback) {
return function(string) {
return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
};
}
function createCtor(Ctor) {
return function() {
var args = arguments;
switch (args.length) {
case 0:
return new Ctor();
case 1:
return new Ctor(args[0]);
case 2:
return new Ctor(args[0], args[1]);
case 3:
return new Ctor(args[0], args[1], args[2]);
case 4:
return new Ctor(args[0], args[1], args[2], args[3]);
case 5:
return new Ctor(args[0], args[1], args[2], args[3], args[4]);
case 6:
return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
case 7:
return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
}
var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
return isObject4(result2) ? result2 : thisBinding;
};
}
function createCurry(func, bitmask, arity) {
var Ctor = createCtor(func);
function wrapper() {
var length5 = arguments.length, args = Array2(length5), index2 = length5, placeholder = getHolder(wrapper);
while (index2--) {
args[index2] = arguments[index2];
}
var holders = length5 < 3 && args[0] !== placeholder && args[length5 - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
length5 -= holders.length;
if (length5 < arity) {
return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, undefined2, args, holders, undefined2, undefined2, arity - length5);
}
var fn2 = this && this !== root && this instanceof wrapper ? Ctor : func;
return apply(fn2, this, args);
}
return wrapper;
}
function createFind(findIndexFunc) {
return function(collection, predicate, fromIndex) {
var iterable = Object2(collection);
if (!isArrayLike2(collection)) {
var iteratee2 = getIteratee(predicate, 3);
collection = keys2(collection);
predicate = function(key) {
return iteratee2(iterable[key], key, iterable);
};
}
var index2 = findIndexFunc(collection, predicate, fromIndex);
return index2 > -1 ? iterable[iteratee2 ? collection[index2] : index2] : undefined2;
};
}
function createFlow(fromRight) {
return flatRest(function(funcs) {
var length5 = funcs.length, index2 = length5, prereq = LodashWrapper.prototype.thru;
if (fromRight) {
funcs.reverse();
}
while (index2--) {
var func = funcs[index2];
if (typeof func != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
if (prereq && !wrapper && getFuncName(func) == "wrapper") {
var wrapper = new LodashWrapper([], true);
}
}
index2 = wrapper ? index2 : length5;
while (++index2 < length5) {
func = funcs[index2];
var funcName = getFuncName(func), data3 = funcName == "wrapper" ? getData(func) : undefined2;
if (data3 && isLaziable(data3[0]) && data3[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data3[4].length && data3[9] == 1) {
wrapper = wrapper[getFuncName(data3[0])].apply(wrapper, data3[3]);
} else {
wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
}
}
return function() {
var args = arguments, value2 = args[0];
if (wrapper && args.length == 1 && isArray3(value2)) {
return wrapper.plant(value2).value();
}
var index3 = 0, result2 = length5 ? funcs[index3].apply(this, args) : value2;
while (++index3 < length5) {
result2 = funcs[index3].call(this, result2);
}
return result2;
};
});
}
function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined2 : createCtor(func);
function wrapper() {
var length5 = arguments.length, args = Array2(length5), index2 = length5;
while (index2--) {
args[index2] = arguments[index2];
}
if (isCurried) {
var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
}
if (partials) {
args = composeArgs(args, partials, holders, isCurried);
}
if (partialsRight) {
args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
}
length5 -= holdersCount;
if (isCurried && length5 < arity) {
var newHolders = replaceHolders(args, placeholder);
return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary2, arity - length5);
}
var thisBinding = isBind ? thisArg : this, fn2 = isBindKey ? thisBinding[func] : func;
length5 = args.length;
if (argPos) {
args = reorder(args, argPos);
} else if (isFlip && length5 > 1) {
args.reverse();
}
if (isAry && ary2 < length5) {
args.length = ary2;
}
if (this && this !== root && this instanceof wrapper) {
fn2 = Ctor || createCtor(fn2);
}
return fn2.apply(thisBinding, args);
}
return wrapper;
}
function createInverter(setter, toIteratee) {
return function(object, iteratee2) {
return baseInverter(object, setter, toIteratee(iteratee2), {});
};
}
function createMathOperation(operator, defaultValue) {
return function(value2, other2) {
var result2;
if (value2 === undefined2 && other2 === undefined2) {
return defaultValue;
}
if (value2 !== undefined2) {
result2 = value2;
}
if (other2 !== undefined2) {
if (result2 === undefined2) {
return other2;
}
if (typeof value2 == "string" || typeof other2 == "string") {
value2 = baseToString(value2);
other2 = baseToString(other2);
} else {
value2 = baseToNumber(value2);
other2 = baseToNumber(other2);
}
result2 = operator(value2, other2);
}
return result2;
};
}
function createOver(arrayFunc) {
return flatRest(function(iteratees) {
iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
return baseRest(function(args) {
var thisArg = this;
return arrayFunc(iteratees, function(iteratee2) {
return apply(iteratee2, thisArg, args);
});
});
});
}
function createPadding(length5, chars) {
chars = chars === undefined2 ? " " : baseToString(chars);
var charsLength = chars.length;
if (charsLength < 2) {
return charsLength ? baseRepeat(chars, length5) : chars;
}
var result2 = baseRepeat(chars, nativeCeil(length5 / stringSize(chars)));
return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length5).join("") : result2.slice(0, length5);
}
function createPartial(func, bitmask, thisArg, partials) {
var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
function wrapper() {
var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn2 = this && this !== root && this instanceof wrapper ? Ctor : func;
while (++leftIndex < leftLength) {
args[leftIndex] = partials[leftIndex];
}
while (argsLength--) {
args[leftIndex++] = arguments[++argsIndex];
}
return apply(fn2, isBind ? thisArg : this, args);
}
return wrapper;
}
function createRange(fromRight) {
return function(start, end2, step) {
if (step && typeof step != "number" && isIterateeCall(start, end2, step)) {
end2 = step = undefined2;
}
start = toFinite(start);
if (end2 === undefined2) {
end2 = start;
start = 0;
} else {
end2 = toFinite(end2);
}
step = step === undefined2 ? start < end2 ? 1 : -1 : toFinite(step);
return baseRange(start, end2, step, fromRight);
};
}
function createRelationalOperation(operator) {
return function(value2, other2) {
if (!(typeof value2 == "string" && typeof other2 == "string")) {
value2 = toNumber(value2);
other2 = toNumber(other2);
}
return operator(value2, other2);
};
}
function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) {
var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials;
bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG;
bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
}
var newData = [
func,
bitmask,
thisArg,
newPartials,
newHolders,
newPartialsRight,
newHoldersRight,
argPos,
ary2,
arity
];
var result2 = wrapFunc.apply(undefined2, newData);
if (isLaziable(func)) {
setData(result2, newData);
}
result2.placeholder = placeholder;
return setWrapToString(result2, func, bitmask);
}
function createRound(methodName) {
var func = Math2[methodName];
return function(number, precision) {
number = toNumber(number);
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
if (precision && nativeIsFinite(number)) {
var pair = (toString7(number) + "e").split("e"), value2 = func(pair[0] + "e" + (+pair[1] + precision));
pair = (toString7(value2) + "e").split("e");
return +(pair[0] + "e" + (+pair[1] - precision));
}
return func(number);
};
}
var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop2 : function(values3) {
return new Set2(values3);
};
function createToPairs(keysFunc) {
return function(object) {
var tag = getTag(object);
if (tag == mapTag4) {
return mapToArray(object);
}
if (tag == setTag5) {
return setToPairs(object);
}
return baseToPairs(object, keysFunc(object));
};
}
function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
if (!isBindKey && typeof func != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
var length5 = partials ? partials.length : 0;
if (!length5) {
bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
partials = holders = undefined2;
}
ary2 = ary2 === undefined2 ? ary2 : nativeMax(toInteger(ary2), 0);
arity = arity === undefined2 ? arity : toInteger(arity);
length5 -= holders ? holders.length : 0;
if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
var partialsRight = partials, holdersRight = holders;
partials = holders = undefined2;
}
var data3 = isBindKey ? undefined2 : getData(func);
var newData = [
func,
bitmask,
thisArg,
partials,
holders,
partialsRight,
holdersRight,
argPos,
ary2,
arity
];
if (data3) {
mergeData(newData, data3);
}
func = newData[0];
bitmask = newData[1];
thisArg = newData[2];
partials = newData[3];
holders = newData[4];
arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax(newData[9] - length5, 0);
if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
}
if (!bitmask || bitmask == WRAP_BIND_FLAG) {
var result2 = createBind(func, bitmask, thisArg);
} else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
result2 = createCurry(func, bitmask, arity);
} else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
result2 = createPartial(func, bitmask, thisArg, partials);
} else {
result2 = createHybrid.apply(undefined2, newData);
}
var setter = data3 ? baseSetData : setData;
return setWrapToString(setter(result2, newData), func, bitmask);
}
function customDefaultsAssignIn(objValue, srcValue, key, object) {
if (objValue === undefined2 || eq(objValue, objectProto5[key]) && !hasOwnProperty4.call(object, key)) {
return srcValue;
}
return objValue;
}
function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
if (isObject4(objValue) && isObject4(srcValue)) {
stack.set(srcValue, objValue);
baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack);
stack["delete"](srcValue);
}
return objValue;
}
function customOmitClone(value2) {
return isPlainObject3(value2) ? undefined2 : value2;
}
function equalArrays(array, other2, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other2.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
var arrStacked = stack.get(array);
var othStacked = stack.get(other2);
if (arrStacked && othStacked) {
return arrStacked == other2 && othStacked == array;
}
var index2 = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined2;
stack.set(array, other2);
stack.set(other2, array);
while (++index2 < arrLength) {
var arrValue = array[index2], othValue = other2[index2];
if (customizer) {
var compared = isPartial ? customizer(othValue, arrValue, index2, other2, array, stack) : customizer(arrValue, othValue, index2, array, other2, stack);
}
if (compared !== undefined2) {
if (compared) {
continue;
}
result2 = false;
break;
}
if (seen) {
if (!arraySome(other2, function(othValue2, othIndex) {
if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
return seen.push(othIndex);
}
})) {
result2 = false;
break;
}
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
result2 = false;
break;
}
}
stack["delete"](array);
stack["delete"](other2);
return result2;
}
function equalByTag(object, other2, tag, bitmask, customizer, equalFunc, stack) {
switch (tag) {
case dataViewTag4:
if (object.byteLength != other2.byteLength || object.byteOffset != other2.byteOffset) {
return false;
}
object = object.buffer;
other2 = other2.buffer;
case arrayBufferTag4:
if (object.byteLength != other2.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other2))) {
return false;
}
return true;
case boolTag4:
case dateTag4:
case numberTag4:
return eq(+object, +other2);
case errorTag4:
return object.name == other2.name && object.message == other2.message;
case regexpTag4:
case stringTag4:
return object == other2 + "";
case mapTag4:
var convert = mapToArray;
case setTag5:
var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
convert || (convert = setToArray);
if (object.size != other2.size && !isPartial) {
return false;
}
var stacked = stack.get(object);
if (stacked) {
return stacked == other2;
}
bitmask |= COMPARE_UNORDERED_FLAG;
stack.set(object, other2);
var result2 = equalArrays(convert(object), convert(other2), bitmask, customizer, equalFunc, stack);
stack["delete"](object);
return result2;
case symbolTag:
if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other2);
}
}
return false;
}
function equalObjects(object, other2, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other2), othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index2 = objLength;
while (index2--) {
var key = objProps[index2];
if (!(isPartial ? key in other2 : hasOwnProperty4.call(other2, key))) {
return false;
}
}
var objStacked = stack.get(object);
var othStacked = stack.get(other2);
if (objStacked && othStacked) {
return objStacked == other2 && othStacked == object;
}
var result2 = true;
stack.set(object, other2);
stack.set(other2, object);
var skipCtor = isPartial;
while (++index2 < objLength) {
key = objProps[index2];
var objValue = object[key], othValue = other2[key];
if (customizer) {
var compared = isPartial ? customizer(othValue, objValue, key, other2, object, stack) : customizer(objValue, othValue, key, object, other2, stack);
}
if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
result2 = false;
break;
}
skipCtor || (skipCtor = key == "constructor");
}
if (result2 && !skipCtor) {
var objCtor = object.constructor, othCtor = other2.constructor;
if (objCtor != othCtor && ("constructor" in object && "constructor" in other2) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
result2 = false;
}
}
stack["delete"](object);
stack["delete"](other2);
return result2;
}
function flatRest(func) {
return setToString(overRest(func, undefined2, flatten2), func + "");
}
function getAllKeys(object) {
return baseGetAllKeys(object, keys2, getSymbols);
}
function getAllKeysIn(object) {
return baseGetAllKeys(object, keysIn, getSymbolsIn);
}
var getData = !metaMap ? noop2 : function(func) {
return metaMap.get(func);
};
function getFuncName(func) {
var result2 = func.name + "", array = realNames[result2], length5 = hasOwnProperty4.call(realNames, result2) ? array.length : 0;
while (length5--) {
var data3 = array[length5], otherFunc = data3.func;
if (otherFunc == null || otherFunc == func) {
return data3.name;
}
}
return result2;
}
function getHolder(func) {
var object = hasOwnProperty4.call(lodash, "placeholder") ? lodash : func;
return object.placeholder;
}
function getIteratee() {
var result2 = lodash.iteratee || iteratee;
result2 = result2 === iteratee ? baseIteratee : result2;
return arguments.length ? result2(arguments[0], arguments[1]) : result2;
}
function getMapData(map7, key) {
var data3 = map7.__data__;
return isKeyable(key) ? data3[typeof key == "string" ? "string" : "hash"] : data3.map;
}
function getMatchData(object) {
var result2 = keys2(object), length5 = result2.length;
while (length5--) {
var key = result2[length5], value2 = object[key];
result2[length5] = [key, value2, isStrictComparable(value2)];
}
return result2;
}
function getNative(object, key) {
var value2 = getValue3(object, key);
return baseIsNative(value2) ? value2 : undefined2;
}
function getRawTag(value2) {
var isOwn = hasOwnProperty4.call(value2, symToStringTag), tag = value2[symToStringTag];
try {
value2[symToStringTag] = undefined2;
var unmasked = true;
} catch (e4) {
}
var result2 = nativeObjectToString.call(value2);
if (unmasked) {
if (isOwn) {
value2[symToStringTag] = tag;
} else {
delete value2[symToStringTag];
}
}
return result2;
}
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
if (object == null) {
return [];
}
object = Object2(object);
return arrayFilter(nativeGetSymbols(object), function(symbol) {
return propertyIsEnumerable.call(object, symbol);
});
};
var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
var result2 = [];
while (object) {
arrayPush(result2, getSymbols(object));
object = getPrototype(object);
}
return result2;
};
var getTag = baseGetTag;
if (DataView2 && getTag(new DataView2(new ArrayBuffer(1))) != dataViewTag4 || Map2 && getTag(new Map2()) != mapTag4 || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag5 || WeakMap2 && getTag(new WeakMap2()) != weakMapTag4) {
getTag = function(value2) {
var result2 = baseGetTag(value2), Ctor = result2 == objectTag4 ? value2.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : "";
if (ctorString) {
switch (ctorString) {
case dataViewCtorString:
return dataViewTag4;
case mapCtorString:
return mapTag4;
case promiseCtorString:
return promiseTag;
case setCtorString:
return setTag5;
case weakMapCtorString:
return weakMapTag4;
}
}
return result2;
};
}
function getView(start, end2, transforms) {
var index2 = -1, length5 = transforms.length;
while (++index2 < length5) {
var data3 = transforms[index2], size3 = data3.size;
switch (data3.type) {
case "drop":
start += size3;
break;
case "dropRight":
end2 -= size3;
break;
case "take":
end2 = nativeMin(end2, start + size3);
break;
case "takeRight":
start = nativeMax(start, end2 - size3);
break;
}
}
return { "start": start, "end": end2 };
}
function getWrapDetails(source) {
var match = source.match(reWrapDetails);
return match ? match[1].split(reSplitDetails) : [];
}
function hasPath2(object, path, hasFunc) {
path = castPath(path, object);
var index2 = -1, length5 = path.length, result2 = false;
while (++index2 < length5) {
var key = toKey(path[index2]);
if (!(result2 = object != null && hasFunc(object, key))) {
break;
}
object = object[key];
}
if (result2 || ++index2 != length5) {
return result2;
}
length5 = object == null ? 0 : object.length;
return !!length5 && isLength4(length5) && isIndex(key, length5) && (isArray3(object) || isArguments(object));
}
function initCloneArray(array) {
var length5 = array.length, result2 = new array.constructor(length5);
if (length5 && typeof array[0] == "string" && hasOwnProperty4.call(array, "index")) {
result2.index = array.index;
result2.input = array.input;
}
return result2;
}
function initCloneObject(object) {
return typeof object.constructor == "function" && !isPrototype2(object) ? baseCreate(getPrototype(object)) : {};
}
function initCloneByTag(object, tag, isDeep) {
var Ctor = object.constructor;
switch (tag) {
case arrayBufferTag4:
return cloneArrayBuffer(object);
case boolTag4:
case dateTag4:
return new Ctor(+object);
case dataViewTag4:
return cloneDataView(object, isDeep);
case float32Tag4:
case float64Tag4:
case int8Tag4:
case int16Tag4:
case int32Tag4:
case uint8Tag4:
case uint8ClampedTag4:
case uint16Tag4:
case uint32Tag4:
return cloneTypedArray(object, isDeep);
case mapTag4:
return new Ctor();
case numberTag4:
case stringTag4:
return new Ctor(object);
case regexpTag4:
return cloneRegExp(object);
case setTag5:
return new Ctor();
case symbolTag:
return cloneSymbol(object);
}
}
function insertWrapDetails(source, details) {
var length5 = details.length;
if (!length5) {
return source;
}
var lastIndex = length5 - 1;
details[lastIndex] = (length5 > 1 ? "& " : "") + details[lastIndex];
details = details.join(length5 > 2 ? ", " : " ");
return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
}
function isFlattenable(value2) {
return isArray3(value2) || isArguments(value2) || !!(spreadableSymbol && value2 && value2[spreadableSymbol]);
}
function isIndex(value2, length5) {
var type2 = typeof value2;
length5 = length5 == null ? MAX_SAFE_INTEGER4 : length5;
return !!length5 && (type2 == "number" || type2 != "symbol" && reIsUint.test(value2)) && (value2 > -1 && value2 % 1 == 0 && value2 < length5);
}
function isIterateeCall(value2, index2, object) {
if (!isObject4(object)) {
return false;
}
var type2 = typeof index2;
if (type2 == "number" ? isArrayLike2(object) && isIndex(index2, object.length) : type2 == "string" && index2 in object) {
return eq(object[index2], value2);
}
return false;
}
function isKey(value2, object) {
if (isArray3(value2)) {
return false;
}
var type2 = typeof value2;
if (type2 == "number" || type2 == "symbol" || type2 == "boolean" || value2 == null || isSymbol(value2)) {
return true;
}
return reIsPlainProp.test(value2) || !reIsDeepProp.test(value2) || object != null && value2 in Object2(object);
}
function isKeyable(value2) {
var type2 = typeof value2;
return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value2 !== "__proto__" : value2 === null;
}
function isLaziable(func) {
var funcName = getFuncName(func), other2 = lodash[funcName];
if (typeof other2 != "function" || !(funcName in LazyWrapper.prototype)) {
return false;
}
if (func === other2) {
return true;
}
var data3 = getData(other2);
return !!data3 && func === data3[0];
}
function isMasked(func) {
return !!maskSrcKey && maskSrcKey in func;
}
var isMaskable = coreJsData ? isFunction2 : stubFalse;
function isPrototype2(value2) {
var Ctor = value2 && value2.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto5;
return value2 === proto;
}
function isStrictComparable(value2) {
return value2 === value2 && !isObject4(value2);
}
function matchesStrictComparable(key, srcValue) {
return function(object) {
if (object == null) {
return false;
}
return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object));
};
}
function memoizeCapped(func) {
var result2 = memoize(func, function(key) {
if (cache3.size === MAX_MEMOIZE_SIZE) {
cache3.clear();
}
return key;
});
var cache3 = result2.cache;
return result2;
}
function mergeData(data3, source) {
var bitmask = data3[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data3[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG;
if (!(isCommon || isCombo)) {
return data3;
}
if (srcBitmask & WRAP_BIND_FLAG) {
data3[2] = source[2];
newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
}
var value2 = source[3];
if (value2) {
var partials = data3[3];
data3[3] = partials ? composeArgs(partials, value2, source[4]) : value2;
data3[4] = partials ? replaceHolders(data3[3], PLACEHOLDER) : source[4];
}
value2 = source[5];
if (value2) {
partials = data3[5];
data3[5] = partials ? composeArgsRight(partials, value2, source[6]) : value2;
data3[6] = partials ? replaceHolders(data3[5], PLACEHOLDER) : source[6];
}
value2 = source[7];
if (value2) {
data3[7] = value2;
}
if (srcBitmask & WRAP_ARY_FLAG) {
data3[8] = data3[8] == null ? source[8] : nativeMin(data3[8], source[8]);
}
if (data3[9] == null) {
data3[9] = source[9];
}
data3[0] = source[0];
data3[1] = newBitmask;
return data3;
}
function nativeKeysIn(object) {
var result2 = [];
if (object != null) {
for (var key in Object2(object)) {
result2.push(key);
}
}
return result2;
}
function objectToString4(value2) {
return nativeObjectToString.call(value2);
}
function overRest(func, start, transform19) {
start = nativeMax(start === undefined2 ? func.length - 1 : start, 0);
return function() {
var args = arguments, index2 = -1, length5 = nativeMax(args.length - start, 0), array = Array2(length5);
while (++index2 < length5) {
array[index2] = args[start + index2];
}
index2 = -1;
var otherArgs = Array2(start + 1);
while (++index2 < start) {
otherArgs[index2] = args[index2];
}
otherArgs[start] = transform19(array);
return apply(func, this, otherArgs);
};
}
function parent(object, path) {
return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
}
function reorder(array, indexes) {
var arrLength = array.length, length5 = nativeMin(indexes.length, arrLength), oldArray = copyArray(array);
while (length5--) {
var index2 = indexes[length5];
array[length5] = isIndex(index2, arrLength) ? oldArray[index2] : undefined2;
}
return array;
}
function safeGet(object, key) {
if (key === "constructor" && typeof object[key] === "function") {
return;
}
if (key == "__proto__") {
return;
}
return object[key];
}
var setData = shortOut(baseSetData);
var setTimeout2 = ctxSetTimeout || function(func, wait) {
return root.setTimeout(func, wait);
};
var setToString = shortOut(baseSetToString);
function setWrapToString(wrapper, reference, bitmask) {
var source = reference + "";
return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
}
function shortOut(func) {
var count2 = 0, lastCalled = 0;
return function() {
var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
lastCalled = stamp;
if (remaining > 0) {
if (++count2 >= HOT_COUNT) {
return arguments[0];
}
} else {
count2 = 0;
}
return func.apply(undefined2, arguments);
};
}
function shuffleSelf(array, size3) {
var index2 = -1, length5 = array.length, lastIndex = length5 - 1;
size3 = size3 === undefined2 ? length5 : size3;
while (++index2 < size3) {
var rand = baseRandom(index2, lastIndex), value2 = array[rand];
array[rand] = array[index2];
array[index2] = value2;
}
array.length = size3;
return array;
}
var stringToPath = memoizeCapped(function(string) {
var result2 = [];
if (string.charCodeAt(0) === 46) {
result2.push("");
}
string.replace(rePropName, function(match, number, quote, subString) {
result2.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
});
return result2;
});
function toKey(value2) {
if (typeof value2 == "string" || isSymbol(value2)) {
return value2;
}
var result2 = value2 + "";
return result2 == "0" && 1 / value2 == -INFINITY ? "-0" : result2;
}
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e4) {
}
try {
return func + "";
} catch (e4) {
}
}
return "";
}
function updateWrapDetails(details, bitmask) {
arrayEach(wrapFlags, function(pair) {
var value2 = "_." + pair[0];
if (bitmask & pair[1] && !arrayIncludes(details, value2)) {
details.push(value2);
}
});
return details.sort();
}
function wrapperClone(wrapper) {
if (wrapper instanceof LazyWrapper) {
return wrapper.clone();
}
var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
result2.__actions__ = copyArray(wrapper.__actions__);
result2.__index__ = wrapper.__index__;
result2.__values__ = wrapper.__values__;
return result2;
}
function chunk(array, size3, guard) {
if (guard ? isIterateeCall(array, size3, guard) : size3 === undefined2) {
size3 = 1;
} else {
size3 = nativeMax(toInteger(size3), 0);
}
var length5 = array == null ? 0 : array.length;
if (!length5 || size3 < 1) {
return [];
}
var index2 = 0, resIndex = 0, result2 = Array2(nativeCeil(length5 / size3));
while (index2 < length5) {
result2[resIndex++] = baseSlice(array, index2, index2 += size3);
}
return result2;
}
function compact(array) {
var index2 = -1, length5 = array == null ? 0 : array.length, resIndex = 0, result2 = [];
while (++index2 < length5) {
var value2 = array[index2];
if (value2) {
result2[resIndex++] = value2;
}
}
return result2;
}
function concat() {
var length5 = arguments.length;
if (!length5) {
return [];
}
var args = Array2(length5 - 1), array = arguments[0], index2 = length5;
while (index2--) {
args[index2 - 1] = arguments[index2];
}
return arrayPush(isArray3(array) ? copyArray(array) : [array], baseFlatten(args, 1));
}
var difference2 = baseRest(function(array, values3) {
return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values3, 1, isArrayLikeObject, true)) : [];
});
var differenceBy = baseRest(function(array, values3) {
var iteratee2 = last2(values3);
if (isArrayLikeObject(iteratee2)) {
iteratee2 = undefined2;
}
return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values3, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : [];
});
var differenceWith = baseRest(function(array, values3) {
var comparator = last2(values3);
if (isArrayLikeObject(comparator)) {
comparator = undefined2;
}
return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values3, 1, isArrayLikeObject, true), undefined2, comparator) : [];
});
function drop(array, n3, guard) {
var length5 = array == null ? 0 : array.length;
if (!length5) {
return [];
}
n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
return baseSlice(array, n3 < 0 ? 0 : n3, length5);
}
function dropRight(array, n3, guard) {
var length5 = array == null ? 0 : array.length;
if (!length5) {
return [];
}
n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
n3 = length5 - n3;
return baseSlice(array, 0, n3 < 0 ? 0 : n3);
}
function dropRightWhile(array, predicate) {
return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true, true) : [];
}
function dropWhile(array, predicate) {
return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true) : [];
}
function fill(array, value2, start, end2) {
var length5 = array == null ? 0 : array.length;
if (!length5) {
return [];
}
if (start && typeof start != "number" && isIterateeCall(array, value2, start)) {
start = 0;
end2 = length5;
}
return baseFill(array, value2, start, end2);
}
function findIndex2(array, predicate, fromIndex) {
var length5 = array == null ? 0 : array.length;
if (!length5) {
return -1;
}
var index2 = fromIndex == null ? 0 : toInteger(fromIndex);
if (index2 < 0) {
index2 = nativeMax(length5 + index2, 0);
}
return baseFindIndex(array, getIteratee(predicate, 3), index2);
}
function findLastIndex(array, predicate, fromIndex) {
var length5 = array == null ? 0 : array.length;
if (!length5) {
return -1;
}
var index2 = length5 - 1;
if (fromIndex !== undefined2) {
index2 = toInteger(fromIndex);
index2 = fromIndex < 0 ? nativeMax(length5 + index2, 0) : nativeMin(index2, length5 - 1);
}
return baseFindIndex(array, getIteratee(predicate, 3), index2, true);
}
function flatten2(array) {
var length5 = array == null ? 0 : array.length;
return length5 ? baseFlatten(array, 1) : [];
}
function flattenDeep(array) {
var length5 = array == null ? 0 : array.length;
return length5 ? baseFlatten(array, INFINITY) : [];
}
function flattenDepth(array, depth) {
var length5 = array == null ? 0 : array.length;
if (!length5) {
return [];
}
depth = depth === undefined2 ? 1 : toInteger(depth);
return baseFlatten(array, depth);
}
function fromPairs(pairs2) {
var index2 = -1, length5 = pairs2 == null ? 0 : pairs2.length, result2 = {};
while (++index2 < length5) {
var pair = pairs2[index2];
result2[pair[0]] = pair[1];
}
return result2;
}
function head2(array) {
return array && array.length ? array[0] : undefined2;
}
function indexOf3(array, value2, fromIndex) {
var length5 = array == null ? 0 : array.length;
if (!length5) {
return -1;
}
var index2 = fromIndex == null ? 0 : toInteger(fromIndex);
if (index2 < 0) {
index2 = nativeMax(length5 + index2, 0);
}
return baseIndexOf(array, value2, index2);
}
function initial(array) {
var length5 = array == null ? 0 : array.length;
return length5 ? baseSlice(array, 0, -1) : [];
}
var intersection2 = baseRest(function(arrays) {
var mapped = arrayMap(arrays, castArrayLikeObject);
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
});
var intersectionBy = baseRest(function(arrays) {
var iteratee2 = last2(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
if (iteratee2 === last2(mapped)) {
iteratee2 = undefined2;
} else {
mapped.pop();
}
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : [];
});
var intersectionWith = baseRest(function(arrays) {
var comparator = last2(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
comparator = typeof comparator == "function" ? comparator : undefined2;
if (comparator) {
mapped.pop();
}
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
});
function join(array, separator) {
return array == null ? "" : nativeJoin.call(array, separator);
}
function last2(array) {
var length5 = array == null ? 0 : array.length;
return length5 ? array[length5 - 1] : undefined2;
}
function lastIndexOf(array, value2, fromIndex) {
var length5 = array == null ? 0 : array.length;
if (!length5) {
return -1;
}
var index2 = length5;
if (fromIndex !== undefined2) {
index2 = toInteger(fromIndex);
index2 = index2 < 0 ? nativeMax(length5 + index2, 0) : nativeMin(index2, length5 - 1);
}
return value2 === value2 ? strictLastIndexOf(array, value2, index2) : baseFindIndex(array, baseIsNaN, index2, true);
}
function nth(array, n3) {
return array && array.length ? baseNth(array, toInteger(n3)) : undefined2;
}
var pull = baseRest(pullAll);
function pullAll(array, values3) {
return array && array.length && values3 && values3.length ? basePullAll(array, values3) : array;
}
function pullAllBy(array, values3, iteratee2) {
return array && array.length && values3 && values3.length ? basePullAll(array, values3, getIteratee(iteratee2, 2)) : array;
}
function pullAllWith(array, values3, comparator) {
return array && array.length && values3 && values3.length ? basePullAll(array, values3, undefined2, comparator) : array;
}
var pullAt3 = flatRest(function(array, indexes) {
var length5 = array == null ? 0 : array.length, result2 = baseAt(array, indexes);
basePullAt(array, arrayMap(indexes, function(index2) {
return isIndex(index2, length5) ? +index2 : index2;
}).sort(compareAscending));
return result2;
});
function remove2(array, predicate) {
var result2 = [];
if (!(array && array.length)) {
return result2;
}
var index2 = -1, indexes = [], length5 = array.length;
predicate = getIteratee(predicate, 3);
while (++index2 < length5) {
var value2 = array[index2];
if (predicate(value2, index2, array)) {
result2.push(value2);
indexes.push(index2);
}
}
basePullAt(array, indexes);
return result2;
}
function reverse(array) {
return array == null ? array : nativeReverse.call(array);
}
function slice(array, start, end2) {
var length5 = array == null ? 0 : array.length;
if (!length5) {
return [];
}
if (end2 && typeof end2 != "number" && isIterateeCall(array, start, end2)) {
start = 0;
end2 = length5;
} else {
start = start == null ? 0 : toInteger(start);
end2 = end2 === undefined2 ? length5 : toInteger(end2);
}
return baseSlice(array, start, end2);
}
function sortedIndex(array, value2) {
return baseSortedIndex(array, value2);
}
function sortedIndexBy(array, value2, iteratee2) {
return baseSortedIndexBy(array, value2, getIteratee(iteratee2, 2));
}
function sortedIndexOf(array, value2) {
var length5 = array == null ? 0 : array.length;
if (length5) {
var index2 = baseSortedIndex(array, value2);
if (index2 < length5 && eq(array[index2], value2)) {
return index2;
}
}
return -1;
}
function sortedLastIndex(array, value2) {
return baseSortedIndex(array, value2, true);
}
function sortedLastIndexBy(array, value2, iteratee2) {
return baseSortedIndexBy(array, value2, getIteratee(iteratee2, 2), true);
}
function sortedLastIndexOf(array, value2) {
var length5 = array == null ? 0 : array.length;
if (length5) {
var index2 = baseSortedIndex(array, value2, true) - 1;
if (eq(array[index2], value2)) {
return index2;
}
}
return -1;
}
function sortedUniq(array) {
return array && array.length ? baseSortedUniq(array) : [];
}
function sortedUniqBy(array, iteratee2) {
return array && array.length ? baseSortedUniq(array, getIteratee(iteratee2, 2)) : [];
}
function tail(array) {
var length5 = array == null ? 0 : array.length;
return length5 ? baseSlice(array, 1, length5) : [];
}
function take(array, n3, guard) {
if (!(array && array.length)) {
return [];
}
n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
return baseSlice(array, 0, n3 < 0 ? 0 : n3);
}
function takeRight(array, n3, guard) {
var length5 = array == null ? 0 : array.length;
if (!length5) {
return [];
}
n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
n3 = length5 - n3;
return baseSlice(array, n3 < 0 ? 0 : n3, length5);
}
function takeRightWhile(array, predicate) {
return array && array.length ? baseWhile(array, getIteratee(predicate, 3), false, true) : [];
}
function takeWhile(array, predicate) {
return array && array.length ? baseWhile(array, getIteratee(predicate, 3)) : [];
}
var union = baseRest(function(arrays) {
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
});
var unionBy = baseRest(function(arrays) {
var iteratee2 = last2(arrays);
if (isArrayLikeObject(iteratee2)) {
iteratee2 = undefined2;
}
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2));
});
var unionWith = baseRest(function(arrays) {
var comparator = last2(arrays);
comparator = typeof comparator == "function" ? comparator : undefined2;
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined2, comparator);
});
function uniq5(array) {
return array && array.length ? baseUniq(array) : [];
}
function uniqBy(array, iteratee2) {
return array && array.length ? baseUniq(array, getIteratee(iteratee2, 2)) : [];
}
function uniqWith(array, comparator) {
comparator = typeof comparator == "function" ? comparator : undefined2;
return array && array.length ? baseUniq(array, undefined2, comparator) : [];
}
function unzip(array) {
if (!(array && array.length)) {
return [];
}
var length5 = 0;
array = arrayFilter(array, function(group2) {
if (isArrayLikeObject(group2)) {
length5 = nativeMax(group2.length, length5);
return true;
}
});
return baseTimes(length5, function(index2) {
return arrayMap(array, baseProperty(index2));
});
}
function unzipWith(array, iteratee2) {
if (!(array && array.length)) {
return [];
}
var result2 = unzip(array);
if (iteratee2 == null) {
return result2;
}
return arrayMap(result2, function(group2) {
return apply(iteratee2, undefined2, group2);
});
}
var without = baseRest(function(array, values3) {
return isArrayLikeObject(array) ? baseDifference(array, values3) : [];
});
var xor = baseRest(function(arrays) {
return baseXor(arrayFilter(arrays, isArrayLikeObject));
});
var xorBy = baseRest(function(arrays) {
var iteratee2 = last2(arrays);
if (isArrayLikeObject(iteratee2)) {
iteratee2 = undefined2;
}
return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee2, 2));
});
var xorWith = baseRest(function(arrays) {
var comparator = last2(arrays);
comparator = typeof comparator == "function" ? comparator : undefined2;
return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined2, comparator);
});
var zip = baseRest(unzip);
function zipObject2(props, values3) {
return baseZipObject(props || [], values3 || [], assignValue);
}
function zipObjectDeep(props, values3) {
return baseZipObject(props || [], values3 || [], baseSet);
}
var zipWith = baseRest(function(arrays) {
var length5 = arrays.length, iteratee2 = length5 > 1 ? arrays[length5 - 1] : undefined2;
iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2;
return unzipWith(arrays, iteratee2);
});
function chain(value2) {
var result2 = lodash(value2);
result2.__chain__ = true;
return result2;
}
function tap(value2, interceptor) {
interceptor(value2);
return value2;
}
function thru(value2, interceptor) {
return interceptor(value2);
}
var wrapperAt = flatRest(function(paths) {
var length5 = paths.length, start = length5 ? paths[0] : 0, value2 = this.__wrapped__, interceptor = function(object) {
return baseAt(object, paths);
};
if (length5 > 1 || this.__actions__.length || !(value2 instanceof LazyWrapper) || !isIndex(start)) {
return this.thru(interceptor);
}
value2 = value2.slice(start, +start + (length5 ? 1 : 0));
value2.__actions__.push({
"func": thru,
"args": [interceptor],
"thisArg": undefined2
});
return new LodashWrapper(value2, this.__chain__).thru(function(array) {
if (length5 && !array.length) {
array.push(undefined2);
}
return array;
});
});
function wrapperChain() {
return chain(this);
}
function wrapperCommit() {
return new LodashWrapper(this.value(), this.__chain__);
}
function wrapperNext() {
if (this.__values__ === undefined2) {
this.__values__ = toArray2(this.value());
}
var done = this.__index__ >= this.__values__.length, value2 = done ? undefined2 : this.__values__[this.__index__++];
return { "done": done, "value": value2 };
}
function wrapperToIterator() {
return this;
}
function wrapperPlant(value2) {
var result2, parent2 = this;
while (parent2 instanceof baseLodash) {
var clone11 = wrapperClone(parent2);
clone11.__index__ = 0;
clone11.__values__ = undefined2;
if (result2) {
previous.__wrapped__ = clone11;
} else {
result2 = clone11;
}
var previous = clone11;
parent2 = parent2.__wrapped__;
}
previous.__wrapped__ = value2;
return result2;
}
function wrapperReverse() {
var value2 = this.__wrapped__;
if (value2 instanceof LazyWrapper) {
var wrapped = value2;
if (this.__actions__.length) {
wrapped = new LazyWrapper(this);
}
wrapped = wrapped.reverse();
wrapped.__actions__.push({
"func": thru,
"args": [reverse],
"thisArg": undefined2
});
return new LodashWrapper(wrapped, this.__chain__);
}
return this.thru(reverse);
}
function wrapperValue() {
return baseWrapperValue(this.__wrapped__, this.__actions__);
}
var countBy = createAggregator(function(result2, value2, key) {
if (hasOwnProperty4.call(result2, key)) {
++result2[key];
} else {
baseAssignValue(result2, key, 1);
}
});
function every2(collection, predicate, guard) {
var func = isArray3(collection) ? arrayEvery : baseEvery;
if (guard && isIterateeCall(collection, predicate, guard)) {
predicate = undefined2;
}
return func(collection, getIteratee(predicate, 3));
}
function filter2(collection, predicate) {
var func = isArray3(collection) ? arrayFilter : baseFilter;
return func(collection, getIteratee(predicate, 3));
}
var find4 = createFind(findIndex2);
var findLast = createFind(findLastIndex);
function flatMap(collection, iteratee2) {
return baseFlatten(map6(collection, iteratee2), 1);
}
function flatMapDeep(collection, iteratee2) {
return baseFlatten(map6(collection, iteratee2), INFINITY);
}
function flatMapDepth(collection, iteratee2, depth) {
depth = depth === undefined2 ? 1 : toInteger(depth);
return baseFlatten(map6(collection, iteratee2), depth);
}
function forEach4(collection, iteratee2) {
var func = isArray3(collection) ? arrayEach : baseEach;
return func(collection, getIteratee(iteratee2, 3));
}
function forEachRight(collection, iteratee2) {
var func = isArray3(collection) ? arrayEachRight : baseEachRight;
return func(collection, getIteratee(iteratee2, 3));
}
var groupBy2 = createAggregator(function(result2, value2, key) {
if (hasOwnProperty4.call(result2, key)) {
result2[key].push(value2);
} else {
baseAssignValue(result2, key, [value2]);
}
});
function includes(collection, value2, fromIndex, guard) {
collection = isArrayLike2(collection) ? collection : values2(collection);
fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
var length5 = collection.length;
if (fromIndex < 0) {
fromIndex = nativeMax(length5 + fromIndex, 0);
}
return isString2(collection) ? fromIndex <= length5 && collection.indexOf(value2, fromIndex) > -1 : !!length5 && baseIndexOf(collection, value2, fromIndex) > -1;
}
var invokeMap = baseRest(function(collection, path, args) {
var index2 = -1, isFunc = typeof path == "function", result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
baseEach(collection, function(value2) {
result2[++index2] = isFunc ? apply(path, value2, args) : baseInvoke(value2, path, args);
});
return result2;
});
var keyBy = createAggregator(function(result2, value2, key) {
baseAssignValue(result2, key, value2);
});
function map6(collection, iteratee2) {
var func = isArray3(collection) ? arrayMap : baseMap;
return func(collection, getIteratee(iteratee2, 3));
}
function orderBy(collection, iteratees, orders, guard) {
if (collection == null) {
return [];
}
if (!isArray3(iteratees)) {
iteratees = iteratees == null ? [] : [iteratees];
}
orders = guard ? undefined2 : orders;
if (!isArray3(orders)) {
orders = orders == null ? [] : [orders];
}
return baseOrderBy(collection, iteratees, orders);
}
var partition3 = createAggregator(function(result2, value2, key) {
result2[key ? 0 : 1].push(value2);
}, function() {
return [[], []];
});
function reduce2(collection, iteratee2, accumulator) {
var func = isArray3(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach);
}
function reduceRight(collection, iteratee2, accumulator) {
var func = isArray3(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight);
}
function reject(collection, predicate) {
var func = isArray3(collection) ? arrayFilter : baseFilter;
return func(collection, negate4(getIteratee(predicate, 3)));
}
function sample(collection) {
var func = isArray3(collection) ? arraySample : baseSample;
return func(collection);
}
function sampleSize(collection, n3, guard) {
if (guard ? isIterateeCall(collection, n3, guard) : n3 === undefined2) {
n3 = 1;
} else {
n3 = toInteger(n3);
}
var func = isArray3(collection) ? arraySampleSize : baseSampleSize;
return func(collection, n3);
}
function shuffle3(collection) {
var func = isArray3(collection) ? arrayShuffle : baseShuffle;
return func(collection);
}
function size2(collection) {
if (collection == null) {
return 0;
}
if (isArrayLike2(collection)) {
return isString2(collection) ? stringSize(collection) : collection.length;
}
var tag = getTag(collection);
if (tag == mapTag4 || tag == setTag5) {
return collection.size;
}
return baseKeys(collection).length;
}
function some2(collection, predicate, guard) {
var func = isArray3(collection) ? arraySome : baseSome;
if (guard && isIterateeCall(collection, predicate, guard)) {
predicate = undefined2;
}
return func(collection, getIteratee(predicate, 3));
}
var sortBy2 = baseRest(function(collection, iteratees) {
if (collection == null) {
return [];
}
var length5 = iteratees.length;
if (length5 > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
iteratees = [];
} else if (length5 > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
iteratees = [iteratees[0]];
}
return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
});
var now2 = ctxNow || function() {
return root.Date.now();
};
function after(n3, func) {
if (typeof func != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
n3 = toInteger(n3);
return function() {
if (--n3 < 1) {
return func.apply(this, arguments);
}
};
}
function ary(func, n3, guard) {
n3 = guard ? undefined2 : n3;
n3 = func && n3 == null ? func.length : n3;
return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n3);
}
function before(n3, func) {
var result2;
if (typeof func != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
n3 = toInteger(n3);
return function() {
if (--n3 > 0) {
result2 = func.apply(this, arguments);
}
if (n3 <= 1) {
func = undefined2;
}
return result2;
};
}
var bind3 = baseRest(function(func, thisArg, partials) {
var bitmask = WRAP_BIND_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, getHolder(bind3));
bitmask |= WRAP_PARTIAL_FLAG;
}
return createWrap(func, bitmask, thisArg, partials, holders);
});
var bindKey = baseRest(function(object, key, partials) {
var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, getHolder(bindKey));
bitmask |= WRAP_PARTIAL_FLAG;
}
return createWrap(key, bitmask, object, partials, holders);
});
function curry(func, arity, guard) {
arity = guard ? undefined2 : arity;
var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
result2.placeholder = curry.placeholder;
return result2;
}
function curryRight(func, arity, guard) {
arity = guard ? undefined2 : arity;
var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
result2.placeholder = curryRight.placeholder;
return result2;
}
function debounce2(func, wait, options) {
var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
if (typeof func != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
wait = toNumber(wait) || 0;
if (isObject4(options)) {
leading = !!options.leading;
maxing = "maxWait" in options;
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
trailing = "trailing" in options ? !!options.trailing : trailing;
}
function invokeFunc(time2) {
var args = lastArgs, thisArg = lastThis;
lastArgs = lastThis = undefined2;
lastInvokeTime = time2;
result2 = func.apply(thisArg, args);
return result2;
}
function leadingEdge(time2) {
lastInvokeTime = time2;
timerId = setTimeout2(timerExpired, wait);
return leading ? invokeFunc(time2) : result2;
}
function remainingWait(time2) {
var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
}
function shouldInvoke(time2) {
var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime;
return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
}
function timerExpired() {
var time2 = now2();
if (shouldInvoke(time2)) {
return trailingEdge(time2);
}
timerId = setTimeout2(timerExpired, remainingWait(time2));
}
function trailingEdge(time2) {
timerId = undefined2;
if (trailing && lastArgs) {
return invokeFunc(time2);
}
lastArgs = lastThis = undefined2;
return result2;
}
function cancel() {
if (timerId !== undefined2) {
clearTimeout2(timerId);
}
lastInvokeTime = 0;
lastArgs = lastCallTime = lastThis = timerId = undefined2;
}
function flush() {
return timerId === undefined2 ? result2 : trailingEdge(now2());
}
function debounced() {
var time2 = now2(), isInvoking = shouldInvoke(time2);
lastArgs = arguments;
lastThis = this;
lastCallTime = time2;
if (isInvoking) {
if (timerId === undefined2) {
return leadingEdge(lastCallTime);
}
if (maxing) {
clearTimeout2(timerId);
timerId = setTimeout2(timerExpired, wait);
return invokeFunc(lastCallTime);
}
}
if (timerId === undefined2) {
timerId = setTimeout2(timerExpired, wait);
}
return result2;
}
debounced.cancel = cancel;
debounced.flush = flush;
return debounced;
}
var defer = baseRest(function(func, args) {
return baseDelay(func, 1, args);
});
var delay = baseRest(function(func, wait, args) {
return baseDelay(func, toNumber(wait) || 0, args);
});
function flip(func) {
return createWrap(func, WRAP_FLIP_FLAG);
}
function memoize(func, resolver) {
if (typeof func != "function" || resolver != null && typeof resolver != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
var memoized = function() {
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache3 = memoized.cache;
if (cache3.has(key)) {
return cache3.get(key);
}
var result2 = func.apply(this, args);
memoized.cache = cache3.set(key, result2) || cache3;
return result2;
};
memoized.cache = new (memoize.Cache || MapCache)();
return memoized;
}
memoize.Cache = MapCache;
function negate4(predicate) {
if (typeof predicate != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
return function() {
var args = arguments;
switch (args.length) {
case 0:
return !predicate.call(this);
case 1:
return !predicate.call(this, args[0]);
case 2:
return !predicate.call(this, args[0], args[1]);
case 3:
return !predicate.call(this, args[0], args[1], args[2]);
}
return !predicate.apply(this, args);
};
}
function once(func) {
return before(2, func);
}
var overArgs = castRest(function(func, transforms) {
transforms = transforms.length == 1 && isArray3(transforms[0]) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
var funcsLength = transforms.length;
return baseRest(function(args) {
var index2 = -1, length5 = nativeMin(args.length, funcsLength);
while (++index2 < length5) {
args[index2] = transforms[index2].call(this, args[index2]);
}
return apply(func, this, args);
});
});
var partial = baseRest(function(func, partials) {
var holders = replaceHolders(partials, getHolder(partial));
return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders);
});
var partialRight = baseRest(function(func, partials) {
var holders = replaceHolders(partials, getHolder(partialRight));
return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders);
});
var rearg = flatRest(function(func, indexes) {
return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes);
});
function rest(func, start) {
if (typeof func != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
start = start === undefined2 ? start : toInteger(start);
return baseRest(func, start);
}
function spread(func, start) {
if (typeof func != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
start = start == null ? 0 : nativeMax(toInteger(start), 0);
return baseRest(function(args) {
var array = args[start], otherArgs = castSlice(args, 0, start);
if (array) {
arrayPush(otherArgs, array);
}
return apply(func, this, otherArgs);
});
}
function throttle(func, wait, options) {
var leading = true, trailing = true;
if (typeof func != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
if (isObject4(options)) {
leading = "leading" in options ? !!options.leading : leading;
trailing = "trailing" in options ? !!options.trailing : trailing;
}
return debounce2(func, wait, {
"leading": leading,
"maxWait": wait,
"trailing": trailing
});
}
function unary(func) {
return ary(func, 1);
}
function wrap(value2, wrapper) {
return partial(castFunction(wrapper), value2);
}
function castArray() {
if (!arguments.length) {
return [];
}
var value2 = arguments[0];
return isArray3(value2) ? value2 : [value2];
}
function clone10(value2) {
return baseClone(value2, CLONE_SYMBOLS_FLAG);
}
function cloneWith(value2, customizer) {
customizer = typeof customizer == "function" ? customizer : undefined2;
return baseClone(value2, CLONE_SYMBOLS_FLAG, customizer);
}
function cloneDeep(value2) {
return baseClone(value2, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
}
function cloneDeepWith(value2, customizer) {
customizer = typeof customizer == "function" ? customizer : undefined2;
return baseClone(value2, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
}
function conformsTo(object, source) {
return source == null || baseConformsTo(object, source, keys2(source));
}
function eq(value2, other2) {
return value2 === other2 || value2 !== value2 && other2 !== other2;
}
var gt = createRelationalOperation(baseGt);
var gte = createRelationalOperation(function(value2, other2) {
return value2 >= other2;
});
var isArguments = baseIsArguments(function() {
return arguments;
}()) ? baseIsArguments : function(value2) {
return isObjectLike6(value2) && hasOwnProperty4.call(value2, "callee") && !propertyIsEnumerable.call(value2, "callee");
};
var isArray3 = Array2.isArray;
var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
function isArrayLike2(value2) {
return value2 != null && isLength4(value2.length) && !isFunction2(value2);
}
function isArrayLikeObject(value2) {
return isObjectLike6(value2) && isArrayLike2(value2);
}
function isBoolean3(value2) {
return value2 === true || value2 === false || isObjectLike6(value2) && baseGetTag(value2) == boolTag4;
}
var isBuffer = nativeIsBuffer || stubFalse;
var isDate2 = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
function isElement2(value2) {
return isObjectLike6(value2) && value2.nodeType === 1 && !isPlainObject3(value2);
}
function isEmpty2(value2) {
if (value2 == null) {
return true;
}
if (isArrayLike2(value2) && (isArray3(value2) || typeof value2 == "string" || typeof value2.splice == "function" || isBuffer(value2) || isTypedArray4(value2) || isArguments(value2))) {
return !value2.length;
}
var tag = getTag(value2);
if (tag == mapTag4 || tag == setTag5) {
return !value2.size;
}
if (isPrototype2(value2)) {
return !baseKeys(value2).length;
}
for (var key in value2) {
if (hasOwnProperty4.call(value2, key)) {
return false;
}
}
return true;
}
function isEqual3(value2, other2) {
return baseIsEqual(value2, other2);
}
function isEqualWith(value2, other2, customizer) {
customizer = typeof customizer == "function" ? customizer : undefined2;
var result2 = customizer ? customizer(value2, other2) : undefined2;
return result2 === undefined2 ? baseIsEqual(value2, other2, undefined2, customizer) : !!result2;
}
function isError(value2) {
if (!isObjectLike6(value2)) {
return false;
}
var tag = baseGetTag(value2);
return tag == errorTag4 || tag == domExcTag || typeof value2.message == "string" && typeof value2.name == "string" && !isPlainObject3(value2);
}
function isFinite2(value2) {
return typeof value2 == "number" && nativeIsFinite(value2);
}
function isFunction2(value2) {
if (!isObject4(value2)) {
return false;
}
var tag = baseGetTag(value2);
return tag == funcTag4 || tag == genTag || tag == asyncTag || tag == proxyTag;
}
function isInteger3(value2) {
return typeof value2 == "number" && value2 == toInteger(value2);
}
function isLength4(value2) {
return typeof value2 == "number" && value2 > -1 && value2 % 1 == 0 && value2 <= MAX_SAFE_INTEGER4;
}
function isObject4(value2) {
var type2 = typeof value2;
return value2 != null && (type2 == "object" || type2 == "function");
}
function isObjectLike6(value2) {
return value2 != null && typeof value2 == "object";
}
var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
function isMatch2(object, source) {
return object === source || baseIsMatch(object, source, getMatchData(source));
}
function isMatchWith(object, source, customizer) {
customizer = typeof customizer == "function" ? customizer : undefined2;
return baseIsMatch(object, source, getMatchData(source), customizer);
}
function isNaN6(value2) {
return isNumber7(value2) && value2 != +value2;
}
function isNative(value2) {
if (isMaskable(value2)) {
throw new Error2(CORE_ERROR_TEXT);
}
return baseIsNative(value2);
}
function isNull3(value2) {
return value2 === null;
}
function isNil2(value2) {
return value2 == null;
}
function isNumber7(value2) {
return typeof value2 == "number" || isObjectLike6(value2) && baseGetTag(value2) == numberTag4;
}
function isPlainObject3(value2) {
if (!isObjectLike6(value2) || baseGetTag(value2) != objectTag4) {
return false;
}
var proto = getPrototype(value2);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty4.call(proto, "constructor") && proto.constructor;
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
}
var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
function isSafeInteger(value2) {
return isInteger3(value2) && value2 >= -MAX_SAFE_INTEGER4 && value2 <= MAX_SAFE_INTEGER4;
}
var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
function isString2(value2) {
return typeof value2 == "string" || !isArray3(value2) && isObjectLike6(value2) && baseGetTag(value2) == stringTag4;
}
function isSymbol(value2) {
return typeof value2 == "symbol" || isObjectLike6(value2) && baseGetTag(value2) == symbolTag;
}
var isTypedArray4 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray4;
function isUndefined2(value2) {
return value2 === undefined2;
}
function isWeakMap(value2) {
return isObjectLike6(value2) && getTag(value2) == weakMapTag4;
}
function isWeakSet(value2) {
return isObjectLike6(value2) && baseGetTag(value2) == weakSetTag;
}
var lt = createRelationalOperation(baseLt);
var lte = createRelationalOperation(function(value2, other2) {
return value2 <= other2;
});
function toArray2(value2) {
if (!value2) {
return [];
}
if (isArrayLike2(value2)) {
return isString2(value2) ? stringToArray(value2) : copyArray(value2);
}
if (symIterator && value2[symIterator]) {
return iteratorToArray(value2[symIterator]());
}
var tag = getTag(value2), func = tag == mapTag4 ? mapToArray : tag == setTag5 ? setToArray : values2;
return func(value2);
}
function toFinite(value2) {
if (!value2) {
return value2 === 0 ? value2 : 0;
}
value2 = toNumber(value2);
if (value2 === INFINITY || value2 === -INFINITY) {
var sign = value2 < 0 ? -1 : 1;
return sign * MAX_INTEGER;
}
return value2 === value2 ? value2 : 0;
}
function toInteger(value2) {
var result2 = toFinite(value2), remainder = result2 % 1;
return result2 === result2 ? remainder ? result2 - remainder : result2 : 0;
}
function toLength(value2) {
return value2 ? baseClamp(toInteger(value2), 0, MAX_ARRAY_LENGTH) : 0;
}
function toNumber(value2) {
if (typeof value2 == "number") {
return value2;
}
if (isSymbol(value2)) {
return NAN;
}
if (isObject4(value2)) {
var other2 = typeof value2.valueOf == "function" ? value2.valueOf() : value2;
value2 = isObject4(other2) ? other2 + "" : other2;
}
if (typeof value2 != "string") {
return value2 === 0 ? value2 : +value2;
}
value2 = baseTrim(value2);
var isBinary2 = reIsBinary.test(value2);
return isBinary2 || reIsOctal.test(value2) ? freeParseInt(value2.slice(2), isBinary2 ? 2 : 8) : reIsBadHex.test(value2) ? NAN : +value2;
}
function toPlainObject(value2) {
return copyObject(value2, keysIn(value2));
}
function toSafeInteger(value2) {
return value2 ? baseClamp(toInteger(value2), -MAX_SAFE_INTEGER4, MAX_SAFE_INTEGER4) : value2 === 0 ? value2 : 0;
}
function toString7(value2) {
return value2 == null ? "" : baseToString(value2);
}
var assign2 = createAssigner(function(object, source) {
if (isPrototype2(source) || isArrayLike2(source)) {
copyObject(source, keys2(source), object);
return;
}
for (var key in source) {
if (hasOwnProperty4.call(source, key)) {
assignValue(object, key, source[key]);
}
}
});
var assignIn = createAssigner(function(object, source) {
copyObject(source, keysIn(source), object);
});
var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
copyObject(source, keysIn(source), object, customizer);
});
var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
copyObject(source, keys2(source), object, customizer);
});
var at = flatRest(baseAt);
function create8(prototype, properties) {
var result2 = baseCreate(prototype);
return properties == null ? result2 : baseAssign(result2, properties);
}
var defaults = baseRest(function(object, sources) {
object = Object2(object);
var index2 = -1;
var length5 = sources.length;
var guard = length5 > 2 ? sources[2] : undefined2;
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
length5 = 1;
}
while (++index2 < length5) {
var source = sources[index2];
var props = keysIn(source);
var propsIndex = -1;
var propsLength = props.length;
while (++propsIndex < propsLength) {
var key = props[propsIndex];
var value2 = object[key];
if (value2 === undefined2 || eq(value2, objectProto5[key]) && !hasOwnProperty4.call(object, key)) {
object[key] = source[key];
}
}
}
return object;
});
var defaultsDeep = baseRest(function(args) {
args.push(undefined2, customDefaultsMerge);
return apply(mergeWith, undefined2, args);
});
function findKey(object, predicate) {
return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
}
function findLastKey(object, predicate) {
return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
}
function forIn(object, iteratee2) {
return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn);
}
function forInRight(object, iteratee2) {
return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn);
}
function forOwn(object, iteratee2) {
return object && baseForOwn(object, getIteratee(iteratee2, 3));
}
function forOwnRight(object, iteratee2) {
return object && baseForOwnRight(object, getIteratee(iteratee2, 3));
}
function functions(object) {
return object == null ? [] : baseFunctions(object, keys2(object));
}
function functionsIn(object) {
return object == null ? [] : baseFunctions(object, keysIn(object));
}
function get3(object, path, defaultValue) {
var result2 = object == null ? undefined2 : baseGet(object, path);
return result2 === undefined2 ? defaultValue : result2;
}
function has(object, path) {
return object != null && hasPath2(object, path, baseHas);
}
function hasIn(object, path) {
return object != null && hasPath2(object, path, baseHasIn);
}
var invert5 = createInverter(function(result2, value2, key) {
if (value2 != null && typeof value2.toString != "function") {
value2 = nativeObjectToString.call(value2);
}
result2[value2] = key;
}, constant2(identity5));
var invertBy = createInverter(function(result2, value2, key) {
if (value2 != null && typeof value2.toString != "function") {
value2 = nativeObjectToString.call(value2);
}
if (hasOwnProperty4.call(result2, value2)) {
result2[value2].push(key);
} else {
result2[value2] = [key];
}
}, getIteratee);
var invoke = baseRest(baseInvoke);
function keys2(object) {
return isArrayLike2(object) ? arrayLikeKeys(object) : baseKeys(object);
}
function keysIn(object) {
return isArrayLike2(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
}
function mapKeys(object, iteratee2) {
var result2 = {};
iteratee2 = getIteratee(iteratee2, 3);
baseForOwn(object, function(value2, key, object2) {
baseAssignValue(result2, iteratee2(value2, key, object2), value2);
});
return result2;
}
function mapValues(object, iteratee2) {
var result2 = {};
iteratee2 = getIteratee(iteratee2, 3);
baseForOwn(object, function(value2, key, object2) {
baseAssignValue(result2, key, iteratee2(value2, key, object2));
});
return result2;
}
var merge3 = createAssigner(function(object, source, srcIndex) {
baseMerge(object, source, srcIndex);
});
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
baseMerge(object, source, srcIndex, customizer);
});
var omit2 = flatRest(function(object, paths) {
var result2 = {};
if (object == null) {
return result2;
}
var isDeep = false;
paths = arrayMap(paths, function(path) {
path = castPath(path, object);
isDeep || (isDeep = path.length > 1);
return path;
});
copyObject(object, getAllKeysIn(object), result2);
if (isDeep) {
result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
}
var length5 = paths.length;
while (length5--) {
baseUnset(result2, paths[length5]);
}
return result2;
});
function omitBy(object, predicate) {
return pickBy(object, negate4(getIteratee(predicate)));
}
var pick2 = flatRest(function(object, paths) {
return object == null ? {} : basePick(object, paths);
});
function pickBy(object, predicate) {
if (object == null) {
return {};
}
var props = arrayMap(getAllKeysIn(object), function(prop) {
return [prop];
});
predicate = getIteratee(predicate);
return basePickBy(object, props, function(value2, path) {
return predicate(value2, path[0]);
});
}
function result(object, path, defaultValue) {
path = castPath(path, object);
var index2 = -1, length5 = path.length;
if (!length5) {
length5 = 1;
object = undefined2;
}
while (++index2 < length5) {
var value2 = object == null ? undefined2 : object[toKey(path[index2])];
if (value2 === undefined2) {
index2 = length5;
value2 = defaultValue;
}
object = isFunction2(value2) ? value2.call(object) : value2;
}
return object;
}
function set10(object, path, value2) {
return object == null ? object : baseSet(object, path, value2);
}
function setWith(object, path, value2, customizer) {
customizer = typeof customizer == "function" ? customizer : undefined2;
return object == null ? object : baseSet(object, path, value2, customizer);
}
var toPairs = createToPairs(keys2);
var toPairsIn = createToPairs(keysIn);
function transform18(object, iteratee2, accumulator) {
var isArr = isArray3(object), isArrLike = isArr || isBuffer(object) || isTypedArray4(object);
iteratee2 = getIteratee(iteratee2, 4);
if (accumulator == null) {
var Ctor = object && object.constructor;
if (isArrLike) {
accumulator = isArr ? new Ctor() : [];
} else if (isObject4(object)) {
accumulator = isFunction2(Ctor) ? baseCreate(getPrototype(object)) : {};
} else {
accumulator = {};
}
}
(isArrLike ? arrayEach : baseForOwn)(object, function(value2, index2, object2) {
return iteratee2(accumulator, value2, index2, object2);
});
return accumulator;
}
function unset(object, path) {
return object == null ? true : baseUnset(object, path);
}
function update15(object, path, updater) {
return object == null ? object : baseUpdate2(object, path, castFunction(updater));
}
function updateWith(object, path, updater, customizer) {
customizer = typeof customizer == "function" ? customizer : undefined2;
return object == null ? object : baseUpdate2(object, path, castFunction(updater), customizer);
}
function values2(object) {
return object == null ? [] : baseValues(object, keys2(object));
}
function valuesIn(object) {
return object == null ? [] : baseValues(object, keysIn(object));
}
function clamp2(number, lower, upper) {
if (upper === undefined2) {
upper = lower;
lower = undefined2;
}
if (upper !== undefined2) {
upper = toNumber(upper);
upper = upper === upper ? upper : 0;
}
if (lower !== undefined2) {
lower = toNumber(lower);
lower = lower === lower ? lower : 0;
}
return baseClamp(toNumber(number), lower, upper);
}
function inRange(number, start, end2) {
start = toFinite(start);
if (end2 === undefined2) {
end2 = start;
start = 0;
} else {
end2 = toFinite(end2);
}
number = toNumber(number);
return baseInRange(number, start, end2);
}
function random5(lower, upper, floating) {
if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) {
upper = floating = undefined2;
}
if (floating === undefined2) {
if (typeof upper == "boolean") {
floating = upper;
upper = undefined2;
} else if (typeof lower == "boolean") {
floating = lower;
lower = undefined2;
}
}
if (lower === undefined2 && upper === undefined2) {
lower = 0;
upper = 1;
} else {
lower = toFinite(lower);
if (upper === undefined2) {
upper = lower;
lower = 0;
} else {
upper = toFinite(upper);
}
}
if (lower > upper) {
var temp = lower;
lower = upper;
upper = temp;
}
if (floating || lower % 1 || upper % 1) {
var rand = nativeRandom();
return nativeMin(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
}
return baseRandom(lower, upper);
}
var camelCase = createCompounder(function(result2, word2, index2) {
word2 = word2.toLowerCase();
return result2 + (index2 ? capitalize(word2) : word2);
});
function capitalize(string) {
return upperFirst2(toString7(string).toLowerCase());
}
function deburr(string) {
string = toString7(string);
return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
}
function endsWith(string, target, position2) {
string = toString7(string);
target = baseToString(target);
var length5 = string.length;
position2 = position2 === undefined2 ? length5 : baseClamp(toInteger(position2), 0, length5);
var end2 = position2;
position2 -= target.length;
return position2 >= 0 && string.slice(position2, end2) == target;
}
function escape(string) {
string = toString7(string);
return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string;
}
function escapeRegExp(string) {
string = toString7(string);
return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
}
var kebabCase2 = createCompounder(function(result2, word2, index2) {
return result2 + (index2 ? "-" : "") + word2.toLowerCase();
});
var lowerCase2 = createCompounder(function(result2, word2, index2) {
return result2 + (index2 ? " " : "") + word2.toLowerCase();
});
var lowerFirst = createCaseFirst("toLowerCase");
function pad2(string, length5, chars) {
string = toString7(string);
length5 = toInteger(length5);
var strLength = length5 ? stringSize(string) : 0;
if (!length5 || strLength >= length5) {
return string;
}
var mid2 = (length5 - strLength) / 2;
return createPadding(nativeFloor(mid2), chars) + string + createPadding(nativeCeil(mid2), chars);
}
function padEnd2(string, length5, chars) {
string = toString7(string);
length5 = toInteger(length5);
var strLength = length5 ? stringSize(string) : 0;
return length5 && strLength < length5 ? string + createPadding(length5 - strLength, chars) : string;
}
function padStart2(string, length5, chars) {
string = toString7(string);
length5 = toInteger(length5);
var strLength = length5 ? stringSize(string) : 0;
return length5 && strLength < length5 ? createPadding(length5 - strLength, chars) + string : string;
}
function parseInt2(string, radix, guard) {
if (guard || radix == null) {
radix = 0;
} else if (radix) {
radix = +radix;
}
return nativeParseInt(toString7(string).replace(reTrimStart, ""), radix || 0);
}
function repeat2(string, n3, guard) {
if (guard ? isIterateeCall(string, n3, guard) : n3 === undefined2) {
n3 = 1;
} else {
n3 = toInteger(n3);
}
return baseRepeat(toString7(string), n3);
}
function replace() {
var args = arguments, string = toString7(args[0]);
return args.length < 3 ? string : string.replace(args[1], args[2]);
}
var snakeCase = createCompounder(function(result2, word2, index2) {
return result2 + (index2 ? "_" : "") + word2.toLowerCase();
});
function split(string, separator, limit) {
if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
separator = limit = undefined2;
}
limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0;
if (!limit) {
return [];
}
string = toString7(string);
if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
separator = baseToString(separator);
if (!separator && hasUnicode(string)) {
return castSlice(stringToArray(string), 0, limit);
}
}
return string.split(separator, limit);
}
var startCase = createCompounder(function(result2, word2, index2) {
return result2 + (index2 ? " " : "") + upperFirst2(word2);
});
function startsWith(string, target, position2) {
string = toString7(string);
position2 = position2 == null ? 0 : baseClamp(toInteger(position2), 0, string.length);
target = baseToString(target);
return string.slice(position2, position2 + target.length) == target;
}
function template2(string, options, guard) {
var settings = lodash.templateSettings;
if (guard && isIterateeCall(string, options, guard)) {
options = undefined2;
}
string = toString7(string);
options = assignInWith({}, options, settings, customDefaultsAssignIn);
var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys2(imports), importsValues = baseValues(imports, importsKeys);
var isEscaping, isEvaluating, index2 = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
var reDelimiters = RegExp2((options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g");
var sourceURL = "//# sourceURL=" + (hasOwnProperty4.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
interpolateValue || (interpolateValue = esTemplateValue);
source += string.slice(index2, offset).replace(reUnescapedString, escapeStringChar);
if (escapeValue) {
isEscaping = true;
source += "' +\n__e(" + escapeValue + ") +\n'";
}
if (evaluateValue) {
isEvaluating = true;
source += "';\n" + evaluateValue + ";\n__p += '";
}
if (interpolateValue) {
source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
}
index2 = offset + match.length;
return match;
});
source += "';\n";
var variable = hasOwnProperty4.call(options, "variable") && options.variable;
if (!variable) {
source = "with (obj) {\n" + source + "\n}\n";
} else if (reForbiddenIdentifierChars.test(variable)) {
throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
}
source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}";
var result2 = attempt(function() {
return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues);
});
result2.source = source;
if (isError(result2)) {
throw result2;
}
return result2;
}
function toLower(value2) {
return toString7(value2).toLowerCase();
}
function toUpper(value2) {
return toString7(value2).toUpperCase();
}
function trim(string, chars, guard) {
string = toString7(string);
if (string && (guard || chars === undefined2)) {
return baseTrim(string);
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end2 = charsEndIndex(strSymbols, chrSymbols) + 1;
return castSlice(strSymbols, start, end2).join("");
}
function trimEnd(string, chars, guard) {
string = toString7(string);
if (string && (guard || chars === undefined2)) {
return string.slice(0, trimmedEndIndex(string) + 1);
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string), end2 = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
return castSlice(strSymbols, 0, end2).join("");
}
function trimStart(string, chars, guard) {
string = toString7(string);
if (string && (guard || chars === undefined2)) {
return string.replace(reTrimStart, "");
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars));
return castSlice(strSymbols, start).join("");
}
function truncate(string, options) {
var length5 = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
if (isObject4(options)) {
var separator = "separator" in options ? options.separator : separator;
length5 = "length" in options ? toInteger(options.length) : length5;
omission = "omission" in options ? baseToString(options.omission) : omission;
}
string = toString7(string);
var strLength = string.length;
if (hasUnicode(string)) {
var strSymbols = stringToArray(string);
strLength = strSymbols.length;
}
if (length5 >= strLength) {
return string;
}
var end2 = length5 - stringSize(omission);
if (end2 < 1) {
return omission;
}
var result2 = strSymbols ? castSlice(strSymbols, 0, end2).join("") : string.slice(0, end2);
if (separator === undefined2) {
return result2 + omission;
}
if (strSymbols) {
end2 += result2.length - end2;
}
if (isRegExp(separator)) {
if (string.slice(end2).search(separator)) {
var match, substring = result2;
if (!separator.global) {
separator = RegExp2(separator.source, toString7(reFlags.exec(separator)) + "g");
}
separator.lastIndex = 0;
while (match = separator.exec(substring)) {
var newEnd = match.index;
}
result2 = result2.slice(0, newEnd === undefined2 ? end2 : newEnd);
}
} else if (string.indexOf(baseToString(separator), end2) != end2) {
var index2 = result2.lastIndexOf(separator);
if (index2 > -1) {
result2 = result2.slice(0, index2);
}
}
return result2 + omission;
}
function unescape(string) {
string = toString7(string);
return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string;
}
var upperCase = createCompounder(function(result2, word2, index2) {
return result2 + (index2 ? " " : "") + word2.toUpperCase();
});
var upperFirst2 = createCaseFirst("toUpperCase");
function words(string, pattern2, guard) {
string = toString7(string);
pattern2 = guard ? undefined2 : pattern2;
if (pattern2 === undefined2) {
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
}
return string.match(pattern2) || [];
}
var attempt = baseRest(function(func, args) {
try {
return apply(func, undefined2, args);
} catch (e4) {
return isError(e4) ? e4 : new Error2(e4);
}
});
var bindAll = flatRest(function(object, methodNames) {
arrayEach(methodNames, function(key) {
key = toKey(key);
baseAssignValue(object, key, bind3(object[key], object));
});
return object;
});
function cond(pairs2) {
var length5 = pairs2 == null ? 0 : pairs2.length, toIteratee = getIteratee();
pairs2 = !length5 ? [] : arrayMap(pairs2, function(pair) {
if (typeof pair[1] != "function") {
throw new TypeError2(FUNC_ERROR_TEXT);
}
return [toIteratee(pair[0]), pair[1]];
});
return baseRest(function(args) {
var index2 = -1;
while (++index2 < length5) {
var pair = pairs2[index2];
if (apply(pair[0], this, args)) {
return apply(pair[1], this, args);
}
}
});
}
function conforms(source) {
return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
}
function constant2(value2) {
return function() {
return value2;
};
}
function defaultTo(value2, defaultValue) {
return value2 == null || value2 !== value2 ? defaultValue : value2;
}
var flow2 = createFlow();
var flowRight = createFlow(true);
function identity5(value2) {
return value2;
}
function iteratee(func) {
return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG));
}
function matches(source) {
return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
}
function matchesProperty(path, srcValue) {
return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
}
var method = baseRest(function(path, args) {
return function(object) {
return baseInvoke(object, path, args);
};
});
var methodOf = baseRest(function(object, args) {
return function(path) {
return baseInvoke(object, path, args);
};
});
function mixin(object, source, options) {
var props = keys2(source), methodNames = baseFunctions(source, props);
if (options == null && !(isObject4(source) && (methodNames.length || !props.length))) {
options = source;
source = object;
object = this;
methodNames = baseFunctions(source, keys2(source));
}
var chain2 = !(isObject4(options) && "chain" in options) || !!options.chain, isFunc = isFunction2(object);
arrayEach(methodNames, function(methodName) {
var func = source[methodName];
object[methodName] = func;
if (isFunc) {
object.prototype[methodName] = function() {
var chainAll = this.__chain__;
if (chain2 || chainAll) {
var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__);
actions.push({ "func": func, "args": arguments, "thisArg": object });
result2.__chain__ = chainAll;
return result2;
}
return func.apply(object, arrayPush([this.value()], arguments));
};
}
});
return object;
}
function noConflict() {
if (root._ === this) {
root._ = oldDash;
}
return this;
}
function noop2() {
}
function nthArg(n3) {
n3 = toInteger(n3);
return baseRest(function(args) {
return baseNth(args, n3);
});
}
var over = createOver(arrayMap);
var overEvery = createOver(arrayEvery);
var overSome = createOver(arraySome);
function property(path) {
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
}
function propertyOf(object) {
return function(path) {
return object == null ? undefined2 : baseGet(object, path);
};
}
var range = createRange();
var rangeRight = createRange(true);
function stubArray() {
return [];
}
function stubFalse() {
return false;
}
function stubObject() {
return {};
}
function stubString() {
return "";
}
function stubTrue() {
return true;
}
function times(n3, iteratee2) {
n3 = toInteger(n3);
if (n3 < 1 || n3 > MAX_SAFE_INTEGER4) {
return [];
}
var index2 = MAX_ARRAY_LENGTH, length5 = nativeMin(n3, MAX_ARRAY_LENGTH);
iteratee2 = getIteratee(iteratee2);
n3 -= MAX_ARRAY_LENGTH;
var result2 = baseTimes(length5, iteratee2);
while (++index2 < n3) {
iteratee2(index2);
}
return result2;
}
function toPath(value2) {
if (isArray3(value2)) {
return arrayMap(value2, toKey);
}
return isSymbol(value2) ? [value2] : copyArray(stringToPath(toString7(value2)));
}
function uniqueId5(prefix2) {
var id = ++idCounter;
return toString7(prefix2) + id;
}
var add8 = createMathOperation(function(augend, addend) {
return augend + addend;
}, 0);
var ceil4 = createRound("ceil");
var divide4 = createMathOperation(function(dividend, divisor) {
return dividend / divisor;
}, 1);
var floor4 = createRound("floor");
function max8(array) {
return array && array.length ? baseExtremum(array, identity5, baseGt) : undefined2;
}
function maxBy(array, iteratee2) {
return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseGt) : undefined2;
}
function mean(array) {
return baseMean(array, identity5);
}
function meanBy(array, iteratee2) {
return baseMean(array, getIteratee(iteratee2, 2));
}
function min7(array) {
return array && array.length ? baseExtremum(array, identity5, baseLt) : undefined2;
}
function minBy2(array, iteratee2) {
return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseLt) : undefined2;
}
var multiply7 = createMathOperation(function(multiplier, multiplicand) {
return multiplier * multiplicand;
}, 1);
var round5 = createRound("round");
var subtract6 = createMathOperation(function(minuend, subtrahend) {
return minuend - subtrahend;
}, 0);
function sum(array) {
return array && array.length ? baseSum(array, identity5) : 0;
}
function sumBy2(array, iteratee2) {
return array && array.length ? baseSum(array, getIteratee(iteratee2, 2)) : 0;
}
lodash.after = after;
lodash.ary = ary;
lodash.assign = assign2;
lodash.assignIn = assignIn;
lodash.assignInWith = assignInWith;
lodash.assignWith = assignWith;
lodash.at = at;
lodash.before = before;
lodash.bind = bind3;
lodash.bindAll = bindAll;
lodash.bindKey = bindKey;
lodash.castArray = castArray;
lodash.chain = chain;
lodash.chunk = chunk;
lodash.compact = compact;
lodash.concat = concat;
lodash.cond = cond;
lodash.conforms = conforms;
lodash.constant = constant2;
lodash.countBy = countBy;
lodash.create = create8;
lodash.curry = curry;
lodash.curryRight = curryRight;
lodash.debounce = debounce2;
lodash.defaults = defaults;
lodash.defaultsDeep = defaultsDeep;
lodash.defer = defer;
lodash.delay = delay;
lodash.difference = difference2;
lodash.differenceBy = differenceBy;
lodash.differenceWith = differenceWith;
lodash.drop = drop;
lodash.dropRight = dropRight;
lodash.dropRightWhile = dropRightWhile;
lodash.dropWhile = dropWhile;
lodash.fill = fill;
lodash.filter = filter2;
lodash.flatMap = flatMap;
lodash.flatMapDeep = flatMapDeep;
lodash.flatMapDepth = flatMapDepth;
lodash.flatten = flatten2;
lodash.flattenDeep = flattenDeep;
lodash.flattenDepth = flattenDepth;
lodash.flip = flip;
lodash.flow = flow2;
lodash.flowRight = flowRight;
lodash.fromPairs = fromPairs;
lodash.functions = functions;
lodash.functionsIn = functionsIn;
lodash.groupBy = groupBy2;
lodash.initial = initial;
lodash.intersection = intersection2;
lodash.intersectionBy = intersectionBy;
lodash.intersectionWith = intersectionWith;
lodash.invert = invert5;
lodash.invertBy = invertBy;
lodash.invokeMap = invokeMap;
lodash.iteratee = iteratee;
lodash.keyBy = keyBy;
lodash.keys = keys2;
lodash.keysIn = keysIn;
lodash.map = map6;
lodash.mapKeys = mapKeys;
lodash.mapValues = mapValues;
lodash.matches = matches;
lodash.matchesProperty = matchesProperty;
lodash.memoize = memoize;
lodash.merge = merge3;
lodash.mergeWith = mergeWith;
lodash.method = method;
lodash.methodOf = methodOf;
lodash.mixin = mixin;
lodash.negate = negate4;
lodash.nthArg = nthArg;
lodash.omit = omit2;
lodash.omitBy = omitBy;
lodash.once = once;
lodash.orderBy = orderBy;
lodash.over = over;
lodash.overArgs = overArgs;
lodash.overEvery = overEvery;
lodash.overSome = overSome;
lodash.partial = partial;
lodash.partialRight = partialRight;
lodash.partition = partition3;
lodash.pick = pick2;
lodash.pickBy = pickBy;
lodash.property = property;
lodash.propertyOf = propertyOf;
lodash.pull = pull;
lodash.pullAll = pullAll;
lodash.pullAllBy = pullAllBy;
lodash.pullAllWith = pullAllWith;
lodash.pullAt = pullAt3;
lodash.range = range;
lodash.rangeRight = rangeRight;
lodash.rearg = rearg;
lodash.reject = reject;
lodash.remove = remove2;
lodash.rest = rest;
lodash.reverse = reverse;
lodash.sampleSize = sampleSize;
lodash.set = set10;
lodash.setWith = setWith;
lodash.shuffle = shuffle3;
lodash.slice = slice;
lodash.sortBy = sortBy2;
lodash.sortedUniq = sortedUniq;
lodash.sortedUniqBy = sortedUniqBy;
lodash.split = split;
lodash.spread = spread;
lodash.tail = tail;
lodash.take = take;
lodash.takeRight = takeRight;
lodash.takeRightWhile = takeRightWhile;
lodash.takeWhile = takeWhile;
lodash.tap = tap;
lodash.throttle = throttle;
lodash.thru = thru;
lodash.toArray = toArray2;
lodash.toPairs = toPairs;
lodash.toPairsIn = toPairsIn;
lodash.toPath = toPath;
lodash.toPlainObject = toPlainObject;
lodash.transform = transform18;
lodash.unary = unary;
lodash.union = union;
lodash.unionBy = unionBy;
lodash.unionWith = unionWith;
lodash.uniq = uniq5;
lodash.uniqBy = uniqBy;
lodash.uniqWith = uniqWith;
lodash.unset = unset;
lodash.unzip = unzip;
lodash.unzipWith = unzipWith;
lodash.update = update15;
lodash.updateWith = updateWith;
lodash.values = values2;
lodash.valuesIn = valuesIn;
lodash.without = without;
lodash.words = words;
lodash.wrap = wrap;
lodash.xor = xor;
lodash.xorBy = xorBy;
lodash.xorWith = xorWith;
lodash.zip = zip;
lodash.zipObject = zipObject2;
lodash.zipObjectDeep = zipObjectDeep;
lodash.zipWith = zipWith;
lodash.entries = toPairs;
lodash.entriesIn = toPairsIn;
lodash.extend = assignIn;
lodash.extendWith = assignInWith;
mixin(lodash, lodash);
lodash.add = add8;
lodash.attempt = attempt;
lodash.camelCase = camelCase;
lodash.capitalize = capitalize;
lodash.ceil = ceil4;
lodash.clamp = clamp2;
lodash.clone = clone10;
lodash.cloneDeep = cloneDeep;
lodash.cloneDeepWith = cloneDeepWith;
lodash.cloneWith = cloneWith;
lodash.conformsTo = conformsTo;
lodash.deburr = deburr;
lodash.defaultTo = defaultTo;
lodash.divide = divide4;
lodash.endsWith = endsWith;
lodash.eq = eq;
lodash.escape = escape;
lodash.escapeRegExp = escapeRegExp;
lodash.every = every2;
lodash.find = find4;
lodash.findIndex = findIndex2;
lodash.findKey = findKey;
lodash.findLast = findLast;
lodash.findLastIndex = findLastIndex;
lodash.findLastKey = findLastKey;
lodash.floor = floor4;
lodash.forEach = forEach4;
lodash.forEachRight = forEachRight;
lodash.forIn = forIn;
lodash.forInRight = forInRight;
lodash.forOwn = forOwn;
lodash.forOwnRight = forOwnRight;
lodash.get = get3;
lodash.gt = gt;
lodash.gte = gte;
lodash.has = has;
lodash.hasIn = hasIn;
lodash.head = head2;
lodash.identity = identity5;
lodash.includes = includes;
lodash.indexOf = indexOf3;
lodash.inRange = inRange;
lodash.invoke = invoke;
lodash.isArguments = isArguments;
lodash.isArray = isArray3;
lodash.isArrayBuffer = isArrayBuffer;
lodash.isArrayLike = isArrayLike2;
lodash.isArrayLikeObject = isArrayLikeObject;
lodash.isBoolean = isBoolean3;
lodash.isBuffer = isBuffer;
lodash.isDate = isDate2;
lodash.isElement = isElement2;
lodash.isEmpty = isEmpty2;
lodash.isEqual = isEqual3;
lodash.isEqualWith = isEqualWith;
lodash.isError = isError;
lodash.isFinite = isFinite2;
lodash.isFunction = isFunction2;
lodash.isInteger = isInteger3;
lodash.isLength = isLength4;
lodash.isMap = isMap;
lodash.isMatch = isMatch2;
lodash.isMatchWith = isMatchWith;
lodash.isNaN = isNaN6;
lodash.isNative = isNative;
lodash.isNil = isNil2;
lodash.isNull = isNull3;
lodash.isNumber = isNumber7;
lodash.isObject = isObject4;
lodash.isObjectLike = isObjectLike6;
lodash.isPlainObject = isPlainObject3;
lodash.isRegExp = isRegExp;
lodash.isSafeInteger = isSafeInteger;
lodash.isSet = isSet;
lodash.isString = isString2;
lodash.isSymbol = isSymbol;
lodash.isTypedArray = isTypedArray4;
lodash.isUndefined = isUndefined2;
lodash.isWeakMap = isWeakMap;
lodash.isWeakSet = isWeakSet;
lodash.join = join;
lodash.kebabCase = kebabCase2;
lodash.last = last2;
lodash.lastIndexOf = lastIndexOf;
lodash.lowerCase = lowerCase2;
lodash.lowerFirst = lowerFirst;
lodash.lt = lt;
lodash.lte = lte;
lodash.max = max8;
lodash.maxBy = maxBy;
lodash.mean = mean;
lodash.meanBy = meanBy;
lodash.min = min7;
lodash.minBy = minBy2;
lodash.stubArray = stubArray;
lodash.stubFalse = stubFalse;
lodash.stubObject = stubObject;
lodash.stubString = stubString;
lodash.stubTrue = stubTrue;
lodash.multiply = multiply7;
lodash.nth = nth;
lodash.noConflict = noConflict;
lodash.noop = noop2;
lodash.now = now2;
lodash.pad = pad2;
lodash.padEnd = padEnd2;
lodash.padStart = padStart2;
lodash.parseInt = parseInt2;
lodash.random = random5;
lodash.reduce = reduce2;
lodash.reduceRight = reduceRight;
lodash.repeat = repeat2;
lodash.replace = replace;
lodash.result = result;
lodash.round = round5;
lodash.runInContext = runInContext2;
lodash.sample = sample;
lodash.size = size2;
lodash.snakeCase = snakeCase;
lodash.some = some2;
lodash.sortedIndex = sortedIndex;
lodash.sortedIndexBy = sortedIndexBy;
lodash.sortedIndexOf = sortedIndexOf;
lodash.sortedLastIndex = sortedLastIndex;
lodash.sortedLastIndexBy = sortedLastIndexBy;
lodash.sortedLastIndexOf = sortedLastIndexOf;
lodash.startCase = startCase;
lodash.startsWith = startsWith;
lodash.subtract = subtract6;
lodash.sum = sum;
lodash.sumBy = sumBy2;
lodash.template = template2;
lodash.times = times;
lodash.toFinite = toFinite;
lodash.toInteger = toInteger;
lodash.toLength = toLength;
lodash.toLower = toLower;
lodash.toNumber = toNumber;
lodash.toSafeInteger = toSafeInteger;
lodash.toString = toString7;
lodash.toUpper = toUpper;
lodash.trim = trim;
lodash.trimEnd = trimEnd;
lodash.trimStart = trimStart;
lodash.truncate = truncate;
lodash.unescape = unescape;
lodash.uniqueId = uniqueId5;
lodash.upperCase = upperCase;
lodash.upperFirst = upperFirst2;
lodash.each = forEach4;
lodash.eachRight = forEachRight;
lodash.first = head2;
mixin(lodash, function() {
var source = {};
baseForOwn(lodash, function(func, methodName) {
if (!hasOwnProperty4.call(lodash.prototype, methodName)) {
source[methodName] = func;
}
});
return source;
}(), { "chain": false });
lodash.VERSION = VERSION2;
arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
lodash[methodName].placeholder = lodash;
});
arrayEach(["drop", "take"], function(methodName, index2) {
LazyWrapper.prototype[methodName] = function(n3) {
n3 = n3 === undefined2 ? 1 : nativeMax(toInteger(n3), 0);
var result2 = this.__filtered__ && !index2 ? new LazyWrapper(this) : this.clone();
if (result2.__filtered__) {
result2.__takeCount__ = nativeMin(n3, result2.__takeCount__);
} else {
result2.__views__.push({
"size": nativeMin(n3, MAX_ARRAY_LENGTH),
"type": methodName + (result2.__dir__ < 0 ? "Right" : "")
});
}
return result2;
};
LazyWrapper.prototype[methodName + "Right"] = function(n3) {
return this.reverse()[methodName](n3).reverse();
};
});
arrayEach(["filter", "map", "takeWhile"], function(methodName, index2) {
var type2 = index2 + 1, isFilter = type2 == LAZY_FILTER_FLAG || type2 == LAZY_WHILE_FLAG;
LazyWrapper.prototype[methodName] = function(iteratee2) {
var result2 = this.clone();
result2.__iteratees__.push({
"iteratee": getIteratee(iteratee2, 3),
"type": type2
});
result2.__filtered__ = result2.__filtered__ || isFilter;
return result2;
};
});
arrayEach(["head", "last"], function(methodName, index2) {
var takeName = "take" + (index2 ? "Right" : "");
LazyWrapper.prototype[methodName] = function() {
return this[takeName](1).value()[0];
};
});
arrayEach(["initial", "tail"], function(methodName, index2) {
var dropName = "drop" + (index2 ? "" : "Right");
LazyWrapper.prototype[methodName] = function() {
return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
};
});
LazyWrapper.prototype.compact = function() {
return this.filter(identity5);
};
LazyWrapper.prototype.find = function(predicate) {
return this.filter(predicate).head();
};
LazyWrapper.prototype.findLast = function(predicate) {
return this.reverse().find(predicate);
};
LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
if (typeof path == "function") {
return new LazyWrapper(this);
}
return this.map(function(value2) {
return baseInvoke(value2, path, args);
});
});
LazyWrapper.prototype.reject = function(predicate) {
return this.filter(negate4(getIteratee(predicate)));
};
LazyWrapper.prototype.slice = function(start, end2) {
start = toInteger(start);
var result2 = this;
if (result2.__filtered__ && (start > 0 || end2 < 0)) {
return new LazyWrapper(result2);
}
if (start < 0) {
result2 = result2.takeRight(-start);
} else if (start) {
result2 = result2.drop(start);
}
if (end2 !== undefined2) {
end2 = toInteger(end2);
result2 = end2 < 0 ? result2.dropRight(-end2) : result2.take(end2 - start);
}
return result2;
};
LazyWrapper.prototype.takeRightWhile = function(predicate) {
return this.reverse().takeWhile(predicate).reverse();
};
LazyWrapper.prototype.toArray = function() {
return this.take(MAX_ARRAY_LENGTH);
};
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName);
if (!lodashFunc) {
return;
}
lodash.prototype[methodName] = function() {
var value2 = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value2 instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray3(value2);
var interceptor = function(value3) {
var result3 = lodashFunc.apply(lodash, arrayPush([value3], args));
return isTaker && chainAll ? result3[0] : result3;
};
if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
isLazy = useLazy = false;
}
var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
if (!retUnwrapped && useLazy) {
value2 = onlyLazy ? value2 : new LazyWrapper(this);
var result2 = func.apply(value2, args);
result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 });
return new LodashWrapper(result2, chainAll);
}
if (isUnwrapped && onlyLazy) {
return func.apply(this, args);
}
result2 = this.thru(interceptor);
return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
};
});
arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
lodash.prototype[methodName] = function() {
var args = arguments;
if (retUnwrapped && !this.__chain__) {
var value2 = this.value();
return func.apply(isArray3(value2) ? value2 : [], args);
}
return this[chainName](function(value3) {
return func.apply(isArray3(value3) ? value3 : [], args);
});
};
});
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
var lodashFunc = lodash[methodName];
if (lodashFunc) {
var key = lodashFunc.name + "";
if (!hasOwnProperty4.call(realNames, key)) {
realNames[key] = [];
}
realNames[key].push({ "name": methodName, "func": lodashFunc });
}
});
realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{
"name": "wrapper",
"func": undefined2
}];
LazyWrapper.prototype.clone = lazyClone;
LazyWrapper.prototype.reverse = lazyReverse;
LazyWrapper.prototype.value = lazyValue;
lodash.prototype.at = wrapperAt;
lodash.prototype.chain = wrapperChain;
lodash.prototype.commit = wrapperCommit;
lodash.prototype.next = wrapperNext;
lodash.prototype.plant = wrapperPlant;
lodash.prototype.reverse = wrapperReverse;
lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
lodash.prototype.first = lodash.prototype.head;
if (symIterator) {
lodash.prototype[symIterator] = wrapperToIterator;
}
return lodash;
};
var _8 = runInContext();
if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
root._ = _8;
define(function() {
return _8;
});
} else if (freeModule) {
(freeModule.exports = _8)._ = _8;
freeExports._ = _8;
} else {
root._ = _8;
}
}).call(exports);
}
});
// node_modules/@dagrejs/graphlib/lib/lodash.js
var require_lodash2 = __commonJS({
"node_modules/@dagrejs/graphlib/lib/lodash.js"(exports, module2) {
var lodash;
if (typeof require === "function") {
try {
lodash = require_lodash();
} catch (e4) {
}
}
if (!lodash) {
lodash = window._;
}
module2.exports = lodash;
}
});
// node_modules/@dagrejs/graphlib/lib/graph.js
var require_graph = __commonJS({
"node_modules/@dagrejs/graphlib/lib/graph.js"(exports, module2) {
"use strict";
var _8 = require_lodash2();
module2.exports = Graph10;
var DEFAULT_EDGE_NAME = "\0";
var GRAPH_NODE = "\0";
var EDGE_KEY_DELIM = "";
function Graph10(opts) {
this._isDirected = _8.has(opts, "directed") ? opts.directed : true;
this._isMultigraph = _8.has(opts, "multigraph") ? opts.multigraph : false;
this._isCompound = _8.has(opts, "compound") ? opts.compound : false;
this._label = void 0;
this._defaultNodeLabelFn = _8.constant(void 0);
this._defaultEdgeLabelFn = _8.constant(void 0);
this._nodes = {};
if (this._isCompound) {
this._parent = {};
this._children = {};
this._children[GRAPH_NODE] = {};
}
this._in = {};
this._preds = {};
this._out = {};
this._sucs = {};
this._edgeObjs = {};
this._edgeLabels = {};
}
Graph10.prototype._nodeCount = 0;
Graph10.prototype._edgeCount = 0;
Graph10.prototype.isDirected = function() {
return this._isDirected;
};
Graph10.prototype.isMultigraph = function() {
return this._isMultigraph;
};
Graph10.prototype.isCompound = function() {
return this._isCompound;
};
Graph10.prototype.setGraph = function(label17) {
this._label = label17;
return this;
};
Graph10.prototype.graph = function() {
return this._label;
};
Graph10.prototype.setDefaultNodeLabel = function(newDefault) {
if (!_8.isFunction(newDefault)) {
newDefault = _8.constant(newDefault);
}
this._defaultNodeLabelFn = newDefault;
return this;
};
Graph10.prototype.nodeCount = function() {
return this._nodeCount;
};
Graph10.prototype.nodes = function() {
return _8.keys(this._nodes);
};
Graph10.prototype.sources = function() {
return _8.filter(this.nodes(), _8.bind(function(v3) {
return _8.isEmpty(this._in[v3]);
}, this));
};
Graph10.prototype.sinks = function() {
return _8.filter(this.nodes(), _8.bind(function(v3) {
return _8.isEmpty(this._out[v3]);
}, this));
};
Graph10.prototype.setNodes = function(vs, value2) {
var args = arguments;
_8.each(vs, _8.bind(function(v3) {
if (args.length > 1) {
this.setNode(v3, value2);
} else {
this.setNode(v3);
}
}, this));
return this;
};
Graph10.prototype.setNode = function(v3, value2) {
if (_8.has(this._nodes, v3)) {
if (arguments.length > 1) {
this._nodes[v3] = value2;
}
return this;
}
this._nodes[v3] = arguments.length > 1 ? value2 : this._defaultNodeLabelFn(v3);
if (this._isCompound) {
this._parent[v3] = GRAPH_NODE;
this._children[v3] = {};
this._children[GRAPH_NODE][v3] = true;
}
this._in[v3] = {};
this._preds[v3] = {};
this._out[v3] = {};
this._sucs[v3] = {};
++this._nodeCount;
return this;
};
Graph10.prototype.node = function(v3) {
return this._nodes[v3];
};
Graph10.prototype.hasNode = function(v3) {
return _8.has(this._nodes, v3);
};
Graph10.prototype.removeNode = function(v3) {
var self2 = this;
if (_8.has(this._nodes, v3)) {
var removeEdge = function(e4) {
self2.removeEdge(self2._edgeObjs[e4]);
};
delete this._nodes[v3];
if (this._isCompound) {
this._removeFromParentsChildList(v3);
delete this._parent[v3];
_8.each(this.children(v3), _8.bind(function(child) {
this.setParent(child);
}, this));
delete this._children[v3];
}
_8.each(_8.keys(this._in[v3]), removeEdge);
delete this._in[v3];
delete this._preds[v3];
_8.each(_8.keys(this._out[v3]), removeEdge);
delete this._out[v3];
delete this._sucs[v3];
--this._nodeCount;
}
return this;
};
Graph10.prototype.setParent = function(v3, parent) {
if (!this._isCompound) {
throw new Error("Cannot set parent in a non-compound graph");
}
if (_8.isUndefined(parent)) {
parent = GRAPH_NODE;
} else {
parent += "";
for (var ancestor = parent; !_8.isUndefined(ancestor); ancestor = this.parent(ancestor)) {
if (ancestor === v3) {
throw new Error("Setting " + parent + " as parent of " + v3 + " would create create a cycle");
}
}
this.setNode(parent);
}
this.setNode(v3);
this._removeFromParentsChildList(v3);
this._parent[v3] = parent;
this._children[parent][v3] = true;
return this;
};
Graph10.prototype._removeFromParentsChildList = function(v3) {
delete this._children[this._parent[v3]][v3];
};
Graph10.prototype.parent = function(v3) {
if (this._isCompound) {
var parent = this._parent[v3];
if (parent !== GRAPH_NODE) {
return parent;
}
}
};
Graph10.prototype.children = function(v3) {
if (_8.isUndefined(v3)) {
v3 = GRAPH_NODE;
}
if (this._isCompound) {
var children = this._children[v3];
if (children) {
return _8.keys(children);
}
} else if (v3 === GRAPH_NODE) {
return this.nodes();
} else if (this.hasNode(v3)) {
return [];
}
};
Graph10.prototype.predecessors = function(v3) {
var predsV = this._preds[v3];
if (predsV) {
return _8.keys(predsV);
}
};
Graph10.prototype.successors = function(v3) {
var sucsV = this._sucs[v3];
if (sucsV) {
return _8.keys(sucsV);
}
};
Graph10.prototype.neighbors = function(v3) {
var preds = this.predecessors(v3);
if (preds) {
return _8.union(preds, this.successors(v3));
}
};
Graph10.prototype.isLeaf = function(v3) {
var neighbors;
if (this.isDirected()) {
neighbors = this.successors(v3);
} else {
neighbors = this.neighbors(v3);
}
return neighbors.length === 0;
};
Graph10.prototype.filterNodes = function(filter2) {
var copy8 = new this.constructor({
directed: this._isDirected,
multigraph: this._isMultigraph,
compound: this._isCompound
});
copy8.setGraph(this.graph());
_8.each(this._nodes, _8.bind(function(value2, v3) {
if (filter2(v3)) {
copy8.setNode(v3, value2);
}
}, this));
_8.each(this._edgeObjs, _8.bind(function(e4) {
if (copy8.hasNode(e4.v) && copy8.hasNode(e4.w)) {
copy8.setEdge(e4, this.edge(e4));
}
}, this));
var self2 = this;
var parents = {};
function findParent(v3) {
var parent = self2.parent(v3);
if (parent === void 0 || copy8.hasNode(parent)) {
parents[v3] = parent;
return parent;
} else if (parent in parents) {
return parents[parent];
} else {
return findParent(parent);
}
}
if (this._isCompound) {
_8.each(copy8.nodes(), function(v3) {
copy8.setParent(v3, findParent(v3));
});
}
return copy8;
};
Graph10.prototype.setDefaultEdgeLabel = function(newDefault) {
if (!_8.isFunction(newDefault)) {
newDefault = _8.constant(newDefault);
}
this._defaultEdgeLabelFn = newDefault;
return this;
};
Graph10.prototype.edgeCount = function() {
return this._edgeCount;
};
Graph10.prototype.edges = function() {
return _8.values(this._edgeObjs);
};
Graph10.prototype.setPath = function(vs, value2) {
var self2 = this, args = arguments;
_8.reduce(vs, function(v3, w4) {
if (args.length > 1) {
self2.setEdge(v3, w4, value2);
} else {
self2.setEdge(v3, w4);
}
return w4;
});
return this;
};
Graph10.prototype.setEdge = function() {
var v3, w4, name, value2, valueSpecified = false, arg0 = arguments[0];
if (typeof arg0 === "object" && arg0 !== null && "v" in arg0) {
v3 = arg0.v;
w4 = arg0.w;
name = arg0.name;
if (arguments.length === 2) {
value2 = arguments[1];
valueSpecified = true;
}
} else {
v3 = arg0;
w4 = arguments[1];
name = arguments[3];
if (arguments.length > 2) {
value2 = arguments[2];
valueSpecified = true;
}
}
v3 = "" + v3;
w4 = "" + w4;
if (!_8.isUndefined(name)) {
name = "" + name;
}
var e4 = edgeArgsToId(this._isDirected, v3, w4, name);
if (_8.has(this._edgeLabels, e4)) {
if (valueSpecified) {
this._edgeLabels[e4] = value2;
}
return this;
}
if (!_8.isUndefined(name) && !this._isMultigraph) {
throw new Error("Cannot set a named edge when isMultigraph = false");
}
this.setNode(v3);
this.setNode(w4);
this._edgeLabels[e4] = valueSpecified ? value2 : this._defaultEdgeLabelFn(v3, w4, name);
var edgeObj = edgeArgsToObj(this._isDirected, v3, w4, name);
v3 = edgeObj.v;
w4 = edgeObj.w;
Object.freeze(edgeObj);
this._edgeObjs[e4] = edgeObj;
incrementOrInitEntry(this._preds[w4], v3);
incrementOrInitEntry(this._sucs[v3], w4);
this._in[w4][e4] = edgeObj;
this._out[v3][e4] = edgeObj;
this._edgeCount++;
return this;
};
Graph10.prototype.edge = function(v3, w4, name) {
var e4 = arguments.length === 1 ? edgeObjToId(this._isDirected, arguments[0]) : edgeArgsToId(this._isDirected, v3, w4, name);
return this._edgeLabels[e4];
};
Graph10.prototype.hasEdge = function(v3, w4, name) {
var e4 = arguments.length === 1 ? edgeObjToId(this._isDirected, arguments[0]) : edgeArgsToId(this._isDirected, v3, w4, name);
return _8.has(this._edgeLabels, e4);
};
Graph10.prototype.removeEdge = function(v3, w4, name) {
var e4 = arguments.length === 1 ? edgeObjToId(this._isDirected, arguments[0]) : edgeArgsToId(this._isDirected, v3, w4, name), edge2 = this._edgeObjs[e4];
if (edge2) {
v3 = edge2.v;
w4 = edge2.w;
delete this._edgeLabels[e4];
delete this._edgeObjs[e4];
decrementOrRemoveEntry(this._preds[w4], v3);
decrementOrRemoveEntry(this._sucs[v3], w4);
delete this._in[w4][e4];
delete this._out[v3][e4];
this._edgeCount--;
}
return this;
};
Graph10.prototype.inEdges = function(v3, u3) {
var inV = this._in[v3];
if (inV) {
var edges = _8.values(inV);
if (!u3) {
return edges;
}
return _8.filter(edges, function(edge2) {
return edge2.v === u3;
});
}
};
Graph10.prototype.outEdges = function(v3, w4) {
var outV = this._out[v3];
if (outV) {
var edges = _8.values(outV);
if (!w4) {
return edges;
}
return _8.filter(edges, function(edge2) {
return edge2.w === w4;
});
}
};
Graph10.prototype.nodeEdges = function(v3, w4) {
var inEdges = this.inEdges(v3, w4);
if (inEdges) {
return inEdges.concat(this.outEdges(v3, w4));
}
};
function incrementOrInitEntry(map6, k4) {
if (map6[k4]) {
map6[k4]++;
} else {
map6[k4] = 1;
}
}
function decrementOrRemoveEntry(map6, k4) {
if (!--map6[k4]) {
delete map6[k4];
}
}
function edgeArgsToId(isDirected, v_, w_, name) {
var v3 = "" + v_;
var w4 = "" + w_;
if (!isDirected && v3 > w4) {
var tmp = v3;
v3 = w4;
w4 = tmp;
}
return v3 + EDGE_KEY_DELIM + w4 + EDGE_KEY_DELIM + (_8.isUndefined(name) ? DEFAULT_EDGE_NAME : name);
}
function edgeArgsToObj(isDirected, v_, w_, name) {
var v3 = "" + v_;
var w4 = "" + w_;
if (!isDirected && v3 > w4) {
var tmp = v3;
v3 = w4;
w4 = tmp;
}
var edgeObj = { v: v3, w: w4 };
if (name) {
edgeObj.name = name;
}
return edgeObj;
}
function edgeObjToId(isDirected, edgeObj) {
return edgeArgsToId(isDirected, edgeObj.v, edgeObj.w, edgeObj.name);
}
}
});
// node_modules/@dagrejs/graphlib/lib/version.js
var require_version = __commonJS({
"node_modules/@dagrejs/graphlib/lib/version.js"(exports, module2) {
module2.exports = "2.1.4";
}
});
// node_modules/@dagrejs/graphlib/lib/index.js
var require_lib2 = __commonJS({
"node_modules/@dagrejs/graphlib/lib/index.js"(exports, module2) {
module2.exports = {
Graph: require_graph(),
version: require_version()
};
}
});
// node_modules/@dagrejs/graphlib/lib/json.js
var require_json = __commonJS({
"node_modules/@dagrejs/graphlib/lib/json.js"(exports, module2) {
var _8 = require_lodash2();
var Graph10 = require_graph();
module2.exports = {
write,
read
};
function write(g4) {
var json2 = {
options: {
directed: g4.isDirected(),
multigraph: g4.isMultigraph(),
compound: g4.isCompound()
},
nodes: writeNodes(g4),
edges: writeEdges(g4)
};
if (!_8.isUndefined(g4.graph())) {
json2.value = _8.clone(g4.graph());
}
return json2;
}
function writeNodes(g4) {
return _8.map(g4.nodes(), function(v3) {
var nodeValue = g4.node(v3), parent = g4.parent(v3), node = { v: v3 };
if (!_8.isUndefined(nodeValue)) {
node.value = nodeValue;
}
if (!_8.isUndefined(parent)) {
node.parent = parent;
}
return node;
});
}
function writeEdges(g4) {
return _8.map(g4.edges(), function(e4) {
var edgeValue = g4.edge(e4), edge2 = { v: e4.v, w: e4.w };
if (!_8.isUndefined(e4.name)) {
edge2.name = e4.name;
}
if (!_8.isUndefined(edgeValue)) {
edge2.value = edgeValue;
}
return edge2;
});
}
function read(json2) {
var g4 = new Graph10(json2.options).setGraph(json2.value);
_8.each(json2.nodes, function(entry) {
g4.setNode(entry.v, entry.value);
if (entry.parent) {
g4.setParent(entry.v, entry.parent);
}
});
_8.each(json2.edges, function(entry) {
g4.setEdge({ v: entry.v, w: entry.w, name: entry.name }, entry.value);
});
return g4;
}
}
});
// node_modules/@dagrejs/graphlib/lib/alg/components.js
var require_components = __commonJS({
"node_modules/@dagrejs/graphlib/lib/alg/components.js"(exports, module2) {
var _8 = require_lodash2();
module2.exports = components;
function components(g4) {
var visited = {}, cmpts = [], cmpt;
function dfs2(v3) {
if (_8.has(visited, v3))
return;
visited[v3] = true;
cmpt.push(v3);
_8.each(g4.successors(v3), dfs2);
_8.each(g4.predecessors(v3), dfs2);
}
_8.each(g4.nodes(), function(v3) {
cmpt = [];
dfs2(v3);
if (cmpt.length) {
cmpts.push(cmpt);
}
});
return cmpts;
}
}
});
// node_modules/@dagrejs/graphlib/lib/data/priority-queue.js
var require_priority_queue = __commonJS({
"node_modules/@dagrejs/graphlib/lib/data/priority-queue.js"(exports, module2) {
var _8 = require_lodash2();
module2.exports = PriorityQueue;
function PriorityQueue() {
this._arr = [];
this._keyIndices = {};
}
PriorityQueue.prototype.size = function() {
return this._arr.length;
};
PriorityQueue.prototype.keys = function() {
return this._arr.map(function(x6) {
return x6.key;
});
};
PriorityQueue.prototype.has = function(key) {
return _8.has(this._keyIndices, key);
};
PriorityQueue.prototype.priority = function(key) {
var index2 = this._keyIndices[key];
if (index2 !== void 0) {
return this._arr[index2].priority;
}
};
PriorityQueue.prototype.min = function() {
if (this.size() === 0) {
throw new Error("Queue underflow");
}
return this._arr[0].key;
};
PriorityQueue.prototype.add = function(key, priority) {
var keyIndices = this._keyIndices;
key = String(key);
if (!_8.has(keyIndices, key)) {
var arr = this._arr;
var index2 = arr.length;
keyIndices[key] = index2;
arr.push({ key, priority });
this._decrease(index2);
return true;
}
return false;
};
PriorityQueue.prototype.removeMin = function() {
this._swap(0, this._arr.length - 1);
var min7 = this._arr.pop();
delete this._keyIndices[min7.key];
this._heapify(0);
return min7.key;
};
PriorityQueue.prototype.decrease = function(key, priority) {
var index2 = this._keyIndices[key];
if (priority > this._arr[index2].priority) {
throw new Error("New priority is greater than current priority. Key: " + key + " Old: " + this._arr[index2].priority + " New: " + priority);
}
this._arr[index2].priority = priority;
this._decrease(index2);
};
PriorityQueue.prototype._heapify = function(i4) {
var arr = this._arr;
var l4 = 2 * i4, r4 = l4 + 1, largest = i4;
if (l4 < arr.length) {
largest = arr[l4].priority < arr[largest].priority ? l4 : largest;
if (r4 < arr.length) {
largest = arr[r4].priority < arr[largest].priority ? r4 : largest;
}
if (largest !== i4) {
this._swap(i4, largest);
this._heapify(largest);
}
}
};
PriorityQueue.prototype._decrease = function(index2) {
var arr = this._arr;
var priority = arr[index2].priority;
var parent;
while (index2 !== 0) {
parent = index2 >> 1;
if (arr[parent].priority < priority) {
break;
}
this._swap(index2, parent);
index2 = parent;
}
};
PriorityQueue.prototype._swap = function(i4, j4) {
var arr = this._arr;
var keyIndices = this._keyIndices;
var origArrI = arr[i4];
var origArrJ = arr[j4];
arr[i4] = origArrJ;
arr[j4] = origArrI;
keyIndices[origArrJ.key] = i4;
keyIndices[origArrI.key] = j4;
};
}
});
// node_modules/@dagrejs/graphlib/lib/alg/dijkstra.js
var require_dijkstra = __commonJS({
"node_modules/@dagrejs/graphlib/lib/alg/dijkstra.js"(exports, module2) {
var _8 = require_lodash2();
var PriorityQueue = require_priority_queue();
module2.exports = dijkstra3;
var DEFAULT_WEIGHT_FUNC = _8.constant(1);
function dijkstra3(g4, source, weightFn, edgeFn) {
return runDijkstra(g4, String(source), weightFn || DEFAULT_WEIGHT_FUNC, edgeFn || function(v3) {
return g4.outEdges(v3);
});
}
function runDijkstra(g4, source, weightFn, edgeFn) {
var results = {}, pq = new PriorityQueue(), v3, vEntry;
var updateNeighbors = function(edge2) {
var w4 = edge2.v !== v3 ? edge2.v : edge2.w, wEntry = results[w4], weight = weightFn(edge2), distance15 = vEntry.distance + weight;
if (weight < 0) {
throw new Error("dijkstra does not allow negative edge weights. Bad edge: " + edge2 + " Weight: " + weight);
}
if (distance15 < wEntry.distance) {
wEntry.distance = distance15;
wEntry.predecessor = v3;
pq.decrease(w4, distance15);
}
};
g4.nodes().forEach(function(v4) {
var distance15 = v4 === source ? 0 : Number.POSITIVE_INFINITY;
results[v4] = { distance: distance15 };
pq.add(v4, distance15);
});
while (pq.size() > 0) {
v3 = pq.removeMin();
vEntry = results[v3];
if (vEntry.distance === Number.POSITIVE_INFINITY) {
break;
}
edgeFn(v3).forEach(updateNeighbors);
}
return results;
}
}
});
// node_modules/@dagrejs/graphlib/lib/alg/dijkstra-all.js
var require_dijkstra_all = __commonJS({
"node_modules/@dagrejs/graphlib/lib/alg/dijkstra-all.js"(exports, module2) {
var dijkstra3 = require_dijkstra();
var _8 = require_lodash2();
module2.exports = dijkstraAll;
function dijkstraAll(g4, weightFunc, edgeFunc) {
return _8.transform(g4.nodes(), function(acc, v3) {
acc[v3] = dijkstra3(g4, v3, weightFunc, edgeFunc);
}, {});
}
}
});
// node_modules/@dagrejs/graphlib/lib/alg/tarjan.js
var require_tarjan = __commonJS({
"node_modules/@dagrejs/graphlib/lib/alg/tarjan.js"(exports, module2) {
var _8 = require_lodash2();
module2.exports = tarjan;
function tarjan(g4) {
var index2 = 0, stack = [], visited = {}, results = [];
function dfs2(v3) {
var entry = visited[v3] = {
onStack: true,
lowlink: index2,
index: index2++
};
stack.push(v3);
g4.successors(v3).forEach(function(w5) {
if (!_8.has(visited, w5)) {
dfs2(w5);
entry.lowlink = Math.min(entry.lowlink, visited[w5].lowlink);
} else if (visited[w5].onStack) {
entry.lowlink = Math.min(entry.lowlink, visited[w5].index);
}
});
if (entry.lowlink === entry.index) {
var cmpt = [], w4;
do {
w4 = stack.pop();
visited[w4].onStack = false;
cmpt.push(w4);
} while (v3 !== w4);
results.push(cmpt);
}
}
g4.nodes().forEach(function(v3) {
if (!_8.has(visited, v3)) {
dfs2(v3);
}
});
return results;
}
}
});
// node_modules/@dagrejs/graphlib/lib/alg/find-cycles.js
var require_find_cycles = __commonJS({
"node_modules/@dagrejs/graphlib/lib/alg/find-cycles.js"(exports, module2) {
var _8 = require_lodash2();
var tarjan = require_tarjan();
module2.exports = findCycles;
function findCycles(g4) {
return _8.filter(tarjan(g4), function(cmpt) {
return cmpt.length > 1 || cmpt.length === 1 && g4.hasEdge(cmpt[0], cmpt[0]);
});
}
}
});
// node_modules/@dagrejs/graphlib/lib/alg/floyd-warshall.js
var require_floyd_warshall = __commonJS({
"node_modules/@dagrejs/graphlib/lib/alg/floyd-warshall.js"(exports, module2) {
var _8 = require_lodash2();
module2.exports = floydWarshall6;
var DEFAULT_WEIGHT_FUNC = _8.constant(1);
function floydWarshall6(g4, weightFn, edgeFn) {
return runFloydWarshall(g4, weightFn || DEFAULT_WEIGHT_FUNC, edgeFn || function(v3) {
return g4.outEdges(v3);
});
}
function runFloydWarshall(g4, weightFn, edgeFn) {
var results = {}, nodes = g4.nodes();
nodes.forEach(function(v3) {
results[v3] = {};
results[v3][v3] = { distance: 0 };
nodes.forEach(function(w4) {
if (v3 !== w4) {
results[v3][w4] = { distance: Number.POSITIVE_INFINITY };
}
});
edgeFn(v3).forEach(function(edge2) {
var w4 = edge2.v === v3 ? edge2.w : edge2.v, d3 = weightFn(edge2);
results[v3][w4] = { distance: d3, predecessor: v3 };
});
});
nodes.forEach(function(k4) {
var rowK = results[k4];
nodes.forEach(function(i4) {
var rowI = results[i4];
nodes.forEach(function(j4) {
var ik = rowI[k4];
var kj = rowK[j4];
var ij = rowI[j4];
var altDistance = ik.distance + kj.distance;
if (altDistance < ij.distance) {
ij.distance = altDistance;
ij.predecessor = kj.predecessor;
}
});
});
});
return results;
}
}
});
// node_modules/@dagrejs/graphlib/lib/alg/topsort.js
var require_topsort = __commonJS({
"node_modules/@dagrejs/graphlib/lib/alg/topsort.js"(exports, module2) {
var _8 = require_lodash2();
module2.exports = topsort;
topsort.CycleException = CycleException;
function topsort(g4) {
var visited = {}, stack = {}, results = [];
function visit(node) {
if (_8.has(stack, node)) {
throw new CycleException();
}
if (!_8.has(visited, node)) {
stack[node] = true;
visited[node] = true;
_8.each(g4.predecessors(node), visit);
delete stack[node];
results.push(node);
}
}
_8.each(g4.sinks(), visit);
if (_8.size(visited) !== g4.nodeCount()) {
throw new CycleException();
}
return results;
}
function CycleException() {
}
}
});
// node_modules/@dagrejs/graphlib/lib/alg/is-acyclic.js
var require_is_acyclic = __commonJS({
"node_modules/@dagrejs/graphlib/lib/alg/is-acyclic.js"(exports, module2) {
var topsort = require_topsort();
module2.exports = isAcyclic;
function isAcyclic(g4) {
try {
topsort(g4);
} catch (e4) {
if (e4 instanceof topsort.CycleException) {
return false;
}
throw e4;
}
return true;
}
}
});
// node_modules/@dagrejs/graphlib/lib/alg/dfs.js
var require_dfs = __commonJS({
"node_modules/@dagrejs/graphlib/lib/alg/dfs.js"(exports, module2) {
var _8 = require_lodash2();
module2.exports = dfs2;
function dfs2(g4, vs, order2) {
if (!_8.isArray(vs)) {
vs = [vs];
}
var navigation = (g4.isDirected() ? g4.successors : g4.neighbors).bind(g4);
var acc = [], visited = {};
_8.each(vs, function(v3) {
if (!g4.hasNode(v3)) {
throw new Error("Graph does not have node: " + v3);
}
doDfs(g4, v3, order2 === "post", visited, navigation, acc);
});
return acc;
}
function doDfs(g4, v3, postorder3, visited, navigation, acc) {
if (!_8.has(visited, v3)) {
visited[v3] = true;
if (!postorder3) {
acc.push(v3);
}
_8.each(navigation(v3), function(w4) {
doDfs(g4, w4, postorder3, visited, navigation, acc);
});
if (postorder3) {
acc.push(v3);
}
}
}
}
});
// node_modules/@dagrejs/graphlib/lib/alg/postorder.js
var require_postorder = __commonJS({
"node_modules/@dagrejs/graphlib/lib/alg/postorder.js"(exports, module2) {
var dfs2 = require_dfs();
module2.exports = postorder3;
function postorder3(g4, vs) {
return dfs2(g4, vs, "post");
}
}
});
// node_modules/@dagrejs/graphlib/lib/alg/preorder.js
var require_preorder = __commonJS({
"node_modules/@dagrejs/graphlib/lib/alg/preorder.js"(exports, module2) {
var dfs2 = require_dfs();
module2.exports = preorder2;
function preorder2(g4, vs) {
return dfs2(g4, vs, "pre");
}
}
});
// node_modules/@dagrejs/graphlib/lib/alg/prim.js
var require_prim = __commonJS({
"node_modules/@dagrejs/graphlib/lib/alg/prim.js"(exports, module2) {
var _8 = require_lodash2();
var Graph10 = require_graph();
var PriorityQueue = require_priority_queue();
module2.exports = prim;
function prim(g4, weightFunc) {
var result = new Graph10(), parents = {}, pq = new PriorityQueue(), v3;
function updateNeighbors(edge2) {
var w4 = edge2.v === v3 ? edge2.w : edge2.v, pri = pq.priority(w4);
if (pri !== void 0) {
var edgeWeight = weightFunc(edge2);
if (edgeWeight < pri) {
parents[w4] = v3;
pq.decrease(w4, edgeWeight);
}
}
}
if (g4.nodeCount() === 0) {
return result;
}
_8.each(g4.nodes(), function(v4) {
pq.add(v4, Number.POSITIVE_INFINITY);
result.setNode(v4);
});
pq.decrease(g4.nodes()[0], 0);
var init = false;
while (pq.size() > 0) {
v3 = pq.removeMin();
if (_8.has(parents, v3)) {
result.setEdge(v3, parents[v3]);
} else if (init) {
throw new Error("Input graph is not connected: " + g4);
} else {
init = true;
}
g4.nodeEdges(v3).forEach(updateNeighbors);
}
return result;
}
}
});
// node_modules/@dagrejs/graphlib/lib/alg/index.js
var require_alg = __commonJS({
"node_modules/@dagrejs/graphlib/lib/alg/index.js"(exports, module2) {
module2.exports = {
components: require_components(),
dijkstra: require_dijkstra(),
dijkstraAll: require_dijkstra_all(),
findCycles: require_find_cycles(),
floydWarshall: require_floyd_warshall(),
isAcyclic: require_is_acyclic(),
postorder: require_postorder(),
preorder: require_preorder(),
prim: require_prim(),
tarjan: require_tarjan(),
topsort: require_topsort()
};
}
});
// node_modules/@dagrejs/graphlib/index.js
var require_graphlib = __commonJS({
"node_modules/@dagrejs/graphlib/index.js"(exports, module2) {
var lib = require_lib2();
module2.exports = {
Graph: lib.Graph,
json: require_json(),
alg: require_alg(),
version: lib.version
};
}
});
// node_modules/regenerator-runtime/runtime.js
var require_runtime = __commonJS({
"node_modules/regenerator-runtime/runtime.js"(exports, module2) {
var runtime = function(exports2) {
"use strict";
var Op = Object.prototype;
var hasOwn = Op.hasOwnProperty;
var undefined2;
var $Symbol = typeof Symbol === "function" ? Symbol : {};
var iteratorSymbol = $Symbol.iterator || "@@iterator";
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define2(obj, key, value2) {
Object.defineProperty(obj, key, {
value: value2,
enumerable: true,
configurable: true,
writable: true
});
return obj[key];
}
try {
define2({}, "");
} catch (err) {
define2 = function(obj, key, value2) {
return obj[key] = value2;
};
}
function wrap(innerFn, outerFn, self2, tryLocsList) {
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
var generator = Object.create(protoGenerator.prototype);
var context = new Context2(tryLocsList || []);
generator._invoke = makeInvokeMethod(innerFn, self2, context);
return generator;
}
exports2.wrap = wrap;
function tryCatch(fn2, obj, arg) {
try {
return { type: "normal", arg: fn2.call(obj, arg) };
} catch (err) {
return { type: "throw", arg: err };
}
}
var GenStateSuspendedStart = "suspendedStart";
var GenStateSuspendedYield = "suspendedYield";
var GenStateExecuting = "executing";
var GenStateCompleted = "completed";
var ContinueSentinel = {};
function Generator() {
}
function GeneratorFunction() {
}
function GeneratorFunctionPrototype() {
}
var IteratorPrototype = {};
define2(IteratorPrototype, iteratorSymbol, function() {
return this;
});
var getProto = Object.getPrototypeOf;
var NativeIteratorPrototype = getProto && getProto(getProto(values2([])));
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
IteratorPrototype = NativeIteratorPrototype;
}
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
GeneratorFunction.prototype = GeneratorFunctionPrototype;
define2(Gp, "constructor", GeneratorFunctionPrototype);
define2(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
GeneratorFunction.displayName = define2(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
define2(prototype, method, function(arg) {
return this._invoke(method, arg);
});
});
}
exports2.isGeneratorFunction = function(genFun) {
var ctor = typeof genFun === "function" && genFun.constructor;
return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
};
exports2.mark = function(genFun) {
if (Object.setPrototypeOf) {
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
} else {
genFun.__proto__ = GeneratorFunctionPrototype;
define2(genFun, toStringTagSymbol, "GeneratorFunction");
}
genFun.prototype = Object.create(Gp);
return genFun;
};
exports2.awrap = function(arg) {
return { __await: arg };
};
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if (record.type === "throw") {
reject(record.arg);
} else {
var result = record.arg;
var value2 = result.value;
if (value2 && typeof value2 === "object" && hasOwn.call(value2, "__await")) {
return PromiseImpl.resolve(value2.__await).then(function(value3) {
invoke("next", value3, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
});
}
return PromiseImpl.resolve(value2).then(function(unwrapped) {
result.value = unwrapped;
resolve(result);
}, function(error) {
return invoke("throw", error, resolve, reject);
});
}
}
var previousPromise;
function enqueue(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
}
this._invoke = enqueue;
}
defineIteratorMethods(AsyncIterator.prototype);
define2(AsyncIterator.prototype, asyncIteratorSymbol, function() {
return this;
});
exports2.AsyncIterator = AsyncIterator;
exports2.async = function(innerFn, outerFn, self2, tryLocsList, PromiseImpl) {
if (PromiseImpl === void 0)
PromiseImpl = Promise;
var iter = new AsyncIterator(wrap(innerFn, outerFn, self2, tryLocsList), PromiseImpl);
return exports2.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
};
function makeInvokeMethod(innerFn, self2, context) {
var state2 = GenStateSuspendedStart;
return function invoke(method, arg) {
if (state2 === GenStateExecuting) {
throw new Error("Generator is already running");
}
if (state2 === GenStateCompleted) {
if (method === "throw") {
throw arg;
}
return doneResult();
}
context.method = method;
context.arg = arg;
while (true) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel)
continue;
return delegateResult;
}
}
if (context.method === "next") {
context.sent = context._sent = context.arg;
} else if (context.method === "throw") {
if (state2 === GenStateSuspendedStart) {
state2 = GenStateCompleted;
throw context.arg;
}
context.dispatchException(context.arg);
} else if (context.method === "return") {
context.abrupt("return", context.arg);
}
state2 = GenStateExecuting;
var record = tryCatch(innerFn, self2, context);
if (record.type === "normal") {
state2 = context.done ? GenStateCompleted : GenStateSuspendedYield;
if (record.arg === ContinueSentinel) {
continue;
}
return {
value: record.arg,
done: context.done
};
} else if (record.type === "throw") {
state2 = GenStateCompleted;
context.method = "throw";
context.arg = record.arg;
}
}
};
}
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (method === undefined2) {
context.delegate = null;
if (context.method === "throw") {
if (delegate.iterator["return"]) {
context.method = "return";
context.arg = undefined2;
maybeInvokeDelegate(delegate, context);
if (context.method === "throw") {
return ContinueSentinel;
}
}
context.method = "throw";
context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if (record.type === "throw") {
context.method = "throw";
context.arg = record.arg;
context.delegate = null;
return ContinueSentinel;
}
var info = record.arg;
if (!info) {
context.method = "throw";
context.arg = new TypeError("iterator result is not an object");
context.delegate = null;
return ContinueSentinel;
}
if (info.done) {
context[delegate.resultName] = info.value;
context.next = delegate.nextLoc;
if (context.method !== "return") {
context.method = "next";
context.arg = undefined2;
}
} else {
return info;
}
context.delegate = null;
return ContinueSentinel;
}
defineIteratorMethods(Gp);
define2(Gp, toStringTagSymbol, "Generator");
define2(Gp, iteratorSymbol, function() {
return this;
});
define2(Gp, "toString", function() {
return "[object Generator]";
});
function pushTryEntry(locs) {
var entry = { tryLoc: locs[0] };
if (1 in locs) {
entry.catchLoc = locs[1];
}
if (2 in locs) {
entry.finallyLoc = locs[2];
entry.afterLoc = locs[3];
}
this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal";
delete record.arg;
entry.completion = record;
}
function Context2(tryLocsList) {
this.tryEntries = [{ tryLoc: "root" }];
tryLocsList.forEach(pushTryEntry, this);
this.reset(true);
}
exports2.keys = function(object) {
var keys2 = [];
for (var key in object) {
keys2.push(key);
}
keys2.reverse();
return function next() {
while (keys2.length) {
var key2 = keys2.pop();
if (key2 in object) {
next.value = key2;
next.done = false;
return next;
}
}
next.done = true;
return next;
};
};
function values2(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) {
return iteratorMethod.call(iterable);
}
if (typeof iterable.next === "function") {
return iterable;
}
if (!isNaN(iterable.length)) {
var i4 = -1, next = function next2() {
while (++i4 < iterable.length) {
if (hasOwn.call(iterable, i4)) {
next2.value = iterable[i4];
next2.done = false;
return next2;
}
}
next2.value = undefined2;
next2.done = true;
return next2;
};
return next.next = next;
}
}
return { next: doneResult };
}
exports2.values = values2;
function doneResult() {
return { value: undefined2, done: true };
}
Context2.prototype = {
constructor: Context2,
reset: function(skipTempReset) {
this.prev = 0;
this.next = 0;
this.sent = this._sent = undefined2;
this.done = false;
this.delegate = null;
this.method = "next";
this.arg = undefined2;
this.tryEntries.forEach(resetTryEntry);
if (!skipTempReset) {
for (var name in this) {
if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
this[name] = undefined2;
}
}
}
},
stop: function() {
this.done = true;
var rootEntry = this.tryEntries[0];
var rootRecord = rootEntry.completion;
if (rootRecord.type === "throw") {
throw rootRecord.arg;
}
return this.rval;
},
dispatchException: function(exception2) {
if (this.done) {
throw exception2;
}
var context = this;
function handle(loc, caught) {
record.type = "throw";
record.arg = exception2;
context.next = loc;
if (caught) {
context.method = "next";
context.arg = undefined2;
}
return !!caught;
}
for (var i4 = this.tryEntries.length - 1; i4 >= 0; --i4) {
var entry = this.tryEntries[i4];
var record = entry.completion;
if (entry.tryLoc === "root") {
return handle("end");
}
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc");
var hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
} else if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else if (hasCatch) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
}
} else if (hasFinally) {
if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else {
throw new Error("try statement without catch or finally");
}
}
}
},
abrupt: function(type2, arg) {
for (var i4 = this.tryEntries.length - 1; i4 >= 0; --i4) {
var entry = this.tryEntries[i4];
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
if (finallyEntry && (type2 === "break" || type2 === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
finallyEntry = null;
}
var record = finallyEntry ? finallyEntry.completion : {};
record.type = type2;
record.arg = arg;
if (finallyEntry) {
this.method = "next";
this.next = finallyEntry.finallyLoc;
return ContinueSentinel;
}
return this.complete(record);
},
complete: function(record, afterLoc) {
if (record.type === "throw") {
throw record.arg;
}
if (record.type === "break" || record.type === "continue") {
this.next = record.arg;
} else if (record.type === "return") {
this.rval = this.arg = record.arg;
this.method = "return";
this.next = "end";
} else if (record.type === "normal" && afterLoc) {
this.next = afterLoc;
}
return ContinueSentinel;
},
finish: function(finallyLoc) {
for (var i4 = this.tryEntries.length - 1; i4 >= 0; --i4) {
var entry = this.tryEntries[i4];
if (entry.finallyLoc === finallyLoc) {
this.complete(entry.completion, entry.afterLoc);
resetTryEntry(entry);
return ContinueSentinel;
}
}
},
"catch": function(tryLoc) {
for (var i4 = this.tryEntries.length - 1; i4 >= 0; --i4) {
var entry = this.tryEntries[i4];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if (record.type === "throw") {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function(iterable, resultName, nextLoc) {
this.delegate = {
iterator: values2(iterable),
resultName,
nextLoc
};
if (this.method === "next") {
this.arg = undefined2;
}
return ContinueSentinel;
}
};
return exports2;
}(typeof module2 === "object" ? module2.exports : {});
try {
regeneratorRuntime = runtime;
} catch (accidentalStrictMode) {
if (typeof globalThis === "object") {
globalThis.regeneratorRuntime = runtime;
} else {
Function("r", "regeneratorRuntime = r")(runtime);
}
}
}
});
// node_modules/@babel/runtime/regenerator/index.js
var require_regenerator = __commonJS({
"node_modules/@babel/runtime/regenerator/index.js"(exports, module2) {
module2.exports = require_runtime();
}
});
// node_modules/inversify/lib/constants/metadata_keys.js
var require_metadata_keys = __commonJS({
"node_modules/inversify/lib/constants/metadata_keys.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NON_CUSTOM_TAG_KEYS = exports.POST_CONSTRUCT = exports.DESIGN_PARAM_TYPES = exports.PARAM_TYPES = exports.TAGGED_PROP = exports.TAGGED = exports.MULTI_INJECT_TAG = exports.INJECT_TAG = exports.OPTIONAL_TAG = exports.UNMANAGED_TAG = exports.NAME_TAG = exports.NAMED_TAG = void 0;
exports.NAMED_TAG = "named";
exports.NAME_TAG = "name";
exports.UNMANAGED_TAG = "unmanaged";
exports.OPTIONAL_TAG = "optional";
exports.INJECT_TAG = "inject";
exports.MULTI_INJECT_TAG = "multi_inject";
exports.TAGGED = "inversify:tagged";
exports.TAGGED_PROP = "inversify:tagged_props";
exports.PARAM_TYPES = "inversify:paramtypes";
exports.DESIGN_PARAM_TYPES = "design:paramtypes";
exports.POST_CONSTRUCT = "post_construct";
function getNonCustomTagKeys() {
return [
exports.INJECT_TAG,
exports.MULTI_INJECT_TAG,
exports.NAME_TAG,
exports.UNMANAGED_TAG,
exports.NAMED_TAG,
exports.OPTIONAL_TAG
];
}
exports.NON_CUSTOM_TAG_KEYS = getNonCustomTagKeys();
}
});
// node_modules/inversify/lib/constants/literal_types.js
var require_literal_types = __commonJS({
"node_modules/inversify/lib/constants/literal_types.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TargetTypeEnum = exports.BindingTypeEnum = exports.BindingScopeEnum = void 0;
var BindingScopeEnum = {
Request: "Request",
Singleton: "Singleton",
Transient: "Transient"
};
exports.BindingScopeEnum = BindingScopeEnum;
var BindingTypeEnum = {
ConstantValue: "ConstantValue",
Constructor: "Constructor",
DynamicValue: "DynamicValue",
Factory: "Factory",
Function: "Function",
Instance: "Instance",
Invalid: "Invalid",
Provider: "Provider"
};
exports.BindingTypeEnum = BindingTypeEnum;
var TargetTypeEnum = {
ClassProperty: "ClassProperty",
ConstructorArgument: "ConstructorArgument",
Variable: "Variable"
};
exports.TargetTypeEnum = TargetTypeEnum;
}
});
// node_modules/inversify/lib/utils/id.js
var require_id2 = __commonJS({
"node_modules/inversify/lib/utils/id.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.id = void 0;
var idCounter = 0;
function id() {
return idCounter++;
}
exports.id = id;
}
});
// node_modules/inversify/lib/bindings/binding.js
var require_binding = __commonJS({
"node_modules/inversify/lib/bindings/binding.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Binding = void 0;
var literal_types_1 = require_literal_types();
var id_1 = require_id2();
var Binding = function() {
function Binding2(serviceIdentifier, scope) {
this.id = id_1.id();
this.activated = false;
this.serviceIdentifier = serviceIdentifier;
this.scope = scope;
this.type = literal_types_1.BindingTypeEnum.Invalid;
this.constraint = function(request) {
return true;
};
this.implementationType = null;
this.cache = null;
this.factory = null;
this.provider = null;
this.onActivation = null;
this.dynamicValue = null;
}
Binding2.prototype.clone = function() {
var clone10 = new Binding2(this.serviceIdentifier, this.scope);
clone10.activated = clone10.scope === literal_types_1.BindingScopeEnum.Singleton ? this.activated : false;
clone10.implementationType = this.implementationType;
clone10.dynamicValue = this.dynamicValue;
clone10.scope = this.scope;
clone10.type = this.type;
clone10.factory = this.factory;
clone10.provider = this.provider;
clone10.constraint = this.constraint;
clone10.onActivation = this.onActivation;
clone10.cache = this.cache;
return clone10;
};
return Binding2;
}();
exports.Binding = Binding;
}
});
// node_modules/inversify/lib/constants/error_msgs.js
var require_error_msgs = __commonJS({
"node_modules/inversify/lib/constants/error_msgs.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.STACK_OVERFLOW = exports.CIRCULAR_DEPENDENCY_IN_FACTORY = exports.POST_CONSTRUCT_ERROR = exports.MULTIPLE_POST_CONSTRUCT_METHODS = exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = exports.ARGUMENTS_LENGTH_MISMATCH = exports.INVALID_DECORATOR_OPERATION = exports.INVALID_TO_SELF_VALUE = exports.INVALID_FUNCTION_BINDING = exports.INVALID_MIDDLEWARE_RETURN = exports.NO_MORE_SNAPSHOTS_AVAILABLE = exports.INVALID_BINDING_TYPE = exports.NOT_IMPLEMENTED = exports.CIRCULAR_DEPENDENCY = exports.UNDEFINED_INJECT_ANNOTATION = exports.MISSING_INJECT_ANNOTATION = exports.MISSING_INJECTABLE_ANNOTATION = exports.NOT_REGISTERED = exports.CANNOT_UNBIND = exports.AMBIGUOUS_MATCH = exports.KEY_NOT_FOUND = exports.NULL_ARGUMENT = exports.DUPLICATED_METADATA = exports.DUPLICATED_INJECTABLE_DECORATOR = void 0;
exports.DUPLICATED_INJECTABLE_DECORATOR = "Cannot apply @injectable decorator multiple times.";
exports.DUPLICATED_METADATA = "Metadata key was used more than once in a parameter:";
exports.NULL_ARGUMENT = "NULL argument";
exports.KEY_NOT_FOUND = "Key Not Found";
exports.AMBIGUOUS_MATCH = "Ambiguous match found for serviceIdentifier:";
exports.CANNOT_UNBIND = "Could not unbind serviceIdentifier:";
exports.NOT_REGISTERED = "No matching bindings found for serviceIdentifier:";
exports.MISSING_INJECTABLE_ANNOTATION = "Missing required @injectable annotation in:";
exports.MISSING_INJECT_ANNOTATION = "Missing required @inject or @multiInject annotation in:";
var UNDEFINED_INJECT_ANNOTATION = function(name) {
return "@inject called with undefined this could mean that the class " + name + " has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation.";
};
exports.UNDEFINED_INJECT_ANNOTATION = UNDEFINED_INJECT_ANNOTATION;
exports.CIRCULAR_DEPENDENCY = "Circular dependency found:";
exports.NOT_IMPLEMENTED = "Sorry, this feature is not fully implemented yet.";
exports.INVALID_BINDING_TYPE = "Invalid binding type:";
exports.NO_MORE_SNAPSHOTS_AVAILABLE = "No snapshot available to restore.";
exports.INVALID_MIDDLEWARE_RETURN = "Invalid return type in middleware. Middleware must return!";
exports.INVALID_FUNCTION_BINDING = "Value provided to function binding must be a function!";
exports.INVALID_TO_SELF_VALUE = "The toSelf function can only be applied when a constructor is used as service identifier";
exports.INVALID_DECORATOR_OPERATION = "The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.";
var ARGUMENTS_LENGTH_MISMATCH = function() {
var values2 = [];
for (var _i = 0; _i < arguments.length; _i++) {
values2[_i] = arguments[_i];
}
return "The number of constructor arguments in the derived class " + (values2[0] + " must be >= than the number of constructor arguments of its base class.");
};
exports.ARGUMENTS_LENGTH_MISMATCH = ARGUMENTS_LENGTH_MISMATCH;
exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = "Invalid Container constructor argument. Container options must be an object.";
exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = "Invalid Container option. Default scope must be a string ('singleton' or 'transient').";
exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = "Invalid Container option. Auto bind injectable must be a boolean";
exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = "Invalid Container option. Skip base check must be a boolean";
exports.MULTIPLE_POST_CONSTRUCT_METHODS = "Cannot apply @postConstruct decorator multiple times in the same class";
var POST_CONSTRUCT_ERROR = function() {
var values2 = [];
for (var _i = 0; _i < arguments.length; _i++) {
values2[_i] = arguments[_i];
}
return "@postConstruct error in class " + values2[0] + ": " + values2[1];
};
exports.POST_CONSTRUCT_ERROR = POST_CONSTRUCT_ERROR;
var CIRCULAR_DEPENDENCY_IN_FACTORY = function() {
var values2 = [];
for (var _i = 0; _i < arguments.length; _i++) {
values2[_i] = arguments[_i];
}
return "It looks like there is a circular dependency " + ("in one of the '" + values2[0] + "' bindings. Please investigate bindings with") + ("service identifier '" + values2[1] + "'.");
};
exports.CIRCULAR_DEPENDENCY_IN_FACTORY = CIRCULAR_DEPENDENCY_IN_FACTORY;
exports.STACK_OVERFLOW = "Maximum call stack size exceeded";
}
});
// node_modules/inversify/lib/planning/metadata_reader.js
var require_metadata_reader = __commonJS({
"node_modules/inversify/lib/planning/metadata_reader.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MetadataReader = void 0;
var METADATA_KEY = require_metadata_keys();
var MetadataReader = function() {
function MetadataReader2() {
}
MetadataReader2.prototype.getConstructorMetadata = function(constructorFunc) {
var compilerGeneratedMetadata = Reflect.getMetadata(METADATA_KEY.PARAM_TYPES, constructorFunc);
var userGeneratedMetadata = Reflect.getMetadata(METADATA_KEY.TAGGED, constructorFunc);
return {
compilerGeneratedMetadata,
userGeneratedMetadata: userGeneratedMetadata || {}
};
};
MetadataReader2.prototype.getPropertiesMetadata = function(constructorFunc) {
var userGeneratedMetadata = Reflect.getMetadata(METADATA_KEY.TAGGED_PROP, constructorFunc) || [];
return userGeneratedMetadata;
};
return MetadataReader2;
}();
exports.MetadataReader = MetadataReader;
}
});
// node_modules/inversify/lib/bindings/binding_count.js
var require_binding_count = __commonJS({
"node_modules/inversify/lib/bindings/binding_count.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BindingCount = void 0;
var BindingCount = {
MultipleBindingsAvailable: 2,
NoBindingsAvailable: 0,
OnlyOneBindingAvailable: 1
};
exports.BindingCount = BindingCount;
}
});
// node_modules/inversify/lib/utils/exceptions.js
var require_exceptions = __commonJS({
"node_modules/inversify/lib/utils/exceptions.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isStackOverflowExeption = void 0;
var ERROR_MSGS = require_error_msgs();
function isStackOverflowExeption(error) {
return error instanceof RangeError || error.message === ERROR_MSGS.STACK_OVERFLOW;
}
exports.isStackOverflowExeption = isStackOverflowExeption;
}
});
// node_modules/inversify/lib/utils/serialization.js
var require_serialization = __commonJS({
"node_modules/inversify/lib/utils/serialization.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.circularDependencyToException = exports.listMetadataForTarget = exports.listRegisteredBindingsForServiceIdentifier = exports.getServiceIdentifierAsString = exports.getFunctionName = void 0;
var ERROR_MSGS = require_error_msgs();
function getServiceIdentifierAsString(serviceIdentifier) {
if (typeof serviceIdentifier === "function") {
var _serviceIdentifier = serviceIdentifier;
return _serviceIdentifier.name;
} else if (typeof serviceIdentifier === "symbol") {
return serviceIdentifier.toString();
} else {
var _serviceIdentifier = serviceIdentifier;
return _serviceIdentifier;
}
}
exports.getServiceIdentifierAsString = getServiceIdentifierAsString;
function listRegisteredBindingsForServiceIdentifier(container2, serviceIdentifier, getBindings) {
var registeredBindingsList = "";
var registeredBindings = getBindings(container2, serviceIdentifier);
if (registeredBindings.length !== 0) {
registeredBindingsList = "\nRegistered bindings:";
registeredBindings.forEach(function(binding) {
var name = "Object";
if (binding.implementationType !== null) {
name = getFunctionName(binding.implementationType);
}
registeredBindingsList = registeredBindingsList + "\n " + name;
if (binding.constraint.metaData) {
registeredBindingsList = registeredBindingsList + " - " + binding.constraint.metaData;
}
});
}
return registeredBindingsList;
}
exports.listRegisteredBindingsForServiceIdentifier = listRegisteredBindingsForServiceIdentifier;
function alreadyDependencyChain(request, serviceIdentifier) {
if (request.parentRequest === null) {
return false;
} else if (request.parentRequest.serviceIdentifier === serviceIdentifier) {
return true;
} else {
return alreadyDependencyChain(request.parentRequest, serviceIdentifier);
}
}
function dependencyChainToString(request) {
function _createStringArr(req, result) {
if (result === void 0) {
result = [];
}
var serviceIdentifier = getServiceIdentifierAsString(req.serviceIdentifier);
result.push(serviceIdentifier);
if (req.parentRequest !== null) {
return _createStringArr(req.parentRequest, result);
}
return result;
}
var stringArr = _createStringArr(request);
return stringArr.reverse().join(" --> ");
}
function circularDependencyToException(request) {
request.childRequests.forEach(function(childRequest) {
if (alreadyDependencyChain(childRequest, childRequest.serviceIdentifier)) {
var services = dependencyChainToString(childRequest);
throw new Error(ERROR_MSGS.CIRCULAR_DEPENDENCY + " " + services);
} else {
circularDependencyToException(childRequest);
}
});
}
exports.circularDependencyToException = circularDependencyToException;
function listMetadataForTarget(serviceIdentifierString, target) {
if (target.isTagged() || target.isNamed()) {
var m_1 = "";
var namedTag = target.getNamedTag();
var otherTags = target.getCustomTags();
if (namedTag !== null) {
m_1 += namedTag.toString() + "\n";
}
if (otherTags !== null) {
otherTags.forEach(function(tag) {
m_1 += tag.toString() + "\n";
});
}
return " " + serviceIdentifierString + "\n " + serviceIdentifierString + " - " + m_1;
} else {
return " " + serviceIdentifierString;
}
}
exports.listMetadataForTarget = listMetadataForTarget;
function getFunctionName(v3) {
if (v3.name) {
return v3.name;
} else {
var name_1 = v3.toString();
var match = name_1.match(/^function\s*([^\s(]+)/);
return match ? match[1] : "Anonymous function: " + name_1;
}
}
exports.getFunctionName = getFunctionName;
}
});
// node_modules/inversify/lib/planning/context.js
var require_context = __commonJS({
"node_modules/inversify/lib/planning/context.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Context = void 0;
var id_1 = require_id2();
var Context2 = function() {
function Context3(container2) {
this.id = id_1.id();
this.container = container2;
}
Context3.prototype.addPlan = function(plan) {
this.plan = plan;
};
Context3.prototype.setCurrentRequest = function(currentRequest) {
this.currentRequest = currentRequest;
};
return Context3;
}();
exports.Context = Context2;
}
});
// node_modules/inversify/lib/planning/metadata.js
var require_metadata = __commonJS({
"node_modules/inversify/lib/planning/metadata.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Metadata = void 0;
var METADATA_KEY = require_metadata_keys();
var Metadata = function() {
function Metadata2(key, value2) {
this.key = key;
this.value = value2;
}
Metadata2.prototype.toString = function() {
if (this.key === METADATA_KEY.NAMED_TAG) {
return "named: " + this.value.toString() + " ";
} else {
return "tagged: { key:" + this.key.toString() + ", value: " + this.value + " }";
}
};
return Metadata2;
}();
exports.Metadata = Metadata;
}
});
// node_modules/inversify/lib/planning/plan.js
var require_plan = __commonJS({
"node_modules/inversify/lib/planning/plan.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Plan = void 0;
var Plan = function() {
function Plan2(parentContext, rootRequest) {
this.parentContext = parentContext;
this.rootRequest = rootRequest;
}
return Plan2;
}();
exports.Plan = Plan;
}
});
// node_modules/inversify/lib/annotation/decorator_utils.js
var require_decorator_utils = __commonJS({
"node_modules/inversify/lib/annotation/decorator_utils.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.tagProperty = exports.tagParameter = exports.decorate = void 0;
var ERROR_MSGS = require_error_msgs();
var METADATA_KEY = require_metadata_keys();
function tagParameter(annotationTarget, propertyName, parameterIndex, metadata) {
var metadataKey = METADATA_KEY.TAGGED;
_tagParameterOrProperty(metadataKey, annotationTarget, propertyName, metadata, parameterIndex);
}
exports.tagParameter = tagParameter;
function tagProperty(annotationTarget, propertyName, metadata) {
var metadataKey = METADATA_KEY.TAGGED_PROP;
_tagParameterOrProperty(metadataKey, annotationTarget.constructor, propertyName, metadata);
}
exports.tagProperty = tagProperty;
function _tagParameterOrProperty(metadataKey, annotationTarget, propertyName, metadata, parameterIndex) {
var paramsOrPropertiesMetadata = {};
var isParameterDecorator = typeof parameterIndex === "number";
var key = parameterIndex !== void 0 && isParameterDecorator ? parameterIndex.toString() : propertyName;
if (isParameterDecorator && propertyName !== void 0) {
throw new Error(ERROR_MSGS.INVALID_DECORATOR_OPERATION);
}
if (Reflect.hasOwnMetadata(metadataKey, annotationTarget)) {
paramsOrPropertiesMetadata = Reflect.getMetadata(metadataKey, annotationTarget);
}
var paramOrPropertyMetadata = paramsOrPropertiesMetadata[key];
if (!Array.isArray(paramOrPropertyMetadata)) {
paramOrPropertyMetadata = [];
} else {
for (var _i = 0, paramOrPropertyMetadata_1 = paramOrPropertyMetadata; _i < paramOrPropertyMetadata_1.length; _i++) {
var m4 = paramOrPropertyMetadata_1[_i];
if (m4.key === metadata.key) {
throw new Error(ERROR_MSGS.DUPLICATED_METADATA + " " + m4.key.toString());
}
}
}
paramOrPropertyMetadata.push(metadata);
paramsOrPropertiesMetadata[key] = paramOrPropertyMetadata;
Reflect.defineMetadata(metadataKey, paramsOrPropertiesMetadata, annotationTarget);
}
function _decorate(decorators, target) {
Reflect.decorate(decorators, target);
}
function _param(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
}
function decorate(decorator, target, parameterIndex) {
if (typeof parameterIndex === "number") {
_decorate([_param(parameterIndex, decorator)], target);
} else if (typeof parameterIndex === "string") {
Reflect.decorate([decorator], target, parameterIndex);
} else {
_decorate([decorator], target);
}
}
exports.decorate = decorate;
}
});
// node_modules/inversify/lib/annotation/inject.js
var require_inject = __commonJS({
"node_modules/inversify/lib/annotation/inject.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.inject = exports.LazyServiceIdentifer = void 0;
var error_msgs_1 = require_error_msgs();
var METADATA_KEY = require_metadata_keys();
var metadata_1 = require_metadata();
var decorator_utils_1 = require_decorator_utils();
var LazyServiceIdentifer = function() {
function LazyServiceIdentifer2(cb) {
this._cb = cb;
}
LazyServiceIdentifer2.prototype.unwrap = function() {
return this._cb();
};
return LazyServiceIdentifer2;
}();
exports.LazyServiceIdentifer = LazyServiceIdentifer;
function inject24(serviceIdentifier) {
return function(target, targetKey, index2) {
if (serviceIdentifier === void 0) {
throw new Error(error_msgs_1.UNDEFINED_INJECT_ANNOTATION(target.name));
}
var metadata = new metadata_1.Metadata(METADATA_KEY.INJECT_TAG, serviceIdentifier);
if (typeof index2 === "number") {
decorator_utils_1.tagParameter(target, targetKey, index2, metadata);
} else {
decorator_utils_1.tagProperty(target, targetKey, metadata);
}
};
}
exports.inject = inject24;
}
});
// node_modules/inversify/lib/planning/queryable_string.js
var require_queryable_string = __commonJS({
"node_modules/inversify/lib/planning/queryable_string.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.QueryableString = void 0;
var QueryableString = function() {
function QueryableString2(str8) {
this.str = str8;
}
QueryableString2.prototype.startsWith = function(searchString) {
return this.str.indexOf(searchString) === 0;
};
QueryableString2.prototype.endsWith = function(searchString) {
var reverseString = "";
var reverseSearchString = searchString.split("").reverse().join("");
reverseString = this.str.split("").reverse().join("");
return this.startsWith.call({ str: reverseString }, reverseSearchString);
};
QueryableString2.prototype.contains = function(searchString) {
return this.str.indexOf(searchString) !== -1;
};
QueryableString2.prototype.equals = function(compareString) {
return this.str === compareString;
};
QueryableString2.prototype.value = function() {
return this.str;
};
return QueryableString2;
}();
exports.QueryableString = QueryableString;
}
});
// node_modules/inversify/lib/planning/target.js
var require_target = __commonJS({
"node_modules/inversify/lib/planning/target.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Target = void 0;
var METADATA_KEY = require_metadata_keys();
var id_1 = require_id2();
var metadata_1 = require_metadata();
var queryable_string_1 = require_queryable_string();
var Target2 = function() {
function Target3(type2, name, serviceIdentifier, namedOrTagged) {
this.id = id_1.id();
this.type = type2;
this.serviceIdentifier = serviceIdentifier;
this.name = new queryable_string_1.QueryableString(name || "");
this.metadata = new Array();
var metadataItem = null;
if (typeof namedOrTagged === "string") {
metadataItem = new metadata_1.Metadata(METADATA_KEY.NAMED_TAG, namedOrTagged);
} else if (namedOrTagged instanceof metadata_1.Metadata) {
metadataItem = namedOrTagged;
}
if (metadataItem !== null) {
this.metadata.push(metadataItem);
}
}
Target3.prototype.hasTag = function(key) {
for (var _i = 0, _a6 = this.metadata; _i < _a6.length; _i++) {
var m4 = _a6[_i];
if (m4.key === key) {
return true;
}
}
return false;
};
Target3.prototype.isArray = function() {
return this.hasTag(METADATA_KEY.MULTI_INJECT_TAG);
};
Target3.prototype.matchesArray = function(name) {
return this.matchesTag(METADATA_KEY.MULTI_INJECT_TAG)(name);
};
Target3.prototype.isNamed = function() {
return this.hasTag(METADATA_KEY.NAMED_TAG);
};
Target3.prototype.isTagged = function() {
return this.metadata.some(function(metadata) {
return METADATA_KEY.NON_CUSTOM_TAG_KEYS.every(function(key) {
return metadata.key !== key;
});
});
};
Target3.prototype.isOptional = function() {
return this.matchesTag(METADATA_KEY.OPTIONAL_TAG)(true);
};
Target3.prototype.getNamedTag = function() {
if (this.isNamed()) {
return this.metadata.filter(function(m4) {
return m4.key === METADATA_KEY.NAMED_TAG;
})[0];
}
return null;
};
Target3.prototype.getCustomTags = function() {
if (this.isTagged()) {
return this.metadata.filter(function(metadata) {
return METADATA_KEY.NON_CUSTOM_TAG_KEYS.every(function(key) {
return metadata.key !== key;
});
});
} else {
return null;
}
};
Target3.prototype.matchesNamedTag = function(name) {
return this.matchesTag(METADATA_KEY.NAMED_TAG)(name);
};
Target3.prototype.matchesTag = function(key) {
var _this = this;
return function(value2) {
for (var _i = 0, _a6 = _this.metadata; _i < _a6.length; _i++) {
var m4 = _a6[_i];
if (m4.key === key && m4.value === value2) {
return true;
}
}
return false;
};
};
return Target3;
}();
exports.Target = Target2;
}
});
// node_modules/inversify/lib/planning/reflection_utils.js
var require_reflection_utils = __commonJS({
"node_modules/inversify/lib/planning/reflection_utils.js"(exports) {
"use strict";
var __spreadArray4 = exports && exports.__spreadArray || function(to, from) {
for (var i4 = 0, il = from.length, j4 = to.length; i4 < il; i4++, j4++)
to[j4] = from[i4];
return to;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFunctionName = exports.getBaseClassDependencyCount = exports.getDependencies = void 0;
var inject_1 = require_inject();
var ERROR_MSGS = require_error_msgs();
var literal_types_1 = require_literal_types();
var METADATA_KEY = require_metadata_keys();
var serialization_1 = require_serialization();
Object.defineProperty(exports, "getFunctionName", { enumerable: true, get: function() {
return serialization_1.getFunctionName;
} });
var target_1 = require_target();
function getDependencies(metadataReader, func) {
var constructorName = serialization_1.getFunctionName(func);
var targets = getTargets(metadataReader, constructorName, func, false);
return targets;
}
exports.getDependencies = getDependencies;
function getTargets(metadataReader, constructorName, func, isBaseClass) {
var metadata = metadataReader.getConstructorMetadata(func);
var serviceIdentifiers = metadata.compilerGeneratedMetadata;
if (serviceIdentifiers === void 0) {
var msg = ERROR_MSGS.MISSING_INJECTABLE_ANNOTATION + " " + constructorName + ".";
throw new Error(msg);
}
var constructorArgsMetadata = metadata.userGeneratedMetadata;
var keys2 = Object.keys(constructorArgsMetadata);
var hasUserDeclaredUnknownInjections = func.length === 0 && keys2.length > 0;
var hasOptionalParameters = keys2.length > func.length;
var iterations = hasUserDeclaredUnknownInjections || hasOptionalParameters ? keys2.length : func.length;
var constructorTargets = getConstructorArgsAsTargets(isBaseClass, constructorName, serviceIdentifiers, constructorArgsMetadata, iterations);
var propertyTargets = getClassPropsAsTargets(metadataReader, func);
var targets = __spreadArray4(__spreadArray4([], constructorTargets), propertyTargets);
return targets;
}
function getConstructorArgsAsTarget(index2, isBaseClass, constructorName, serviceIdentifiers, constructorArgsMetadata) {
var targetMetadata = constructorArgsMetadata[index2.toString()] || [];
var metadata = formatTargetMetadata(targetMetadata);
var isManaged = metadata.unmanaged !== true;
var serviceIdentifier = serviceIdentifiers[index2];
var injectIdentifier = metadata.inject || metadata.multiInject;
serviceIdentifier = injectIdentifier ? injectIdentifier : serviceIdentifier;
if (serviceIdentifier instanceof inject_1.LazyServiceIdentifer) {
serviceIdentifier = serviceIdentifier.unwrap();
}
if (isManaged) {
var isObject4 = serviceIdentifier === Object;
var isFunction2 = serviceIdentifier === Function;
var isUndefined2 = serviceIdentifier === void 0;
var isUnknownType = isObject4 || isFunction2 || isUndefined2;
if (!isBaseClass && isUnknownType) {
var msg = ERROR_MSGS.MISSING_INJECT_ANNOTATION + " argument " + index2 + " in class " + constructorName + ".";
throw new Error(msg);
}
var target = new target_1.Target(literal_types_1.TargetTypeEnum.ConstructorArgument, metadata.targetName, serviceIdentifier);
target.metadata = targetMetadata;
return target;
}
return null;
}
function getConstructorArgsAsTargets(isBaseClass, constructorName, serviceIdentifiers, constructorArgsMetadata, iterations) {
var targets = [];
for (var i4 = 0; i4 < iterations; i4++) {
var index2 = i4;
var target = getConstructorArgsAsTarget(index2, isBaseClass, constructorName, serviceIdentifiers, constructorArgsMetadata);
if (target !== null) {
targets.push(target);
}
}
return targets;
}
function getClassPropsAsTargets(metadataReader, constructorFunc) {
var classPropsMetadata = metadataReader.getPropertiesMetadata(constructorFunc);
var targets = [];
var keys2 = Object.keys(classPropsMetadata);
for (var _i = 0, keys_1 = keys2; _i < keys_1.length; _i++) {
var key = keys_1[_i];
var targetMetadata = classPropsMetadata[key];
var metadata = formatTargetMetadata(classPropsMetadata[key]);
var targetName = metadata.targetName || key;
var serviceIdentifier = metadata.inject || metadata.multiInject;
var target = new target_1.Target(literal_types_1.TargetTypeEnum.ClassProperty, targetName, serviceIdentifier);
target.metadata = targetMetadata;
targets.push(target);
}
var baseConstructor = Object.getPrototypeOf(constructorFunc.prototype).constructor;
if (baseConstructor !== Object) {
var baseTargets = getClassPropsAsTargets(metadataReader, baseConstructor);
targets = __spreadArray4(__spreadArray4([], targets), baseTargets);
}
return targets;
}
function getBaseClassDependencyCount(metadataReader, func) {
var baseConstructor = Object.getPrototypeOf(func.prototype).constructor;
if (baseConstructor !== Object) {
var baseConstructorName = serialization_1.getFunctionName(baseConstructor);
var targets = getTargets(metadataReader, baseConstructorName, baseConstructor, true);
var metadata = targets.map(function(t4) {
return t4.metadata.filter(function(m4) {
return m4.key === METADATA_KEY.UNMANAGED_TAG;
});
});
var unmanagedCount = [].concat.apply([], metadata).length;
var dependencyCount = targets.length - unmanagedCount;
if (dependencyCount > 0) {
return dependencyCount;
} else {
return getBaseClassDependencyCount(metadataReader, baseConstructor);
}
} else {
return 0;
}
}
exports.getBaseClassDependencyCount = getBaseClassDependencyCount;
function formatTargetMetadata(targetMetadata) {
var targetMetadataMap = {};
targetMetadata.forEach(function(m4) {
targetMetadataMap[m4.key.toString()] = m4.value;
});
return {
inject: targetMetadataMap[METADATA_KEY.INJECT_TAG],
multiInject: targetMetadataMap[METADATA_KEY.MULTI_INJECT_TAG],
targetName: targetMetadataMap[METADATA_KEY.NAME_TAG],
unmanaged: targetMetadataMap[METADATA_KEY.UNMANAGED_TAG]
};
}
}
});
// node_modules/inversify/lib/planning/request.js
var require_request = __commonJS({
"node_modules/inversify/lib/planning/request.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Request = void 0;
var id_1 = require_id2();
var Request = function() {
function Request2(serviceIdentifier, parentContext, parentRequest, bindings, target) {
this.id = id_1.id();
this.serviceIdentifier = serviceIdentifier;
this.parentContext = parentContext;
this.parentRequest = parentRequest;
this.target = target;
this.childRequests = [];
this.bindings = Array.isArray(bindings) ? bindings : [bindings];
this.requestScope = parentRequest === null ? new Map() : null;
}
Request2.prototype.addChildRequest = function(serviceIdentifier, bindings, target) {
var child = new Request2(serviceIdentifier, this.parentContext, this, bindings, target);
this.childRequests.push(child);
return child;
};
return Request2;
}();
exports.Request = Request;
}
});
// node_modules/inversify/lib/planning/planner.js
var require_planner = __commonJS({
"node_modules/inversify/lib/planning/planner.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBindingDictionary = exports.createMockRequest = exports.plan = void 0;
var binding_count_1 = require_binding_count();
var ERROR_MSGS = require_error_msgs();
var literal_types_1 = require_literal_types();
var METADATA_KEY = require_metadata_keys();
var exceptions_1 = require_exceptions();
var serialization_1 = require_serialization();
var context_1 = require_context();
var metadata_1 = require_metadata();
var plan_1 = require_plan();
var reflection_utils_1 = require_reflection_utils();
var request_1 = require_request();
var target_1 = require_target();
function getBindingDictionary(cntnr) {
return cntnr._bindingDictionary;
}
exports.getBindingDictionary = getBindingDictionary;
function _createTarget(isMultiInject, targetType, serviceIdentifier, name, key, value2) {
var metadataKey = isMultiInject ? METADATA_KEY.MULTI_INJECT_TAG : METADATA_KEY.INJECT_TAG;
var injectMetadata = new metadata_1.Metadata(metadataKey, serviceIdentifier);
var target = new target_1.Target(targetType, name, serviceIdentifier, injectMetadata);
if (key !== void 0) {
var tagMetadata = new metadata_1.Metadata(key, value2);
target.metadata.push(tagMetadata);
}
return target;
}
function _getActiveBindings(metadataReader, avoidConstraints, context, parentRequest, target) {
var bindings = getBindings(context.container, target.serviceIdentifier);
var activeBindings = [];
if (bindings.length === binding_count_1.BindingCount.NoBindingsAvailable && context.container.options.autoBindInjectable && typeof target.serviceIdentifier === "function" && metadataReader.getConstructorMetadata(target.serviceIdentifier).compilerGeneratedMetadata) {
context.container.bind(target.serviceIdentifier).toSelf();
bindings = getBindings(context.container, target.serviceIdentifier);
}
if (!avoidConstraints) {
activeBindings = bindings.filter(function(binding) {
var request = new request_1.Request(binding.serviceIdentifier, context, parentRequest, binding, target);
return binding.constraint(request);
});
} else {
activeBindings = bindings;
}
_validateActiveBindingCount(target.serviceIdentifier, activeBindings, target, context.container);
return activeBindings;
}
function _validateActiveBindingCount(serviceIdentifier, bindings, target, container2) {
switch (bindings.length) {
case binding_count_1.BindingCount.NoBindingsAvailable:
if (target.isOptional()) {
return bindings;
} else {
var serviceIdentifierString = serialization_1.getServiceIdentifierAsString(serviceIdentifier);
var msg = ERROR_MSGS.NOT_REGISTERED;
msg += serialization_1.listMetadataForTarget(serviceIdentifierString, target);
msg += serialization_1.listRegisteredBindingsForServiceIdentifier(container2, serviceIdentifierString, getBindings);
throw new Error(msg);
}
case binding_count_1.BindingCount.OnlyOneBindingAvailable:
if (!target.isArray()) {
return bindings;
}
case binding_count_1.BindingCount.MultipleBindingsAvailable:
default:
if (!target.isArray()) {
var serviceIdentifierString = serialization_1.getServiceIdentifierAsString(serviceIdentifier);
var msg = ERROR_MSGS.AMBIGUOUS_MATCH + " " + serviceIdentifierString;
msg += serialization_1.listRegisteredBindingsForServiceIdentifier(container2, serviceIdentifierString, getBindings);
throw new Error(msg);
} else {
return bindings;
}
}
}
function _createSubRequests(metadataReader, avoidConstraints, serviceIdentifier, context, parentRequest, target) {
var activeBindings;
var childRequest;
if (parentRequest === null) {
activeBindings = _getActiveBindings(metadataReader, avoidConstraints, context, null, target);
childRequest = new request_1.Request(serviceIdentifier, context, null, activeBindings, target);
var thePlan = new plan_1.Plan(context, childRequest);
context.addPlan(thePlan);
} else {
activeBindings = _getActiveBindings(metadataReader, avoidConstraints, context, parentRequest, target);
childRequest = parentRequest.addChildRequest(target.serviceIdentifier, activeBindings, target);
}
activeBindings.forEach(function(binding) {
var subChildRequest = null;
if (target.isArray()) {
subChildRequest = childRequest.addChildRequest(binding.serviceIdentifier, binding, target);
} else {
if (binding.cache) {
return;
}
subChildRequest = childRequest;
}
if (binding.type === literal_types_1.BindingTypeEnum.Instance && binding.implementationType !== null) {
var dependencies = reflection_utils_1.getDependencies(metadataReader, binding.implementationType);
if (!context.container.options.skipBaseClassChecks) {
var baseClassDependencyCount = reflection_utils_1.getBaseClassDependencyCount(metadataReader, binding.implementationType);
if (dependencies.length < baseClassDependencyCount) {
var error = ERROR_MSGS.ARGUMENTS_LENGTH_MISMATCH(reflection_utils_1.getFunctionName(binding.implementationType));
throw new Error(error);
}
}
dependencies.forEach(function(dependency) {
_createSubRequests(metadataReader, false, dependency.serviceIdentifier, context, subChildRequest, dependency);
});
}
});
}
function getBindings(container2, serviceIdentifier) {
var bindings = [];
var bindingDictionary = getBindingDictionary(container2);
if (bindingDictionary.hasKey(serviceIdentifier)) {
bindings = bindingDictionary.get(serviceIdentifier);
} else if (container2.parent !== null) {
bindings = getBindings(container2.parent, serviceIdentifier);
}
return bindings;
}
function plan(metadataReader, container2, isMultiInject, targetType, serviceIdentifier, key, value2, avoidConstraints) {
if (avoidConstraints === void 0) {
avoidConstraints = false;
}
var context = new context_1.Context(container2);
var target = _createTarget(isMultiInject, targetType, serviceIdentifier, "", key, value2);
try {
_createSubRequests(metadataReader, avoidConstraints, serviceIdentifier, context, null, target);
return context;
} catch (error) {
if (exceptions_1.isStackOverflowExeption(error)) {
if (context.plan) {
serialization_1.circularDependencyToException(context.plan.rootRequest);
}
}
throw error;
}
}
exports.plan = plan;
function createMockRequest(container2, serviceIdentifier, key, value2) {
var target = new target_1.Target(literal_types_1.TargetTypeEnum.Variable, "", serviceIdentifier, new metadata_1.Metadata(key, value2));
var context = new context_1.Context(container2);
var request = new request_1.Request(serviceIdentifier, context, null, [], target);
return request;
}
exports.createMockRequest = createMockRequest;
}
});
// node_modules/inversify/lib/resolution/instantiation.js
var require_instantiation = __commonJS({
"node_modules/inversify/lib/resolution/instantiation.js"(exports) {
"use strict";
var __spreadArray4 = exports && exports.__spreadArray || function(to, from) {
for (var i4 = 0, il = from.length, j4 = to.length; i4 < il; i4++, j4++)
to[j4] = from[i4];
return to;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveInstance = void 0;
var error_msgs_1 = require_error_msgs();
var literal_types_1 = require_literal_types();
var METADATA_KEY = require_metadata_keys();
function _injectProperties(instance, childRequests, resolveRequest) {
var propertyInjectionsRequests = childRequests.filter(function(childRequest) {
return childRequest.target !== null && childRequest.target.type === literal_types_1.TargetTypeEnum.ClassProperty;
});
var propertyInjections = propertyInjectionsRequests.map(resolveRequest);
propertyInjectionsRequests.forEach(function(r4, index2) {
var propertyName = "";
propertyName = r4.target.name.value();
var injection = propertyInjections[index2];
instance[propertyName] = injection;
});
return instance;
}
function _createInstance(Func, injections) {
return new (Func.bind.apply(Func, __spreadArray4([void 0], injections)))();
}
function _postConstruct(constr, result) {
if (Reflect.hasMetadata(METADATA_KEY.POST_CONSTRUCT, constr)) {
var data3 = Reflect.getMetadata(METADATA_KEY.POST_CONSTRUCT, constr);
try {
result[data3.value]();
} catch (e4) {
throw new Error(error_msgs_1.POST_CONSTRUCT_ERROR(constr.name, e4.message));
}
}
}
function resolveInstance(constr, childRequests, resolveRequest) {
var result = null;
if (childRequests.length > 0) {
var constructorInjectionsRequests = childRequests.filter(function(childRequest) {
return childRequest.target !== null && childRequest.target.type === literal_types_1.TargetTypeEnum.ConstructorArgument;
});
var constructorInjections = constructorInjectionsRequests.map(resolveRequest);
result = _createInstance(constr, constructorInjections);
result = _injectProperties(result, childRequests, resolveRequest);
} else {
result = new constr();
}
_postConstruct(constr, result);
return result;
}
exports.resolveInstance = resolveInstance;
}
});
// node_modules/inversify/lib/resolution/resolver.js
var require_resolver = __commonJS({
"node_modules/inversify/lib/resolution/resolver.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolve = void 0;
var ERROR_MSGS = require_error_msgs();
var literal_types_1 = require_literal_types();
var exceptions_1 = require_exceptions();
var serialization_1 = require_serialization();
var instantiation_1 = require_instantiation();
var invokeFactory = function(factoryType, serviceIdentifier, fn2) {
try {
return fn2();
} catch (error) {
if (exceptions_1.isStackOverflowExeption(error)) {
throw new Error(ERROR_MSGS.CIRCULAR_DEPENDENCY_IN_FACTORY(factoryType, serviceIdentifier.toString()));
} else {
throw error;
}
}
};
var _resolveRequest = function(requestScope) {
return function(request) {
request.parentContext.setCurrentRequest(request);
var bindings = request.bindings;
var childRequests = request.childRequests;
var targetIsAnArray = request.target && request.target.isArray();
var targetParentIsNotAnArray = !request.parentRequest || !request.parentRequest.target || !request.target || !request.parentRequest.target.matchesArray(request.target.serviceIdentifier);
if (targetIsAnArray && targetParentIsNotAnArray) {
return childRequests.map(function(childRequest) {
var _f = _resolveRequest(requestScope);
return _f(childRequest);
});
} else {
var result = null;
if (request.target.isOptional() && bindings.length === 0) {
return void 0;
}
var binding_1 = bindings[0];
var isSingleton = binding_1.scope === literal_types_1.BindingScopeEnum.Singleton;
var isRequestSingleton = binding_1.scope === literal_types_1.BindingScopeEnum.Request;
if (isSingleton && binding_1.activated) {
return binding_1.cache;
}
if (isRequestSingleton && requestScope !== null && requestScope.has(binding_1.id)) {
return requestScope.get(binding_1.id);
}
if (binding_1.type === literal_types_1.BindingTypeEnum.ConstantValue) {
result = binding_1.cache;
binding_1.activated = true;
} else if (binding_1.type === literal_types_1.BindingTypeEnum.Function) {
result = binding_1.cache;
binding_1.activated = true;
} else if (binding_1.type === literal_types_1.BindingTypeEnum.Constructor) {
result = binding_1.implementationType;
} else if (binding_1.type === literal_types_1.BindingTypeEnum.DynamicValue && binding_1.dynamicValue !== null) {
result = invokeFactory("toDynamicValue", binding_1.serviceIdentifier, function() {
return binding_1.dynamicValue(request.parentContext);
});
} else if (binding_1.type === literal_types_1.BindingTypeEnum.Factory && binding_1.factory !== null) {
result = invokeFactory("toFactory", binding_1.serviceIdentifier, function() {
return binding_1.factory(request.parentContext);
});
} else if (binding_1.type === literal_types_1.BindingTypeEnum.Provider && binding_1.provider !== null) {
result = invokeFactory("toProvider", binding_1.serviceIdentifier, function() {
return binding_1.provider(request.parentContext);
});
} else if (binding_1.type === literal_types_1.BindingTypeEnum.Instance && binding_1.implementationType !== null) {
result = instantiation_1.resolveInstance(binding_1.implementationType, childRequests, _resolveRequest(requestScope));
} else {
var serviceIdentifier = serialization_1.getServiceIdentifierAsString(request.serviceIdentifier);
throw new Error(ERROR_MSGS.INVALID_BINDING_TYPE + " " + serviceIdentifier);
}
if (typeof binding_1.onActivation === "function") {
result = binding_1.onActivation(request.parentContext, result);
}
if (isSingleton) {
binding_1.cache = result;
binding_1.activated = true;
}
if (isRequestSingleton && requestScope !== null && !requestScope.has(binding_1.id)) {
requestScope.set(binding_1.id, result);
}
return result;
}
};
};
function resolve(context) {
var _f = _resolveRequest(context.plan.rootRequest.requestScope);
return _f(context.plan.rootRequest);
}
exports.resolve = resolve;
}
});
// node_modules/inversify/lib/syntax/constraint_helpers.js
var require_constraint_helpers = __commonJS({
"node_modules/inversify/lib/syntax/constraint_helpers.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.typeConstraint = exports.namedConstraint = exports.taggedConstraint = exports.traverseAncerstors = void 0;
var METADATA_KEY = require_metadata_keys();
var metadata_1 = require_metadata();
var traverseAncerstors = function(request, constraint) {
var parent = request.parentRequest;
if (parent !== null) {
return constraint(parent) ? true : traverseAncerstors(parent, constraint);
} else {
return false;
}
};
exports.traverseAncerstors = traverseAncerstors;
var taggedConstraint = function(key) {
return function(value2) {
var constraint = function(request) {
return request !== null && request.target !== null && request.target.matchesTag(key)(value2);
};
constraint.metaData = new metadata_1.Metadata(key, value2);
return constraint;
};
};
exports.taggedConstraint = taggedConstraint;
var namedConstraint = taggedConstraint(METADATA_KEY.NAMED_TAG);
exports.namedConstraint = namedConstraint;
var typeConstraint = function(type2) {
return function(request) {
var binding = null;
if (request !== null) {
binding = request.bindings[0];
if (typeof type2 === "string") {
var serviceIdentifier = binding.serviceIdentifier;
return serviceIdentifier === type2;
} else {
var constructor = request.bindings[0].implementationType;
return type2 === constructor;
}
}
return false;
};
};
exports.typeConstraint = typeConstraint;
}
});
// node_modules/inversify/lib/syntax/binding_when_syntax.js
var require_binding_when_syntax = __commonJS({
"node_modules/inversify/lib/syntax/binding_when_syntax.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BindingWhenSyntax = void 0;
var binding_on_syntax_1 = require_binding_on_syntax();
var constraint_helpers_1 = require_constraint_helpers();
var BindingWhenSyntax = function() {
function BindingWhenSyntax2(binding) {
this._binding = binding;
}
BindingWhenSyntax2.prototype.when = function(constraint) {
this._binding.constraint = constraint;
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};
BindingWhenSyntax2.prototype.whenTargetNamed = function(name) {
this._binding.constraint = constraint_helpers_1.namedConstraint(name);
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};
BindingWhenSyntax2.prototype.whenTargetIsDefault = function() {
this._binding.constraint = function(request) {
var targetIsDefault = request.target !== null && !request.target.isNamed() && !request.target.isTagged();
return targetIsDefault;
};
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};
BindingWhenSyntax2.prototype.whenTargetTagged = function(tag, value2) {
this._binding.constraint = constraint_helpers_1.taggedConstraint(tag)(value2);
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};
BindingWhenSyntax2.prototype.whenInjectedInto = function(parent) {
this._binding.constraint = function(request) {
return constraint_helpers_1.typeConstraint(parent)(request.parentRequest);
};
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};
BindingWhenSyntax2.prototype.whenParentNamed = function(name) {
this._binding.constraint = function(request) {
return constraint_helpers_1.namedConstraint(name)(request.parentRequest);
};
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};
BindingWhenSyntax2.prototype.whenParentTagged = function(tag, value2) {
this._binding.constraint = function(request) {
return constraint_helpers_1.taggedConstraint(tag)(value2)(request.parentRequest);
};
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};
BindingWhenSyntax2.prototype.whenAnyAncestorIs = function(ancestor) {
this._binding.constraint = function(request) {
return constraint_helpers_1.traverseAncerstors(request, constraint_helpers_1.typeConstraint(ancestor));
};
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};
BindingWhenSyntax2.prototype.whenNoAncestorIs = function(ancestor) {
this._binding.constraint = function(request) {
return !constraint_helpers_1.traverseAncerstors(request, constraint_helpers_1.typeConstraint(ancestor));
};
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};
BindingWhenSyntax2.prototype.whenAnyAncestorNamed = function(name) {
this._binding.constraint = function(request) {
return constraint_helpers_1.traverseAncerstors(request, constraint_helpers_1.namedConstraint(name));
};
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};
BindingWhenSyntax2.prototype.whenNoAncestorNamed = function(name) {
this._binding.constraint = function(request) {
return !constraint_helpers_1.traverseAncerstors(request, constraint_helpers_1.namedConstraint(name));
};
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};
BindingWhenSyntax2.prototype.whenAnyAncestorTagged = function(tag, value2) {
this._binding.constraint = function(request) {
return constraint_helpers_1.traverseAncerstors(request, constraint_helpers_1.taggedConstraint(tag)(value2));
};
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};
BindingWhenSyntax2.prototype.whenNoAncestorTagged = function(tag, value2) {
this._binding.constraint = function(request) {
return !constraint_helpers_1.traverseAncerstors(request, constraint_helpers_1.taggedConstraint(tag)(value2));
};
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};
BindingWhenSyntax2.prototype.whenAnyAncestorMatches = function(constraint) {
this._binding.constraint = function(request) {
return constraint_helpers_1.traverseAncerstors(request, constraint);
};
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};
BindingWhenSyntax2.prototype.whenNoAncestorMatches = function(constraint) {
this._binding.constraint = function(request) {
return !constraint_helpers_1.traverseAncerstors(request, constraint);
};
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};
return BindingWhenSyntax2;
}();
exports.BindingWhenSyntax = BindingWhenSyntax;
}
});
// node_modules/inversify/lib/syntax/binding_on_syntax.js
var require_binding_on_syntax = __commonJS({
"node_modules/inversify/lib/syntax/binding_on_syntax.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BindingOnSyntax = void 0;
var binding_when_syntax_1 = require_binding_when_syntax();
var BindingOnSyntax = function() {
function BindingOnSyntax2(binding) {
this._binding = binding;
}
BindingOnSyntax2.prototype.onActivation = function(handler) {
this._binding.onActivation = handler;
return new binding_when_syntax_1.BindingWhenSyntax(this._binding);
};
return BindingOnSyntax2;
}();
exports.BindingOnSyntax = BindingOnSyntax;
}
});
// node_modules/inversify/lib/syntax/binding_when_on_syntax.js
var require_binding_when_on_syntax = __commonJS({
"node_modules/inversify/lib/syntax/binding_when_on_syntax.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BindingWhenOnSyntax = void 0;
var binding_on_syntax_1 = require_binding_on_syntax();
var binding_when_syntax_1 = require_binding_when_syntax();
var BindingWhenOnSyntax = function() {
function BindingWhenOnSyntax2(binding) {
this._binding = binding;
this._bindingWhenSyntax = new binding_when_syntax_1.BindingWhenSyntax(this._binding);
this._bindingOnSyntax = new binding_on_syntax_1.BindingOnSyntax(this._binding);
}
BindingWhenOnSyntax2.prototype.when = function(constraint) {
return this._bindingWhenSyntax.when(constraint);
};
BindingWhenOnSyntax2.prototype.whenTargetNamed = function(name) {
return this._bindingWhenSyntax.whenTargetNamed(name);
};
BindingWhenOnSyntax2.prototype.whenTargetIsDefault = function() {
return this._bindingWhenSyntax.whenTargetIsDefault();
};
BindingWhenOnSyntax2.prototype.whenTargetTagged = function(tag, value2) {
return this._bindingWhenSyntax.whenTargetTagged(tag, value2);
};
BindingWhenOnSyntax2.prototype.whenInjectedInto = function(parent) {
return this._bindingWhenSyntax.whenInjectedInto(parent);
};
BindingWhenOnSyntax2.prototype.whenParentNamed = function(name) {
return this._bindingWhenSyntax.whenParentNamed(name);
};
BindingWhenOnSyntax2.prototype.whenParentTagged = function(tag, value2) {
return this._bindingWhenSyntax.whenParentTagged(tag, value2);
};
BindingWhenOnSyntax2.prototype.whenAnyAncestorIs = function(ancestor) {
return this._bindingWhenSyntax.whenAnyAncestorIs(ancestor);
};
BindingWhenOnSyntax2.prototype.whenNoAncestorIs = function(ancestor) {
return this._bindingWhenSyntax.whenNoAncestorIs(ancestor);
};
BindingWhenOnSyntax2.prototype.whenAnyAncestorNamed = function(name) {
return this._bindingWhenSyntax.whenAnyAncestorNamed(name);
};
BindingWhenOnSyntax2.prototype.whenAnyAncestorTagged = function(tag, value2) {
return this._bindingWhenSyntax.whenAnyAncestorTagged(tag, value2);
};
BindingWhenOnSyntax2.prototype.whenNoAncestorNamed = function(name) {
return this._bindingWhenSyntax.whenNoAncestorNamed(name);
};
BindingWhenOnSyntax2.prototype.whenNoAncestorTagged = function(tag, value2) {
return this._bindingWhenSyntax.whenNoAncestorTagged(tag, value2);
};
BindingWhenOnSyntax2.prototype.whenAnyAncestorMatches = function(constraint) {
return this._bindingWhenSyntax.whenAnyAncestorMatches(constraint);
};
BindingWhenOnSyntax2.prototype.whenNoAncestorMatches = function(constraint) {
return this._bindingWhenSyntax.whenNoAncestorMatches(constraint);
};
BindingWhenOnSyntax2.prototype.onActivation = function(handler) {
return this._bindingOnSyntax.onActivation(handler);
};
return BindingWhenOnSyntax2;
}();
exports.BindingWhenOnSyntax = BindingWhenOnSyntax;
}
});
// node_modules/inversify/lib/syntax/binding_in_syntax.js
var require_binding_in_syntax = __commonJS({
"node_modules/inversify/lib/syntax/binding_in_syntax.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BindingInSyntax = void 0;
var literal_types_1 = require_literal_types();
var binding_when_on_syntax_1 = require_binding_when_on_syntax();
var BindingInSyntax = function() {
function BindingInSyntax2(binding) {
this._binding = binding;
}
BindingInSyntax2.prototype.inRequestScope = function() {
this._binding.scope = literal_types_1.BindingScopeEnum.Request;
return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding);
};
BindingInSyntax2.prototype.inSingletonScope = function() {
this._binding.scope = literal_types_1.BindingScopeEnum.Singleton;
return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding);
};
BindingInSyntax2.prototype.inTransientScope = function() {
this._binding.scope = literal_types_1.BindingScopeEnum.Transient;
return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding);
};
return BindingInSyntax2;
}();
exports.BindingInSyntax = BindingInSyntax;
}
});
// node_modules/inversify/lib/syntax/binding_in_when_on_syntax.js
var require_binding_in_when_on_syntax = __commonJS({
"node_modules/inversify/lib/syntax/binding_in_when_on_syntax.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BindingInWhenOnSyntax = void 0;
var binding_in_syntax_1 = require_binding_in_syntax();
var binding_on_syntax_1 = require_binding_on_syntax();
var binding_when_syntax_1 = require_binding_when_syntax();
var BindingInWhenOnSyntax = function() {
function BindingInWhenOnSyntax2(binding) {
this._binding = binding;
this._bindingWhenSyntax = new binding_when_syntax_1.BindingWhenSyntax(this._binding);
this._bindingOnSyntax = new binding_on_syntax_1.BindingOnSyntax(this._binding);
this._bindingInSyntax = new binding_in_syntax_1.BindingInSyntax(binding);
}
BindingInWhenOnSyntax2.prototype.inRequestScope = function() {
return this._bindingInSyntax.inRequestScope();
};
BindingInWhenOnSyntax2.prototype.inSingletonScope = function() {
return this._bindingInSyntax.inSingletonScope();
};
BindingInWhenOnSyntax2.prototype.inTransientScope = function() {
return this._bindingInSyntax.inTransientScope();
};
BindingInWhenOnSyntax2.prototype.when = function(constraint) {
return this._bindingWhenSyntax.when(constraint);
};
BindingInWhenOnSyntax2.prototype.whenTargetNamed = function(name) {
return this._bindingWhenSyntax.whenTargetNamed(name);
};
BindingInWhenOnSyntax2.prototype.whenTargetIsDefault = function() {
return this._bindingWhenSyntax.whenTargetIsDefault();
};
BindingInWhenOnSyntax2.prototype.whenTargetTagged = function(tag, value2) {
return this._bindingWhenSyntax.whenTargetTagged(tag, value2);
};
BindingInWhenOnSyntax2.prototype.whenInjectedInto = function(parent) {
return this._bindingWhenSyntax.whenInjectedInto(parent);
};
BindingInWhenOnSyntax2.prototype.whenParentNamed = function(name) {
return this._bindingWhenSyntax.whenParentNamed(name);
};
BindingInWhenOnSyntax2.prototype.whenParentTagged = function(tag, value2) {
return this._bindingWhenSyntax.whenParentTagged(tag, value2);
};
BindingInWhenOnSyntax2.prototype.whenAnyAncestorIs = function(ancestor) {
return this._bindingWhenSyntax.whenAnyAncestorIs(ancestor);
};
BindingInWhenOnSyntax2.prototype.whenNoAncestorIs = function(ancestor) {
return this._bindingWhenSyntax.whenNoAncestorIs(ancestor);
};
BindingInWhenOnSyntax2.prototype.whenAnyAncestorNamed = function(name) {
return this._bindingWhenSyntax.whenAnyAncestorNamed(name);
};
BindingInWhenOnSyntax2.prototype.whenAnyAncestorTagged = function(tag, value2) {
return this._bindingWhenSyntax.whenAnyAncestorTagged(tag, value2);
};
BindingInWhenOnSyntax2.prototype.whenNoAncestorNamed = function(name) {
return this._bindingWhenSyntax.whenNoAncestorNamed(name);
};
BindingInWhenOnSyntax2.prototype.whenNoAncestorTagged = function(tag, value2) {
return this._bindingWhenSyntax.whenNoAncestorTagged(tag, value2);
};
BindingInWhenOnSyntax2.prototype.whenAnyAncestorMatches = function(constraint) {
return this._bindingWhenSyntax.whenAnyAncestorMatches(constraint);
};
BindingInWhenOnSyntax2.prototype.whenNoAncestorMatches = function(constraint) {
return this._bindingWhenSyntax.whenNoAncestorMatches(constraint);
};
BindingInWhenOnSyntax2.prototype.onActivation = function(handler) {
return this._bindingOnSyntax.onActivation(handler);
};
return BindingInWhenOnSyntax2;
}();
exports.BindingInWhenOnSyntax = BindingInWhenOnSyntax;
}
});
// node_modules/inversify/lib/syntax/binding_to_syntax.js
var require_binding_to_syntax = __commonJS({
"node_modules/inversify/lib/syntax/binding_to_syntax.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BindingToSyntax = void 0;
var ERROR_MSGS = require_error_msgs();
var literal_types_1 = require_literal_types();
var binding_in_when_on_syntax_1 = require_binding_in_when_on_syntax();
var binding_when_on_syntax_1 = require_binding_when_on_syntax();
var BindingToSyntax = function() {
function BindingToSyntax2(binding) {
this._binding = binding;
}
BindingToSyntax2.prototype.to = function(constructor) {
this._binding.type = literal_types_1.BindingTypeEnum.Instance;
this._binding.implementationType = constructor;
return new binding_in_when_on_syntax_1.BindingInWhenOnSyntax(this._binding);
};
BindingToSyntax2.prototype.toSelf = function() {
if (typeof this._binding.serviceIdentifier !== "function") {
throw new Error("" + ERROR_MSGS.INVALID_TO_SELF_VALUE);
}
var self2 = this._binding.serviceIdentifier;
return this.to(self2);
};
BindingToSyntax2.prototype.toConstantValue = function(value2) {
this._binding.type = literal_types_1.BindingTypeEnum.ConstantValue;
this._binding.cache = value2;
this._binding.dynamicValue = null;
this._binding.implementationType = null;
this._binding.scope = literal_types_1.BindingScopeEnum.Singleton;
return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding);
};
BindingToSyntax2.prototype.toDynamicValue = function(func) {
this._binding.type = literal_types_1.BindingTypeEnum.DynamicValue;
this._binding.cache = null;
this._binding.dynamicValue = func;
this._binding.implementationType = null;
return new binding_in_when_on_syntax_1.BindingInWhenOnSyntax(this._binding);
};
BindingToSyntax2.prototype.toConstructor = function(constructor) {
this._binding.type = literal_types_1.BindingTypeEnum.Constructor;
this._binding.implementationType = constructor;
this._binding.scope = literal_types_1.BindingScopeEnum.Singleton;
return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding);
};
BindingToSyntax2.prototype.toFactory = function(factory) {
this._binding.type = literal_types_1.BindingTypeEnum.Factory;
this._binding.factory = factory;
this._binding.scope = literal_types_1.BindingScopeEnum.Singleton;
return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding);
};
BindingToSyntax2.prototype.toFunction = function(func) {
if (typeof func !== "function") {
throw new Error(ERROR_MSGS.INVALID_FUNCTION_BINDING);
}
var bindingWhenOnSyntax = this.toConstantValue(func);
this._binding.type = literal_types_1.BindingTypeEnum.Function;
this._binding.scope = literal_types_1.BindingScopeEnum.Singleton;
return bindingWhenOnSyntax;
};
BindingToSyntax2.prototype.toAutoFactory = function(serviceIdentifier) {
this._binding.type = literal_types_1.BindingTypeEnum.Factory;
this._binding.factory = function(context) {
var autofactory = function() {
return context.container.get(serviceIdentifier);
};
return autofactory;
};
this._binding.scope = literal_types_1.BindingScopeEnum.Singleton;
return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding);
};
BindingToSyntax2.prototype.toProvider = function(provider) {
this._binding.type = literal_types_1.BindingTypeEnum.Provider;
this._binding.provider = provider;
this._binding.scope = literal_types_1.BindingScopeEnum.Singleton;
return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding);
};
BindingToSyntax2.prototype.toService = function(service) {
this.toDynamicValue(function(context) {
return context.container.get(service);
});
};
return BindingToSyntax2;
}();
exports.BindingToSyntax = BindingToSyntax;
}
});
// node_modules/inversify/lib/container/container_snapshot.js
var require_container_snapshot = __commonJS({
"node_modules/inversify/lib/container/container_snapshot.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContainerSnapshot = void 0;
var ContainerSnapshot = function() {
function ContainerSnapshot2() {
}
ContainerSnapshot2.of = function(bindings, middleware) {
var snapshot = new ContainerSnapshot2();
snapshot.bindings = bindings;
snapshot.middleware = middleware;
return snapshot;
};
return ContainerSnapshot2;
}();
exports.ContainerSnapshot = ContainerSnapshot;
}
});
// node_modules/inversify/lib/container/lookup.js
var require_lookup = __commonJS({
"node_modules/inversify/lib/container/lookup.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Lookup = void 0;
var ERROR_MSGS = require_error_msgs();
var Lookup = function() {
function Lookup2() {
this._map = new Map();
}
Lookup2.prototype.getMap = function() {
return this._map;
};
Lookup2.prototype.add = function(serviceIdentifier, value2) {
if (serviceIdentifier === null || serviceIdentifier === void 0) {
throw new Error(ERROR_MSGS.NULL_ARGUMENT);
}
if (value2 === null || value2 === void 0) {
throw new Error(ERROR_MSGS.NULL_ARGUMENT);
}
var entry = this._map.get(serviceIdentifier);
if (entry !== void 0) {
entry.push(value2);
this._map.set(serviceIdentifier, entry);
} else {
this._map.set(serviceIdentifier, [value2]);
}
};
Lookup2.prototype.get = function(serviceIdentifier) {
if (serviceIdentifier === null || serviceIdentifier === void 0) {
throw new Error(ERROR_MSGS.NULL_ARGUMENT);
}
var entry = this._map.get(serviceIdentifier);
if (entry !== void 0) {
return entry;
} else {
throw new Error(ERROR_MSGS.KEY_NOT_FOUND);
}
};
Lookup2.prototype.remove = function(serviceIdentifier) {
if (serviceIdentifier === null || serviceIdentifier === void 0) {
throw new Error(ERROR_MSGS.NULL_ARGUMENT);
}
if (!this._map.delete(serviceIdentifier)) {
throw new Error(ERROR_MSGS.KEY_NOT_FOUND);
}
};
Lookup2.prototype.removeByCondition = function(condition) {
var _this = this;
this._map.forEach(function(entries, key) {
var updatedEntries = entries.filter(function(entry) {
return !condition(entry);
});
if (updatedEntries.length > 0) {
_this._map.set(key, updatedEntries);
} else {
_this._map.delete(key);
}
});
};
Lookup2.prototype.hasKey = function(serviceIdentifier) {
if (serviceIdentifier === null || serviceIdentifier === void 0) {
throw new Error(ERROR_MSGS.NULL_ARGUMENT);
}
return this._map.has(serviceIdentifier);
};
Lookup2.prototype.clone = function() {
var copy8 = new Lookup2();
this._map.forEach(function(value2, key) {
value2.forEach(function(b10) {
return copy8.add(key, b10.clone());
});
});
return copy8;
};
Lookup2.prototype.traverse = function(func) {
this._map.forEach(function(value2, key) {
func(key, value2);
});
};
return Lookup2;
}();
exports.Lookup = Lookup;
}
});
// node_modules/inversify/lib/container/container.js
var require_container = __commonJS({
"node_modules/inversify/lib/container/container.js"(exports) {
"use strict";
var __awaiter7 = exports && exports.__awaiter || function(thisArg, _arguments, P4, generator) {
function adopt(value2) {
return value2 instanceof P4 ? value2 : new P4(function(resolve) {
resolve(value2);
});
}
return new (P4 || (P4 = Promise))(function(resolve, reject) {
function fulfilled(value2) {
try {
step(generator.next(value2));
} catch (e4) {
reject(e4);
}
}
function rejected(value2) {
try {
step(generator["throw"](value2));
} catch (e4) {
reject(e4);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator5 = exports && exports.__generator || function(thisArg, body) {
var _8 = { label: 0, sent: function() {
if (t4[0] & 1)
throw t4[1];
return t4[1];
}, trys: [], ops: [] }, f3, y5, t4, g4;
return g4 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g4[Symbol.iterator] = function() {
return this;
}), g4;
function verb(n3) {
return function(v3) {
return step([n3, v3]);
};
}
function step(op) {
if (f3)
throw new TypeError("Generator is already executing.");
while (_8)
try {
if (f3 = 1, y5 && (t4 = op[0] & 2 ? y5["return"] : op[0] ? y5["throw"] || ((t4 = y5["return"]) && t4.call(y5), 0) : y5.next) && !(t4 = t4.call(y5, op[1])).done)
return t4;
if (y5 = 0, t4)
op = [op[0] & 2, t4.value];
switch (op[0]) {
case 0:
case 1:
t4 = op;
break;
case 4:
_8.label++;
return { value: op[1], done: false };
case 5:
_8.label++;
y5 = op[1];
op = [0];
continue;
case 7:
op = _8.ops.pop();
_8.trys.pop();
continue;
default:
if (!(t4 = _8.trys, t4 = t4.length > 0 && t4[t4.length - 1]) && (op[0] === 6 || op[0] === 2)) {
_8 = 0;
continue;
}
if (op[0] === 3 && (!t4 || op[1] > t4[0] && op[1] < t4[3])) {
_8.label = op[1];
break;
}
if (op[0] === 6 && _8.label < t4[1]) {
_8.label = t4[1];
t4 = op;
break;
}
if (t4 && _8.label < t4[2]) {
_8.label = t4[2];
_8.ops.push(op);
break;
}
if (t4[2])
_8.ops.pop();
_8.trys.pop();
continue;
}
op = body.call(thisArg, _8);
} catch (e4) {
op = [6, e4];
y5 = 0;
} finally {
f3 = t4 = 0;
}
if (op[0] & 5)
throw op[1];
return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __spreadArray4 = exports && exports.__spreadArray || function(to, from) {
for (var i4 = 0, il = from.length, j4 = to.length; i4 < il; i4++, j4++)
to[j4] = from[i4];
return to;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Container = void 0;
var binding_1 = require_binding();
var ERROR_MSGS = require_error_msgs();
var literal_types_1 = require_literal_types();
var METADATA_KEY = require_metadata_keys();
var metadata_reader_1 = require_metadata_reader();
var planner_1 = require_planner();
var resolver_1 = require_resolver();
var binding_to_syntax_1 = require_binding_to_syntax();
var id_1 = require_id2();
var serialization_1 = require_serialization();
var container_snapshot_1 = require_container_snapshot();
var lookup_1 = require_lookup();
var Container3 = function() {
function Container4(containerOptions) {
this._appliedMiddleware = [];
var options = containerOptions || {};
if (typeof options !== "object") {
throw new Error("" + ERROR_MSGS.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT);
}
if (options.defaultScope === void 0) {
options.defaultScope = literal_types_1.BindingScopeEnum.Transient;
} else if (options.defaultScope !== literal_types_1.BindingScopeEnum.Singleton && options.defaultScope !== literal_types_1.BindingScopeEnum.Transient && options.defaultScope !== literal_types_1.BindingScopeEnum.Request) {
throw new Error("" + ERROR_MSGS.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE);
}
if (options.autoBindInjectable === void 0) {
options.autoBindInjectable = false;
} else if (typeof options.autoBindInjectable !== "boolean") {
throw new Error("" + ERROR_MSGS.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE);
}
if (options.skipBaseClassChecks === void 0) {
options.skipBaseClassChecks = false;
} else if (typeof options.skipBaseClassChecks !== "boolean") {
throw new Error("" + ERROR_MSGS.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK);
}
this.options = {
autoBindInjectable: options.autoBindInjectable,
defaultScope: options.defaultScope,
skipBaseClassChecks: options.skipBaseClassChecks
};
this.id = id_1.id();
this._bindingDictionary = new lookup_1.Lookup();
this._snapshots = [];
this._middleware = null;
this.parent = null;
this._metadataReader = new metadata_reader_1.MetadataReader();
}
Container4.merge = function(container1, container2) {
var container3 = [];
for (var _i = 2; _i < arguments.length; _i++) {
container3[_i - 2] = arguments[_i];
}
var container4 = new Container4();
var targetContainers = __spreadArray4([container1, container2], container3).map(function(targetContainer) {
return planner_1.getBindingDictionary(targetContainer);
});
var bindingDictionary = planner_1.getBindingDictionary(container4);
function copyDictionary(origin, destination) {
origin.traverse(function(key, value2) {
value2.forEach(function(binding) {
destination.add(binding.serviceIdentifier, binding.clone());
});
});
}
targetContainers.forEach(function(targetBindingDictionary) {
copyDictionary(targetBindingDictionary, bindingDictionary);
});
return container4;
};
Container4.prototype.load = function() {
var modules = [];
for (var _i = 0; _i < arguments.length; _i++) {
modules[_i] = arguments[_i];
}
var getHelpers = this._getContainerModuleHelpersFactory();
for (var _a6 = 0, modules_1 = modules; _a6 < modules_1.length; _a6++) {
var currentModule = modules_1[_a6];
var containerModuleHelpers = getHelpers(currentModule.id);
currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction);
}
};
Container4.prototype.loadAsync = function() {
var modules = [];
for (var _i = 0; _i < arguments.length; _i++) {
modules[_i] = arguments[_i];
}
return __awaiter7(this, void 0, void 0, function() {
var getHelpers, _a6, modules_2, currentModule, containerModuleHelpers;
return __generator5(this, function(_b) {
switch (_b.label) {
case 0:
getHelpers = this._getContainerModuleHelpersFactory();
_a6 = 0, modules_2 = modules;
_b.label = 1;
case 1:
if (!(_a6 < modules_2.length))
return [3, 4];
currentModule = modules_2[_a6];
containerModuleHelpers = getHelpers(currentModule.id);
return [4, currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction)];
case 2:
_b.sent();
_b.label = 3;
case 3:
_a6++;
return [3, 1];
case 4:
return [2];
}
});
});
};
Container4.prototype.unload = function() {
var _this = this;
var modules = [];
for (var _i = 0; _i < arguments.length; _i++) {
modules[_i] = arguments[_i];
}
var conditionFactory = function(expected) {
return function(item) {
return item.moduleId === expected;
};
};
modules.forEach(function(module3) {
var condition = conditionFactory(module3.id);
_this._bindingDictionary.removeByCondition(condition);
});
};
Container4.prototype.bind = function(serviceIdentifier) {
var scope = this.options.defaultScope || literal_types_1.BindingScopeEnum.Transient;
var binding = new binding_1.Binding(serviceIdentifier, scope);
this._bindingDictionary.add(serviceIdentifier, binding);
return new binding_to_syntax_1.BindingToSyntax(binding);
};
Container4.prototype.rebind = function(serviceIdentifier) {
this.unbind(serviceIdentifier);
return this.bind(serviceIdentifier);
};
Container4.prototype.unbind = function(serviceIdentifier) {
try {
this._bindingDictionary.remove(serviceIdentifier);
} catch (e4) {
throw new Error(ERROR_MSGS.CANNOT_UNBIND + " " + serialization_1.getServiceIdentifierAsString(serviceIdentifier));
}
};
Container4.prototype.unbindAll = function() {
this._bindingDictionary = new lookup_1.Lookup();
};
Container4.prototype.isBound = function(serviceIdentifier) {
var bound = this._bindingDictionary.hasKey(serviceIdentifier);
if (!bound && this.parent) {
bound = this.parent.isBound(serviceIdentifier);
}
return bound;
};
Container4.prototype.isBoundNamed = function(serviceIdentifier, named9) {
return this.isBoundTagged(serviceIdentifier, METADATA_KEY.NAMED_TAG, named9);
};
Container4.prototype.isBoundTagged = function(serviceIdentifier, key, value2) {
var bound = false;
if (this._bindingDictionary.hasKey(serviceIdentifier)) {
var bindings = this._bindingDictionary.get(serviceIdentifier);
var request_1 = planner_1.createMockRequest(this, serviceIdentifier, key, value2);
bound = bindings.some(function(b10) {
return b10.constraint(request_1);
});
}
if (!bound && this.parent) {
bound = this.parent.isBoundTagged(serviceIdentifier, key, value2);
}
return bound;
};
Container4.prototype.snapshot = function() {
this._snapshots.push(container_snapshot_1.ContainerSnapshot.of(this._bindingDictionary.clone(), this._middleware));
};
Container4.prototype.restore = function() {
var snapshot = this._snapshots.pop();
if (snapshot === void 0) {
throw new Error(ERROR_MSGS.NO_MORE_SNAPSHOTS_AVAILABLE);
}
this._bindingDictionary = snapshot.bindings;
this._middleware = snapshot.middleware;
};
Container4.prototype.createChild = function(containerOptions) {
var child = new Container4(containerOptions || this.options);
child.parent = this;
return child;
};
Container4.prototype.applyMiddleware = function() {
var middlewares = [];
for (var _i = 0; _i < arguments.length; _i++) {
middlewares[_i] = arguments[_i];
}
this._appliedMiddleware = this._appliedMiddleware.concat(middlewares);
var initial = this._middleware ? this._middleware : this._planAndResolve();
this._middleware = middlewares.reduce(function(prev, curr) {
return curr(prev);
}, initial);
};
Container4.prototype.applyCustomMetadataReader = function(metadataReader) {
this._metadataReader = metadataReader;
};
Container4.prototype.get = function(serviceIdentifier) {
return this._get(false, false, literal_types_1.TargetTypeEnum.Variable, serviceIdentifier);
};
Container4.prototype.getTagged = function(serviceIdentifier, key, value2) {
return this._get(false, false, literal_types_1.TargetTypeEnum.Variable, serviceIdentifier, key, value2);
};
Container4.prototype.getNamed = function(serviceIdentifier, named9) {
return this.getTagged(serviceIdentifier, METADATA_KEY.NAMED_TAG, named9);
};
Container4.prototype.getAll = function(serviceIdentifier) {
return this._get(true, true, literal_types_1.TargetTypeEnum.Variable, serviceIdentifier);
};
Container4.prototype.getAllTagged = function(serviceIdentifier, key, value2) {
return this._get(false, true, literal_types_1.TargetTypeEnum.Variable, serviceIdentifier, key, value2);
};
Container4.prototype.getAllNamed = function(serviceIdentifier, named9) {
return this.getAllTagged(serviceIdentifier, METADATA_KEY.NAMED_TAG, named9);
};
Container4.prototype.resolve = function(constructorFunction) {
var tempContainer = this.createChild();
tempContainer.bind(constructorFunction).toSelf();
this._appliedMiddleware.forEach(function(m4) {
tempContainer.applyMiddleware(m4);
});
return tempContainer.get(constructorFunction);
};
Container4.prototype._getContainerModuleHelpersFactory = function() {
var _this = this;
var setModuleId = function(bindingToSyntax, moduleId) {
bindingToSyntax._binding.moduleId = moduleId;
};
var getBindFunction = function(moduleId) {
return function(serviceIdentifier) {
var _bind = _this.bind.bind(_this);
var bindingToSyntax = _bind(serviceIdentifier);
setModuleId(bindingToSyntax, moduleId);
return bindingToSyntax;
};
};
var getUnbindFunction = function(moduleId) {
return function(serviceIdentifier) {
var _unbind = _this.unbind.bind(_this);
_unbind(serviceIdentifier);
};
};
var getIsboundFunction = function(moduleId) {
return function(serviceIdentifier) {
var _isBound = _this.isBound.bind(_this);
return _isBound(serviceIdentifier);
};
};
var getRebindFunction = function(moduleId) {
return function(serviceIdentifier) {
var _rebind = _this.rebind.bind(_this);
var bindingToSyntax = _rebind(serviceIdentifier);
setModuleId(bindingToSyntax, moduleId);
return bindingToSyntax;
};
};
return function(mId) {
return {
bindFunction: getBindFunction(mId),
isboundFunction: getIsboundFunction(mId),
rebindFunction: getRebindFunction(mId),
unbindFunction: getUnbindFunction(mId)
};
};
};
Container4.prototype._get = function(avoidConstraints, isMultiInject, targetType, serviceIdentifier, key, value2) {
var result = null;
var defaultArgs = {
avoidConstraints,
contextInterceptor: function(context) {
return context;
},
isMultiInject,
key,
serviceIdentifier,
targetType,
value: value2
};
if (this._middleware) {
result = this._middleware(defaultArgs);
if (result === void 0 || result === null) {
throw new Error(ERROR_MSGS.INVALID_MIDDLEWARE_RETURN);
}
} else {
result = this._planAndResolve()(defaultArgs);
}
return result;
};
Container4.prototype._planAndResolve = function() {
var _this = this;
return function(args) {
var context = planner_1.plan(_this._metadataReader, _this, args.isMultiInject, args.targetType, args.serviceIdentifier, args.key, args.value, args.avoidConstraints);
context = args.contextInterceptor(context);
var result = resolver_1.resolve(context);
return result;
};
};
return Container4;
}();
exports.Container = Container3;
}
});
// node_modules/inversify/lib/container/container_module.js
var require_container_module = __commonJS({
"node_modules/inversify/lib/container/container_module.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AsyncContainerModule = exports.ContainerModule = void 0;
var id_1 = require_id2();
var ContainerModule = function() {
function ContainerModule2(registry) {
this.id = id_1.id();
this.registry = registry;
}
return ContainerModule2;
}();
exports.ContainerModule = ContainerModule;
var AsyncContainerModule = function() {
function AsyncContainerModule2(registry) {
this.id = id_1.id();
this.registry = registry;
}
return AsyncContainerModule2;
}();
exports.AsyncContainerModule = AsyncContainerModule;
}
});
// node_modules/inversify/lib/annotation/injectable.js
var require_injectable = __commonJS({
"node_modules/inversify/lib/annotation/injectable.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.injectable = void 0;
var ERRORS_MSGS = require_error_msgs();
var METADATA_KEY = require_metadata_keys();
function injectable35() {
return function(target) {
if (Reflect.hasOwnMetadata(METADATA_KEY.PARAM_TYPES, target)) {
throw new Error(ERRORS_MSGS.DUPLICATED_INJECTABLE_DECORATOR);
}
var types2 = Reflect.getMetadata(METADATA_KEY.DESIGN_PARAM_TYPES, target) || [];
Reflect.defineMetadata(METADATA_KEY.PARAM_TYPES, types2, target);
return target;
};
}
exports.injectable = injectable35;
}
});
// node_modules/inversify/lib/annotation/tagged.js
var require_tagged = __commonJS({
"node_modules/inversify/lib/annotation/tagged.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.tagged = void 0;
var metadata_1 = require_metadata();
var decorator_utils_1 = require_decorator_utils();
function tagged(metadataKey, metadataValue) {
return function(target, targetKey, index2) {
var metadata = new metadata_1.Metadata(metadataKey, metadataValue);
if (typeof index2 === "number") {
decorator_utils_1.tagParameter(target, targetKey, index2, metadata);
} else {
decorator_utils_1.tagProperty(target, targetKey, metadata);
}
};
}
exports.tagged = tagged;
}
});
// node_modules/inversify/lib/annotation/named.js
var require_named = __commonJS({
"node_modules/inversify/lib/annotation/named.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.named = void 0;
var METADATA_KEY = require_metadata_keys();
var metadata_1 = require_metadata();
var decorator_utils_1 = require_decorator_utils();
function named9(name) {
return function(target, targetKey, index2) {
var metadata = new metadata_1.Metadata(METADATA_KEY.NAMED_TAG, name);
if (typeof index2 === "number") {
decorator_utils_1.tagParameter(target, targetKey, index2, metadata);
} else {
decorator_utils_1.tagProperty(target, targetKey, metadata);
}
};
}
exports.named = named9;
}
});
// node_modules/inversify/lib/annotation/optional.js
var require_optional = __commonJS({
"node_modules/inversify/lib/annotation/optional.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.optional = void 0;
var METADATA_KEY = require_metadata_keys();
var metadata_1 = require_metadata();
var decorator_utils_1 = require_decorator_utils();
function optional2() {
return function(target, targetKey, index2) {
var metadata = new metadata_1.Metadata(METADATA_KEY.OPTIONAL_TAG, true);
if (typeof index2 === "number") {
decorator_utils_1.tagParameter(target, targetKey, index2, metadata);
} else {
decorator_utils_1.tagProperty(target, targetKey, metadata);
}
};
}
exports.optional = optional2;
}
});
// node_modules/inversify/lib/annotation/unmanaged.js
var require_unmanaged = __commonJS({
"node_modules/inversify/lib/annotation/unmanaged.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.unmanaged = void 0;
var METADATA_KEY = require_metadata_keys();
var metadata_1 = require_metadata();
var decorator_utils_1 = require_decorator_utils();
function unmanaged() {
return function(target, targetKey, index2) {
var metadata = new metadata_1.Metadata(METADATA_KEY.UNMANAGED_TAG, true);
decorator_utils_1.tagParameter(target, targetKey, index2, metadata);
};
}
exports.unmanaged = unmanaged;
}
});
// node_modules/inversify/lib/annotation/multi_inject.js
var require_multi_inject = __commonJS({
"node_modules/inversify/lib/annotation/multi_inject.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.multiInject = void 0;
var METADATA_KEY = require_metadata_keys();
var metadata_1 = require_metadata();
var decorator_utils_1 = require_decorator_utils();
function multiInject(serviceIdentifier) {
return function(target, targetKey, index2) {
var metadata = new metadata_1.Metadata(METADATA_KEY.MULTI_INJECT_TAG, serviceIdentifier);
if (typeof index2 === "number") {
decorator_utils_1.tagParameter(target, targetKey, index2, metadata);
} else {
decorator_utils_1.tagProperty(target, targetKey, metadata);
}
};
}
exports.multiInject = multiInject;
}
});
// node_modules/inversify/lib/annotation/target_name.js
var require_target_name = __commonJS({
"node_modules/inversify/lib/annotation/target_name.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.targetName = void 0;
var METADATA_KEY = require_metadata_keys();
var metadata_1 = require_metadata();
var decorator_utils_1 = require_decorator_utils();
function targetName(name) {
return function(target, targetKey, index2) {
var metadata = new metadata_1.Metadata(METADATA_KEY.NAME_TAG, name);
decorator_utils_1.tagParameter(target, targetKey, index2, metadata);
};
}
exports.targetName = targetName;
}
});
// node_modules/inversify/lib/annotation/post_construct.js
var require_post_construct = __commonJS({
"node_modules/inversify/lib/annotation/post_construct.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.postConstruct = void 0;
var ERRORS_MSGS = require_error_msgs();
var METADATA_KEY = require_metadata_keys();
var metadata_1 = require_metadata();
function postConstruct() {
return function(target, propertyKey, descriptor) {
var metadata = new metadata_1.Metadata(METADATA_KEY.POST_CONSTRUCT, propertyKey);
if (Reflect.hasOwnMetadata(METADATA_KEY.POST_CONSTRUCT, target.constructor)) {
throw new Error(ERRORS_MSGS.MULTIPLE_POST_CONSTRUCT_METHODS);
}
Reflect.defineMetadata(METADATA_KEY.POST_CONSTRUCT, metadata, target.constructor);
};
}
exports.postConstruct = postConstruct;
}
});
// node_modules/inversify/lib/utils/binding_utils.js
var require_binding_utils = __commonJS({
"node_modules/inversify/lib/utils/binding_utils.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.multiBindToService = void 0;
var multiBindToService = function(container2) {
return function(service) {
return function() {
var types2 = [];
for (var _i = 0; _i < arguments.length; _i++) {
types2[_i] = arguments[_i];
}
return types2.forEach(function(t4) {
return container2.bind(t4).toService(service);
});
};
};
};
exports.multiBindToService = multiBindToService;
}
});
// node_modules/inversify/lib/inversify.js
var require_inversify = __commonJS({
"node_modules/inversify/lib/inversify.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.multiBindToService = exports.getServiceIdentifierAsString = exports.typeConstraint = exports.namedConstraint = exports.taggedConstraint = exports.traverseAncerstors = exports.decorate = exports.id = exports.MetadataReader = exports.postConstruct = exports.targetName = exports.multiInject = exports.unmanaged = exports.optional = exports.LazyServiceIdentifer = exports.inject = exports.named = exports.tagged = exports.injectable = exports.ContainerModule = exports.AsyncContainerModule = exports.TargetTypeEnum = exports.BindingTypeEnum = exports.BindingScopeEnum = exports.Container = exports.METADATA_KEY = void 0;
var keys2 = require_metadata_keys();
exports.METADATA_KEY = keys2;
var container_1 = require_container();
Object.defineProperty(exports, "Container", { enumerable: true, get: function() {
return container_1.Container;
} });
var literal_types_1 = require_literal_types();
Object.defineProperty(exports, "BindingScopeEnum", { enumerable: true, get: function() {
return literal_types_1.BindingScopeEnum;
} });
Object.defineProperty(exports, "BindingTypeEnum", { enumerable: true, get: function() {
return literal_types_1.BindingTypeEnum;
} });
Object.defineProperty(exports, "TargetTypeEnum", { enumerable: true, get: function() {
return literal_types_1.TargetTypeEnum;
} });
var container_module_1 = require_container_module();
Object.defineProperty(exports, "AsyncContainerModule", { enumerable: true, get: function() {
return container_module_1.AsyncContainerModule;
} });
Object.defineProperty(exports, "ContainerModule", { enumerable: true, get: function() {
return container_module_1.ContainerModule;
} });
var injectable_1 = require_injectable();
Object.defineProperty(exports, "injectable", { enumerable: true, get: function() {
return injectable_1.injectable;
} });
var tagged_1 = require_tagged();
Object.defineProperty(exports, "tagged", { enumerable: true, get: function() {
return tagged_1.tagged;
} });
var named_1 = require_named();
Object.defineProperty(exports, "named", { enumerable: true, get: function() {
return named_1.named;
} });
var inject_1 = require_inject();
Object.defineProperty(exports, "inject", { enumerable: true, get: function() {
return inject_1.inject;
} });
Object.defineProperty(exports, "LazyServiceIdentifer", { enumerable: true, get: function() {
return inject_1.LazyServiceIdentifer;
} });
var optional_1 = require_optional();
Object.defineProperty(exports, "optional", { enumerable: true, get: function() {
return optional_1.optional;
} });
var unmanaged_1 = require_unmanaged();
Object.defineProperty(exports, "unmanaged", { enumerable: true, get: function() {
return unmanaged_1.unmanaged;
} });
var multi_inject_1 = require_multi_inject();
Object.defineProperty(exports, "multiInject", { enumerable: true, get: function() {
return multi_inject_1.multiInject;
} });
var target_name_1 = require_target_name();
Object.defineProperty(exports, "targetName", { enumerable: true, get: function() {
return target_name_1.targetName;
} });
var post_construct_1 = require_post_construct();
Object.defineProperty(exports, "postConstruct", { enumerable: true, get: function() {
return post_construct_1.postConstruct;
} });
var metadata_reader_1 = require_metadata_reader();
Object.defineProperty(exports, "MetadataReader", { enumerable: true, get: function() {
return metadata_reader_1.MetadataReader;
} });
var id_1 = require_id2();
Object.defineProperty(exports, "id", { enumerable: true, get: function() {
return id_1.id;
} });
var decorator_utils_1 = require_decorator_utils();
Object.defineProperty(exports, "decorate", { enumerable: true, get: function() {
return decorator_utils_1.decorate;
} });
var constraint_helpers_1 = require_constraint_helpers();
Object.defineProperty(exports, "traverseAncerstors", { enumerable: true, get: function() {
return constraint_helpers_1.traverseAncerstors;
} });
Object.defineProperty(exports, "taggedConstraint", { enumerable: true, get: function() {
return constraint_helpers_1.taggedConstraint;
} });
Object.defineProperty(exports, "namedConstraint", { enumerable: true, get: function() {
return constraint_helpers_1.namedConstraint;
} });
Object.defineProperty(exports, "typeConstraint", { enumerable: true, get: function() {
return constraint_helpers_1.typeConstraint;
} });
var serialization_1 = require_serialization();
Object.defineProperty(exports, "getServiceIdentifierAsString", { enumerable: true, get: function() {
return serialization_1.getServiceIdentifierAsString;
} });
var binding_utils_1 = require_binding_utils();
Object.defineProperty(exports, "multiBindToService", { enumerable: true, get: function() {
return binding_utils_1.multiBindToService;
} });
}
});
// node_modules/inversify-inject-decorators/lib/decorators.js
var require_decorators = __commonJS({
"node_modules/inversify-inject-decorators/lib/decorators.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var INJECTION = Symbol.for("INJECTION");
function _proxyGetter(proto, key, resolve, doCache) {
function getter() {
if (doCache && !Reflect.hasMetadata(INJECTION, this, key)) {
Reflect.defineMetadata(INJECTION, resolve(), this, key);
}
if (Reflect.hasMetadata(INJECTION, this, key)) {
return Reflect.getMetadata(INJECTION, this, key);
} else {
return resolve();
}
}
function setter(newVal) {
Reflect.defineMetadata(INJECTION, newVal, this, key);
}
Object.defineProperty(proto, key, {
configurable: true,
enumerable: true,
get: getter,
set: setter
});
}
function makePropertyInjectDecorator(container2, doCache) {
return function(serviceIdentifier) {
return function(proto, key) {
var resolve = function() {
return container2.get(serviceIdentifier);
};
_proxyGetter(proto, key, resolve, doCache);
};
};
}
exports.makePropertyInjectDecorator = makePropertyInjectDecorator;
function makePropertyInjectNamedDecorator(container2, doCache) {
return function(serviceIdentifier, named9) {
return function(proto, key) {
var resolve = function() {
return container2.getNamed(serviceIdentifier, named9);
};
_proxyGetter(proto, key, resolve, doCache);
};
};
}
exports.makePropertyInjectNamedDecorator = makePropertyInjectNamedDecorator;
function makePropertyInjectTaggedDecorator(container2, doCache) {
return function(serviceIdentifier, key, value2) {
return function(proto, propertyName) {
var resolve = function() {
return container2.getTagged(serviceIdentifier, key, value2);
};
_proxyGetter(proto, propertyName, resolve, doCache);
};
};
}
exports.makePropertyInjectTaggedDecorator = makePropertyInjectTaggedDecorator;
function makePropertyMultiInjectDecorator(container2, doCache) {
return function(serviceIdentifier) {
return function(proto, key) {
var resolve = function() {
return container2.getAll(serviceIdentifier);
};
_proxyGetter(proto, key, resolve, doCache);
};
};
}
exports.makePropertyMultiInjectDecorator = makePropertyMultiInjectDecorator;
}
});
// node_modules/inversify-inject-decorators/lib/index.js
var require_lib3 = __commonJS({
"node_modules/inversify-inject-decorators/lib/index.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var decorators_1 = require_decorators();
function getDecorators2(container2, doCache) {
if (doCache === void 0) {
doCache = true;
}
var lazyInject2 = decorators_1.makePropertyInjectDecorator(container2, doCache);
var lazyInjectNamed = decorators_1.makePropertyInjectNamedDecorator(container2, doCache);
var lazyInjectTagged = decorators_1.makePropertyInjectTaggedDecorator(container2, doCache);
var lazyMultiInject2 = decorators_1.makePropertyMultiInjectDecorator(container2, doCache);
return {
lazyInject: lazyInject2,
lazyInjectNamed,
lazyInjectTagged,
lazyMultiInject: lazyMultiInject2
};
}
exports.default = getDecorators2;
}
});
// node_modules/@webgpu/types/dist/constants.js
var require_constants = __commonJS({
"node_modules/@webgpu/types/dist/constants.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ExtensionName;
(function(ExtensionName2) {
ExtensionName2["TextureCompressionBC"] = "texture-compression-bc";
})(ExtensionName = exports.ExtensionName || (exports.ExtensionName = {}));
var AddressMode;
(function(AddressMode2) {
AddressMode2["ClampToEdge"] = "clamp-to-edge";
AddressMode2["Repeat"] = "repeat";
AddressMode2["MirrorRepeat"] = "mirror-repeat";
})(AddressMode = exports.AddressMode || (exports.AddressMode = {}));
var BindingType2;
(function(BindingType3) {
BindingType3["UniformBuffer"] = "uniform-buffer";
BindingType3["StorageBuffer"] = "storage-buffer";
BindingType3["ReadonlyStorageBuffer"] = "readonly-storage-buffer";
BindingType3["Sampler"] = "sampler";
BindingType3["ComparisonSampler"] = "comparison-sampler";
BindingType3["SampledTexture"] = "sampled-texture";
BindingType3["ReadonlyStorageTexture"] = "readonly-storage-texture";
BindingType3["WriteonlyStorageTexture"] = "writeonly-storage-texture";
})(BindingType2 = exports.BindingType || (exports.BindingType = {}));
var BlendFactor2;
(function(BlendFactor3) {
BlendFactor3["Zero"] = "zero";
BlendFactor3["One"] = "one";
BlendFactor3["SrcColor"] = "src-color";
BlendFactor3["OneMinusSrcColor"] = "one-minus-src-color";
BlendFactor3["SrcAlpha"] = "src-alpha";
BlendFactor3["OneMinusSrcAlpha"] = "one-minus-src-alpha";
BlendFactor3["DstColor"] = "dst-color";
BlendFactor3["OneMinusDstColor"] = "one-minus-dst-color";
BlendFactor3["DstAlpha"] = "dst-alpha";
BlendFactor3["OneMinusDstAlpha"] = "one-minus-dst-alpha";
BlendFactor3["SrcAlphaSaturated"] = "src-alpha-saturated";
BlendFactor3["BlendColor"] = "blend-color";
BlendFactor3["OneMinusBlendColor"] = "one-minus-blend-color";
})(BlendFactor2 = exports.BlendFactor || (exports.BlendFactor = {}));
var BlendOperation2;
(function(BlendOperation3) {
BlendOperation3["Add"] = "add";
BlendOperation3["Subtract"] = "subtract";
BlendOperation3["ReverseSubtract"] = "reverse-subtract";
BlendOperation3["Min"] = "min";
BlendOperation3["Max"] = "max";
})(BlendOperation2 = exports.BlendOperation || (exports.BlendOperation = {}));
var CompareFunction2;
(function(CompareFunction3) {
CompareFunction3["Never"] = "never";
CompareFunction3["Less"] = "less";
CompareFunction3["Equal"] = "equal";
CompareFunction3["LessEqual"] = "less-equal";
CompareFunction3["Greater"] = "greater";
CompareFunction3["NotEqual"] = "not-equal";
CompareFunction3["GreaterEqual"] = "greater-equal";
CompareFunction3["Always"] = "always";
})(CompareFunction2 = exports.CompareFunction || (exports.CompareFunction = {}));
var CullMode3;
(function(CullMode4) {
CullMode4["None"] = "none";
CullMode4["Front"] = "front";
CullMode4["Back"] = "back";
})(CullMode3 = exports.CullMode || (exports.CullMode = {}));
var FilterMode;
(function(FilterMode2) {
FilterMode2["Nearest"] = "nearest";
FilterMode2["Linear"] = "linear";
})(FilterMode = exports.FilterMode || (exports.FilterMode = {}));
var FrontFace2;
(function(FrontFace3) {
FrontFace3["CCW"] = "ccw";
FrontFace3["CW"] = "cw";
})(FrontFace2 = exports.FrontFace || (exports.FrontFace = {}));
var IndexFormat2;
(function(IndexFormat3) {
IndexFormat3["Uint16"] = "uint16";
IndexFormat3["Uint32"] = "uint32";
})(IndexFormat2 = exports.IndexFormat || (exports.IndexFormat = {}));
var InputStepMode;
(function(InputStepMode2) {
InputStepMode2["Vertex"] = "vertex";
InputStepMode2["Instance"] = "instance";
})(InputStepMode = exports.InputStepMode || (exports.InputStepMode = {}));
var LoadOp2;
(function(LoadOp3) {
LoadOp3["Load"] = "load";
})(LoadOp2 = exports.LoadOp || (exports.LoadOp = {}));
var PrimitiveTopology2;
(function(PrimitiveTopology3) {
PrimitiveTopology3["PointList"] = "point-list";
PrimitiveTopology3["LineList"] = "line-list";
PrimitiveTopology3["LineStrip"] = "line-strip";
PrimitiveTopology3["TriangleList"] = "triangle-list";
PrimitiveTopology3["TriangleStrip"] = "triangle-strip";
})(PrimitiveTopology2 = exports.PrimitiveTopology || (exports.PrimitiveTopology = {}));
var StencilOperation2;
(function(StencilOperation3) {
StencilOperation3["Keep"] = "keep";
StencilOperation3["Zero"] = "zero";
StencilOperation3["Replace"] = "replace";
StencilOperation3["Invert"] = "invert";
StencilOperation3["IncrementClamp"] = "increment-clamp";
StencilOperation3["DecrementClamp"] = "decrement-clamp";
StencilOperation3["IncrementWrap"] = "increment-wrap";
StencilOperation3["DecrementWrap"] = "decrement-wrap";
})(StencilOperation2 = exports.StencilOperation || (exports.StencilOperation = {}));
var StoreOp2;
(function(StoreOp3) {
StoreOp3["Store"] = "store";
StoreOp3["Clear"] = "clear";
})(StoreOp2 = exports.StoreOp || (exports.StoreOp = {}));
var TextureDimension3;
(function(TextureDimension4) {
TextureDimension4["E1d"] = "1d";
TextureDimension4["E2d"] = "2d";
TextureDimension4["E3d"] = "3d";
})(TextureDimension3 = exports.TextureDimension || (exports.TextureDimension = {}));
var TextureFormat6;
(function(TextureFormat7) {
TextureFormat7["R8Unorm"] = "r8unorm";
TextureFormat7["R8Snorm"] = "r8snorm";
TextureFormat7["R8Uint"] = "r8uint";
TextureFormat7["R8Sint"] = "r8sint";
TextureFormat7["R16Uint"] = "r16uint";
TextureFormat7["R16Sint"] = "r16sint";
TextureFormat7["R16Float"] = "r16float";
TextureFormat7["RG8Unorm"] = "rg8unorm";
TextureFormat7["RG8Snorm"] = "rg8snorm";
TextureFormat7["RG8Uint"] = "rg8uint";
TextureFormat7["RG8Sint"] = "rg8sint";
TextureFormat7["R32Uint"] = "r32uint";
TextureFormat7["R32Sint"] = "r32sint";
TextureFormat7["R32Float"] = "r32float";
TextureFormat7["RG16Uint"] = "rg16uint";
TextureFormat7["RG16Sint"] = "rg16sint";
TextureFormat7["RG16Float"] = "rg16float";
TextureFormat7["RGBA8Unorm"] = "rgba8unorm";
TextureFormat7["RGBA8UnormSRGB"] = "rgba8unorm-srgb";
TextureFormat7["RGBA8Snorm"] = "rgba8snorm";
TextureFormat7["RGBA8Uint"] = "rgba8uint";
TextureFormat7["RGBA8Sint"] = "rgba8sint";
TextureFormat7["BGRA8Unorm"] = "bgra8unorm";
TextureFormat7["BGRA8UnormSRGB"] = "bgra8unorm-srgb";
TextureFormat7["RGB10A2Unorm"] = "rgb10a2unorm";
TextureFormat7["RG11B10Float"] = "rg11b10float";
TextureFormat7["RG32Uint"] = "rg32uint";
TextureFormat7["RG32Sint"] = "rg32sint";
TextureFormat7["RG32Float"] = "rg32float";
TextureFormat7["RGBA16Uint"] = "rgba16uint";
TextureFormat7["RGBA16Sint"] = "rgba16sint";
TextureFormat7["RGBA16Float"] = "rgba16float";
TextureFormat7["RGBA32Uint"] = "rgba32uint";
TextureFormat7["RGBA32Sint"] = "rgba32sint";
TextureFormat7["RGBA32Float"] = "rgba32float";
TextureFormat7["Depth32Float"] = "depth32float";
TextureFormat7["Depth24Plus"] = "depth24plus";
TextureFormat7["Depth24PlusStencil8"] = "depth24plus-stencil8";
})(TextureFormat6 = exports.TextureFormat || (exports.TextureFormat = {}));
var TextureComponentType;
(function(TextureComponentType2) {
TextureComponentType2["Float"] = "float";
TextureComponentType2["Sint"] = "sint";
TextureComponentType2["Uint"] = "uint";
})(TextureComponentType = exports.TextureComponentType || (exports.TextureComponentType = {}));
var TextureViewDimension2;
(function(TextureViewDimension3) {
TextureViewDimension3["E1d"] = "1d";
TextureViewDimension3["E2d"] = "2d";
TextureViewDimension3["E2dArray"] = "2d-array";
TextureViewDimension3["Cube"] = "cube";
TextureViewDimension3["CubeArray"] = "cube-array";
TextureViewDimension3["E3d"] = "3d";
})(TextureViewDimension2 = exports.TextureViewDimension || (exports.TextureViewDimension = {}));
var VertexFormat;
(function(VertexFormat2) {
VertexFormat2["Uchar2"] = "uchar2";
VertexFormat2["Uchar4"] = "uchar4";
VertexFormat2["Char2"] = "char2";
VertexFormat2["Char4"] = "char4";
VertexFormat2["Uchar2Norm"] = "uchar2norm";
VertexFormat2["Uchar4Norm"] = "uchar4norm";
VertexFormat2["Char2Norm"] = "char2norm";
VertexFormat2["Char4Norm"] = "char4norm";
VertexFormat2["Ushort2"] = "ushort2";
VertexFormat2["Ushort4"] = "ushort4";
VertexFormat2["Short2"] = "short2";
VertexFormat2["Short4"] = "short4";
VertexFormat2["Ushort2Norm"] = "ushort2norm";
VertexFormat2["Ushort4Norm"] = "ushort4norm";
VertexFormat2["Short2Norm"] = "short2norm";
VertexFormat2["Short4Norm"] = "short4norm";
VertexFormat2["Half2"] = "half2";
VertexFormat2["Half4"] = "half4";
VertexFormat2["Float"] = "float";
VertexFormat2["Float2"] = "float2";
VertexFormat2["Float3"] = "float3";
VertexFormat2["Float4"] = "float4";
VertexFormat2["Uint"] = "uint";
VertexFormat2["Uint2"] = "uint2";
VertexFormat2["Uint3"] = "uint3";
VertexFormat2["Uint4"] = "uint4";
VertexFormat2["Int"] = "int";
VertexFormat2["Int2"] = "int2";
VertexFormat2["Int3"] = "int3";
VertexFormat2["Int4"] = "int4";
})(VertexFormat = exports.VertexFormat || (exports.VertexFormat = {}));
var TextureAspect2;
(function(TextureAspect3) {
TextureAspect3["All"] = "all";
TextureAspect3["StencilOnly"] = "stencil-only";
TextureAspect3["DepthOnly"] = "depth-only";
})(TextureAspect2 = exports.TextureAspect || (exports.TextureAspect = {}));
var CompilationMessageType;
(function(CompilationMessageType2) {
CompilationMessageType2["Error"] = "error";
CompilationMessageType2["Warning"] = "warning";
CompilationMessageType2["Info"] = "info";
})(CompilationMessageType = exports.CompilationMessageType || (exports.CompilationMessageType = {}));
var QueryType;
(function(QueryType2) {
QueryType2["Occlusion"] = "occlusion";
})(QueryType = exports.QueryType || (exports.QueryType = {}));
var BufferUsage5;
(function(BufferUsage6) {
BufferUsage6[BufferUsage6["MapRead"] = 1] = "MapRead";
BufferUsage6[BufferUsage6["MapWrite"] = 2] = "MapWrite";
BufferUsage6[BufferUsage6["CopySrc"] = 4] = "CopySrc";
BufferUsage6[BufferUsage6["CopyDst"] = 8] = "CopyDst";
BufferUsage6[BufferUsage6["Index"] = 16] = "Index";
BufferUsage6[BufferUsage6["Vertex"] = 32] = "Vertex";
BufferUsage6[BufferUsage6["Uniform"] = 64] = "Uniform";
BufferUsage6[BufferUsage6["Storage"] = 128] = "Storage";
BufferUsage6[BufferUsage6["Indirect"] = 256] = "Indirect";
BufferUsage6[BufferUsage6["QueryResolve"] = 512] = "QueryResolve";
})(BufferUsage5 = exports.BufferUsage || (exports.BufferUsage = {}));
var ColorWrite2;
(function(ColorWrite3) {
ColorWrite3[ColorWrite3["Red"] = 1] = "Red";
ColorWrite3[ColorWrite3["Green"] = 2] = "Green";
ColorWrite3[ColorWrite3["Blue"] = 4] = "Blue";
ColorWrite3[ColorWrite3["Alpha"] = 8] = "Alpha";
ColorWrite3[ColorWrite3["All"] = 15] = "All";
})(ColorWrite2 = exports.ColorWrite || (exports.ColorWrite = {}));
var ShaderStage2;
(function(ShaderStage3) {
ShaderStage3[ShaderStage3["Vertex"] = 1] = "Vertex";
ShaderStage3[ShaderStage3["Fragment"] = 2] = "Fragment";
ShaderStage3[ShaderStage3["Compute"] = 4] = "Compute";
})(ShaderStage2 = exports.ShaderStage || (exports.ShaderStage = {}));
var TextureUsage3;
(function(TextureUsage4) {
TextureUsage4[TextureUsage4["CopySrc"] = 1] = "CopySrc";
TextureUsage4[TextureUsage4["CopyDst"] = 2] = "CopyDst";
TextureUsage4[TextureUsage4["Sampled"] = 4] = "Sampled";
TextureUsage4[TextureUsage4["Storage"] = 8] = "Storage";
TextureUsage4[TextureUsage4["OutputAttachment"] = 16] = "OutputAttachment";
})(TextureUsage3 = exports.TextureUsage || (exports.TextureUsage = {}));
var MapMode2;
(function(MapMode3) {
MapMode3[MapMode3["Read"] = 1] = "Read";
MapMode3[MapMode3["Write"] = 2] = "Write";
})(MapMode2 = exports.MapMode || (exports.MapMode = {}));
}
});
// node_modules/regl/dist/regl.js
var require_regl = __commonJS({
"node_modules/regl/dist/regl.js"(exports, module2) {
(function(global2, factory) {
typeof exports === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global2.createREGL = factory();
})(exports, function() {
"use strict";
var isTypedArray4 = function(x6) {
return x6 instanceof Uint8Array || x6 instanceof Uint16Array || x6 instanceof Uint32Array || x6 instanceof Int8Array || x6 instanceof Int16Array || x6 instanceof Int32Array || x6 instanceof Float32Array || x6 instanceof Float64Array || x6 instanceof Uint8ClampedArray;
};
var extend4 = function(base, opts) {
var keys2 = Object.keys(opts);
for (var i4 = 0; i4 < keys2.length; ++i4) {
base[keys2[i4]] = opts[keys2[i4]];
}
return base;
};
var endl = "\n";
function decodeB64(str8) {
if (typeof atob !== "undefined") {
return atob(str8);
}
return "base64:" + str8;
}
function raise(message) {
var error = new Error("(regl) " + message);
console.error(error);
throw error;
}
function check(pred, message) {
if (!pred) {
raise(message);
}
}
function encolon(message) {
if (message) {
return ": " + message;
}
return "";
}
function checkParameter(param, possibilities, message) {
if (!(param in possibilities)) {
raise("unknown parameter (" + param + ")" + encolon(message) + ". possible values: " + Object.keys(possibilities).join());
}
}
function checkIsTypedArray(data3, message) {
if (!isTypedArray4(data3)) {
raise("invalid parameter type" + encolon(message) + ". must be a typed array");
}
}
function standardTypeEh(value2, type2) {
switch (type2) {
case "number":
return typeof value2 === "number";
case "object":
return typeof value2 === "object";
case "string":
return typeof value2 === "string";
case "boolean":
return typeof value2 === "boolean";
case "function":
return typeof value2 === "function";
case "undefined":
return typeof value2 === "undefined";
case "symbol":
return typeof value2 === "symbol";
}
}
function checkTypeOf(value2, type2, message) {
if (!standardTypeEh(value2, type2)) {
raise("invalid parameter type" + encolon(message) + ". expected " + type2 + ", got " + typeof value2);
}
}
function checkNonNegativeInt(value2, message) {
if (!(value2 >= 0 && (value2 | 0) === value2)) {
raise("invalid parameter type, (" + value2 + ")" + encolon(message) + ". must be a nonnegative integer");
}
}
function checkOneOf(value2, list, message) {
if (list.indexOf(value2) < 0) {
raise("invalid value" + encolon(message) + ". must be one of: " + list);
}
}
var constructorKeys = [
"gl",
"canvas",
"container",
"attributes",
"pixelRatio",
"extensions",
"optionalExtensions",
"profile",
"onDone"
];
function checkConstructor(obj) {
Object.keys(obj).forEach(function(key) {
if (constructorKeys.indexOf(key) < 0) {
raise('invalid regl constructor argument "' + key + '". must be one of ' + constructorKeys);
}
});
}
function leftPad(str8, n3) {
str8 = str8 + "";
while (str8.length < n3) {
str8 = " " + str8;
}
return str8;
}
function ShaderFile() {
this.name = "unknown";
this.lines = [];
this.index = {};
this.hasErrors = false;
}
function ShaderLine(number, line3) {
this.number = number;
this.line = line3;
this.errors = [];
}
function ShaderError(fileNumber, lineNumber, message) {
this.file = fileNumber;
this.line = lineNumber;
this.message = message;
}
function guessCommand() {
var error = new Error();
var stack = (error.stack || error).toString();
var pat = /compileProcedure.*\n\s*at.*\((.*)\)/.exec(stack);
if (pat) {
return pat[1];
}
var pat2 = /compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(stack);
if (pat2) {
return pat2[1];
}
return "unknown";
}
function guessCallSite() {
var error = new Error();
var stack = (error.stack || error).toString();
var pat = /at REGLCommand.*\n\s+at.*\((.*)\)/.exec(stack);
if (pat) {
return pat[1];
}
var pat2 = /at REGLCommand.*\n\s+at\s+(.*)\n/.exec(stack);
if (pat2) {
return pat2[1];
}
return "unknown";
}
function parseSource(source, command) {
var lines2 = source.split("\n");
var lineNumber = 1;
var fileNumber = 0;
var files = {
unknown: new ShaderFile(),
0: new ShaderFile()
};
files.unknown.name = files[0].name = command || guessCommand();
files.unknown.lines.push(new ShaderLine(0, ""));
for (var i4 = 0; i4 < lines2.length; ++i4) {
var line3 = lines2[i4];
var parts = /^\s*#\s*(\w+)\s+(.+)\s*$/.exec(line3);
if (parts) {
switch (parts[1]) {
case "line":
var lineNumberInfo = /(\d+)(\s+\d+)?/.exec(parts[2]);
if (lineNumberInfo) {
lineNumber = lineNumberInfo[1] | 0;
if (lineNumberInfo[2]) {
fileNumber = lineNumberInfo[2] | 0;
if (!(fileNumber in files)) {
files[fileNumber] = new ShaderFile();
}
}
}
break;
case "define":
var nameInfo = /SHADER_NAME(_B64)?\s+(.*)$/.exec(parts[2]);
if (nameInfo) {
files[fileNumber].name = nameInfo[1] ? decodeB64(nameInfo[2]) : nameInfo[2];
}
break;
}
}
files[fileNumber].lines.push(new ShaderLine(lineNumber++, line3));
}
Object.keys(files).forEach(function(fileNumber2) {
var file = files[fileNumber2];
file.lines.forEach(function(line4) {
file.index[line4.number] = line4;
});
});
return files;
}
function parseErrorLog(errLog) {
var result = [];
errLog.split("\n").forEach(function(errMsg) {
if (errMsg.length < 5) {
return;
}
var parts = /^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(errMsg);
if (parts) {
result.push(new ShaderError(parts[1] | 0, parts[2] | 0, parts[3].trim()));
} else if (errMsg.length > 0) {
result.push(new ShaderError("unknown", 0, errMsg));
}
});
return result;
}
function annotateFiles(files, errors) {
errors.forEach(function(error) {
var file = files[error.file];
if (file) {
var line3 = file.index[error.line];
if (line3) {
line3.errors.push(error);
file.hasErrors = true;
return;
}
}
files.unknown.hasErrors = true;
files.unknown.lines[0].errors.push(error);
});
}
function checkShaderError(gl2, shader, source, type2, command) {
if (!gl2.getShaderParameter(shader, gl2.COMPILE_STATUS)) {
var errLog = gl2.getShaderInfoLog(shader);
var typeName = type2 === gl2.FRAGMENT_SHADER ? "fragment" : "vertex";
checkCommandType(source, "string", typeName + " shader source must be a string", command);
var files = parseSource(source, command);
var errors = parseErrorLog(errLog);
annotateFiles(files, errors);
Object.keys(files).forEach(function(fileNumber) {
var file = files[fileNumber];
if (!file.hasErrors) {
return;
}
var strings = [""];
var styles = [""];
function push(str8, style) {
strings.push(str8);
styles.push(style || "");
}
push("file number " + fileNumber + ": " + file.name + "\n", "color:red;text-decoration:underline;font-weight:bold");
file.lines.forEach(function(line3) {
if (line3.errors.length > 0) {
push(leftPad(line3.number, 4) + "| ", "background-color:yellow; font-weight:bold");
push(line3.line + endl, "color:red; background-color:yellow; font-weight:bold");
var offset = 0;
line3.errors.forEach(function(error) {
var message = error.message;
var token2 = /^\s*'(.*)'\s*:\s*(.*)$/.exec(message);
if (token2) {
var tokenPat = token2[1];
message = token2[2];
switch (tokenPat) {
case "assign":
tokenPat = "=";
break;
}
offset = Math.max(line3.line.indexOf(tokenPat, offset), 0);
} else {
offset = 0;
}
push(leftPad("| ", 6));
push(leftPad("^^^", offset + 3) + endl, "font-weight:bold");
push(leftPad("| ", 6));
push(message + endl, "font-weight:bold");
});
push(leftPad("| ", 6) + endl);
} else {
push(leftPad(line3.number, 4) + "| ");
push(line3.line + endl, "color:red");
}
});
if (typeof document !== "undefined" && !window.chrome) {
styles[0] = strings.join("%c");
console.log.apply(console, styles);
} else {
console.log(strings.join(""));
}
});
check.raise("Error compiling " + typeName + " shader, " + files[0].name);
}
}
function checkLinkError(gl2, program, fragShader, vertShader, command) {
if (!gl2.getProgramParameter(program, gl2.LINK_STATUS)) {
var errLog = gl2.getProgramInfoLog(program);
var fragParse = parseSource(fragShader, command);
var vertParse = parseSource(vertShader, command);
var header = 'Error linking program with vertex shader, "' + vertParse[0].name + '", and fragment shader "' + fragParse[0].name + '"';
if (typeof document !== "undefined") {
console.log("%c" + header + endl + "%c" + errLog, "color:red;text-decoration:underline;font-weight:bold", "color:red");
} else {
console.log(header + endl + errLog);
}
check.raise(header);
}
}
function saveCommandRef(object) {
object._commandRef = guessCommand();
}
function saveDrawCommandInfo(opts, uniforms, attributes, stringStore) {
saveCommandRef(opts);
function id(str8) {
if (str8) {
return stringStore.id(str8);
}
return 0;
}
opts._fragId = id(opts.static.frag);
opts._vertId = id(opts.static.vert);
function addProps(dict, set10) {
Object.keys(set10).forEach(function(u3) {
dict[stringStore.id(u3)] = true;
});
}
var uniformSet = opts._uniformSet = {};
addProps(uniformSet, uniforms.static);
addProps(uniformSet, uniforms.dynamic);
var attributeSet = opts._attributeSet = {};
addProps(attributeSet, attributes.static);
addProps(attributeSet, attributes.dynamic);
opts._hasCount = "count" in opts.static || "count" in opts.dynamic || "elements" in opts.static || "elements" in opts.dynamic;
}
function commandRaise(message, command) {
var callSite = guessCallSite();
raise(message + " in command " + (command || guessCommand()) + (callSite === "unknown" ? "" : " called from " + callSite));
}
function checkCommand(pred, message, command) {
if (!pred) {
commandRaise(message, command || guessCommand());
}
}
function checkParameterCommand(param, possibilities, message, command) {
if (!(param in possibilities)) {
commandRaise("unknown parameter (" + param + ")" + encolon(message) + ". possible values: " + Object.keys(possibilities).join(), command || guessCommand());
}
}
function checkCommandType(value2, type2, message, command) {
if (!standardTypeEh(value2, type2)) {
commandRaise("invalid parameter type" + encolon(message) + ". expected " + type2 + ", got " + typeof value2, command || guessCommand());
}
}
function checkOptional(block) {
block();
}
function checkFramebufferFormat(attachment, texFormats, rbFormats) {
if (attachment.texture) {
checkOneOf(attachment.texture._texture.internalformat, texFormats, "unsupported texture format for attachment");
} else {
checkOneOf(attachment.renderbuffer._renderbuffer.format, rbFormats, "unsupported renderbuffer format for attachment");
}
}
var GL_CLAMP_TO_EDGE = 33071;
var GL_NEAREST = 9728;
var GL_NEAREST_MIPMAP_NEAREST = 9984;
var GL_LINEAR_MIPMAP_NEAREST = 9985;
var GL_NEAREST_MIPMAP_LINEAR = 9986;
var GL_LINEAR_MIPMAP_LINEAR = 9987;
var GL_BYTE = 5120;
var GL_UNSIGNED_BYTE = 5121;
var GL_SHORT = 5122;
var GL_UNSIGNED_SHORT = 5123;
var GL_INT = 5124;
var GL_UNSIGNED_INT = 5125;
var GL_FLOAT = 5126;
var GL_UNSIGNED_SHORT_4_4_4_4 = 32819;
var GL_UNSIGNED_SHORT_5_5_5_1 = 32820;
var GL_UNSIGNED_SHORT_5_6_5 = 33635;
var GL_UNSIGNED_INT_24_8_WEBGL = 34042;
var GL_HALF_FLOAT_OES = 36193;
var TYPE_SIZE = {};
TYPE_SIZE[GL_BYTE] = TYPE_SIZE[GL_UNSIGNED_BYTE] = 1;
TYPE_SIZE[GL_SHORT] = TYPE_SIZE[GL_UNSIGNED_SHORT] = TYPE_SIZE[GL_HALF_FLOAT_OES] = TYPE_SIZE[GL_UNSIGNED_SHORT_5_6_5] = TYPE_SIZE[GL_UNSIGNED_SHORT_4_4_4_4] = TYPE_SIZE[GL_UNSIGNED_SHORT_5_5_5_1] = 2;
TYPE_SIZE[GL_INT] = TYPE_SIZE[GL_UNSIGNED_INT] = TYPE_SIZE[GL_FLOAT] = TYPE_SIZE[GL_UNSIGNED_INT_24_8_WEBGL] = 4;
function pixelSize(type2, channels) {
if (type2 === GL_UNSIGNED_SHORT_5_5_5_1 || type2 === GL_UNSIGNED_SHORT_4_4_4_4 || type2 === GL_UNSIGNED_SHORT_5_6_5) {
return 2;
} else if (type2 === GL_UNSIGNED_INT_24_8_WEBGL) {
return 4;
} else {
return TYPE_SIZE[type2] * channels;
}
}
function isPow2(v3) {
return !(v3 & v3 - 1) && !!v3;
}
function checkTexture2D(info, mipData, limits) {
var i4;
var w4 = mipData.width;
var h3 = mipData.height;
var c5 = mipData.channels;
check(w4 > 0 && w4 <= limits.maxTextureSize && h3 > 0 && h3 <= limits.maxTextureSize, "invalid texture shape");
if (info.wrapS !== GL_CLAMP_TO_EDGE || info.wrapT !== GL_CLAMP_TO_EDGE) {
check(isPow2(w4) && isPow2(h3), "incompatible wrap mode for texture, both width and height must be power of 2");
}
if (mipData.mipmask === 1) {
if (w4 !== 1 && h3 !== 1) {
check(info.minFilter !== GL_NEAREST_MIPMAP_NEAREST && info.minFilter !== GL_NEAREST_MIPMAP_LINEAR && info.minFilter !== GL_LINEAR_MIPMAP_NEAREST && info.minFilter !== GL_LINEAR_MIPMAP_LINEAR, "min filter requires mipmap");
}
} else {
check(isPow2(w4) && isPow2(h3), "texture must be a square power of 2 to support mipmapping");
check(mipData.mipmask === (w4 << 1) - 1, "missing or incomplete mipmap data");
}
if (mipData.type === GL_FLOAT) {
if (limits.extensions.indexOf("oes_texture_float_linear") < 0) {
check(info.minFilter === GL_NEAREST && info.magFilter === GL_NEAREST, "filter not supported, must enable oes_texture_float_linear");
}
check(!info.genMipmaps, "mipmap generation not supported with float textures");
}
var mipimages = mipData.images;
for (i4 = 0; i4 < 16; ++i4) {
if (mipimages[i4]) {
var mw = w4 >> i4;
var mh = h3 >> i4;
check(mipData.mipmask & 1 << i4, "missing mipmap data");
var img = mipimages[i4];
check(img.width === mw && img.height === mh, "invalid shape for mip images");
check(img.format === mipData.format && img.internalformat === mipData.internalformat && img.type === mipData.type, "incompatible type for mip image");
if (img.compressed) {
} else if (img.data) {
var rowSize = Math.ceil(pixelSize(img.type, c5) * mw / img.unpackAlignment) * img.unpackAlignment;
check(img.data.byteLength === rowSize * mh, "invalid data for image, buffer size is inconsistent with image format");
} else if (img.element) {
} else if (img.copy) {
}
} else if (!info.genMipmaps) {
check((mipData.mipmask & 1 << i4) === 0, "extra mipmap data");
}
}
if (mipData.compressed) {
check(!info.genMipmaps, "mipmap generation for compressed images not supported");
}
}
function checkTextureCube(texture, info, faces, limits) {
var w4 = texture.width;
var h3 = texture.height;
var c5 = texture.channels;
check(w4 > 0 && w4 <= limits.maxTextureSize && h3 > 0 && h3 <= limits.maxTextureSize, "invalid texture shape");
check(w4 === h3, "cube map must be square");
check(info.wrapS === GL_CLAMP_TO_EDGE && info.wrapT === GL_CLAMP_TO_EDGE, "wrap mode not supported by cube map");
for (var i4 = 0; i4 < faces.length; ++i4) {
var face = faces[i4];
check(face.width === w4 && face.height === h3, "inconsistent cube map face shape");
if (info.genMipmaps) {
check(!face.compressed, "can not generate mipmap for compressed textures");
check(face.mipmask === 1, "can not specify mipmaps and generate mipmaps");
} else {
}
var mipmaps = face.images;
for (var j4 = 0; j4 < 16; ++j4) {
var img = mipmaps[j4];
if (img) {
var mw = w4 >> j4;
var mh = h3 >> j4;
check(face.mipmask & 1 << j4, "missing mipmap data");
check(img.width === mw && img.height === mh, "invalid shape for mip images");
check(img.format === texture.format && img.internalformat === texture.internalformat && img.type === texture.type, "incompatible type for mip image");
if (img.compressed) {
} else if (img.data) {
check(img.data.byteLength === mw * mh * Math.max(pixelSize(img.type, c5), img.unpackAlignment), "invalid data for image, buffer size is inconsistent with image format");
} else if (img.element) {
} else if (img.copy) {
}
}
}
}
}
var check$1 = extend4(check, {
optional: checkOptional,
raise,
commandRaise,
command: checkCommand,
parameter: checkParameter,
commandParameter: checkParameterCommand,
constructor: checkConstructor,
type: checkTypeOf,
commandType: checkCommandType,
isTypedArray: checkIsTypedArray,
nni: checkNonNegativeInt,
oneOf: checkOneOf,
shaderError: checkShaderError,
linkError: checkLinkError,
callSite: guessCallSite,
saveCommandRef,
saveDrawInfo: saveDrawCommandInfo,
framebufferFormat: checkFramebufferFormat,
guessCommand,
texture2D: checkTexture2D,
textureCube: checkTextureCube
});
var VARIABLE_COUNTER = 0;
var DYN_FUNC = 0;
var DYN_CONSTANT = 5;
var DYN_ARRAY = 6;
function DynamicVariable(type2, data3) {
this.id = VARIABLE_COUNTER++;
this.type = type2;
this.data = data3;
}
function escapeStr(str8) {
return str8.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
}
function splitParts(str8) {
if (str8.length === 0) {
return [];
}
var firstChar = str8.charAt(0);
var lastChar = str8.charAt(str8.length - 1);
if (str8.length > 1 && firstChar === lastChar && (firstChar === '"' || firstChar === "'")) {
return ['"' + escapeStr(str8.substr(1, str8.length - 2)) + '"'];
}
var parts = /\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(str8);
if (parts) {
return splitParts(str8.substr(0, parts.index)).concat(splitParts(parts[1])).concat(splitParts(str8.substr(parts.index + parts[0].length)));
}
var subparts = str8.split(".");
if (subparts.length === 1) {
return ['"' + escapeStr(str8) + '"'];
}
var result = [];
for (var i4 = 0; i4 < subparts.length; ++i4) {
result = result.concat(splitParts(subparts[i4]));
}
return result;
}
function toAccessorString(str8) {
return "[" + splitParts(str8).join("][") + "]";
}
function defineDynamic(type2, data3) {
return new DynamicVariable(type2, toAccessorString(data3 + ""));
}
function isDynamic(x6) {
return typeof x6 === "function" && !x6._reglType || x6 instanceof DynamicVariable;
}
function unbox(x6, path) {
if (typeof x6 === "function") {
return new DynamicVariable(DYN_FUNC, x6);
} else if (typeof x6 === "number" || typeof x6 === "boolean") {
return new DynamicVariable(DYN_CONSTANT, x6);
} else if (Array.isArray(x6)) {
return new DynamicVariable(DYN_ARRAY, x6.map((y5, i4) => unbox(y5, path + "[" + i4 + "]")));
} else if (x6 instanceof DynamicVariable) {
return x6;
}
check$1(false, "invalid option type in uniform " + path);
}
var dynamic = {
DynamicVariable,
define: defineDynamic,
isDynamic,
unbox,
accessor: toAccessorString
};
var raf = {
next: typeof requestAnimationFrame === "function" ? function(cb) {
return requestAnimationFrame(cb);
} : function(cb) {
return setTimeout(cb, 16);
},
cancel: typeof cancelAnimationFrame === "function" ? function(raf2) {
return cancelAnimationFrame(raf2);
} : clearTimeout
};
var clock2 = typeof performance !== "undefined" && performance.now ? function() {
return performance.now();
} : function() {
return +new Date();
};
function createStringStore() {
var stringIds = { "": 0 };
var stringValues = [""];
return {
id: function(str8) {
var result = stringIds[str8];
if (result) {
return result;
}
result = stringIds[str8] = stringValues.length;
stringValues.push(str8);
return result;
},
str: function(id) {
return stringValues[id];
}
};
}
function createCanvas2(element, onDone, pixelRatio) {
var canvas = document.createElement("canvas");
extend4(canvas.style, {
border: 0,
margin: 0,
padding: 0,
top: 0,
left: 0
});
element.appendChild(canvas);
if (element === document.body) {
canvas.style.position = "absolute";
extend4(element.style, {
margin: 0,
padding: 0
});
}
function resize() {
var w4 = window.innerWidth;
var h3 = window.innerHeight;
if (element !== document.body) {
var bounds = element.getBoundingClientRect();
w4 = bounds.right - bounds.left;
h3 = bounds.bottom - bounds.top;
}
canvas.width = pixelRatio * w4;
canvas.height = pixelRatio * h3;
extend4(canvas.style, {
width: w4 + "px",
height: h3 + "px"
});
}
var resizeObserver;
if (element !== document.body && typeof ResizeObserver === "function") {
resizeObserver = new ResizeObserver(function() {
setTimeout(resize);
});
resizeObserver.observe(element);
} else {
window.addEventListener("resize", resize, false);
}
function onDestroy() {
if (resizeObserver) {
resizeObserver.disconnect();
} else {
window.removeEventListener("resize", resize);
}
element.removeChild(canvas);
}
resize();
return {
canvas,
onDestroy
};
}
function createContext(canvas, contextAttributes) {
function get3(name) {
try {
return canvas.getContext(name, contextAttributes);
} catch (e4) {
return null;
}
}
return get3("webgl") || get3("experimental-webgl") || get3("webgl-experimental");
}
function isHTMLElement(obj) {
return typeof obj.nodeName === "string" && typeof obj.appendChild === "function" && typeof obj.getBoundingClientRect === "function";
}
function isWebGLContext(obj) {
return typeof obj.drawArrays === "function" || typeof obj.drawElements === "function";
}
function parseExtensions(input) {
if (typeof input === "string") {
return input.split();
}
check$1(Array.isArray(input), "invalid extension array");
return input;
}
function getElement(desc) {
if (typeof desc === "string") {
check$1(typeof document !== "undefined", "not supported outside of DOM");
return document.querySelector(desc);
}
return desc;
}
function parseArgs(args_) {
var args = args_ || {};
var element, container2, canvas, gl2;
var contextAttributes = {};
var extensions = [];
var optionalExtensions = [];
var pixelRatio = typeof window === "undefined" ? 1 : window.devicePixelRatio;
var profile = false;
var onDone = function(err) {
if (err) {
check$1.raise(err);
}
};
var onDestroy = function() {
};
if (typeof args === "string") {
check$1(typeof document !== "undefined", "selector queries only supported in DOM enviroments");
element = document.querySelector(args);
check$1(element, "invalid query string for element");
} else if (typeof args === "object") {
if (isHTMLElement(args)) {
element = args;
} else if (isWebGLContext(args)) {
gl2 = args;
canvas = gl2.canvas;
} else {
check$1.constructor(args);
if ("gl" in args) {
gl2 = args.gl;
} else if ("canvas" in args) {
canvas = getElement(args.canvas);
} else if ("container" in args) {
container2 = getElement(args.container);
}
if ("attributes" in args) {
contextAttributes = args.attributes;
check$1.type(contextAttributes, "object", "invalid context attributes");
}
if ("extensions" in args) {
extensions = parseExtensions(args.extensions);
}
if ("optionalExtensions" in args) {
optionalExtensions = parseExtensions(args.optionalExtensions);
}
if ("onDone" in args) {
check$1.type(args.onDone, "function", "invalid or missing onDone callback");
onDone = args.onDone;
}
if ("profile" in args) {
profile = !!args.profile;
}
if ("pixelRatio" in args) {
pixelRatio = +args.pixelRatio;
check$1(pixelRatio > 0, "invalid pixel ratio");
}
}
} else {
check$1.raise("invalid arguments to regl");
}
if (element) {
if (element.nodeName.toLowerCase() === "canvas") {
canvas = element;
} else {
container2 = element;
}
}
if (!gl2) {
if (!canvas) {
check$1(typeof document !== "undefined", "must manually specify webgl context outside of DOM environments");
var result = createCanvas2(container2 || document.body, onDone, pixelRatio);
if (!result) {
return null;
}
canvas = result.canvas;
onDestroy = result.onDestroy;
}
if (contextAttributes.premultipliedAlpha === void 0)
contextAttributes.premultipliedAlpha = true;
gl2 = createContext(canvas, contextAttributes);
}
if (!gl2) {
onDestroy();
onDone("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org");
return null;
}
return {
gl: gl2,
canvas,
container: container2,
extensions,
optionalExtensions,
pixelRatio,
profile,
onDone,
onDestroy
};
}
function createExtensionCache(gl2, config) {
var extensions = {};
function tryLoadExtension(name_) {
check$1.type(name_, "string", "extension name must be string");
var name2 = name_.toLowerCase();
var ext;
try {
ext = extensions[name2] = gl2.getExtension(name2);
} catch (e4) {
}
return !!ext;
}
for (var i4 = 0; i4 < config.extensions.length; ++i4) {
var name = config.extensions[i4];
if (!tryLoadExtension(name)) {
config.onDestroy();
config.onDone('"' + name + '" extension is not supported by the current WebGL context, try upgrading your system or a different browser');
return null;
}
}
config.optionalExtensions.forEach(tryLoadExtension);
return {
extensions,
restore: function() {
Object.keys(extensions).forEach(function(name2) {
if (extensions[name2] && !tryLoadExtension(name2)) {
throw new Error("(regl): error restoring extension " + name2);
}
});
}
};
}
function loop(n3, f3) {
var result = Array(n3);
for (var i4 = 0; i4 < n3; ++i4) {
result[i4] = f3(i4);
}
return result;
}
var GL_BYTE$1 = 5120;
var GL_UNSIGNED_BYTE$2 = 5121;
var GL_SHORT$1 = 5122;
var GL_UNSIGNED_SHORT$1 = 5123;
var GL_INT$1 = 5124;
var GL_UNSIGNED_INT$1 = 5125;
var GL_FLOAT$2 = 5126;
function nextPow16(v3) {
for (var i4 = 16; i4 <= 1 << 28; i4 *= 16) {
if (v3 <= i4) {
return i4;
}
}
return 0;
}
function log22(v3) {
var r4, shift;
r4 = (v3 > 65535) << 4;
v3 >>>= r4;
shift = (v3 > 255) << 3;
v3 >>>= shift;
r4 |= shift;
shift = (v3 > 15) << 2;
v3 >>>= shift;
r4 |= shift;
shift = (v3 > 3) << 1;
v3 >>>= shift;
r4 |= shift;
return r4 | v3 >> 1;
}
function createPool() {
var bufferPool = loop(8, function() {
return [];
});
function alloc(n3) {
var sz = nextPow16(n3);
var bin = bufferPool[log22(sz) >> 2];
if (bin.length > 0) {
return bin.pop();
}
return new ArrayBuffer(sz);
}
function free(buf) {
bufferPool[log22(buf.byteLength) >> 2].push(buf);
}
function allocType(type2, n3) {
var result = null;
switch (type2) {
case GL_BYTE$1:
result = new Int8Array(alloc(n3), 0, n3);
break;
case GL_UNSIGNED_BYTE$2:
result = new Uint8Array(alloc(n3), 0, n3);
break;
case GL_SHORT$1:
result = new Int16Array(alloc(2 * n3), 0, n3);
break;
case GL_UNSIGNED_SHORT$1:
result = new Uint16Array(alloc(2 * n3), 0, n3);
break;
case GL_INT$1:
result = new Int32Array(alloc(4 * n3), 0, n3);
break;
case GL_UNSIGNED_INT$1:
result = new Uint32Array(alloc(4 * n3), 0, n3);
break;
case GL_FLOAT$2:
result = new Float32Array(alloc(4 * n3), 0, n3);
break;
default:
return null;
}
if (result.length !== n3) {
return result.subarray(0, n3);
}
return result;
}
function freeType(array) {
free(array.buffer);
}
return {
alloc,
free,
allocType,
freeType
};
}
var pool = createPool();
pool.zero = createPool();
var GL_SUBPIXEL_BITS = 3408;
var GL_RED_BITS = 3410;
var GL_GREEN_BITS = 3411;
var GL_BLUE_BITS = 3412;
var GL_ALPHA_BITS = 3413;
var GL_DEPTH_BITS = 3414;
var GL_STENCIL_BITS = 3415;
var GL_ALIASED_POINT_SIZE_RANGE = 33901;
var GL_ALIASED_LINE_WIDTH_RANGE = 33902;
var GL_MAX_TEXTURE_SIZE = 3379;
var GL_MAX_VIEWPORT_DIMS = 3386;
var GL_MAX_VERTEX_ATTRIBS = 34921;
var GL_MAX_VERTEX_UNIFORM_VECTORS = 36347;
var GL_MAX_VARYING_VECTORS = 36348;
var GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = 35661;
var GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 35660;
var GL_MAX_TEXTURE_IMAGE_UNITS = 34930;
var GL_MAX_FRAGMENT_UNIFORM_VECTORS = 36349;
var GL_MAX_CUBE_MAP_TEXTURE_SIZE = 34076;
var GL_MAX_RENDERBUFFER_SIZE = 34024;
var GL_VENDOR = 7936;
var GL_RENDERER = 7937;
var GL_VERSION = 7938;
var GL_SHADING_LANGUAGE_VERSION = 35724;
var GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = 34047;
var GL_MAX_COLOR_ATTACHMENTS_WEBGL = 36063;
var GL_MAX_DRAW_BUFFERS_WEBGL = 34852;
var GL_TEXTURE_2D = 3553;
var GL_TEXTURE_CUBE_MAP = 34067;
var GL_TEXTURE_CUBE_MAP_POSITIVE_X = 34069;
var GL_TEXTURE0 = 33984;
var GL_RGBA = 6408;
var GL_FLOAT$1 = 5126;
var GL_UNSIGNED_BYTE$1 = 5121;
var GL_FRAMEBUFFER = 36160;
var GL_FRAMEBUFFER_COMPLETE = 36053;
var GL_COLOR_ATTACHMENT0 = 36064;
var GL_COLOR_BUFFER_BIT$1 = 16384;
var wrapLimits = function(gl2, extensions) {
var maxAnisotropic = 1;
if (extensions.ext_texture_filter_anisotropic) {
maxAnisotropic = gl2.getParameter(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT);
}
var maxDrawbuffers = 1;
var maxColorAttachments = 1;
if (extensions.webgl_draw_buffers) {
maxDrawbuffers = gl2.getParameter(GL_MAX_DRAW_BUFFERS_WEBGL);
maxColorAttachments = gl2.getParameter(GL_MAX_COLOR_ATTACHMENTS_WEBGL);
}
var readFloat = !!extensions.oes_texture_float;
if (readFloat) {
var readFloatTexture = gl2.createTexture();
gl2.bindTexture(GL_TEXTURE_2D, readFloatTexture);
gl2.texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_FLOAT$1, null);
var fbo = gl2.createFramebuffer();
gl2.bindFramebuffer(GL_FRAMEBUFFER, fbo);
gl2.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, readFloatTexture, 0);
gl2.bindTexture(GL_TEXTURE_2D, null);
if (gl2.checkFramebufferStatus(GL_FRAMEBUFFER) !== GL_FRAMEBUFFER_COMPLETE)
readFloat = false;
else {
gl2.viewport(0, 0, 1, 1);
gl2.clearColor(1, 0, 0, 1);
gl2.clear(GL_COLOR_BUFFER_BIT$1);
var pixels = pool.allocType(GL_FLOAT$1, 4);
gl2.readPixels(0, 0, 1, 1, GL_RGBA, GL_FLOAT$1, pixels);
if (gl2.getError())
readFloat = false;
else {
gl2.deleteFramebuffer(fbo);
gl2.deleteTexture(readFloatTexture);
readFloat = pixels[0] === 1;
}
pool.freeType(pixels);
}
}
var isIE = typeof navigator !== "undefined" && (/MSIE/.test(navigator.userAgent) || /Trident\//.test(navigator.appVersion) || /Edge/.test(navigator.userAgent));
var npotTextureCube = true;
if (!isIE) {
var cubeTexture = gl2.createTexture();
var data3 = pool.allocType(GL_UNSIGNED_BYTE$1, 36);
gl2.activeTexture(GL_TEXTURE0);
gl2.bindTexture(GL_TEXTURE_CUBE_MAP, cubeTexture);
gl2.texImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGBA, 3, 3, 0, GL_RGBA, GL_UNSIGNED_BYTE$1, data3);
pool.freeType(data3);
gl2.bindTexture(GL_TEXTURE_CUBE_MAP, null);
gl2.deleteTexture(cubeTexture);
npotTextureCube = !gl2.getError();
}
return {
colorBits: [
gl2.getParameter(GL_RED_BITS),
gl2.getParameter(GL_GREEN_BITS),
gl2.getParameter(GL_BLUE_BITS),
gl2.getParameter(GL_ALPHA_BITS)
],
depthBits: gl2.getParameter(GL_DEPTH_BITS),
stencilBits: gl2.getParameter(GL_STENCIL_BITS),
subpixelBits: gl2.getParameter(GL_SUBPIXEL_BITS),
extensions: Object.keys(extensions).filter(function(ext) {
return !!extensions[ext];
}),
maxAnisotropic,
maxDrawbuffers,
maxColorAttachments,
pointSizeDims: gl2.getParameter(GL_ALIASED_POINT_SIZE_RANGE),
lineWidthDims: gl2.getParameter(GL_ALIASED_LINE_WIDTH_RANGE),
maxViewportDims: gl2.getParameter(GL_MAX_VIEWPORT_DIMS),
maxCombinedTextureUnits: gl2.getParameter(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS),
maxCubeMapSize: gl2.getParameter(GL_MAX_CUBE_MAP_TEXTURE_SIZE),
maxRenderbufferSize: gl2.getParameter(GL_MAX_RENDERBUFFER_SIZE),
maxTextureUnits: gl2.getParameter(GL_MAX_TEXTURE_IMAGE_UNITS),
maxTextureSize: gl2.getParameter(GL_MAX_TEXTURE_SIZE),
maxAttributes: gl2.getParameter(GL_MAX_VERTEX_ATTRIBS),
maxVertexUniforms: gl2.getParameter(GL_MAX_VERTEX_UNIFORM_VECTORS),
maxVertexTextureUnits: gl2.getParameter(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS),
maxVaryingVectors: gl2.getParameter(GL_MAX_VARYING_VECTORS),
maxFragmentUniforms: gl2.getParameter(GL_MAX_FRAGMENT_UNIFORM_VECTORS),
glsl: gl2.getParameter(GL_SHADING_LANGUAGE_VERSION),
renderer: gl2.getParameter(GL_RENDERER),
vendor: gl2.getParameter(GL_VENDOR),
version: gl2.getParameter(GL_VERSION),
readFloat,
npotTextureCube
};
};
function isNDArrayLike(obj) {
return !!obj && typeof obj === "object" && Array.isArray(obj.shape) && Array.isArray(obj.stride) && typeof obj.offset === "number" && obj.shape.length === obj.stride.length && (Array.isArray(obj.data) || isTypedArray4(obj.data));
}
var values2 = function(obj) {
return Object.keys(obj).map(function(key) {
return obj[key];
});
};
var flattenUtils = {
shape: arrayShape$1,
flatten: flattenArray
};
function flatten1D(array, nx, out) {
for (var i4 = 0; i4 < nx; ++i4) {
out[i4] = array[i4];
}
}
function flatten2D(array, nx, ny, out) {
var ptr = 0;
for (var i4 = 0; i4 < nx; ++i4) {
var row = array[i4];
for (var j4 = 0; j4 < ny; ++j4) {
out[ptr++] = row[j4];
}
}
}
function flatten3D(array, nx, ny, nz, out, ptr_) {
var ptr = ptr_;
for (var i4 = 0; i4 < nx; ++i4) {
var row = array[i4];
for (var j4 = 0; j4 < ny; ++j4) {
var col = row[j4];
for (var k4 = 0; k4 < nz; ++k4) {
out[ptr++] = col[k4];
}
}
}
}
function flattenRec(array, shape, level, out, ptr) {
var stride = 1;
for (var i4 = level + 1; i4 < shape.length; ++i4) {
stride *= shape[i4];
}
var n3 = shape[level];
if (shape.length - level === 4) {
var nx = shape[level + 1];
var ny = shape[level + 2];
var nz = shape[level + 3];
for (i4 = 0; i4 < n3; ++i4) {
flatten3D(array[i4], nx, ny, nz, out, ptr);
ptr += stride;
}
} else {
for (i4 = 0; i4 < n3; ++i4) {
flattenRec(array[i4], shape, level + 1, out, ptr);
ptr += stride;
}
}
}
function flattenArray(array, shape, type2, out_) {
var sz = 1;
if (shape.length) {
for (var i4 = 0; i4 < shape.length; ++i4) {
sz *= shape[i4];
}
} else {
sz = 0;
}
var out = out_ || pool.allocType(type2, sz);
switch (shape.length) {
case 0:
break;
case 1:
flatten1D(array, shape[0], out);
break;
case 2:
flatten2D(array, shape[0], shape[1], out);
break;
case 3:
flatten3D(array, shape[0], shape[1], shape[2], out, 0);
break;
default:
flattenRec(array, shape, 0, out, 0);
}
return out;
}
function arrayShape$1(array_) {
var shape = [];
for (var array = array_; array.length; array = array[0]) {
shape.push(array.length);
}
return shape;
}
var arrayTypes = {
"[object Int8Array]": 5120,
"[object Int16Array]": 5122,
"[object Int32Array]": 5124,
"[object Uint8Array]": 5121,
"[object Uint8ClampedArray]": 5121,
"[object Uint16Array]": 5123,
"[object Uint32Array]": 5125,
"[object Float32Array]": 5126,
"[object Float64Array]": 5121,
"[object ArrayBuffer]": 5121
};
var int8 = 5120;
var int16 = 5122;
var int32 = 5124;
var uint8 = 5121;
var uint16 = 5123;
var uint32 = 5125;
var float2 = 5126;
var float32 = 5126;
var glTypes = {
int8,
int16,
int32,
uint8,
uint16,
uint32,
float: float2,
float32
};
var dynamic$1 = 35048;
var stream = 35040;
var usageTypes = {
dynamic: dynamic$1,
stream,
"static": 35044
};
var arrayFlatten = flattenUtils.flatten;
var arrayShape = flattenUtils.shape;
var GL_STATIC_DRAW = 35044;
var GL_STREAM_DRAW = 35040;
var GL_UNSIGNED_BYTE$3 = 5121;
var GL_FLOAT$3 = 5126;
var DTYPES_SIZES = [];
DTYPES_SIZES[5120] = 1;
DTYPES_SIZES[5122] = 2;
DTYPES_SIZES[5124] = 4;
DTYPES_SIZES[5121] = 1;
DTYPES_SIZES[5123] = 2;
DTYPES_SIZES[5125] = 4;
DTYPES_SIZES[5126] = 4;
function typedArrayCode(data3) {
return arrayTypes[Object.prototype.toString.call(data3)] | 0;
}
function copyArray(out, inp) {
for (var i4 = 0; i4 < inp.length; ++i4) {
out[i4] = inp[i4];
}
}
function transpose5(result, data3, shapeX, shapeY, strideX, strideY, offset) {
var ptr = 0;
for (var i4 = 0; i4 < shapeX; ++i4) {
for (var j4 = 0; j4 < shapeY; ++j4) {
result[ptr++] = data3[strideX * i4 + strideY * j4 + offset];
}
}
}
function wrapBufferState(gl2, stats2, config, destroyBuffer) {
var bufferCount = 0;
var bufferSet = {};
function REGLBuffer(type2) {
this.id = bufferCount++;
this.buffer = gl2.createBuffer();
this.type = type2;
this.usage = GL_STATIC_DRAW;
this.byteLength = 0;
this.dimension = 1;
this.dtype = GL_UNSIGNED_BYTE$3;
this.persistentData = null;
if (config.profile) {
this.stats = { size: 0 };
}
}
REGLBuffer.prototype.bind = function() {
gl2.bindBuffer(this.type, this.buffer);
};
REGLBuffer.prototype.destroy = function() {
destroy(this);
};
var streamPool = [];
function createStream(type2, data3) {
var buffer = streamPool.pop();
if (!buffer) {
buffer = new REGLBuffer(type2);
}
buffer.bind();
initBufferFromData(buffer, data3, GL_STREAM_DRAW, 0, 1, false);
return buffer;
}
function destroyStream(stream$$1) {
streamPool.push(stream$$1);
}
function initBufferFromTypedArray(buffer, data3, usage) {
buffer.byteLength = data3.byteLength;
gl2.bufferData(buffer.type, data3, usage);
}
function initBufferFromData(buffer, data3, usage, dtype, dimension, persist) {
var shape;
buffer.usage = usage;
if (Array.isArray(data3)) {
buffer.dtype = dtype || GL_FLOAT$3;
if (data3.length > 0) {
var flatData;
if (Array.isArray(data3[0])) {
shape = arrayShape(data3);
var dim = 1;
for (var i4 = 1; i4 < shape.length; ++i4) {
dim *= shape[i4];
}
buffer.dimension = dim;
flatData = arrayFlatten(data3, shape, buffer.dtype);
initBufferFromTypedArray(buffer, flatData, usage);
if (persist) {
buffer.persistentData = flatData;
} else {
pool.freeType(flatData);
}
} else if (typeof data3[0] === "number") {
buffer.dimension = dimension;
var typedData = pool.allocType(buffer.dtype, data3.length);
copyArray(typedData, data3);
initBufferFromTypedArray(buffer, typedData, usage);
if (persist) {
buffer.persistentData = typedData;
} else {
pool.freeType(typedData);
}
} else if (isTypedArray4(data3[0])) {
buffer.dimension = data3[0].length;
buffer.dtype = dtype || typedArrayCode(data3[0]) || GL_FLOAT$3;
flatData = arrayFlatten(data3, [data3.length, data3[0].length], buffer.dtype);
initBufferFromTypedArray(buffer, flatData, usage);
if (persist) {
buffer.persistentData = flatData;
} else {
pool.freeType(flatData);
}
} else {
check$1.raise("invalid buffer data");
}
}
} else if (isTypedArray4(data3)) {
buffer.dtype = dtype || typedArrayCode(data3);
buffer.dimension = dimension;
initBufferFromTypedArray(buffer, data3, usage);
if (persist) {
buffer.persistentData = new Uint8Array(new Uint8Array(data3.buffer));
}
} else if (isNDArrayLike(data3)) {
shape = data3.shape;
var stride = data3.stride;
var offset = data3.offset;
var shapeX = 0;
var shapeY = 0;
var strideX = 0;
var strideY = 0;
if (shape.length === 1) {
shapeX = shape[0];
shapeY = 1;
strideX = stride[0];
strideY = 0;
} else if (shape.length === 2) {
shapeX = shape[0];
shapeY = shape[1];
strideX = stride[0];
strideY = stride[1];
} else {
check$1.raise("invalid shape");
}
buffer.dtype = dtype || typedArrayCode(data3.data) || GL_FLOAT$3;
buffer.dimension = shapeY;
var transposeData2 = pool.allocType(buffer.dtype, shapeX * shapeY);
transpose5(transposeData2, data3.data, shapeX, shapeY, strideX, strideY, offset);
initBufferFromTypedArray(buffer, transposeData2, usage);
if (persist) {
buffer.persistentData = transposeData2;
} else {
pool.freeType(transposeData2);
}
} else if (data3 instanceof ArrayBuffer) {
buffer.dtype = GL_UNSIGNED_BYTE$3;
buffer.dimension = dimension;
initBufferFromTypedArray(buffer, data3, usage);
if (persist) {
buffer.persistentData = new Uint8Array(new Uint8Array(data3));
}
} else {
check$1.raise("invalid buffer data");
}
}
function destroy(buffer) {
stats2.bufferCount--;
destroyBuffer(buffer);
var handle = buffer.buffer;
check$1(handle, "buffer must not be deleted already");
gl2.deleteBuffer(handle);
buffer.buffer = null;
delete bufferSet[buffer.id];
}
function createBuffer(options, type2, deferInit, persistent) {
stats2.bufferCount++;
var buffer = new REGLBuffer(type2);
bufferSet[buffer.id] = buffer;
function reglBuffer(options2) {
var usage = GL_STATIC_DRAW;
var data3 = null;
var byteLength = 0;
var dtype = 0;
var dimension = 1;
if (Array.isArray(options2) || isTypedArray4(options2) || isNDArrayLike(options2) || options2 instanceof ArrayBuffer) {
data3 = options2;
} else if (typeof options2 === "number") {
byteLength = options2 | 0;
} else if (options2) {
check$1.type(options2, "object", "buffer arguments must be an object, a number or an array");
if ("data" in options2) {
check$1(data3 === null || Array.isArray(data3) || isTypedArray4(data3) || isNDArrayLike(data3), "invalid data for buffer");
data3 = options2.data;
}
if ("usage" in options2) {
check$1.parameter(options2.usage, usageTypes, "invalid buffer usage");
usage = usageTypes[options2.usage];
}
if ("type" in options2) {
check$1.parameter(options2.type, glTypes, "invalid buffer type");
dtype = glTypes[options2.type];
}
if ("dimension" in options2) {
check$1.type(options2.dimension, "number", "invalid dimension");
dimension = options2.dimension | 0;
}
if ("length" in options2) {
check$1.nni(byteLength, "buffer length must be a nonnegative integer");
byteLength = options2.length | 0;
}
}
buffer.bind();
if (!data3) {
if (byteLength)
gl2.bufferData(buffer.type, byteLength, usage);
buffer.dtype = dtype || GL_UNSIGNED_BYTE$3;
buffer.usage = usage;
buffer.dimension = dimension;
buffer.byteLength = byteLength;
} else {
initBufferFromData(buffer, data3, usage, dtype, dimension, persistent);
}
if (config.profile) {
buffer.stats.size = buffer.byteLength * DTYPES_SIZES[buffer.dtype];
}
return reglBuffer;
}
function setSubData(data3, offset) {
check$1(offset + data3.byteLength <= buffer.byteLength, "invalid buffer subdata call, buffer is too small. Can't write data of size " + data3.byteLength + " starting from offset " + offset + " to a buffer of size " + buffer.byteLength);
gl2.bufferSubData(buffer.type, offset, data3);
}
function subdata(data3, offset_) {
var offset = (offset_ || 0) | 0;
var shape;
buffer.bind();
if (isTypedArray4(data3) || data3 instanceof ArrayBuffer) {
setSubData(data3, offset);
} else if (Array.isArray(data3)) {
if (data3.length > 0) {
if (typeof data3[0] === "number") {
var converted = pool.allocType(buffer.dtype, data3.length);
copyArray(converted, data3);
setSubData(converted, offset);
pool.freeType(converted);
} else if (Array.isArray(data3[0]) || isTypedArray4(data3[0])) {
shape = arrayShape(data3);
var flatData = arrayFlatten(data3, shape, buffer.dtype);
setSubData(flatData, offset);
pool.freeType(flatData);
} else {
check$1.raise("invalid buffer data");
}
}
} else if (isNDArrayLike(data3)) {
shape = data3.shape;
var stride = data3.stride;
var shapeX = 0;
var shapeY = 0;
var strideX = 0;
var strideY = 0;
if (shape.length === 1) {
shapeX = shape[0];
shapeY = 1;
strideX = stride[0];
strideY = 0;
} else if (shape.length === 2) {
shapeX = shape[0];
shapeY = shape[1];
strideX = stride[0];
strideY = stride[1];
} else {
check$1.raise("invalid shape");
}
var dtype = Array.isArray(data3.data) ? buffer.dtype : typedArrayCode(data3.data);
var transposeData2 = pool.allocType(dtype, shapeX * shapeY);
transpose5(transposeData2, data3.data, shapeX, shapeY, strideX, strideY, data3.offset);
setSubData(transposeData2, offset);
pool.freeType(transposeData2);
} else {
check$1.raise("invalid data for buffer subdata");
}
return reglBuffer;
}
if (!deferInit) {
reglBuffer(options);
}
reglBuffer._reglType = "buffer";
reglBuffer._buffer = buffer;
reglBuffer.subdata = subdata;
if (config.profile) {
reglBuffer.stats = buffer.stats;
}
reglBuffer.destroy = function() {
destroy(buffer);
};
return reglBuffer;
}
function restoreBuffers() {
values2(bufferSet).forEach(function(buffer) {
buffer.buffer = gl2.createBuffer();
gl2.bindBuffer(buffer.type, buffer.buffer);
gl2.bufferData(buffer.type, buffer.persistentData || buffer.byteLength, buffer.usage);
});
}
if (config.profile) {
stats2.getTotalBufferSize = function() {
var total = 0;
Object.keys(bufferSet).forEach(function(key) {
total += bufferSet[key].stats.size;
});
return total;
};
}
return {
create: createBuffer,
createStream,
destroyStream,
clear: function() {
values2(bufferSet).forEach(destroy);
streamPool.forEach(destroy);
},
getBuffer: function(wrapper) {
if (wrapper && wrapper._buffer instanceof REGLBuffer) {
return wrapper._buffer;
}
return null;
},
restore: restoreBuffers,
_initBuffer: initBufferFromData
};
}
var points = 0;
var point2 = 0;
var lines = 1;
var line2 = 1;
var triangles = 4;
var triangle3 = 4;
var primTypes = {
points,
point: point2,
lines,
line: line2,
triangles,
triangle: triangle3,
"line loop": 2,
"line strip": 3,
"triangle strip": 5,
"triangle fan": 6
};
var GL_POINTS = 0;
var GL_LINES = 1;
var GL_TRIANGLES = 4;
var GL_BYTE$2 = 5120;
var GL_UNSIGNED_BYTE$4 = 5121;
var GL_SHORT$2 = 5122;
var GL_UNSIGNED_SHORT$2 = 5123;
var GL_INT$2 = 5124;
var GL_UNSIGNED_INT$2 = 5125;
var GL_ELEMENT_ARRAY_BUFFER = 34963;
var GL_STREAM_DRAW$1 = 35040;
var GL_STATIC_DRAW$1 = 35044;
function wrapElementsState(gl2, extensions, bufferState, stats2) {
var elementSet = {};
var elementCount = 0;
var elementTypes = {
"uint8": GL_UNSIGNED_BYTE$4,
"uint16": GL_UNSIGNED_SHORT$2
};
if (extensions.oes_element_index_uint) {
elementTypes.uint32 = GL_UNSIGNED_INT$2;
}
function REGLElementBuffer(buffer) {
this.id = elementCount++;
elementSet[this.id] = this;
this.buffer = buffer;
this.primType = GL_TRIANGLES;
this.vertCount = 0;
this.type = 0;
}
REGLElementBuffer.prototype.bind = function() {
this.buffer.bind();
};
var bufferPool = [];
function createElementStream(data3) {
var result = bufferPool.pop();
if (!result) {
result = new REGLElementBuffer(bufferState.create(null, GL_ELEMENT_ARRAY_BUFFER, true, false)._buffer);
}
initElements(result, data3, GL_STREAM_DRAW$1, -1, -1, 0, 0);
return result;
}
function destroyElementStream(elements) {
bufferPool.push(elements);
}
function initElements(elements, data3, usage, prim, count2, byteLength, type2) {
elements.buffer.bind();
var dtype;
if (data3) {
var predictedType = type2;
if (!type2 && (!isTypedArray4(data3) || isNDArrayLike(data3) && !isTypedArray4(data3.data))) {
predictedType = extensions.oes_element_index_uint ? GL_UNSIGNED_INT$2 : GL_UNSIGNED_SHORT$2;
}
bufferState._initBuffer(elements.buffer, data3, usage, predictedType, 3);
} else {
gl2.bufferData(GL_ELEMENT_ARRAY_BUFFER, byteLength, usage);
elements.buffer.dtype = dtype || GL_UNSIGNED_BYTE$4;
elements.buffer.usage = usage;
elements.buffer.dimension = 3;
elements.buffer.byteLength = byteLength;
}
dtype = type2;
if (!type2) {
switch (elements.buffer.dtype) {
case GL_UNSIGNED_BYTE$4:
case GL_BYTE$2:
dtype = GL_UNSIGNED_BYTE$4;
break;
case GL_UNSIGNED_SHORT$2:
case GL_SHORT$2:
dtype = GL_UNSIGNED_SHORT$2;
break;
case GL_UNSIGNED_INT$2:
case GL_INT$2:
dtype = GL_UNSIGNED_INT$2;
break;
default:
check$1.raise("unsupported type for element array");
}
elements.buffer.dtype = dtype;
}
elements.type = dtype;
check$1(dtype !== GL_UNSIGNED_INT$2 || !!extensions.oes_element_index_uint, "32 bit element buffers not supported, enable oes_element_index_uint first");
var vertCount = count2;
if (vertCount < 0) {
vertCount = elements.buffer.byteLength;
if (dtype === GL_UNSIGNED_SHORT$2) {
vertCount >>= 1;
} else if (dtype === GL_UNSIGNED_INT$2) {
vertCount >>= 2;
}
}
elements.vertCount = vertCount;
var primType = prim;
if (prim < 0) {
primType = GL_TRIANGLES;
var dimension = elements.buffer.dimension;
if (dimension === 1)
primType = GL_POINTS;
if (dimension === 2)
primType = GL_LINES;
if (dimension === 3)
primType = GL_TRIANGLES;
}
elements.primType = primType;
}
function destroyElements(elements) {
stats2.elementsCount--;
check$1(elements.buffer !== null, "must not double destroy elements");
delete elementSet[elements.id];
elements.buffer.destroy();
elements.buffer = null;
}
function createElements(options, persistent) {
var buffer = bufferState.create(null, GL_ELEMENT_ARRAY_BUFFER, true);
var elements = new REGLElementBuffer(buffer._buffer);
stats2.elementsCount++;
function reglElements(options2) {
if (!options2) {
buffer();
elements.primType = GL_TRIANGLES;
elements.vertCount = 0;
elements.type = GL_UNSIGNED_BYTE$4;
} else if (typeof options2 === "number") {
buffer(options2);
elements.primType = GL_TRIANGLES;
elements.vertCount = options2 | 0;
elements.type = GL_UNSIGNED_BYTE$4;
} else {
var data3 = null;
var usage = GL_STATIC_DRAW$1;
var primType = -1;
var vertCount = -1;
var byteLength = 0;
var dtype = 0;
if (Array.isArray(options2) || isTypedArray4(options2) || isNDArrayLike(options2)) {
data3 = options2;
} else {
check$1.type(options2, "object", "invalid arguments for elements");
if ("data" in options2) {
data3 = options2.data;
check$1(Array.isArray(data3) || isTypedArray4(data3) || isNDArrayLike(data3), "invalid data for element buffer");
}
if ("usage" in options2) {
check$1.parameter(options2.usage, usageTypes, "invalid element buffer usage");
usage = usageTypes[options2.usage];
}
if ("primitive" in options2) {
check$1.parameter(options2.primitive, primTypes, "invalid element buffer primitive");
primType = primTypes[options2.primitive];
}
if ("count" in options2) {
check$1(typeof options2.count === "number" && options2.count >= 0, "invalid vertex count for elements");
vertCount = options2.count | 0;
}
if ("type" in options2) {
check$1.parameter(options2.type, elementTypes, "invalid buffer type");
dtype = elementTypes[options2.type];
}
if ("length" in options2) {
byteLength = options2.length | 0;
} else {
byteLength = vertCount;
if (dtype === GL_UNSIGNED_SHORT$2 || dtype === GL_SHORT$2) {
byteLength *= 2;
} else if (dtype === GL_UNSIGNED_INT$2 || dtype === GL_INT$2) {
byteLength *= 4;
}
}
}
initElements(elements, data3, usage, primType, vertCount, byteLength, dtype);
}
return reglElements;
}
reglElements(options);
reglElements._reglType = "elements";
reglElements._elements = elements;
reglElements.subdata = function(data3, offset) {
buffer.subdata(data3, offset);
return reglElements;
};
reglElements.destroy = function() {
destroyElements(elements);
};
return reglElements;
}
return {
create: createElements,
createStream: createElementStream,
destroyStream: destroyElementStream,
getElements: function(elements) {
if (typeof elements === "function" && elements._elements instanceof REGLElementBuffer) {
return elements._elements;
}
return null;
},
clear: function() {
values2(elementSet).forEach(destroyElements);
}
};
}
var FLOAT = new Float32Array(1);
var INT = new Uint32Array(FLOAT.buffer);
var GL_UNSIGNED_SHORT$4 = 5123;
function convertToHalfFloat(array) {
var ushorts = pool.allocType(GL_UNSIGNED_SHORT$4, array.length);
for (var i4 = 0; i4 < array.length; ++i4) {
if (isNaN(array[i4])) {
ushorts[i4] = 65535;
} else if (array[i4] === Infinity) {
ushorts[i4] = 31744;
} else if (array[i4] === -Infinity) {
ushorts[i4] = 64512;
} else {
FLOAT[0] = array[i4];
var x6 = INT[0];
var sgn = x6 >>> 31 << 15;
var exp2 = (x6 << 1 >>> 24) - 127;
var frac = x6 >> 13 & (1 << 10) - 1;
if (exp2 < -24) {
ushorts[i4] = sgn;
} else if (exp2 < -14) {
var s4 = -14 - exp2;
ushorts[i4] = sgn + (frac + (1 << 10) >> s4);
} else if (exp2 > 15) {
ushorts[i4] = sgn + 31744;
} else {
ushorts[i4] = sgn + (exp2 + 15 << 10) + frac;
}
}
}
return ushorts;
}
function isArrayLike2(s4) {
return Array.isArray(s4) || isTypedArray4(s4);
}
var isPow2$1 = function(v3) {
return !(v3 & v3 - 1) && !!v3;
};
var GL_COMPRESSED_TEXTURE_FORMATS = 34467;
var GL_TEXTURE_2D$1 = 3553;
var GL_TEXTURE_CUBE_MAP$1 = 34067;
var GL_TEXTURE_CUBE_MAP_POSITIVE_X$1 = 34069;
var GL_RGBA$1 = 6408;
var GL_ALPHA = 6406;
var GL_RGB = 6407;
var GL_LUMINANCE = 6409;
var GL_LUMINANCE_ALPHA = 6410;
var GL_RGBA4 = 32854;
var GL_RGB5_A1 = 32855;
var GL_RGB565 = 36194;
var GL_UNSIGNED_SHORT_4_4_4_4$1 = 32819;
var GL_UNSIGNED_SHORT_5_5_5_1$1 = 32820;
var GL_UNSIGNED_SHORT_5_6_5$1 = 33635;
var GL_UNSIGNED_INT_24_8_WEBGL$1 = 34042;
var GL_DEPTH_COMPONENT = 6402;
var GL_DEPTH_STENCIL = 34041;
var GL_SRGB_EXT = 35904;
var GL_SRGB_ALPHA_EXT = 35906;
var GL_HALF_FLOAT_OES$1 = 36193;
var GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 33776;
var GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777;
var GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778;
var GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779;
var GL_COMPRESSED_RGB_ATC_WEBGL = 35986;
var GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 35987;
var GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 34798;
var GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840;
var GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 35841;
var GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842;
var GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 35843;
var GL_COMPRESSED_RGB_ETC1_WEBGL = 36196;
var GL_UNSIGNED_BYTE$5 = 5121;
var GL_UNSIGNED_SHORT$3 = 5123;
var GL_UNSIGNED_INT$3 = 5125;
var GL_FLOAT$4 = 5126;
var GL_TEXTURE_WRAP_S = 10242;
var GL_TEXTURE_WRAP_T = 10243;
var GL_REPEAT = 10497;
var GL_CLAMP_TO_EDGE$1 = 33071;
var GL_MIRRORED_REPEAT = 33648;
var GL_TEXTURE_MAG_FILTER = 10240;
var GL_TEXTURE_MIN_FILTER = 10241;
var GL_NEAREST$1 = 9728;
var GL_LINEAR = 9729;
var GL_NEAREST_MIPMAP_NEAREST$1 = 9984;
var GL_LINEAR_MIPMAP_NEAREST$1 = 9985;
var GL_NEAREST_MIPMAP_LINEAR$1 = 9986;
var GL_LINEAR_MIPMAP_LINEAR$1 = 9987;
var GL_GENERATE_MIPMAP_HINT = 33170;
var GL_DONT_CARE = 4352;
var GL_FASTEST = 4353;
var GL_NICEST = 4354;
var GL_TEXTURE_MAX_ANISOTROPY_EXT = 34046;
var GL_UNPACK_ALIGNMENT = 3317;
var GL_UNPACK_FLIP_Y_WEBGL = 37440;
var GL_UNPACK_PREMULTIPLY_ALPHA_WEBGL = 37441;
var GL_UNPACK_COLORSPACE_CONVERSION_WEBGL = 37443;
var GL_BROWSER_DEFAULT_WEBGL = 37444;
var GL_TEXTURE0$1 = 33984;
var MIPMAP_FILTERS = [
GL_NEAREST_MIPMAP_NEAREST$1,
GL_NEAREST_MIPMAP_LINEAR$1,
GL_LINEAR_MIPMAP_NEAREST$1,
GL_LINEAR_MIPMAP_LINEAR$1
];
var CHANNELS_FORMAT = [
0,
GL_LUMINANCE,
GL_LUMINANCE_ALPHA,
GL_RGB,
GL_RGBA$1
];
var FORMAT_CHANNELS = {};
FORMAT_CHANNELS[GL_LUMINANCE] = FORMAT_CHANNELS[GL_ALPHA] = FORMAT_CHANNELS[GL_DEPTH_COMPONENT] = 1;
FORMAT_CHANNELS[GL_DEPTH_STENCIL] = FORMAT_CHANNELS[GL_LUMINANCE_ALPHA] = 2;
FORMAT_CHANNELS[GL_RGB] = FORMAT_CHANNELS[GL_SRGB_EXT] = 3;
FORMAT_CHANNELS[GL_RGBA$1] = FORMAT_CHANNELS[GL_SRGB_ALPHA_EXT] = 4;
function objectName(str8) {
return "[object " + str8 + "]";
}
var CANVAS_CLASS = objectName("HTMLCanvasElement");
var OFFSCREENCANVAS_CLASS = objectName("OffscreenCanvas");
var CONTEXT2D_CLASS = objectName("CanvasRenderingContext2D");
var BITMAP_CLASS = objectName("ImageBitmap");
var IMAGE_CLASS = objectName("HTMLImageElement");
var VIDEO_CLASS = objectName("HTMLVideoElement");
var PIXEL_CLASSES = Object.keys(arrayTypes).concat([
CANVAS_CLASS,
OFFSCREENCANVAS_CLASS,
CONTEXT2D_CLASS,
BITMAP_CLASS,
IMAGE_CLASS,
VIDEO_CLASS
]);
var TYPE_SIZES = [];
TYPE_SIZES[GL_UNSIGNED_BYTE$5] = 1;
TYPE_SIZES[GL_FLOAT$4] = 4;
TYPE_SIZES[GL_HALF_FLOAT_OES$1] = 2;
TYPE_SIZES[GL_UNSIGNED_SHORT$3] = 2;
TYPE_SIZES[GL_UNSIGNED_INT$3] = 4;
var FORMAT_SIZES_SPECIAL = [];
FORMAT_SIZES_SPECIAL[GL_RGBA4] = 2;
FORMAT_SIZES_SPECIAL[GL_RGB5_A1] = 2;
FORMAT_SIZES_SPECIAL[GL_RGB565] = 2;
FORMAT_SIZES_SPECIAL[GL_DEPTH_STENCIL] = 4;
FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGB_S3TC_DXT1_EXT] = 0.5;
FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_S3TC_DXT1_EXT] = 0.5;
FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_S3TC_DXT3_EXT] = 1;
FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_S3TC_DXT5_EXT] = 1;
FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGB_ATC_WEBGL] = 0.5;
FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL] = 1;
FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL] = 1;
FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG] = 0.5;
FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG] = 0.25;
FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG] = 0.5;
FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG] = 0.25;
FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGB_ETC1_WEBGL] = 0.5;
function isNumericArray(arr) {
return Array.isArray(arr) && (arr.length === 0 || typeof arr[0] === "number");
}
function isRectArray(arr) {
if (!Array.isArray(arr)) {
return false;
}
var width2 = arr.length;
if (width2 === 0 || !isArrayLike2(arr[0])) {
return false;
}
return true;
}
function classString(x6) {
return Object.prototype.toString.call(x6);
}
function isCanvasElement(object) {
return classString(object) === CANVAS_CLASS;
}
function isOffscreenCanvas(object) {
return classString(object) === OFFSCREENCANVAS_CLASS;
}
function isContext2D(object) {
return classString(object) === CONTEXT2D_CLASS;
}
function isBitmap(object) {
return classString(object) === BITMAP_CLASS;
}
function isImageElement(object) {
return classString(object) === IMAGE_CLASS;
}
function isVideoElement(object) {
return classString(object) === VIDEO_CLASS;
}
function isPixelData(object) {
if (!object) {
return false;
}
var className = classString(object);
if (PIXEL_CLASSES.indexOf(className) >= 0) {
return true;
}
return isNumericArray(object) || isRectArray(object) || isNDArrayLike(object);
}
function typedArrayCode$1(data3) {
return arrayTypes[Object.prototype.toString.call(data3)] | 0;
}
function convertData(result, data3) {
var n3 = data3.length;
switch (result.type) {
case GL_UNSIGNED_BYTE$5:
case GL_UNSIGNED_SHORT$3:
case GL_UNSIGNED_INT$3:
case GL_FLOAT$4:
var converted = pool.allocType(result.type, n3);
converted.set(data3);
result.data = converted;
break;
case GL_HALF_FLOAT_OES$1:
result.data = convertToHalfFloat(data3);
break;
default:
check$1.raise("unsupported texture type, must specify a typed array");
}
}
function preConvert(image, n3) {
return pool.allocType(image.type === GL_HALF_FLOAT_OES$1 ? GL_FLOAT$4 : image.type, n3);
}
function postConvert(image, data3) {
if (image.type === GL_HALF_FLOAT_OES$1) {
image.data = convertToHalfFloat(data3);
pool.freeType(data3);
} else {
image.data = data3;
}
}
function transposeData(image, array, strideX, strideY, strideC, offset) {
var w4 = image.width;
var h3 = image.height;
var c5 = image.channels;
var n3 = w4 * h3 * c5;
var data3 = preConvert(image, n3);
var p4 = 0;
for (var i4 = 0; i4 < h3; ++i4) {
for (var j4 = 0; j4 < w4; ++j4) {
for (var k4 = 0; k4 < c5; ++k4) {
data3[p4++] = array[strideX * j4 + strideY * i4 + strideC * k4 + offset];
}
}
}
postConvert(image, data3);
}
function getTextureSize(format2, type2, width2, height, isMipmap, isCube) {
var s4;
if (typeof FORMAT_SIZES_SPECIAL[format2] !== "undefined") {
s4 = FORMAT_SIZES_SPECIAL[format2];
} else {
s4 = FORMAT_CHANNELS[format2] * TYPE_SIZES[type2];
}
if (isCube) {
s4 *= 6;
}
if (isMipmap) {
var total = 0;
var w4 = width2;
while (w4 >= 1) {
total += s4 * w4 * w4;
w4 /= 2;
}
return total;
} else {
return s4 * width2 * height;
}
}
function createTextureSet(gl2, extensions, limits, reglPoll, contextState, stats2, config) {
var mipmapHint = {
"don't care": GL_DONT_CARE,
"dont care": GL_DONT_CARE,
"nice": GL_NICEST,
"fast": GL_FASTEST
};
var wrapModes = {
"repeat": GL_REPEAT,
"clamp": GL_CLAMP_TO_EDGE$1,
"mirror": GL_MIRRORED_REPEAT
};
var magFilters = {
"nearest": GL_NEAREST$1,
"linear": GL_LINEAR
};
var minFilters = extend4({
"mipmap": GL_LINEAR_MIPMAP_LINEAR$1,
"nearest mipmap nearest": GL_NEAREST_MIPMAP_NEAREST$1,
"linear mipmap nearest": GL_LINEAR_MIPMAP_NEAREST$1,
"nearest mipmap linear": GL_NEAREST_MIPMAP_LINEAR$1,
"linear mipmap linear": GL_LINEAR_MIPMAP_LINEAR$1
}, magFilters);
var colorSpace = {
"none": 0,
"browser": GL_BROWSER_DEFAULT_WEBGL
};
var textureTypes = {
"uint8": GL_UNSIGNED_BYTE$5,
"rgba4": GL_UNSIGNED_SHORT_4_4_4_4$1,
"rgb565": GL_UNSIGNED_SHORT_5_6_5$1,
"rgb5 a1": GL_UNSIGNED_SHORT_5_5_5_1$1
};
var textureFormats = {
"alpha": GL_ALPHA,
"luminance": GL_LUMINANCE,
"luminance alpha": GL_LUMINANCE_ALPHA,
"rgb": GL_RGB,
"rgba": GL_RGBA$1,
"rgba4": GL_RGBA4,
"rgb5 a1": GL_RGB5_A1,
"rgb565": GL_RGB565
};
var compressedTextureFormats = {};
if (extensions.ext_srgb) {
textureFormats.srgb = GL_SRGB_EXT;
textureFormats.srgba = GL_SRGB_ALPHA_EXT;
}
if (extensions.oes_texture_float) {
textureTypes.float32 = textureTypes.float = GL_FLOAT$4;
}
if (extensions.oes_texture_half_float) {
textureTypes["float16"] = textureTypes["half float"] = GL_HALF_FLOAT_OES$1;
}
if (extensions.webgl_depth_texture) {
extend4(textureFormats, {
"depth": GL_DEPTH_COMPONENT,
"depth stencil": GL_DEPTH_STENCIL
});
extend4(textureTypes, {
"uint16": GL_UNSIGNED_SHORT$3,
"uint32": GL_UNSIGNED_INT$3,
"depth stencil": GL_UNSIGNED_INT_24_8_WEBGL$1
});
}
if (extensions.webgl_compressed_texture_s3tc) {
extend4(compressedTextureFormats, {
"rgb s3tc dxt1": GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
"rgba s3tc dxt1": GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
"rgba s3tc dxt3": GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
"rgba s3tc dxt5": GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
});
}
if (extensions.webgl_compressed_texture_atc) {
extend4(compressedTextureFormats, {
"rgb atc": GL_COMPRESSED_RGB_ATC_WEBGL,
"rgba atc explicit alpha": GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,
"rgba atc interpolated alpha": GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL
});
}
if (extensions.webgl_compressed_texture_pvrtc) {
extend4(compressedTextureFormats, {
"rgb pvrtc 4bppv1": GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
"rgb pvrtc 2bppv1": GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG,
"rgba pvrtc 4bppv1": GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
"rgba pvrtc 2bppv1": GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
});
}
if (extensions.webgl_compressed_texture_etc1) {
compressedTextureFormats["rgb etc1"] = GL_COMPRESSED_RGB_ETC1_WEBGL;
}
var supportedCompressedFormats = Array.prototype.slice.call(gl2.getParameter(GL_COMPRESSED_TEXTURE_FORMATS));
Object.keys(compressedTextureFormats).forEach(function(name) {
var format2 = compressedTextureFormats[name];
if (supportedCompressedFormats.indexOf(format2) >= 0) {
textureFormats[name] = format2;
}
});
var supportedFormats = Object.keys(textureFormats);
limits.textureFormats = supportedFormats;
var textureFormatsInvert = [];
Object.keys(textureFormats).forEach(function(key) {
var val = textureFormats[key];
textureFormatsInvert[val] = key;
});
var textureTypesInvert = [];
Object.keys(textureTypes).forEach(function(key) {
var val = textureTypes[key];
textureTypesInvert[val] = key;
});
var magFiltersInvert = [];
Object.keys(magFilters).forEach(function(key) {
var val = magFilters[key];
magFiltersInvert[val] = key;
});
var minFiltersInvert = [];
Object.keys(minFilters).forEach(function(key) {
var val = minFilters[key];
minFiltersInvert[val] = key;
});
var wrapModesInvert = [];
Object.keys(wrapModes).forEach(function(key) {
var val = wrapModes[key];
wrapModesInvert[val] = key;
});
var colorFormats = supportedFormats.reduce(function(color4, key) {
var glenum = textureFormats[key];
if (glenum === GL_LUMINANCE || glenum === GL_ALPHA || glenum === GL_LUMINANCE || glenum === GL_LUMINANCE_ALPHA || glenum === GL_DEPTH_COMPONENT || glenum === GL_DEPTH_STENCIL || extensions.ext_srgb && (glenum === GL_SRGB_EXT || glenum === GL_SRGB_ALPHA_EXT)) {
color4[glenum] = glenum;
} else if (glenum === GL_RGB5_A1 || key.indexOf("rgba") >= 0) {
color4[glenum] = GL_RGBA$1;
} else {
color4[glenum] = GL_RGB;
}
return color4;
}, {});
function TexFlags() {
this.internalformat = GL_RGBA$1;
this.format = GL_RGBA$1;
this.type = GL_UNSIGNED_BYTE$5;
this.compressed = false;
this.premultiplyAlpha = false;
this.flipY = false;
this.unpackAlignment = 1;
this.colorSpace = GL_BROWSER_DEFAULT_WEBGL;
this.width = 0;
this.height = 0;
this.channels = 0;
}
function copyFlags(result, other2) {
result.internalformat = other2.internalformat;
result.format = other2.format;
result.type = other2.type;
result.compressed = other2.compressed;
result.premultiplyAlpha = other2.premultiplyAlpha;
result.flipY = other2.flipY;
result.unpackAlignment = other2.unpackAlignment;
result.colorSpace = other2.colorSpace;
result.width = other2.width;
result.height = other2.height;
result.channels = other2.channels;
}
function parseFlags2(flags, options) {
if (typeof options !== "object" || !options) {
return;
}
if ("premultiplyAlpha" in options) {
check$1.type(options.premultiplyAlpha, "boolean", "invalid premultiplyAlpha");
flags.premultiplyAlpha = options.premultiplyAlpha;
}
if ("flipY" in options) {
check$1.type(options.flipY, "boolean", "invalid texture flip");
flags.flipY = options.flipY;
}
if ("alignment" in options) {
check$1.oneOf(options.alignment, [1, 2, 4, 8], "invalid texture unpack alignment");
flags.unpackAlignment = options.alignment;
}
if ("colorSpace" in options) {
check$1.parameter(options.colorSpace, colorSpace, "invalid colorSpace");
flags.colorSpace = colorSpace[options.colorSpace];
}
if ("type" in options) {
var type2 = options.type;
check$1(extensions.oes_texture_float || !(type2 === "float" || type2 === "float32"), "you must enable the OES_texture_float extension in order to use floating point textures.");
check$1(extensions.oes_texture_half_float || !(type2 === "half float" || type2 === "float16"), "you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures.");
check$1(extensions.webgl_depth_texture || !(type2 === "uint16" || type2 === "uint32" || type2 === "depth stencil"), "you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures.");
check$1.parameter(type2, textureTypes, "invalid texture type");
flags.type = textureTypes[type2];
}
var w4 = flags.width;
var h3 = flags.height;
var c5 = flags.channels;
var hasChannels = false;
if ("shape" in options) {
check$1(Array.isArray(options.shape) && options.shape.length >= 2, "shape must be an array");
w4 = options.shape[0];
h3 = options.shape[1];
if (options.shape.length === 3) {
c5 = options.shape[2];
check$1(c5 > 0 && c5 <= 4, "invalid number of channels");
hasChannels = true;
}
check$1(w4 >= 0 && w4 <= limits.maxTextureSize, "invalid width");
check$1(h3 >= 0 && h3 <= limits.maxTextureSize, "invalid height");
} else {
if ("radius" in options) {
w4 = h3 = options.radius;
check$1(w4 >= 0 && w4 <= limits.maxTextureSize, "invalid radius");
}
if ("width" in options) {
w4 = options.width;
check$1(w4 >= 0 && w4 <= limits.maxTextureSize, "invalid width");
}
if ("height" in options) {
h3 = options.height;
check$1(h3 >= 0 && h3 <= limits.maxTextureSize, "invalid height");
}
if ("channels" in options) {
c5 = options.channels;
check$1(c5 > 0 && c5 <= 4, "invalid number of channels");
hasChannels = true;
}
}
flags.width = w4 | 0;
flags.height = h3 | 0;
flags.channels = c5 | 0;
var hasFormat = false;
if ("format" in options) {
var formatStr = options.format;
check$1(extensions.webgl_depth_texture || !(formatStr === "depth" || formatStr === "depth stencil"), "you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures.");
check$1.parameter(formatStr, textureFormats, "invalid texture format");
var internalformat = flags.internalformat = textureFormats[formatStr];
flags.format = colorFormats[internalformat];
if (formatStr in textureTypes) {
if (!("type" in options)) {
flags.type = textureTypes[formatStr];
}
}
if (formatStr in compressedTextureFormats) {
flags.compressed = true;
}
hasFormat = true;
}
if (!hasChannels && hasFormat) {
flags.channels = FORMAT_CHANNELS[flags.format];
} else if (hasChannels && !hasFormat) {
if (flags.channels !== CHANNELS_FORMAT[flags.format]) {
flags.format = flags.internalformat = CHANNELS_FORMAT[flags.channels];
}
} else if (hasFormat && hasChannels) {
check$1(flags.channels === FORMAT_CHANNELS[flags.format], "number of channels inconsistent with specified format");
}
}
function setFlags(flags) {
gl2.pixelStorei(GL_UNPACK_FLIP_Y_WEBGL, flags.flipY);
gl2.pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_WEBGL, flags.premultiplyAlpha);
gl2.pixelStorei(GL_UNPACK_COLORSPACE_CONVERSION_WEBGL, flags.colorSpace);
gl2.pixelStorei(GL_UNPACK_ALIGNMENT, flags.unpackAlignment);
}
function TexImage() {
TexFlags.call(this);
this.xOffset = 0;
this.yOffset = 0;
this.data = null;
this.needsFree = false;
this.element = null;
this.needsCopy = false;
}
function parseImage(image, options) {
var data3 = null;
if (isPixelData(options)) {
data3 = options;
} else if (options) {
check$1.type(options, "object", "invalid pixel data type");
parseFlags2(image, options);
if ("x" in options) {
image.xOffset = options.x | 0;
}
if ("y" in options) {
image.yOffset = options.y | 0;
}
if (isPixelData(options.data)) {
data3 = options.data;
}
}
check$1(!image.compressed || data3 instanceof Uint8Array, "compressed texture data must be stored in a uint8array");
if (options.copy) {
check$1(!data3, "can not specify copy and data field for the same texture");
var viewW = contextState.viewportWidth;
var viewH = contextState.viewportHeight;
image.width = image.width || viewW - image.xOffset;
image.height = image.height || viewH - image.yOffset;
image.needsCopy = true;
check$1(image.xOffset >= 0 && image.xOffset < viewW && image.yOffset >= 0 && image.yOffset < viewH && image.width > 0 && image.width <= viewW && image.height > 0 && image.height <= viewH, "copy texture read out of bounds");
} else if (!data3) {
image.width = image.width || 1;
image.height = image.height || 1;
image.channels = image.channels || 4;
} else if (isTypedArray4(data3)) {
image.channels = image.channels || 4;
image.data = data3;
if (!("type" in options) && image.type === GL_UNSIGNED_BYTE$5) {
image.type = typedArrayCode$1(data3);
}
} else if (isNumericArray(data3)) {
image.channels = image.channels || 4;
convertData(image, data3);
image.alignment = 1;
image.needsFree = true;
} else if (isNDArrayLike(data3)) {
var array = data3.data;
if (!Array.isArray(array) && image.type === GL_UNSIGNED_BYTE$5) {
image.type = typedArrayCode$1(array);
}
var shape = data3.shape;
var stride = data3.stride;
var shapeX, shapeY, shapeC, strideX, strideY, strideC;
if (shape.length === 3) {
shapeC = shape[2];
strideC = stride[2];
} else {
check$1(shape.length === 2, "invalid ndarray pixel data, must be 2 or 3D");
shapeC = 1;
strideC = 1;
}
shapeX = shape[0];
shapeY = shape[1];
strideX = stride[0];
strideY = stride[1];
image.alignment = 1;
image.width = shapeX;
image.height = shapeY;
image.channels = shapeC;
image.format = image.internalformat = CHANNELS_FORMAT[shapeC];
image.needsFree = true;
transposeData(image, array, strideX, strideY, strideC, data3.offset);
} else if (isCanvasElement(data3) || isOffscreenCanvas(data3) || isContext2D(data3)) {
if (isCanvasElement(data3) || isOffscreenCanvas(data3)) {
image.element = data3;
} else {
image.element = data3.canvas;
}
image.width = image.element.width;
image.height = image.element.height;
image.channels = 4;
} else if (isBitmap(data3)) {
image.element = data3;
image.width = data3.width;
image.height = data3.height;
image.channels = 4;
} else if (isImageElement(data3)) {
image.element = data3;
image.width = data3.naturalWidth;
image.height = data3.naturalHeight;
image.channels = 4;
} else if (isVideoElement(data3)) {
image.element = data3;
image.width = data3.videoWidth;
image.height = data3.videoHeight;
image.channels = 4;
} else if (isRectArray(data3)) {
var w4 = image.width || data3[0].length;
var h3 = image.height || data3.length;
var c5 = image.channels;
if (isArrayLike2(data3[0][0])) {
c5 = c5 || data3[0][0].length;
} else {
c5 = c5 || 1;
}
var arrayShape2 = flattenUtils.shape(data3);
var n3 = 1;
for (var dd = 0; dd < arrayShape2.length; ++dd) {
n3 *= arrayShape2[dd];
}
var allocData = preConvert(image, n3);
flattenUtils.flatten(data3, arrayShape2, "", allocData);
postConvert(image, allocData);
image.alignment = 1;
image.width = w4;
image.height = h3;
image.channels = c5;
image.format = image.internalformat = CHANNELS_FORMAT[c5];
image.needsFree = true;
}
if (image.type === GL_FLOAT$4) {
check$1(limits.extensions.indexOf("oes_texture_float") >= 0, "oes_texture_float extension not enabled");
} else if (image.type === GL_HALF_FLOAT_OES$1) {
check$1(limits.extensions.indexOf("oes_texture_half_float") >= 0, "oes_texture_half_float extension not enabled");
}
}
function setImage(info, target, miplevel) {
var element = info.element;
var data3 = info.data;
var internalformat = info.internalformat;
var format2 = info.format;
var type2 = info.type;
var width2 = info.width;
var height = info.height;
setFlags(info);
if (element) {
gl2.texImage2D(target, miplevel, format2, format2, type2, element);
} else if (info.compressed) {
gl2.compressedTexImage2D(target, miplevel, internalformat, width2, height, 0, data3);
} else if (info.needsCopy) {
reglPoll();
gl2.copyTexImage2D(target, miplevel, format2, info.xOffset, info.yOffset, width2, height, 0);
} else {
gl2.texImage2D(target, miplevel, format2, width2, height, 0, format2, type2, data3 || null);
}
}
function setSubImage(info, target, x6, y5, miplevel) {
var element = info.element;
var data3 = info.data;
var internalformat = info.internalformat;
var format2 = info.format;
var type2 = info.type;
var width2 = info.width;
var height = info.height;
setFlags(info);
if (element) {
gl2.texSubImage2D(target, miplevel, x6, y5, format2, type2, element);
} else if (info.compressed) {
gl2.compressedTexSubImage2D(target, miplevel, x6, y5, internalformat, width2, height, data3);
} else if (info.needsCopy) {
reglPoll();
gl2.copyTexSubImage2D(target, miplevel, x6, y5, info.xOffset, info.yOffset, width2, height);
} else {
gl2.texSubImage2D(target, miplevel, x6, y5, width2, height, format2, type2, data3);
}
}
var imagePool = [];
function allocImage() {
return imagePool.pop() || new TexImage();
}
function freeImage(image) {
if (image.needsFree) {
pool.freeType(image.data);
}
TexImage.call(image);
imagePool.push(image);
}
function MipMap() {
TexFlags.call(this);
this.genMipmaps = false;
this.mipmapHint = GL_DONT_CARE;
this.mipmask = 0;
this.images = Array(16);
}
function parseMipMapFromShape(mipmap, width2, height) {
var img = mipmap.images[0] = allocImage();
mipmap.mipmask = 1;
img.width = mipmap.width = width2;
img.height = mipmap.height = height;
img.channels = mipmap.channels = 4;
}
function parseMipMapFromObject(mipmap, options) {
var imgData = null;
if (isPixelData(options)) {
imgData = mipmap.images[0] = allocImage();
copyFlags(imgData, mipmap);
parseImage(imgData, options);
mipmap.mipmask = 1;
} else {
parseFlags2(mipmap, options);
if (Array.isArray(options.mipmap)) {
var mipData = options.mipmap;
for (var i4 = 0; i4 < mipData.length; ++i4) {
imgData = mipmap.images[i4] = allocImage();
copyFlags(imgData, mipmap);
imgData.width >>= i4;
imgData.height >>= i4;
parseImage(imgData, mipData[i4]);
mipmap.mipmask |= 1 << i4;
}
} else {
imgData = mipmap.images[0] = allocImage();
copyFlags(imgData, mipmap);
parseImage(imgData, options);
mipmap.mipmask = 1;
}
}
copyFlags(mipmap, mipmap.images[0]);
if (mipmap.compressed && (mipmap.internalformat === GL_COMPRESSED_RGB_S3TC_DXT1_EXT || mipmap.internalformat === GL_COMPRESSED_RGBA_S3TC_DXT1_EXT || mipmap.internalformat === GL_COMPRESSED_RGBA_S3TC_DXT3_EXT || mipmap.internalformat === GL_COMPRESSED_RGBA_S3TC_DXT5_EXT)) {
check$1(mipmap.width % 4 === 0 && mipmap.height % 4 === 0, "for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4");
}
}
function setMipMap(mipmap, target) {
var images = mipmap.images;
for (var i4 = 0; i4 < images.length; ++i4) {
if (!images[i4]) {
return;
}
setImage(images[i4], target, i4);
}
}
var mipPool = [];
function allocMipMap() {
var result = mipPool.pop() || new MipMap();
TexFlags.call(result);
result.mipmask = 0;
for (var i4 = 0; i4 < 16; ++i4) {
result.images[i4] = null;
}
return result;
}
function freeMipMap(mipmap) {
var images = mipmap.images;
for (var i4 = 0; i4 < images.length; ++i4) {
if (images[i4]) {
freeImage(images[i4]);
}
images[i4] = null;
}
mipPool.push(mipmap);
}
function TexInfo() {
this.minFilter = GL_NEAREST$1;
this.magFilter = GL_NEAREST$1;
this.wrapS = GL_CLAMP_TO_EDGE$1;
this.wrapT = GL_CLAMP_TO_EDGE$1;
this.anisotropic = 1;
this.genMipmaps = false;
this.mipmapHint = GL_DONT_CARE;
}
function parseTexInfo(info, options) {
if ("min" in options) {
var minFilter = options.min;
check$1.parameter(minFilter, minFilters);
info.minFilter = minFilters[minFilter];
if (MIPMAP_FILTERS.indexOf(info.minFilter) >= 0 && !("faces" in options)) {
info.genMipmaps = true;
}
}
if ("mag" in options) {
var magFilter = options.mag;
check$1.parameter(magFilter, magFilters);
info.magFilter = magFilters[magFilter];
}
var wrapS = info.wrapS;
var wrapT = info.wrapT;
if ("wrap" in options) {
var wrap = options.wrap;
if (typeof wrap === "string") {
check$1.parameter(wrap, wrapModes);
wrapS = wrapT = wrapModes[wrap];
} else if (Array.isArray(wrap)) {
check$1.parameter(wrap[0], wrapModes);
check$1.parameter(wrap[1], wrapModes);
wrapS = wrapModes[wrap[0]];
wrapT = wrapModes[wrap[1]];
}
} else {
if ("wrapS" in options) {
var optWrapS = options.wrapS;
check$1.parameter(optWrapS, wrapModes);
wrapS = wrapModes[optWrapS];
}
if ("wrapT" in options) {
var optWrapT = options.wrapT;
check$1.parameter(optWrapT, wrapModes);
wrapT = wrapModes[optWrapT];
}
}
info.wrapS = wrapS;
info.wrapT = wrapT;
if ("anisotropic" in options) {
var anisotropic = options.anisotropic;
check$1(typeof anisotropic === "number" && anisotropic >= 1 && anisotropic <= limits.maxAnisotropic, "aniso samples must be between 1 and ");
info.anisotropic = options.anisotropic;
}
if ("mipmap" in options) {
var hasMipMap = false;
switch (typeof options.mipmap) {
case "string":
check$1.parameter(options.mipmap, mipmapHint, "invalid mipmap hint");
info.mipmapHint = mipmapHint[options.mipmap];
info.genMipmaps = true;
hasMipMap = true;
break;
case "boolean":
hasMipMap = info.genMipmaps = options.mipmap;
break;
case "object":
check$1(Array.isArray(options.mipmap), "invalid mipmap type");
info.genMipmaps = false;
hasMipMap = true;
break;
default:
check$1.raise("invalid mipmap type");
}
if (hasMipMap && !("min" in options)) {
info.minFilter = GL_NEAREST_MIPMAP_NEAREST$1;
}
}
}
function setTexInfo(info, target) {
gl2.texParameteri(target, GL_TEXTURE_MIN_FILTER, info.minFilter);
gl2.texParameteri(target, GL_TEXTURE_MAG_FILTER, info.magFilter);
gl2.texParameteri(target, GL_TEXTURE_WRAP_S, info.wrapS);
gl2.texParameteri(target, GL_TEXTURE_WRAP_T, info.wrapT);
if (extensions.ext_texture_filter_anisotropic) {
gl2.texParameteri(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, info.anisotropic);
}
if (info.genMipmaps) {
gl2.hint(GL_GENERATE_MIPMAP_HINT, info.mipmapHint);
gl2.generateMipmap(target);
}
}
var textureCount = 0;
var textureSet = {};
var numTexUnits = limits.maxTextureUnits;
var textureUnits = Array(numTexUnits).map(function() {
return null;
});
function REGLTexture(target) {
TexFlags.call(this);
this.mipmask = 0;
this.internalformat = GL_RGBA$1;
this.id = textureCount++;
this.refCount = 1;
this.target = target;
this.texture = gl2.createTexture();
this.unit = -1;
this.bindCount = 0;
this.texInfo = new TexInfo();
if (config.profile) {
this.stats = { size: 0 };
}
}
function tempBind(texture) {
gl2.activeTexture(GL_TEXTURE0$1);
gl2.bindTexture(texture.target, texture.texture);
}
function tempRestore() {
var prev = textureUnits[0];
if (prev) {
gl2.bindTexture(prev.target, prev.texture);
} else {
gl2.bindTexture(GL_TEXTURE_2D$1, null);
}
}
function destroy(texture) {
var handle = texture.texture;
check$1(handle, "must not double destroy texture");
var unit = texture.unit;
var target = texture.target;
if (unit >= 0) {
gl2.activeTexture(GL_TEXTURE0$1 + unit);
gl2.bindTexture(target, null);
textureUnits[unit] = null;
}
gl2.deleteTexture(handle);
texture.texture = null;
texture.params = null;
texture.pixels = null;
texture.refCount = 0;
delete textureSet[texture.id];
stats2.textureCount--;
}
extend4(REGLTexture.prototype, {
bind: function() {
var texture = this;
texture.bindCount += 1;
var unit = texture.unit;
if (unit < 0) {
for (var i4 = 0; i4 < numTexUnits; ++i4) {
var other2 = textureUnits[i4];
if (other2) {
if (other2.bindCount > 0) {
continue;
}
other2.unit = -1;
}
textureUnits[i4] = texture;
unit = i4;
break;
}
if (unit >= numTexUnits) {
check$1.raise("insufficient number of texture units");
}
if (config.profile && stats2.maxTextureUnits < unit + 1) {
stats2.maxTextureUnits = unit + 1;
}
texture.unit = unit;
gl2.activeTexture(GL_TEXTURE0$1 + unit);
gl2.bindTexture(texture.target, texture.texture);
}
return unit;
},
unbind: function() {
this.bindCount -= 1;
},
decRef: function() {
if (--this.refCount <= 0) {
destroy(this);
}
}
});
function createTexture2D(a4, b10) {
var texture = new REGLTexture(GL_TEXTURE_2D$1);
textureSet[texture.id] = texture;
stats2.textureCount++;
function reglTexture2D(a5, b11) {
var texInfo = texture.texInfo;
TexInfo.call(texInfo);
var mipData = allocMipMap();
if (typeof a5 === "number") {
if (typeof b11 === "number") {
parseMipMapFromShape(mipData, a5 | 0, b11 | 0);
} else {
parseMipMapFromShape(mipData, a5 | 0, a5 | 0);
}
} else if (a5) {
check$1.type(a5, "object", "invalid arguments to regl.texture");
parseTexInfo(texInfo, a5);
parseMipMapFromObject(mipData, a5);
} else {
parseMipMapFromShape(mipData, 1, 1);
}
if (texInfo.genMipmaps) {
mipData.mipmask = (mipData.width << 1) - 1;
}
texture.mipmask = mipData.mipmask;
copyFlags(texture, mipData);
check$1.texture2D(texInfo, mipData, limits);
texture.internalformat = mipData.internalformat;
reglTexture2D.width = mipData.width;
reglTexture2D.height = mipData.height;
tempBind(texture);
setMipMap(mipData, GL_TEXTURE_2D$1);
setTexInfo(texInfo, GL_TEXTURE_2D$1);
tempRestore();
freeMipMap(mipData);
if (config.profile) {
texture.stats.size = getTextureSize(texture.internalformat, texture.type, mipData.width, mipData.height, texInfo.genMipmaps, false);
}
reglTexture2D.format = textureFormatsInvert[texture.internalformat];
reglTexture2D.type = textureTypesInvert[texture.type];
reglTexture2D.mag = magFiltersInvert[texInfo.magFilter];
reglTexture2D.min = minFiltersInvert[texInfo.minFilter];
reglTexture2D.wrapS = wrapModesInvert[texInfo.wrapS];
reglTexture2D.wrapT = wrapModesInvert[texInfo.wrapT];
return reglTexture2D;
}
function subimage(image, x_, y_, level_) {
check$1(!!image, "must specify image data");
var x6 = x_ | 0;
var y5 = y_ | 0;
var level = level_ | 0;
var imageData = allocImage();
copyFlags(imageData, texture);
imageData.width = 0;
imageData.height = 0;
parseImage(imageData, image);
imageData.width = imageData.width || (texture.width >> level) - x6;
imageData.height = imageData.height || (texture.height >> level) - y5;
check$1(texture.type === imageData.type && texture.format === imageData.format && texture.internalformat === imageData.internalformat, "incompatible format for texture.subimage");
check$1(x6 >= 0 && y5 >= 0 && x6 + imageData.width <= texture.width && y5 + imageData.height <= texture.height, "texture.subimage write out of bounds");
check$1(texture.mipmask & 1 << level, "missing mipmap data");
check$1(imageData.data || imageData.element || imageData.needsCopy, "missing image data");
tempBind(texture);
setSubImage(imageData, GL_TEXTURE_2D$1, x6, y5, level);
tempRestore();
freeImage(imageData);
return reglTexture2D;
}
function resize(w_, h_) {
var w4 = w_ | 0;
var h3 = h_ | 0 || w4;
if (w4 === texture.width && h3 === texture.height) {
return reglTexture2D;
}
reglTexture2D.width = texture.width = w4;
reglTexture2D.height = texture.height = h3;
tempBind(texture);
for (var i4 = 0; texture.mipmask >> i4; ++i4) {
var _w = w4 >> i4;
var _h = h3 >> i4;
if (!_w || !_h)
break;
gl2.texImage2D(GL_TEXTURE_2D$1, i4, texture.format, _w, _h, 0, texture.format, texture.type, null);
}
tempRestore();
if (config.profile) {
texture.stats.size = getTextureSize(texture.internalformat, texture.type, w4, h3, false, false);
}
return reglTexture2D;
}
reglTexture2D(a4, b10);
reglTexture2D.subimage = subimage;
reglTexture2D.resize = resize;
reglTexture2D._reglType = "texture2d";
reglTexture2D._texture = texture;
if (config.profile) {
reglTexture2D.stats = texture.stats;
}
reglTexture2D.destroy = function() {
texture.decRef();
};
return reglTexture2D;
}
function createTextureCube(a0, a1, a22, a32, a4, a5) {
var texture = new REGLTexture(GL_TEXTURE_CUBE_MAP$1);
textureSet[texture.id] = texture;
stats2.cubeCount++;
var faces = new Array(6);
function reglTextureCube(a02, a12, a23, a33, a42, a52) {
var i4;
var texInfo = texture.texInfo;
TexInfo.call(texInfo);
for (i4 = 0; i4 < 6; ++i4) {
faces[i4] = allocMipMap();
}
if (typeof a02 === "number" || !a02) {
var s4 = a02 | 0 || 1;
for (i4 = 0; i4 < 6; ++i4) {
parseMipMapFromShape(faces[i4], s4, s4);
}
} else if (typeof a02 === "object") {
if (a12) {
parseMipMapFromObject(faces[0], a02);
parseMipMapFromObject(faces[1], a12);
parseMipMapFromObject(faces[2], a23);
parseMipMapFromObject(faces[3], a33);
parseMipMapFromObject(faces[4], a42);
parseMipMapFromObject(faces[5], a52);
} else {
parseTexInfo(texInfo, a02);
parseFlags2(texture, a02);
if ("faces" in a02) {
var faceInput = a02.faces;
check$1(Array.isArray(faceInput) && faceInput.length === 6, "cube faces must be a length 6 array");
for (i4 = 0; i4 < 6; ++i4) {
check$1(typeof faceInput[i4] === "object" && !!faceInput[i4], "invalid input for cube map face");
copyFlags(faces[i4], texture);
parseMipMapFromObject(faces[i4], faceInput[i4]);
}
} else {
for (i4 = 0; i4 < 6; ++i4) {
parseMipMapFromObject(faces[i4], a02);
}
}
}
} else {
check$1.raise("invalid arguments to cube map");
}
copyFlags(texture, faces[0]);
if (!limits.npotTextureCube) {
check$1(isPow2$1(texture.width) && isPow2$1(texture.height), "your browser does not support non power or two texture dimensions");
}
if (texInfo.genMipmaps) {
texture.mipmask = (faces[0].width << 1) - 1;
} else {
texture.mipmask = faces[0].mipmask;
}
check$1.textureCube(texture, texInfo, faces, limits);
texture.internalformat = faces[0].internalformat;
reglTextureCube.width = faces[0].width;
reglTextureCube.height = faces[0].height;
tempBind(texture);
for (i4 = 0; i4 < 6; ++i4) {
setMipMap(faces[i4], GL_TEXTURE_CUBE_MAP_POSITIVE_X$1 + i4);
}
setTexInfo(texInfo, GL_TEXTURE_CUBE_MAP$1);
tempRestore();
if (config.profile) {
texture.stats.size = getTextureSize(texture.internalformat, texture.type, reglTextureCube.width, reglTextureCube.height, texInfo.genMipmaps, true);
}
reglTextureCube.format = textureFormatsInvert[texture.internalformat];
reglTextureCube.type = textureTypesInvert[texture.type];
reglTextureCube.mag = magFiltersInvert[texInfo.magFilter];
reglTextureCube.min = minFiltersInvert[texInfo.minFilter];
reglTextureCube.wrapS = wrapModesInvert[texInfo.wrapS];
reglTextureCube.wrapT = wrapModesInvert[texInfo.wrapT];
for (i4 = 0; i4 < 6; ++i4) {
freeMipMap(faces[i4]);
}
return reglTextureCube;
}
function subimage(face, image, x_, y_, level_) {
check$1(!!image, "must specify image data");
check$1(typeof face === "number" && face === (face | 0) && face >= 0 && face < 6, "invalid face");
var x6 = x_ | 0;
var y5 = y_ | 0;
var level = level_ | 0;
var imageData = allocImage();
copyFlags(imageData, texture);
imageData.width = 0;
imageData.height = 0;
parseImage(imageData, image);
imageData.width = imageData.width || (texture.width >> level) - x6;
imageData.height = imageData.height || (texture.height >> level) - y5;
check$1(texture.type === imageData.type && texture.format === imageData.format && texture.internalformat === imageData.internalformat, "incompatible format for texture.subimage");
check$1(x6 >= 0 && y5 >= 0 && x6 + imageData.width <= texture.width && y5 + imageData.height <= texture.height, "texture.subimage write out of bounds");
check$1(texture.mipmask & 1 << level, "missing mipmap data");
check$1(imageData.data || imageData.element || imageData.needsCopy, "missing image data");
tempBind(texture);
setSubImage(imageData, GL_TEXTURE_CUBE_MAP_POSITIVE_X$1 + face, x6, y5, level);
tempRestore();
freeImage(imageData);
return reglTextureCube;
}
function resize(radius_) {
var radius = radius_ | 0;
if (radius === texture.width) {
return;
}
reglTextureCube.width = texture.width = radius;
reglTextureCube.height = texture.height = radius;
tempBind(texture);
for (var i4 = 0; i4 < 6; ++i4) {
for (var j4 = 0; texture.mipmask >> j4; ++j4) {
gl2.texImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X$1 + i4, j4, texture.format, radius >> j4, radius >> j4, 0, texture.format, texture.type, null);
}
}
tempRestore();
if (config.profile) {
texture.stats.size = getTextureSize(texture.internalformat, texture.type, reglTextureCube.width, reglTextureCube.height, false, true);
}
return reglTextureCube;
}
reglTextureCube(a0, a1, a22, a32, a4, a5);
reglTextureCube.subimage = subimage;
reglTextureCube.resize = resize;
reglTextureCube._reglType = "textureCube";
reglTextureCube._texture = texture;
if (config.profile) {
reglTextureCube.stats = texture.stats;
}
reglTextureCube.destroy = function() {
texture.decRef();
};
return reglTextureCube;
}
function destroyTextures() {
for (var i4 = 0; i4 < numTexUnits; ++i4) {
gl2.activeTexture(GL_TEXTURE0$1 + i4);
gl2.bindTexture(GL_TEXTURE_2D$1, null);
textureUnits[i4] = null;
}
values2(textureSet).forEach(destroy);
stats2.cubeCount = 0;
stats2.textureCount = 0;
}
if (config.profile) {
stats2.getTotalTextureSize = function() {
var total = 0;
Object.keys(textureSet).forEach(function(key) {
total += textureSet[key].stats.size;
});
return total;
};
}
function restoreTextures() {
for (var i4 = 0; i4 < numTexUnits; ++i4) {
var tex = textureUnits[i4];
if (tex) {
tex.bindCount = 0;
tex.unit = -1;
textureUnits[i4] = null;
}
}
values2(textureSet).forEach(function(texture) {
texture.texture = gl2.createTexture();
gl2.bindTexture(texture.target, texture.texture);
for (var i5 = 0; i5 < 32; ++i5) {
if ((texture.mipmask & 1 << i5) === 0) {
continue;
}
if (texture.target === GL_TEXTURE_2D$1) {
gl2.texImage2D(GL_TEXTURE_2D$1, i5, texture.internalformat, texture.width >> i5, texture.height >> i5, 0, texture.internalformat, texture.type, null);
} else {
for (var j4 = 0; j4 < 6; ++j4) {
gl2.texImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X$1 + j4, i5, texture.internalformat, texture.width >> i5, texture.height >> i5, 0, texture.internalformat, texture.type, null);
}
}
}
setTexInfo(texture.texInfo, texture.target);
});
}
function refreshTextures() {
for (var i4 = 0; i4 < numTexUnits; ++i4) {
var tex = textureUnits[i4];
if (tex) {
tex.bindCount = 0;
tex.unit = -1;
textureUnits[i4] = null;
}
gl2.activeTexture(GL_TEXTURE0$1 + i4);
gl2.bindTexture(GL_TEXTURE_2D$1, null);
gl2.bindTexture(GL_TEXTURE_CUBE_MAP$1, null);
}
}
return {
create2D: createTexture2D,
createCube: createTextureCube,
clear: destroyTextures,
getTexture: function(wrapper) {
return null;
},
restore: restoreTextures,
refresh: refreshTextures
};
}
var GL_RENDERBUFFER = 36161;
var GL_RGBA4$1 = 32854;
var GL_RGB5_A1$1 = 32855;
var GL_RGB565$1 = 36194;
var GL_DEPTH_COMPONENT16 = 33189;
var GL_STENCIL_INDEX8 = 36168;
var GL_DEPTH_STENCIL$1 = 34041;
var GL_SRGB8_ALPHA8_EXT = 35907;
var GL_RGBA32F_EXT = 34836;
var GL_RGBA16F_EXT = 34842;
var GL_RGB16F_EXT = 34843;
var FORMAT_SIZES = [];
FORMAT_SIZES[GL_RGBA4$1] = 2;
FORMAT_SIZES[GL_RGB5_A1$1] = 2;
FORMAT_SIZES[GL_RGB565$1] = 2;
FORMAT_SIZES[GL_DEPTH_COMPONENT16] = 2;
FORMAT_SIZES[GL_STENCIL_INDEX8] = 1;
FORMAT_SIZES[GL_DEPTH_STENCIL$1] = 4;
FORMAT_SIZES[GL_SRGB8_ALPHA8_EXT] = 4;
FORMAT_SIZES[GL_RGBA32F_EXT] = 16;
FORMAT_SIZES[GL_RGBA16F_EXT] = 8;
FORMAT_SIZES[GL_RGB16F_EXT] = 6;
function getRenderbufferSize(format2, width2, height) {
return FORMAT_SIZES[format2] * width2 * height;
}
var wrapRenderbuffers = function(gl2, extensions, limits, stats2, config) {
var formatTypes = {
"rgba4": GL_RGBA4$1,
"rgb565": GL_RGB565$1,
"rgb5 a1": GL_RGB5_A1$1,
"depth": GL_DEPTH_COMPONENT16,
"stencil": GL_STENCIL_INDEX8,
"depth stencil": GL_DEPTH_STENCIL$1
};
if (extensions.ext_srgb) {
formatTypes["srgba"] = GL_SRGB8_ALPHA8_EXT;
}
if (extensions.ext_color_buffer_half_float) {
formatTypes["rgba16f"] = GL_RGBA16F_EXT;
formatTypes["rgb16f"] = GL_RGB16F_EXT;
}
if (extensions.webgl_color_buffer_float) {
formatTypes["rgba32f"] = GL_RGBA32F_EXT;
}
var formatTypesInvert = [];
Object.keys(formatTypes).forEach(function(key) {
var val = formatTypes[key];
formatTypesInvert[val] = key;
});
var renderbufferCount = 0;
var renderbufferSet = {};
function REGLRenderbuffer(renderbuffer) {
this.id = renderbufferCount++;
this.refCount = 1;
this.renderbuffer = renderbuffer;
this.format = GL_RGBA4$1;
this.width = 0;
this.height = 0;
if (config.profile) {
this.stats = { size: 0 };
}
}
REGLRenderbuffer.prototype.decRef = function() {
if (--this.refCount <= 0) {
destroy(this);
}
};
function destroy(rb) {
var handle = rb.renderbuffer;
check$1(handle, "must not double destroy renderbuffer");
gl2.bindRenderbuffer(GL_RENDERBUFFER, null);
gl2.deleteRenderbuffer(handle);
rb.renderbuffer = null;
rb.refCount = 0;
delete renderbufferSet[rb.id];
stats2.renderbufferCount--;
}
function createRenderbuffer(a4, b10) {
var renderbuffer = new REGLRenderbuffer(gl2.createRenderbuffer());
renderbufferSet[renderbuffer.id] = renderbuffer;
stats2.renderbufferCount++;
function reglRenderbuffer(a5, b11) {
var w4 = 0;
var h3 = 0;
var format2 = GL_RGBA4$1;
if (typeof a5 === "object" && a5) {
var options = a5;
if ("shape" in options) {
var shape = options.shape;
check$1(Array.isArray(shape) && shape.length >= 2, "invalid renderbuffer shape");
w4 = shape[0] | 0;
h3 = shape[1] | 0;
} else {
if ("radius" in options) {
w4 = h3 = options.radius | 0;
}
if ("width" in options) {
w4 = options.width | 0;
}
if ("height" in options) {
h3 = options.height | 0;
}
}
if ("format" in options) {
check$1.parameter(options.format, formatTypes, "invalid renderbuffer format");
format2 = formatTypes[options.format];
}
} else if (typeof a5 === "number") {
w4 = a5 | 0;
if (typeof b11 === "number") {
h3 = b11 | 0;
} else {
h3 = w4;
}
} else if (!a5) {
w4 = h3 = 1;
} else {
check$1.raise("invalid arguments to renderbuffer constructor");
}
check$1(w4 > 0 && h3 > 0 && w4 <= limits.maxRenderbufferSize && h3 <= limits.maxRenderbufferSize, "invalid renderbuffer size");
if (w4 === renderbuffer.width && h3 === renderbuffer.height && format2 === renderbuffer.format) {
return;
}
reglRenderbuffer.width = renderbuffer.width = w4;
reglRenderbuffer.height = renderbuffer.height = h3;
renderbuffer.format = format2;
gl2.bindRenderbuffer(GL_RENDERBUFFER, renderbuffer.renderbuffer);
gl2.renderbufferStorage(GL_RENDERBUFFER, format2, w4, h3);
check$1(gl2.getError() === 0, "invalid render buffer format");
if (config.profile) {
renderbuffer.stats.size = getRenderbufferSize(renderbuffer.format, renderbuffer.width, renderbuffer.height);
}
reglRenderbuffer.format = formatTypesInvert[renderbuffer.format];
return reglRenderbuffer;
}
function resize(w_, h_) {
var w4 = w_ | 0;
var h3 = h_ | 0 || w4;
if (w4 === renderbuffer.width && h3 === renderbuffer.height) {
return reglRenderbuffer;
}
check$1(w4 > 0 && h3 > 0 && w4 <= limits.maxRenderbufferSize && h3 <= limits.maxRenderbufferSize, "invalid renderbuffer size");
reglRenderbuffer.width = renderbuffer.width = w4;
reglRenderbuffer.height = renderbuffer.height = h3;
gl2.bindRenderbuffer(GL_RENDERBUFFER, renderbuffer.renderbuffer);
gl2.renderbufferStorage(GL_RENDERBUFFER, renderbuffer.format, w4, h3);
check$1(gl2.getError() === 0, "invalid render buffer format");
if (config.profile) {
renderbuffer.stats.size = getRenderbufferSize(renderbuffer.format, renderbuffer.width, renderbuffer.height);
}
return reglRenderbuffer;
}
reglRenderbuffer(a4, b10);
reglRenderbuffer.resize = resize;
reglRenderbuffer._reglType = "renderbuffer";
reglRenderbuffer._renderbuffer = renderbuffer;
if (config.profile) {
reglRenderbuffer.stats = renderbuffer.stats;
}
reglRenderbuffer.destroy = function() {
renderbuffer.decRef();
};
return reglRenderbuffer;
}
if (config.profile) {
stats2.getTotalRenderbufferSize = function() {
var total = 0;
Object.keys(renderbufferSet).forEach(function(key) {
total += renderbufferSet[key].stats.size;
});
return total;
};
}
function restoreRenderbuffers() {
values2(renderbufferSet).forEach(function(rb) {
rb.renderbuffer = gl2.createRenderbuffer();
gl2.bindRenderbuffer(GL_RENDERBUFFER, rb.renderbuffer);
gl2.renderbufferStorage(GL_RENDERBUFFER, rb.format, rb.width, rb.height);
});
gl2.bindRenderbuffer(GL_RENDERBUFFER, null);
}
return {
create: createRenderbuffer,
clear: function() {
values2(renderbufferSet).forEach(destroy);
},
restore: restoreRenderbuffers
};
};
var GL_FRAMEBUFFER$1 = 36160;
var GL_RENDERBUFFER$1 = 36161;
var GL_TEXTURE_2D$2 = 3553;
var GL_TEXTURE_CUBE_MAP_POSITIVE_X$2 = 34069;
var GL_COLOR_ATTACHMENT0$1 = 36064;
var GL_DEPTH_ATTACHMENT = 36096;
var GL_STENCIL_ATTACHMENT = 36128;
var GL_DEPTH_STENCIL_ATTACHMENT = 33306;
var GL_FRAMEBUFFER_COMPLETE$1 = 36053;
var GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 36054;
var GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 36055;
var GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 36057;
var GL_FRAMEBUFFER_UNSUPPORTED = 36061;
var GL_HALF_FLOAT_OES$2 = 36193;
var GL_UNSIGNED_BYTE$6 = 5121;
var GL_FLOAT$5 = 5126;
var GL_RGB$1 = 6407;
var GL_RGBA$2 = 6408;
var GL_DEPTH_COMPONENT$1 = 6402;
var colorTextureFormatEnums = [
GL_RGB$1,
GL_RGBA$2
];
var textureFormatChannels = [];
textureFormatChannels[GL_RGBA$2] = 4;
textureFormatChannels[GL_RGB$1] = 3;
var textureTypeSizes = [];
textureTypeSizes[GL_UNSIGNED_BYTE$6] = 1;
textureTypeSizes[GL_FLOAT$5] = 4;
textureTypeSizes[GL_HALF_FLOAT_OES$2] = 2;
var GL_RGBA4$2 = 32854;
var GL_RGB5_A1$2 = 32855;
var GL_RGB565$2 = 36194;
var GL_DEPTH_COMPONENT16$1 = 33189;
var GL_STENCIL_INDEX8$1 = 36168;
var GL_DEPTH_STENCIL$2 = 34041;
var GL_SRGB8_ALPHA8_EXT$1 = 35907;
var GL_RGBA32F_EXT$1 = 34836;
var GL_RGBA16F_EXT$1 = 34842;
var GL_RGB16F_EXT$1 = 34843;
var colorRenderbufferFormatEnums = [
GL_RGBA4$2,
GL_RGB5_A1$2,
GL_RGB565$2,
GL_SRGB8_ALPHA8_EXT$1,
GL_RGBA16F_EXT$1,
GL_RGB16F_EXT$1,
GL_RGBA32F_EXT$1
];
var statusCode = {};
statusCode[GL_FRAMEBUFFER_COMPLETE$1] = "complete";
statusCode[GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT] = "incomplete attachment";
statusCode[GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS] = "incomplete dimensions";
statusCode[GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT] = "incomplete, missing attachment";
statusCode[GL_FRAMEBUFFER_UNSUPPORTED] = "unsupported";
function wrapFBOState(gl2, extensions, limits, textureState, renderbufferState, stats2) {
var framebufferState = {
cur: null,
next: null,
dirty: false,
setFBO: null
};
var colorTextureFormats = ["rgba"];
var colorRenderbufferFormats = ["rgba4", "rgb565", "rgb5 a1"];
if (extensions.ext_srgb) {
colorRenderbufferFormats.push("srgba");
}
if (extensions.ext_color_buffer_half_float) {
colorRenderbufferFormats.push("rgba16f", "rgb16f");
}
if (extensions.webgl_color_buffer_float) {
colorRenderbufferFormats.push("rgba32f");
}
var colorTypes = ["uint8"];
if (extensions.oes_texture_half_float) {
colorTypes.push("half float", "float16");
}
if (extensions.oes_texture_float) {
colorTypes.push("float", "float32");
}
function FramebufferAttachment(target, texture, renderbuffer) {
this.target = target;
this.texture = texture;
this.renderbuffer = renderbuffer;
var w4 = 0;
var h3 = 0;
if (texture) {
w4 = texture.width;
h3 = texture.height;
} else if (renderbuffer) {
w4 = renderbuffer.width;
h3 = renderbuffer.height;
}
this.width = w4;
this.height = h3;
}
function decRef(attachment) {
if (attachment) {
if (attachment.texture) {
attachment.texture._texture.decRef();
}
if (attachment.renderbuffer) {
attachment.renderbuffer._renderbuffer.decRef();
}
}
}
function incRefAndCheckShape(attachment, width2, height) {
if (!attachment) {
return;
}
if (attachment.texture) {
var texture = attachment.texture._texture;
var tw = Math.max(1, texture.width);
var th = Math.max(1, texture.height);
check$1(tw === width2 && th === height, "inconsistent width/height for supplied texture");
texture.refCount += 1;
} else {
var renderbuffer = attachment.renderbuffer._renderbuffer;
check$1(renderbuffer.width === width2 && renderbuffer.height === height, "inconsistent width/height for renderbuffer");
renderbuffer.refCount += 1;
}
}
function attach(location, attachment) {
if (attachment) {
if (attachment.texture) {
gl2.framebufferTexture2D(GL_FRAMEBUFFER$1, location, attachment.target, attachment.texture._texture.texture, 0);
} else {
gl2.framebufferRenderbuffer(GL_FRAMEBUFFER$1, location, GL_RENDERBUFFER$1, attachment.renderbuffer._renderbuffer.renderbuffer);
}
}
}
function parseAttachment(attachment) {
var target = GL_TEXTURE_2D$2;
var texture = null;
var renderbuffer = null;
var data3 = attachment;
if (typeof attachment === "object") {
data3 = attachment.data;
if ("target" in attachment) {
target = attachment.target | 0;
}
}
check$1.type(data3, "function", "invalid attachment data");
var type2 = data3._reglType;
if (type2 === "texture2d") {
texture = data3;
check$1(target === GL_TEXTURE_2D$2);
} else if (type2 === "textureCube") {
texture = data3;
check$1(target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X$2 && target < GL_TEXTURE_CUBE_MAP_POSITIVE_X$2 + 6, "invalid cube map target");
} else if (type2 === "renderbuffer") {
renderbuffer = data3;
target = GL_RENDERBUFFER$1;
} else {
check$1.raise("invalid regl object for attachment");
}
return new FramebufferAttachment(target, texture, renderbuffer);
}
function allocAttachment(width2, height, isTexture, format2, type2) {
if (isTexture) {
var texture = textureState.create2D({
width: width2,
height,
format: format2,
type: type2
});
texture._texture.refCount = 0;
return new FramebufferAttachment(GL_TEXTURE_2D$2, texture, null);
} else {
var rb = renderbufferState.create({
width: width2,
height,
format: format2
});
rb._renderbuffer.refCount = 0;
return new FramebufferAttachment(GL_RENDERBUFFER$1, null, rb);
}
}
function unwrapAttachment(attachment) {
return attachment && (attachment.texture || attachment.renderbuffer);
}
function resizeAttachment(attachment, w4, h3) {
if (attachment) {
if (attachment.texture) {
attachment.texture.resize(w4, h3);
} else if (attachment.renderbuffer) {
attachment.renderbuffer.resize(w4, h3);
}
attachment.width = w4;
attachment.height = h3;
}
}
var framebufferCount = 0;
var framebufferSet = {};
function REGLFramebuffer() {
this.id = framebufferCount++;
framebufferSet[this.id] = this;
this.framebuffer = gl2.createFramebuffer();
this.width = 0;
this.height = 0;
this.colorAttachments = [];
this.depthAttachment = null;
this.stencilAttachment = null;
this.depthStencilAttachment = null;
}
function decFBORefs(framebuffer) {
framebuffer.colorAttachments.forEach(decRef);
decRef(framebuffer.depthAttachment);
decRef(framebuffer.stencilAttachment);
decRef(framebuffer.depthStencilAttachment);
}
function destroy(framebuffer) {
var handle = framebuffer.framebuffer;
check$1(handle, "must not double destroy framebuffer");
gl2.deleteFramebuffer(handle);
framebuffer.framebuffer = null;
stats2.framebufferCount--;
delete framebufferSet[framebuffer.id];
}
function updateFramebuffer(framebuffer) {
var i4;
gl2.bindFramebuffer(GL_FRAMEBUFFER$1, framebuffer.framebuffer);
var colorAttachments = framebuffer.colorAttachments;
for (i4 = 0; i4 < colorAttachments.length; ++i4) {
attach(GL_COLOR_ATTACHMENT0$1 + i4, colorAttachments[i4]);
}
for (i4 = colorAttachments.length; i4 < limits.maxColorAttachments; ++i4) {
gl2.framebufferTexture2D(GL_FRAMEBUFFER$1, GL_COLOR_ATTACHMENT0$1 + i4, GL_TEXTURE_2D$2, null, 0);
}
gl2.framebufferTexture2D(GL_FRAMEBUFFER$1, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D$2, null, 0);
gl2.framebufferTexture2D(GL_FRAMEBUFFER$1, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D$2, null, 0);
gl2.framebufferTexture2D(GL_FRAMEBUFFER$1, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D$2, null, 0);
attach(GL_DEPTH_ATTACHMENT, framebuffer.depthAttachment);
attach(GL_STENCIL_ATTACHMENT, framebuffer.stencilAttachment);
attach(GL_DEPTH_STENCIL_ATTACHMENT, framebuffer.depthStencilAttachment);
var status = gl2.checkFramebufferStatus(GL_FRAMEBUFFER$1);
if (!gl2.isContextLost() && status !== GL_FRAMEBUFFER_COMPLETE$1) {
check$1.raise("framebuffer configuration not supported, status = " + statusCode[status]);
}
gl2.bindFramebuffer(GL_FRAMEBUFFER$1, framebufferState.next ? framebufferState.next.framebuffer : null);
framebufferState.cur = framebufferState.next;
gl2.getError();
}
function createFBO(a0, a1) {
var framebuffer = new REGLFramebuffer();
stats2.framebufferCount++;
function reglFramebuffer(a4, b10) {
var i4;
check$1(framebufferState.next !== framebuffer, "can not update framebuffer which is currently in use");
var width2 = 0;
var height = 0;
var needsDepth = true;
var needsStencil = true;
var colorBuffer = null;
var colorTexture = true;
var colorFormat = "rgba";
var colorType = "uint8";
var colorCount = 1;
var depthBuffer = null;
var stencilBuffer = null;
var depthStencilBuffer = null;
var depthStencilTexture = false;
if (typeof a4 === "number") {
width2 = a4 | 0;
height = b10 | 0 || width2;
} else if (!a4) {
width2 = height = 1;
} else {
check$1.type(a4, "object", "invalid arguments for framebuffer");
var options = a4;
if ("shape" in options) {
var shape = options.shape;
check$1(Array.isArray(shape) && shape.length >= 2, "invalid shape for framebuffer");
width2 = shape[0];
height = shape[1];
} else {
if ("radius" in options) {
width2 = height = options.radius;
}
if ("width" in options) {
width2 = options.width;
}
if ("height" in options) {
height = options.height;
}
}
if ("color" in options || "colors" in options) {
colorBuffer = options.color || options.colors;
if (Array.isArray(colorBuffer)) {
check$1(colorBuffer.length === 1 || extensions.webgl_draw_buffers, "multiple render targets not supported");
}
}
if (!colorBuffer) {
if ("colorCount" in options) {
colorCount = options.colorCount | 0;
check$1(colorCount > 0, "invalid color buffer count");
}
if ("colorTexture" in options) {
colorTexture = !!options.colorTexture;
colorFormat = "rgba4";
}
if ("colorType" in options) {
colorType = options.colorType;
if (!colorTexture) {
if (colorType === "half float" || colorType === "float16") {
check$1(extensions.ext_color_buffer_half_float, "you must enable EXT_color_buffer_half_float to use 16-bit render buffers");
colorFormat = "rgba16f";
} else if (colorType === "float" || colorType === "float32") {
check$1(extensions.webgl_color_buffer_float, "you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers");
colorFormat = "rgba32f";
}
} else {
check$1(extensions.oes_texture_float || !(colorType === "float" || colorType === "float32"), "you must enable OES_texture_float in order to use floating point framebuffer objects");
check$1(extensions.oes_texture_half_float || !(colorType === "half float" || colorType === "float16"), "you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects");
}
check$1.oneOf(colorType, colorTypes, "invalid color type");
}
if ("colorFormat" in options) {
colorFormat = options.colorFormat;
if (colorTextureFormats.indexOf(colorFormat) >= 0) {
colorTexture = true;
} else if (colorRenderbufferFormats.indexOf(colorFormat) >= 0) {
colorTexture = false;
} else {
if (colorTexture) {
check$1.oneOf(options.colorFormat, colorTextureFormats, "invalid color format for texture");
} else {
check$1.oneOf(options.colorFormat, colorRenderbufferFormats, "invalid color format for renderbuffer");
}
}
}
}
if ("depthTexture" in options || "depthStencilTexture" in options) {
depthStencilTexture = !!(options.depthTexture || options.depthStencilTexture);
check$1(!depthStencilTexture || extensions.webgl_depth_texture, "webgl_depth_texture extension not supported");
}
if ("depth" in options) {
if (typeof options.depth === "boolean") {
needsDepth = options.depth;
} else {
depthBuffer = options.depth;
needsStencil = false;
}
}
if ("stencil" in options) {
if (typeof options.stencil === "boolean") {
needsStencil = options.stencil;
} else {
stencilBuffer = options.stencil;
needsDepth = false;
}
}
if ("depthStencil" in options) {
if (typeof options.depthStencil === "boolean") {
needsDepth = needsStencil = options.depthStencil;
} else {
depthStencilBuffer = options.depthStencil;
needsDepth = false;
needsStencil = false;
}
}
}
var colorAttachments = null;
var depthAttachment = null;
var stencilAttachment = null;
var depthStencilAttachment = null;
if (Array.isArray(colorBuffer)) {
colorAttachments = colorBuffer.map(parseAttachment);
} else if (colorBuffer) {
colorAttachments = [parseAttachment(colorBuffer)];
} else {
colorAttachments = new Array(colorCount);
for (i4 = 0; i4 < colorCount; ++i4) {
colorAttachments[i4] = allocAttachment(width2, height, colorTexture, colorFormat, colorType);
}
}
check$1(extensions.webgl_draw_buffers || colorAttachments.length <= 1, "you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers.");
check$1(colorAttachments.length <= limits.maxColorAttachments, "too many color attachments, not supported");
width2 = width2 || colorAttachments[0].width;
height = height || colorAttachments[0].height;
if (depthBuffer) {
depthAttachment = parseAttachment(depthBuffer);
} else if (needsDepth && !needsStencil) {
depthAttachment = allocAttachment(width2, height, depthStencilTexture, "depth", "uint32");
}
if (stencilBuffer) {
stencilAttachment = parseAttachment(stencilBuffer);
} else if (needsStencil && !needsDepth) {
stencilAttachment = allocAttachment(width2, height, false, "stencil", "uint8");
}
if (depthStencilBuffer) {
depthStencilAttachment = parseAttachment(depthStencilBuffer);
} else if (!depthBuffer && !stencilBuffer && needsStencil && needsDepth) {
depthStencilAttachment = allocAttachment(width2, height, depthStencilTexture, "depth stencil", "depth stencil");
}
check$1(!!depthBuffer + !!stencilBuffer + !!depthStencilBuffer <= 1, "invalid framebuffer configuration, can specify exactly one depth/stencil attachment");
var commonColorAttachmentSize = null;
for (i4 = 0; i4 < colorAttachments.length; ++i4) {
incRefAndCheckShape(colorAttachments[i4], width2, height);
check$1(!colorAttachments[i4] || colorAttachments[i4].texture && colorTextureFormatEnums.indexOf(colorAttachments[i4].texture._texture.format) >= 0 || colorAttachments[i4].renderbuffer && colorRenderbufferFormatEnums.indexOf(colorAttachments[i4].renderbuffer._renderbuffer.format) >= 0, "framebuffer color attachment " + i4 + " is invalid");
if (colorAttachments[i4] && colorAttachments[i4].texture) {
var colorAttachmentSize = textureFormatChannels[colorAttachments[i4].texture._texture.format] * textureTypeSizes[colorAttachments[i4].texture._texture.type];
if (commonColorAttachmentSize === null) {
commonColorAttachmentSize = colorAttachmentSize;
} else {
check$1(commonColorAttachmentSize === colorAttachmentSize, "all color attachments much have the same number of bits per pixel.");
}
}
}
incRefAndCheckShape(depthAttachment, width2, height);
check$1(!depthAttachment || depthAttachment.texture && depthAttachment.texture._texture.format === GL_DEPTH_COMPONENT$1 || depthAttachment.renderbuffer && depthAttachment.renderbuffer._renderbuffer.format === GL_DEPTH_COMPONENT16$1, "invalid depth attachment for framebuffer object");
incRefAndCheckShape(stencilAttachment, width2, height);
check$1(!stencilAttachment || stencilAttachment.renderbuffer && stencilAttachment.renderbuffer._renderbuffer.format === GL_STENCIL_INDEX8$1, "invalid stencil attachment for framebuffer object");
incRefAndCheckShape(depthStencilAttachment, width2, height);
check$1(!depthStencilAttachment || depthStencilAttachment.texture && depthStencilAttachment.texture._texture.format === GL_DEPTH_STENCIL$2 || depthStencilAttachment.renderbuffer && depthStencilAttachment.renderbuffer._renderbuffer.format === GL_DEPTH_STENCIL$2, "invalid depth-stencil attachment for framebuffer object");
decFBORefs(framebuffer);
framebuffer.width = width2;
framebuffer.height = height;
framebuffer.colorAttachments = colorAttachments;
framebuffer.depthAttachment = depthAttachment;
framebuffer.stencilAttachment = stencilAttachment;
framebuffer.depthStencilAttachment = depthStencilAttachment;
reglFramebuffer.color = colorAttachments.map(unwrapAttachment);
reglFramebuffer.depth = unwrapAttachment(depthAttachment);
reglFramebuffer.stencil = unwrapAttachment(stencilAttachment);
reglFramebuffer.depthStencil = unwrapAttachment(depthStencilAttachment);
reglFramebuffer.width = framebuffer.width;
reglFramebuffer.height = framebuffer.height;
updateFramebuffer(framebuffer);
return reglFramebuffer;
}
function resize(w_, h_) {
check$1(framebufferState.next !== framebuffer, "can not resize a framebuffer which is currently in use");
var w4 = Math.max(w_ | 0, 1);
var h3 = Math.max(h_ | 0 || w4, 1);
if (w4 === framebuffer.width && h3 === framebuffer.height) {
return reglFramebuffer;
}
var colorAttachments = framebuffer.colorAttachments;
for (var i4 = 0; i4 < colorAttachments.length; ++i4) {
resizeAttachment(colorAttachments[i4], w4, h3);
}
resizeAttachment(framebuffer.depthAttachment, w4, h3);
resizeAttachment(framebuffer.stencilAttachment, w4, h3);
resizeAttachment(framebuffer.depthStencilAttachment, w4, h3);
framebuffer.width = reglFramebuffer.width = w4;
framebuffer.height = reglFramebuffer.height = h3;
updateFramebuffer(framebuffer);
return reglFramebuffer;
}
reglFramebuffer(a0, a1);
return extend4(reglFramebuffer, {
resize,
_reglType: "framebuffer",
_framebuffer: framebuffer,
destroy: function() {
destroy(framebuffer);
decFBORefs(framebuffer);
},
use: function(block) {
framebufferState.setFBO({
framebuffer: reglFramebuffer
}, block);
}
});
}
function createCubeFBO(options) {
var faces = Array(6);
function reglFramebufferCube(a4) {
var i4;
check$1(faces.indexOf(framebufferState.next) < 0, "can not update framebuffer which is currently in use");
var params = {
color: null
};
var radius = 0;
var colorBuffer = null;
var colorFormat = "rgba";
var colorType = "uint8";
var colorCount = 1;
if (typeof a4 === "number") {
radius = a4 | 0;
} else if (!a4) {
radius = 1;
} else {
check$1.type(a4, "object", "invalid arguments for framebuffer");
var options2 = a4;
if ("shape" in options2) {
var shape = options2.shape;
check$1(Array.isArray(shape) && shape.length >= 2, "invalid shape for framebuffer");
check$1(shape[0] === shape[1], "cube framebuffer must be square");
radius = shape[0];
} else {
if ("radius" in options2) {
radius = options2.radius | 0;
}
if ("width" in options2) {
radius = options2.width | 0;
if ("height" in options2) {
check$1(options2.height === radius, "must be square");
}
} else if ("height" in options2) {
radius = options2.height | 0;
}
}
if ("color" in options2 || "colors" in options2) {
colorBuffer = options2.color || options2.colors;
if (Array.isArray(colorBuffer)) {
check$1(colorBuffer.length === 1 || extensions.webgl_draw_buffers, "multiple render targets not supported");
}
}
if (!colorBuffer) {
if ("colorCount" in options2) {
colorCount = options2.colorCount | 0;
check$1(colorCount > 0, "invalid color buffer count");
}
if ("colorType" in options2) {
check$1.oneOf(options2.colorType, colorTypes, "invalid color type");
colorType = options2.colorType;
}
if ("colorFormat" in options2) {
colorFormat = options2.colorFormat;
check$1.oneOf(options2.colorFormat, colorTextureFormats, "invalid color format for texture");
}
}
if ("depth" in options2) {
params.depth = options2.depth;
}
if ("stencil" in options2) {
params.stencil = options2.stencil;
}
if ("depthStencil" in options2) {
params.depthStencil = options2.depthStencil;
}
}
var colorCubes;
if (colorBuffer) {
if (Array.isArray(colorBuffer)) {
colorCubes = [];
for (i4 = 0; i4 < colorBuffer.length; ++i4) {
colorCubes[i4] = colorBuffer[i4];
}
} else {
colorCubes = [colorBuffer];
}
} else {
colorCubes = Array(colorCount);
var cubeMapParams = {
radius,
format: colorFormat,
type: colorType
};
for (i4 = 0; i4 < colorCount; ++i4) {
colorCubes[i4] = textureState.createCube(cubeMapParams);
}
}
params.color = Array(colorCubes.length);
for (i4 = 0; i4 < colorCubes.length; ++i4) {
var cube = colorCubes[i4];
check$1(typeof cube === "function" && cube._reglType === "textureCube", "invalid cube map");
radius = radius || cube.width;
check$1(cube.width === radius && cube.height === radius, "invalid cube map shape");
params.color[i4] = {
target: GL_TEXTURE_CUBE_MAP_POSITIVE_X$2,
data: colorCubes[i4]
};
}
for (i4 = 0; i4 < 6; ++i4) {
for (var j4 = 0; j4 < colorCubes.length; ++j4) {
params.color[j4].target = GL_TEXTURE_CUBE_MAP_POSITIVE_X$2 + i4;
}
if (i4 > 0) {
params.depth = faces[0].depth;
params.stencil = faces[0].stencil;
params.depthStencil = faces[0].depthStencil;
}
if (faces[i4]) {
faces[i4](params);
} else {
faces[i4] = createFBO(params);
}
}
return extend4(reglFramebufferCube, {
width: radius,
height: radius,
color: colorCubes
});
}
function resize(radius_) {
var i4;
var radius = radius_ | 0;
check$1(radius > 0 && radius <= limits.maxCubeMapSize, "invalid radius for cube fbo");
if (radius === reglFramebufferCube.width) {
return reglFramebufferCube;
}
var colors = reglFramebufferCube.color;
for (i4 = 0; i4 < colors.length; ++i4) {
colors[i4].resize(radius);
}
for (i4 = 0; i4 < 6; ++i4) {
faces[i4].resize(radius);
}
reglFramebufferCube.width = reglFramebufferCube.height = radius;
return reglFramebufferCube;
}
reglFramebufferCube(options);
return extend4(reglFramebufferCube, {
faces,
resize,
_reglType: "framebufferCube",
destroy: function() {
faces.forEach(function(f3) {
f3.destroy();
});
}
});
}
function restoreFramebuffers() {
framebufferState.cur = null;
framebufferState.next = null;
framebufferState.dirty = true;
values2(framebufferSet).forEach(function(fb) {
fb.framebuffer = gl2.createFramebuffer();
updateFramebuffer(fb);
});
}
return extend4(framebufferState, {
getFramebuffer: function(object) {
if (typeof object === "function" && object._reglType === "framebuffer") {
var fbo = object._framebuffer;
if (fbo instanceof REGLFramebuffer) {
return fbo;
}
}
return null;
},
create: createFBO,
createCube: createCubeFBO,
clear: function() {
values2(framebufferSet).forEach(destroy);
},
restore: restoreFramebuffers
});
}
var GL_FLOAT$6 = 5126;
var GL_ARRAY_BUFFER$1 = 34962;
function AttributeRecord() {
this.state = 0;
this.x = 0;
this.y = 0;
this.z = 0;
this.w = 0;
this.buffer = null;
this.size = 0;
this.normalized = false;
this.type = GL_FLOAT$6;
this.offset = 0;
this.stride = 0;
this.divisor = 0;
}
function wrapAttributeState(gl2, extensions, limits, stats2, bufferState) {
var NUM_ATTRIBUTES = limits.maxAttributes;
var attributeBindings = new Array(NUM_ATTRIBUTES);
for (var i4 = 0; i4 < NUM_ATTRIBUTES; ++i4) {
attributeBindings[i4] = new AttributeRecord();
}
var vaoCount = 0;
var vaoSet = {};
var state2 = {
Record: AttributeRecord,
scope: {},
state: attributeBindings,
currentVAO: null,
targetVAO: null,
restore: extVAO() ? restoreVAO : function() {
},
createVAO,
getVAO,
destroyBuffer,
setVAO: extVAO() ? setVAOEXT : setVAOEmulated,
clear: extVAO() ? destroyVAOEXT : function() {
}
};
function destroyBuffer(buffer) {
for (var i5 = 0; i5 < attributeBindings.length; ++i5) {
var record = attributeBindings[i5];
if (record.buffer === buffer) {
gl2.disableVertexAttribArray(i5);
record.buffer = null;
}
}
}
function extVAO() {
return extensions.oes_vertex_array_object;
}
function extInstanced() {
return extensions.angle_instanced_arrays;
}
function getVAO(vao) {
if (typeof vao === "function" && vao._vao) {
return vao._vao;
}
return null;
}
function setVAOEXT(vao) {
if (vao === state2.currentVAO) {
return;
}
var ext = extVAO();
if (vao) {
ext.bindVertexArrayOES(vao.vao);
} else {
ext.bindVertexArrayOES(null);
}
state2.currentVAO = vao;
}
function setVAOEmulated(vao) {
if (vao === state2.currentVAO) {
return;
}
if (vao) {
vao.bindAttrs();
} else {
var exti = extInstanced();
for (var i5 = 0; i5 < attributeBindings.length; ++i5) {
var binding = attributeBindings[i5];
if (binding.buffer) {
gl2.enableVertexAttribArray(i5);
gl2.vertexAttribPointer(i5, binding.size, binding.type, binding.normalized, binding.stride, binding.offfset);
if (exti && binding.divisor) {
exti.vertexAttribDivisorANGLE(i5, binding.divisor);
}
} else {
gl2.disableVertexAttribArray(i5);
gl2.vertexAttrib4f(i5, binding.x, binding.y, binding.z, binding.w);
}
}
}
state2.currentVAO = vao;
}
function destroyVAOEXT() {
values2(vaoSet).forEach(function(vao) {
vao.destroy();
});
}
function REGLVAO() {
this.id = ++vaoCount;
this.attributes = [];
var extension = extVAO();
if (extension) {
this.vao = extension.createVertexArrayOES();
} else {
this.vao = null;
}
vaoSet[this.id] = this;
this.buffers = [];
}
REGLVAO.prototype.bindAttrs = function() {
var exti = extInstanced();
var attributes = this.attributes;
for (var i5 = 0; i5 < attributes.length; ++i5) {
var attr = attributes[i5];
if (attr.buffer) {
gl2.enableVertexAttribArray(i5);
gl2.bindBuffer(GL_ARRAY_BUFFER$1, attr.buffer.buffer);
gl2.vertexAttribPointer(i5, attr.size, attr.type, attr.normalized, attr.stride, attr.offset);
if (exti && attr.divisor) {
exti.vertexAttribDivisorANGLE(i5, attr.divisor);
}
} else {
gl2.disableVertexAttribArray(i5);
gl2.vertexAttrib4f(i5, attr.x, attr.y, attr.z, attr.w);
}
}
for (var j4 = attributes.length; j4 < NUM_ATTRIBUTES; ++j4) {
gl2.disableVertexAttribArray(j4);
}
};
REGLVAO.prototype.refresh = function() {
var ext = extVAO();
if (ext) {
ext.bindVertexArrayOES(this.vao);
this.bindAttrs();
state2.currentVAO = this;
}
};
REGLVAO.prototype.destroy = function() {
if (this.vao) {
var extension = extVAO();
if (this === state2.currentVAO) {
state2.currentVAO = null;
extension.bindVertexArrayOES(null);
}
extension.deleteVertexArrayOES(this.vao);
this.vao = null;
}
if (vaoSet[this.id]) {
delete vaoSet[this.id];
stats2.vaoCount -= 1;
}
};
function restoreVAO() {
var ext = extVAO();
if (ext) {
values2(vaoSet).forEach(function(vao) {
vao.refresh();
});
}
}
function createVAO(_attr) {
var vao = new REGLVAO();
stats2.vaoCount += 1;
function updateVAO(attributes) {
check$1(Array.isArray(attributes), "arguments to vertex array constructor must be an array");
check$1(attributes.length < NUM_ATTRIBUTES, "too many attributes");
check$1(attributes.length > 0, "must specify at least one attribute");
var bufUpdated = {};
var nattributes = vao.attributes;
nattributes.length = attributes.length;
for (var i5 = 0; i5 < attributes.length; ++i5) {
var spec = attributes[i5];
var rec = nattributes[i5] = new AttributeRecord();
var data3 = spec.data || spec;
if (Array.isArray(data3) || isTypedArray4(data3) || isNDArrayLike(data3)) {
var buf;
if (vao.buffers[i5]) {
buf = vao.buffers[i5];
if (isTypedArray4(data3) && buf._buffer.byteLength >= data3.byteLength) {
buf.subdata(data3);
} else {
buf.destroy();
vao.buffers[i5] = null;
}
}
if (!vao.buffers[i5]) {
buf = vao.buffers[i5] = bufferState.create(spec, GL_ARRAY_BUFFER$1, false, true);
}
rec.buffer = bufferState.getBuffer(buf);
rec.size = rec.buffer.dimension | 0;
rec.normalized = false;
rec.type = rec.buffer.dtype;
rec.offset = 0;
rec.stride = 0;
rec.divisor = 0;
rec.state = 1;
bufUpdated[i5] = 1;
} else if (bufferState.getBuffer(spec)) {
rec.buffer = bufferState.getBuffer(spec);
rec.size = rec.buffer.dimension | 0;
rec.normalized = false;
rec.type = rec.buffer.dtype;
rec.offset = 0;
rec.stride = 0;
rec.divisor = 0;
rec.state = 1;
} else if (bufferState.getBuffer(spec.buffer)) {
rec.buffer = bufferState.getBuffer(spec.buffer);
rec.size = (+spec.size || rec.buffer.dimension) | 0;
rec.normalized = !!spec.normalized || false;
if ("type" in spec) {
check$1.parameter(spec.type, glTypes, "invalid buffer type");
rec.type = glTypes[spec.type];
} else {
rec.type = rec.buffer.dtype;
}
rec.offset = (spec.offset || 0) | 0;
rec.stride = (spec.stride || 0) | 0;
rec.divisor = (spec.divisor || 0) | 0;
rec.state = 1;
check$1(rec.size >= 1 && rec.size <= 4, "size must be between 1 and 4");
check$1(rec.offset >= 0, "invalid offset");
check$1(rec.stride >= 0 && rec.stride <= 255, "stride must be between 0 and 255");
check$1(rec.divisor >= 0, "divisor must be positive");
check$1(!rec.divisor || !!extensions.angle_instanced_arrays, "ANGLE_instanced_arrays must be enabled to use divisor");
} else if ("x" in spec) {
check$1(i5 > 0, "first attribute must not be a constant");
rec.x = +spec.x || 0;
rec.y = +spec.y || 0;
rec.z = +spec.z || 0;
rec.w = +spec.w || 0;
rec.state = 2;
} else {
check$1(false, "invalid attribute spec for location " + i5);
}
}
for (var j4 = 0; j4 < vao.buffers.length; ++j4) {
if (!bufUpdated[j4] && vao.buffers[j4]) {
vao.buffers[j4].destroy();
vao.buffers[j4] = null;
}
}
vao.refresh();
return updateVAO;
}
updateVAO.destroy = function() {
for (var j4 = 0; j4 < vao.buffers.length; ++j4) {
if (vao.buffers[j4]) {
vao.buffers[j4].destroy();
}
}
vao.buffers.length = 0;
vao.destroy();
};
updateVAO._vao = vao;
updateVAO._reglType = "vao";
return updateVAO(_attr);
}
return state2;
}
var GL_FRAGMENT_SHADER = 35632;
var GL_VERTEX_SHADER = 35633;
var GL_ACTIVE_UNIFORMS = 35718;
var GL_ACTIVE_ATTRIBUTES = 35721;
function wrapShaderState(gl2, stringStore, stats2, config) {
var fragShaders = {};
var vertShaders = {};
function ActiveInfo(name, id, location, info) {
this.name = name;
this.id = id;
this.location = location;
this.info = info;
}
function insertActiveInfo(list, info) {
for (var i4 = 0; i4 < list.length; ++i4) {
if (list[i4].id === info.id) {
list[i4].location = info.location;
return;
}
}
list.push(info);
}
function getShader(type2, id, command) {
var cache3 = type2 === GL_FRAGMENT_SHADER ? fragShaders : vertShaders;
var shader = cache3[id];
if (!shader) {
var source = stringStore.str(id);
shader = gl2.createShader(type2);
gl2.shaderSource(shader, source);
gl2.compileShader(shader);
check$1.shaderError(gl2, shader, source, type2, command);
cache3[id] = shader;
}
return shader;
}
var programCache = {};
var programList = [];
var PROGRAM_COUNTER = 0;
function REGLProgram(fragId, vertId) {
this.id = PROGRAM_COUNTER++;
this.fragId = fragId;
this.vertId = vertId;
this.program = null;
this.uniforms = [];
this.attributes = [];
this.refCount = 1;
if (config.profile) {
this.stats = {
uniformsCount: 0,
attributesCount: 0
};
}
}
function linkProgram(desc, command, attributeLocations) {
var i4, info;
var fragShader = getShader(GL_FRAGMENT_SHADER, desc.fragId);
var vertShader = getShader(GL_VERTEX_SHADER, desc.vertId);
var program = desc.program = gl2.createProgram();
gl2.attachShader(program, fragShader);
gl2.attachShader(program, vertShader);
if (attributeLocations) {
for (i4 = 0; i4 < attributeLocations.length; ++i4) {
var binding = attributeLocations[i4];
gl2.bindAttribLocation(program, binding[0], binding[1]);
}
}
gl2.linkProgram(program);
check$1.linkError(gl2, program, stringStore.str(desc.fragId), stringStore.str(desc.vertId), command);
var numUniforms = gl2.getProgramParameter(program, GL_ACTIVE_UNIFORMS);
if (config.profile) {
desc.stats.uniformsCount = numUniforms;
}
var uniforms = desc.uniforms;
for (i4 = 0; i4 < numUniforms; ++i4) {
info = gl2.getActiveUniform(program, i4);
if (info) {
if (info.size > 1) {
for (var j4 = 0; j4 < info.size; ++j4) {
var name = info.name.replace("[0]", "[" + j4 + "]");
insertActiveInfo(uniforms, new ActiveInfo(name, stringStore.id(name), gl2.getUniformLocation(program, name), info));
}
} else {
insertActiveInfo(uniforms, new ActiveInfo(info.name, stringStore.id(info.name), gl2.getUniformLocation(program, info.name), info));
}
}
}
var numAttributes = gl2.getProgramParameter(program, GL_ACTIVE_ATTRIBUTES);
if (config.profile) {
desc.stats.attributesCount = numAttributes;
}
var attributes = desc.attributes;
for (i4 = 0; i4 < numAttributes; ++i4) {
info = gl2.getActiveAttrib(program, i4);
if (info) {
insertActiveInfo(attributes, new ActiveInfo(info.name, stringStore.id(info.name), gl2.getAttribLocation(program, info.name), info));
}
}
}
if (config.profile) {
stats2.getMaxUniformsCount = function() {
var m4 = 0;
programList.forEach(function(desc) {
if (desc.stats.uniformsCount > m4) {
m4 = desc.stats.uniformsCount;
}
});
return m4;
};
stats2.getMaxAttributesCount = function() {
var m4 = 0;
programList.forEach(function(desc) {
if (desc.stats.attributesCount > m4) {
m4 = desc.stats.attributesCount;
}
});
return m4;
};
}
function restoreShaders() {
fragShaders = {};
vertShaders = {};
for (var i4 = 0; i4 < programList.length; ++i4) {
linkProgram(programList[i4], null, programList[i4].attributes.map(function(info) {
return [info.location, info.name];
}));
}
}
return {
clear: function() {
var deleteShader = gl2.deleteShader.bind(gl2);
values2(fragShaders).forEach(deleteShader);
fragShaders = {};
values2(vertShaders).forEach(deleteShader);
vertShaders = {};
programList.forEach(function(desc) {
gl2.deleteProgram(desc.program);
});
programList.length = 0;
programCache = {};
stats2.shaderCount = 0;
},
program: function(vertId, fragId, command, attribLocations) {
check$1.command(vertId >= 0, "missing vertex shader", command);
check$1.command(fragId >= 0, "missing fragment shader", command);
var cache3 = programCache[fragId];
if (!cache3) {
cache3 = programCache[fragId] = {};
}
var prevProgram = cache3[vertId];
if (prevProgram) {
prevProgram.refCount++;
if (!attribLocations) {
return prevProgram;
}
}
var program = new REGLProgram(fragId, vertId);
stats2.shaderCount++;
linkProgram(program, command, attribLocations);
if (!prevProgram) {
cache3[vertId] = program;
}
programList.push(program);
return extend4(program, {
destroy: function() {
program.refCount--;
if (program.refCount <= 0) {
gl2.deleteProgram(program.program);
var idx = programList.indexOf(program);
programList.splice(idx, 1);
stats2.shaderCount--;
}
if (cache3[program.vertId].refCount <= 0) {
gl2.deleteShader(vertShaders[program.vertId]);
delete vertShaders[program.vertId];
delete programCache[program.fragId][program.vertId];
}
if (!Object.keys(programCache[program.fragId]).length) {
gl2.deleteShader(fragShaders[program.fragId]);
delete fragShaders[program.fragId];
delete programCache[program.fragId];
}
}
});
},
restore: restoreShaders,
shader: getShader,
frag: -1,
vert: -1
};
}
var GL_RGBA$3 = 6408;
var GL_UNSIGNED_BYTE$7 = 5121;
var GL_PACK_ALIGNMENT = 3333;
var GL_FLOAT$7 = 5126;
function wrapReadPixels(gl2, framebufferState, reglPoll, context, glAttributes, extensions, limits) {
function readPixelsImpl(input) {
var type2;
if (framebufferState.next === null) {
check$1(glAttributes.preserveDrawingBuffer, 'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer');
type2 = GL_UNSIGNED_BYTE$7;
} else {
check$1(framebufferState.next.colorAttachments[0].texture !== null, "You cannot read from a renderbuffer");
type2 = framebufferState.next.colorAttachments[0].texture._texture.type;
if (extensions.oes_texture_float) {
check$1(type2 === GL_UNSIGNED_BYTE$7 || type2 === GL_FLOAT$7, "Reading from a framebuffer is only allowed for the types 'uint8' and 'float'");
if (type2 === GL_FLOAT$7) {
check$1(limits.readFloat, "Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float");
}
} else {
check$1(type2 === GL_UNSIGNED_BYTE$7, "Reading from a framebuffer is only allowed for the type 'uint8'");
}
}
var x6 = 0;
var y5 = 0;
var width2 = context.framebufferWidth;
var height = context.framebufferHeight;
var data3 = null;
if (isTypedArray4(input)) {
data3 = input;
} else if (input) {
check$1.type(input, "object", "invalid arguments to regl.read()");
x6 = input.x | 0;
y5 = input.y | 0;
check$1(x6 >= 0 && x6 < context.framebufferWidth, "invalid x offset for regl.read");
check$1(y5 >= 0 && y5 < context.framebufferHeight, "invalid y offset for regl.read");
width2 = (input.width || context.framebufferWidth - x6) | 0;
height = (input.height || context.framebufferHeight - y5) | 0;
data3 = input.data || null;
}
if (data3) {
if (type2 === GL_UNSIGNED_BYTE$7) {
check$1(data3 instanceof Uint8Array, "buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'");
} else if (type2 === GL_FLOAT$7) {
check$1(data3 instanceof Float32Array, "buffer must be 'Float32Array' when reading from a framebuffer of type 'float'");
}
}
check$1(width2 > 0 && width2 + x6 <= context.framebufferWidth, "invalid width for read pixels");
check$1(height > 0 && height + y5 <= context.framebufferHeight, "invalid height for read pixels");
reglPoll();
var size2 = width2 * height * 4;
if (!data3) {
if (type2 === GL_UNSIGNED_BYTE$7) {
data3 = new Uint8Array(size2);
} else if (type2 === GL_FLOAT$7) {
data3 = data3 || new Float32Array(size2);
}
}
check$1.isTypedArray(data3, "data buffer for regl.read() must be a typedarray");
check$1(data3.byteLength >= size2, "data buffer for regl.read() too small");
gl2.pixelStorei(GL_PACK_ALIGNMENT, 4);
gl2.readPixels(x6, y5, width2, height, GL_RGBA$3, type2, data3);
return data3;
}
function readPixelsFBO(options) {
var result;
framebufferState.setFBO({
framebuffer: options.framebuffer
}, function() {
result = readPixelsImpl(options);
});
return result;
}
function readPixels(options) {
if (!options || !("framebuffer" in options)) {
return readPixelsImpl(options);
} else {
return readPixelsFBO(options);
}
}
return readPixels;
}
function slice(x6) {
return Array.prototype.slice.call(x6);
}
function join(x6) {
return slice(x6).join("");
}
function createEnvironment() {
var varCounter = 0;
var linkedNames = [];
var linkedValues = [];
function link(value2) {
for (var i4 = 0; i4 < linkedValues.length; ++i4) {
if (linkedValues[i4] === value2) {
return linkedNames[i4];
}
}
var name = "g" + varCounter++;
linkedNames.push(name);
linkedValues.push(value2);
return name;
}
function block() {
var code = [];
function push() {
code.push.apply(code, slice(arguments));
}
var vars = [];
function def() {
var name = "v" + varCounter++;
vars.push(name);
if (arguments.length > 0) {
code.push(name, "=");
code.push.apply(code, slice(arguments));
code.push(";");
}
return name;
}
return extend4(push, {
def,
toString: function() {
return join([
vars.length > 0 ? "var " + vars.join(",") + ";" : "",
join(code)
]);
}
});
}
function scope() {
var entry = block();
var exit = block();
var entryToString = entry.toString;
var exitToString = exit.toString;
function save(object, prop) {
exit(object, prop, "=", entry.def(object, prop), ";");
}
return extend4(function() {
entry.apply(entry, slice(arguments));
}, {
def: entry.def,
entry,
exit,
save,
set: function(object, prop, value2) {
save(object, prop);
entry(object, prop, "=", value2, ";");
},
toString: function() {
return entryToString() + exitToString();
}
});
}
function conditional() {
var pred = join(arguments);
var thenBlock = scope();
var elseBlock = scope();
var thenToString = thenBlock.toString;
var elseToString = elseBlock.toString;
return extend4(thenBlock, {
then: function() {
thenBlock.apply(thenBlock, slice(arguments));
return this;
},
else: function() {
elseBlock.apply(elseBlock, slice(arguments));
return this;
},
toString: function() {
var elseClause = elseToString();
if (elseClause) {
elseClause = "else{" + elseClause + "}";
}
return join([
"if(",
pred,
"){",
thenToString(),
"}",
elseClause
]);
}
});
}
var globalBlock = block();
var procedures = {};
function proc(name, count2) {
var args = [];
function arg() {
var name2 = "a" + args.length;
args.push(name2);
return name2;
}
count2 = count2 || 0;
for (var i4 = 0; i4 < count2; ++i4) {
arg();
}
var body = scope();
var bodyToString = body.toString;
var result = procedures[name] = extend4(body, {
arg,
toString: function() {
return join([
"function(",
args.join(),
"){",
bodyToString(),
"}"
]);
}
});
return result;
}
function compile() {
var code = [
'"use strict";',
globalBlock,
"return {"
];
Object.keys(procedures).forEach(function(name) {
code.push('"', name, '":', procedures[name].toString(), ",");
});
code.push("}");
var src = join(code).replace(/;/g, ";\n").replace(/}/g, "}\n").replace(/{/g, "{\n");
var proc2 = Function.apply(null, linkedNames.concat(src));
return proc2.apply(null, linkedValues);
}
return {
global: globalBlock,
link,
block,
proc,
scope,
cond: conditional,
compile
};
}
var CUTE_COMPONENTS = "xyzw".split("");
var GL_UNSIGNED_BYTE$8 = 5121;
var ATTRIB_STATE_POINTER = 1;
var ATTRIB_STATE_CONSTANT = 2;
var DYN_FUNC$1 = 0;
var DYN_PROP$1 = 1;
var DYN_CONTEXT$1 = 2;
var DYN_STATE$1 = 3;
var DYN_THUNK = 4;
var DYN_CONSTANT$1 = 5;
var DYN_ARRAY$1 = 6;
var S_DITHER = "dither";
var S_BLEND_ENABLE = "blend.enable";
var S_BLEND_COLOR = "blend.color";
var S_BLEND_EQUATION = "blend.equation";
var S_BLEND_FUNC = "blend.func";
var S_DEPTH_ENABLE = "depth.enable";
var S_DEPTH_FUNC = "depth.func";
var S_DEPTH_RANGE = "depth.range";
var S_DEPTH_MASK = "depth.mask";
var S_COLOR_MASK = "colorMask";
var S_CULL_ENABLE = "cull.enable";
var S_CULL_FACE = "cull.face";
var S_FRONT_FACE = "frontFace";
var S_LINE_WIDTH = "lineWidth";
var S_POLYGON_OFFSET_ENABLE = "polygonOffset.enable";
var S_POLYGON_OFFSET_OFFSET = "polygonOffset.offset";
var S_SAMPLE_ALPHA = "sample.alpha";
var S_SAMPLE_ENABLE = "sample.enable";
var S_SAMPLE_COVERAGE = "sample.coverage";
var S_STENCIL_ENABLE = "stencil.enable";
var S_STENCIL_MASK = "stencil.mask";
var S_STENCIL_FUNC = "stencil.func";
var S_STENCIL_OPFRONT = "stencil.opFront";
var S_STENCIL_OPBACK = "stencil.opBack";
var S_SCISSOR_ENABLE = "scissor.enable";
var S_SCISSOR_BOX = "scissor.box";
var S_VIEWPORT = "viewport";
var S_PROFILE = "profile";
var S_FRAMEBUFFER = "framebuffer";
var S_VERT = "vert";
var S_FRAG = "frag";
var S_ELEMENTS = "elements";
var S_PRIMITIVE = "primitive";
var S_COUNT = "count";
var S_OFFSET = "offset";
var S_INSTANCES = "instances";
var S_VAO = "vao";
var SUFFIX_WIDTH = "Width";
var SUFFIX_HEIGHT = "Height";
var S_FRAMEBUFFER_WIDTH = S_FRAMEBUFFER + SUFFIX_WIDTH;
var S_FRAMEBUFFER_HEIGHT = S_FRAMEBUFFER + SUFFIX_HEIGHT;
var S_VIEWPORT_WIDTH = S_VIEWPORT + SUFFIX_WIDTH;
var S_VIEWPORT_HEIGHT = S_VIEWPORT + SUFFIX_HEIGHT;
var S_DRAWINGBUFFER = "drawingBuffer";
var S_DRAWINGBUFFER_WIDTH = S_DRAWINGBUFFER + SUFFIX_WIDTH;
var S_DRAWINGBUFFER_HEIGHT = S_DRAWINGBUFFER + SUFFIX_HEIGHT;
var NESTED_OPTIONS = [
S_BLEND_FUNC,
S_BLEND_EQUATION,
S_STENCIL_FUNC,
S_STENCIL_OPFRONT,
S_STENCIL_OPBACK,
S_SAMPLE_COVERAGE,
S_VIEWPORT,
S_SCISSOR_BOX,
S_POLYGON_OFFSET_OFFSET
];
var GL_ARRAY_BUFFER$2 = 34962;
var GL_ELEMENT_ARRAY_BUFFER$1 = 34963;
var GL_FRAGMENT_SHADER$1 = 35632;
var GL_VERTEX_SHADER$1 = 35633;
var GL_TEXTURE_2D$3 = 3553;
var GL_TEXTURE_CUBE_MAP$2 = 34067;
var GL_CULL_FACE = 2884;
var GL_BLEND = 3042;
var GL_DITHER = 3024;
var GL_STENCIL_TEST = 2960;
var GL_DEPTH_TEST = 2929;
var GL_SCISSOR_TEST = 3089;
var GL_POLYGON_OFFSET_FILL = 32823;
var GL_SAMPLE_ALPHA_TO_COVERAGE = 32926;
var GL_SAMPLE_COVERAGE = 32928;
var GL_FLOAT$8 = 5126;
var GL_FLOAT_VEC2 = 35664;
var GL_FLOAT_VEC3 = 35665;
var GL_FLOAT_VEC4 = 35666;
var GL_INT$3 = 5124;
var GL_INT_VEC2 = 35667;
var GL_INT_VEC3 = 35668;
var GL_INT_VEC4 = 35669;
var GL_BOOL = 35670;
var GL_BOOL_VEC2 = 35671;
var GL_BOOL_VEC3 = 35672;
var GL_BOOL_VEC4 = 35673;
var GL_FLOAT_MAT2 = 35674;
var GL_FLOAT_MAT3 = 35675;
var GL_FLOAT_MAT4 = 35676;
var GL_SAMPLER_2D = 35678;
var GL_SAMPLER_CUBE = 35680;
var GL_TRIANGLES$1 = 4;
var GL_FRONT = 1028;
var GL_BACK = 1029;
var GL_CW = 2304;
var GL_CCW = 2305;
var GL_MIN_EXT = 32775;
var GL_MAX_EXT = 32776;
var GL_ALWAYS = 519;
var GL_KEEP = 7680;
var GL_ZERO = 0;
var GL_ONE = 1;
var GL_FUNC_ADD = 32774;
var GL_LESS = 513;
var GL_FRAMEBUFFER$2 = 36160;
var GL_COLOR_ATTACHMENT0$2 = 36064;
var blendFuncs = {
"0": 0,
"1": 1,
"zero": 0,
"one": 1,
"src color": 768,
"one minus src color": 769,
"src alpha": 770,
"one minus src alpha": 771,
"dst color": 774,
"one minus dst color": 775,
"dst alpha": 772,
"one minus dst alpha": 773,
"constant color": 32769,
"one minus constant color": 32770,
"constant alpha": 32771,
"one minus constant alpha": 32772,
"src alpha saturate": 776
};
var invalidBlendCombinations = [
"constant color, constant alpha",
"one minus constant color, constant alpha",
"constant color, one minus constant alpha",
"one minus constant color, one minus constant alpha",
"constant alpha, constant color",
"constant alpha, one minus constant color",
"one minus constant alpha, constant color",
"one minus constant alpha, one minus constant color"
];
var compareFuncs = {
"never": 512,
"less": 513,
"<": 513,
"equal": 514,
"=": 514,
"==": 514,
"===": 514,
"lequal": 515,
"<=": 515,
"greater": 516,
">": 516,
"notequal": 517,
"!=": 517,
"!==": 517,
"gequal": 518,
">=": 518,
"always": 519
};
var stencilOps = {
"0": 0,
"zero": 0,
"keep": 7680,
"replace": 7681,
"increment": 7682,
"decrement": 7683,
"increment wrap": 34055,
"decrement wrap": 34056,
"invert": 5386
};
var shaderType = {
"frag": GL_FRAGMENT_SHADER$1,
"vert": GL_VERTEX_SHADER$1
};
var orientationType = {
"cw": GL_CW,
"ccw": GL_CCW
};
function isBufferArgs(x6) {
return Array.isArray(x6) || isTypedArray4(x6) || isNDArrayLike(x6);
}
function sortState(state2) {
return state2.sort(function(a4, b10) {
if (a4 === S_VIEWPORT) {
return -1;
} else if (b10 === S_VIEWPORT) {
return 1;
}
return a4 < b10 ? -1 : 1;
});
}
function Declaration(thisDep, contextDep, propDep, append) {
this.thisDep = thisDep;
this.contextDep = contextDep;
this.propDep = propDep;
this.append = append;
}
function isStatic(decl) {
return decl && !(decl.thisDep || decl.contextDep || decl.propDep);
}
function createStaticDecl(append) {
return new Declaration(false, false, false, append);
}
function createDynamicDecl(dyn, append) {
var type2 = dyn.type;
if (type2 === DYN_FUNC$1) {
var numArgs = dyn.data.length;
return new Declaration(true, numArgs >= 1, numArgs >= 2, append);
} else if (type2 === DYN_THUNK) {
var data3 = dyn.data;
return new Declaration(data3.thisDep, data3.contextDep, data3.propDep, append);
} else if (type2 === DYN_CONSTANT$1) {
return new Declaration(false, false, false, append);
} else if (type2 === DYN_ARRAY$1) {
var thisDep = false;
var contextDep = false;
var propDep = false;
for (var i4 = 0; i4 < dyn.data.length; ++i4) {
var subDyn = dyn.data[i4];
if (subDyn.type === DYN_PROP$1) {
propDep = true;
} else if (subDyn.type === DYN_CONTEXT$1) {
contextDep = true;
} else if (subDyn.type === DYN_STATE$1) {
thisDep = true;
} else if (subDyn.type === DYN_FUNC$1) {
thisDep = true;
var subArgs = subDyn.data;
if (subArgs >= 1) {
contextDep = true;
}
if (subArgs >= 2) {
propDep = true;
}
} else if (subDyn.type === DYN_THUNK) {
thisDep = thisDep || subDyn.data.thisDep;
contextDep = contextDep || subDyn.data.contextDep;
propDep = propDep || subDyn.data.propDep;
}
}
return new Declaration(thisDep, contextDep, propDep, append);
} else {
return new Declaration(type2 === DYN_STATE$1, type2 === DYN_CONTEXT$1, type2 === DYN_PROP$1, append);
}
}
var SCOPE_DECL = new Declaration(false, false, false, function() {
});
function reglCore(gl2, stringStore, extensions, limits, bufferState, elementState, textureState, framebufferState, uniformState, attributeState, shaderState, drawState, contextState, timer3, config) {
var AttributeRecord2 = attributeState.Record;
var blendEquations = {
"add": 32774,
"subtract": 32778,
"reverse subtract": 32779
};
if (extensions.ext_blend_minmax) {
blendEquations.min = GL_MIN_EXT;
blendEquations.max = GL_MAX_EXT;
}
var extInstancing = extensions.angle_instanced_arrays;
var extDrawBuffers = extensions.webgl_draw_buffers;
var currentState = {
dirty: true,
profile: config.profile
};
var nextState = {};
var GL_STATE_NAMES = [];
var GL_FLAGS = {};
var GL_VARIABLES = {};
function propName(name) {
return name.replace(".", "_");
}
function stateFlag(sname, cap, init) {
var name = propName(sname);
GL_STATE_NAMES.push(sname);
nextState[name] = currentState[name] = !!init;
GL_FLAGS[name] = cap;
}
function stateVariable(sname, func, init) {
var name = propName(sname);
GL_STATE_NAMES.push(sname);
if (Array.isArray(init)) {
currentState[name] = init.slice();
nextState[name] = init.slice();
} else {
currentState[name] = nextState[name] = init;
}
GL_VARIABLES[name] = func;
}
stateFlag(S_DITHER, GL_DITHER);
stateFlag(S_BLEND_ENABLE, GL_BLEND);
stateVariable(S_BLEND_COLOR, "blendColor", [0, 0, 0, 0]);
stateVariable(S_BLEND_EQUATION, "blendEquationSeparate", [GL_FUNC_ADD, GL_FUNC_ADD]);
stateVariable(S_BLEND_FUNC, "blendFuncSeparate", [GL_ONE, GL_ZERO, GL_ONE, GL_ZERO]);
stateFlag(S_DEPTH_ENABLE, GL_DEPTH_TEST, true);
stateVariable(S_DEPTH_FUNC, "depthFunc", GL_LESS);
stateVariable(S_DEPTH_RANGE, "depthRange", [0, 1]);
stateVariable(S_DEPTH_MASK, "depthMask", true);
stateVariable(S_COLOR_MASK, S_COLOR_MASK, [true, true, true, true]);
stateFlag(S_CULL_ENABLE, GL_CULL_FACE);
stateVariable(S_CULL_FACE, "cullFace", GL_BACK);
stateVariable(S_FRONT_FACE, S_FRONT_FACE, GL_CCW);
stateVariable(S_LINE_WIDTH, S_LINE_WIDTH, 1);
stateFlag(S_POLYGON_OFFSET_ENABLE, GL_POLYGON_OFFSET_FILL);
stateVariable(S_POLYGON_OFFSET_OFFSET, "polygonOffset", [0, 0]);
stateFlag(S_SAMPLE_ALPHA, GL_SAMPLE_ALPHA_TO_COVERAGE);
stateFlag(S_SAMPLE_ENABLE, GL_SAMPLE_COVERAGE);
stateVariable(S_SAMPLE_COVERAGE, "sampleCoverage", [1, false]);
stateFlag(S_STENCIL_ENABLE, GL_STENCIL_TEST);
stateVariable(S_STENCIL_MASK, "stencilMask", -1);
stateVariable(S_STENCIL_FUNC, "stencilFunc", [GL_ALWAYS, 0, -1]);
stateVariable(S_STENCIL_OPFRONT, "stencilOpSeparate", [GL_FRONT, GL_KEEP, GL_KEEP, GL_KEEP]);
stateVariable(S_STENCIL_OPBACK, "stencilOpSeparate", [GL_BACK, GL_KEEP, GL_KEEP, GL_KEEP]);
stateFlag(S_SCISSOR_ENABLE, GL_SCISSOR_TEST);
stateVariable(S_SCISSOR_BOX, "scissor", [0, 0, gl2.drawingBufferWidth, gl2.drawingBufferHeight]);
stateVariable(S_VIEWPORT, S_VIEWPORT, [0, 0, gl2.drawingBufferWidth, gl2.drawingBufferHeight]);
var sharedState = {
gl: gl2,
context: contextState,
strings: stringStore,
next: nextState,
current: currentState,
draw: drawState,
elements: elementState,
buffer: bufferState,
shader: shaderState,
attributes: attributeState.state,
vao: attributeState,
uniforms: uniformState,
framebuffer: framebufferState,
extensions,
timer: timer3,
isBufferArgs
};
var sharedConstants = {
primTypes,
compareFuncs,
blendFuncs,
blendEquations,
stencilOps,
glTypes,
orientationType
};
check$1.optional(function() {
sharedState.isArrayLike = isArrayLike2;
});
if (extDrawBuffers) {
sharedConstants.backBuffer = [GL_BACK];
sharedConstants.drawBuffer = loop(limits.maxDrawbuffers, function(i4) {
if (i4 === 0) {
return [0];
}
return loop(i4, function(j4) {
return GL_COLOR_ATTACHMENT0$2 + j4;
});
});
}
var drawCallCounter = 0;
function createREGLEnvironment() {
var env = createEnvironment();
var link = env.link;
var global2 = env.global;
env.id = drawCallCounter++;
env.batchId = "0";
var SHARED = link(sharedState);
var shared = env.shared = {
props: "a0"
};
Object.keys(sharedState).forEach(function(prop) {
shared[prop] = global2.def(SHARED, ".", prop);
});
check$1.optional(function() {
env.CHECK = link(check$1);
env.commandStr = check$1.guessCommand();
env.command = link(env.commandStr);
env.assert = function(block, pred, message) {
block("if(!(", pred, "))", this.CHECK, ".commandRaise(", link(message), ",", this.command, ");");
};
sharedConstants.invalidBlendCombinations = invalidBlendCombinations;
});
var nextVars = env.next = {};
var currentVars = env.current = {};
Object.keys(GL_VARIABLES).forEach(function(variable) {
if (Array.isArray(currentState[variable])) {
nextVars[variable] = global2.def(shared.next, ".", variable);
currentVars[variable] = global2.def(shared.current, ".", variable);
}
});
var constants = env.constants = {};
Object.keys(sharedConstants).forEach(function(name) {
constants[name] = global2.def(JSON.stringify(sharedConstants[name]));
});
env.invoke = function(block, x6) {
switch (x6.type) {
case DYN_FUNC$1:
var argList = [
"this",
shared.context,
shared.props,
env.batchId
];
return block.def(link(x6.data), ".call(", argList.slice(0, Math.max(x6.data.length + 1, 4)), ")");
case DYN_PROP$1:
return block.def(shared.props, x6.data);
case DYN_CONTEXT$1:
return block.def(shared.context, x6.data);
case DYN_STATE$1:
return block.def("this", x6.data);
case DYN_THUNK:
x6.data.append(env, block);
return x6.data.ref;
case DYN_CONSTANT$1:
return x6.data.toString();
case DYN_ARRAY$1:
return x6.data.map(function(y5) {
return env.invoke(block, y5);
});
}
};
env.attribCache = {};
var scopeAttribs = {};
env.scopeAttrib = function(name) {
var id = stringStore.id(name);
if (id in scopeAttribs) {
return scopeAttribs[id];
}
var binding = attributeState.scope[id];
if (!binding) {
binding = attributeState.scope[id] = new AttributeRecord2();
}
var result = scopeAttribs[id] = link(binding);
return result;
};
return env;
}
function parseProfile(options) {
var staticOptions = options.static;
var dynamicOptions = options.dynamic;
var profileEnable;
if (S_PROFILE in staticOptions) {
var value2 = !!staticOptions[S_PROFILE];
profileEnable = createStaticDecl(function(env, scope) {
return value2;
});
profileEnable.enable = value2;
} else if (S_PROFILE in dynamicOptions) {
var dyn = dynamicOptions[S_PROFILE];
profileEnable = createDynamicDecl(dyn, function(env, scope) {
return env.invoke(scope, dyn);
});
}
return profileEnable;
}
function parseFramebuffer(options, env) {
var staticOptions = options.static;
var dynamicOptions = options.dynamic;
if (S_FRAMEBUFFER in staticOptions) {
var framebuffer = staticOptions[S_FRAMEBUFFER];
if (framebuffer) {
framebuffer = framebufferState.getFramebuffer(framebuffer);
check$1.command(framebuffer, "invalid framebuffer object");
return createStaticDecl(function(env2, block) {
var FRAMEBUFFER = env2.link(framebuffer);
var shared = env2.shared;
block.set(shared.framebuffer, ".next", FRAMEBUFFER);
var CONTEXT = shared.context;
block.set(CONTEXT, "." + S_FRAMEBUFFER_WIDTH, FRAMEBUFFER + ".width");
block.set(CONTEXT, "." + S_FRAMEBUFFER_HEIGHT, FRAMEBUFFER + ".height");
return FRAMEBUFFER;
});
} else {
return createStaticDecl(function(env2, scope) {
var shared = env2.shared;
scope.set(shared.framebuffer, ".next", "null");
var CONTEXT = shared.context;
scope.set(CONTEXT, "." + S_FRAMEBUFFER_WIDTH, CONTEXT + "." + S_DRAWINGBUFFER_WIDTH);
scope.set(CONTEXT, "." + S_FRAMEBUFFER_HEIGHT, CONTEXT + "." + S_DRAWINGBUFFER_HEIGHT);
return "null";
});
}
} else if (S_FRAMEBUFFER in dynamicOptions) {
var dyn = dynamicOptions[S_FRAMEBUFFER];
return createDynamicDecl(dyn, function(env2, scope) {
var FRAMEBUFFER_FUNC = env2.invoke(scope, dyn);
var shared = env2.shared;
var FRAMEBUFFER_STATE = shared.framebuffer;
var FRAMEBUFFER = scope.def(FRAMEBUFFER_STATE, ".getFramebuffer(", FRAMEBUFFER_FUNC, ")");
check$1.optional(function() {
env2.assert(scope, "!" + FRAMEBUFFER_FUNC + "||" + FRAMEBUFFER, "invalid framebuffer object");
});
scope.set(FRAMEBUFFER_STATE, ".next", FRAMEBUFFER);
var CONTEXT = shared.context;
scope.set(CONTEXT, "." + S_FRAMEBUFFER_WIDTH, FRAMEBUFFER + "?" + FRAMEBUFFER + ".width:" + CONTEXT + "." + S_DRAWINGBUFFER_WIDTH);
scope.set(CONTEXT, "." + S_FRAMEBUFFER_HEIGHT, FRAMEBUFFER + "?" + FRAMEBUFFER + ".height:" + CONTEXT + "." + S_DRAWINGBUFFER_HEIGHT);
return FRAMEBUFFER;
});
} else {
return null;
}
}
function parseViewportScissor(options, framebuffer, env) {
var staticOptions = options.static;
var dynamicOptions = options.dynamic;
function parseBox(param) {
if (param in staticOptions) {
var box2 = staticOptions[param];
check$1.commandType(box2, "object", "invalid " + param, env.commandStr);
var isStatic2 = true;
var x6 = box2.x | 0;
var y5 = box2.y | 0;
var w4, h3;
if ("width" in box2) {
w4 = box2.width | 0;
check$1.command(w4 >= 0, "invalid " + param, env.commandStr);
} else {
isStatic2 = false;
}
if ("height" in box2) {
h3 = box2.height | 0;
check$1.command(h3 >= 0, "invalid " + param, env.commandStr);
} else {
isStatic2 = false;
}
return new Declaration(!isStatic2 && framebuffer && framebuffer.thisDep, !isStatic2 && framebuffer && framebuffer.contextDep, !isStatic2 && framebuffer && framebuffer.propDep, function(env2, scope) {
var CONTEXT = env2.shared.context;
var BOX_W = w4;
if (!("width" in box2)) {
BOX_W = scope.def(CONTEXT, ".", S_FRAMEBUFFER_WIDTH, "-", x6);
}
var BOX_H = h3;
if (!("height" in box2)) {
BOX_H = scope.def(CONTEXT, ".", S_FRAMEBUFFER_HEIGHT, "-", y5);
}
return [x6, y5, BOX_W, BOX_H];
});
} else if (param in dynamicOptions) {
var dynBox = dynamicOptions[param];
var result = createDynamicDecl(dynBox, function(env2, scope) {
var BOX = env2.invoke(scope, dynBox);
check$1.optional(function() {
env2.assert(scope, BOX + "&&typeof " + BOX + '==="object"', "invalid " + param);
});
var CONTEXT = env2.shared.context;
var BOX_X = scope.def(BOX, ".x|0");
var BOX_Y = scope.def(BOX, ".y|0");
var BOX_W = scope.def('"width" in ', BOX, "?", BOX, ".width|0:", "(", CONTEXT, ".", S_FRAMEBUFFER_WIDTH, "-", BOX_X, ")");
var BOX_H = scope.def('"height" in ', BOX, "?", BOX, ".height|0:", "(", CONTEXT, ".", S_FRAMEBUFFER_HEIGHT, "-", BOX_Y, ")");
check$1.optional(function() {
env2.assert(scope, BOX_W + ">=0&&" + BOX_H + ">=0", "invalid " + param);
});
return [BOX_X, BOX_Y, BOX_W, BOX_H];
});
if (framebuffer) {
result.thisDep = result.thisDep || framebuffer.thisDep;
result.contextDep = result.contextDep || framebuffer.contextDep;
result.propDep = result.propDep || framebuffer.propDep;
}
return result;
} else if (framebuffer) {
return new Declaration(framebuffer.thisDep, framebuffer.contextDep, framebuffer.propDep, function(env2, scope) {
var CONTEXT = env2.shared.context;
return [
0,
0,
scope.def(CONTEXT, ".", S_FRAMEBUFFER_WIDTH),
scope.def(CONTEXT, ".", S_FRAMEBUFFER_HEIGHT)
];
});
} else {
return null;
}
}
var viewport = parseBox(S_VIEWPORT);
if (viewport) {
var prevViewport = viewport;
viewport = new Declaration(viewport.thisDep, viewport.contextDep, viewport.propDep, function(env2, scope) {
var VIEWPORT = prevViewport.append(env2, scope);
var CONTEXT = env2.shared.context;
scope.set(CONTEXT, "." + S_VIEWPORT_WIDTH, VIEWPORT[2]);
scope.set(CONTEXT, "." + S_VIEWPORT_HEIGHT, VIEWPORT[3]);
return VIEWPORT;
});
}
return {
viewport,
scissor_box: parseBox(S_SCISSOR_BOX)
};
}
function parseAttribLocations(options, attributes) {
var staticOptions = options.static;
var staticProgram = typeof staticOptions[S_FRAG] === "string" && typeof staticOptions[S_VERT] === "string";
if (staticProgram) {
if (Object.keys(attributes.dynamic).length > 0) {
return null;
}
var staticAttributes = attributes.static;
var sAttributes = Object.keys(staticAttributes);
if (sAttributes.length > 0 && typeof staticAttributes[sAttributes[0]] === "number") {
var bindings = [];
for (var i4 = 0; i4 < sAttributes.length; ++i4) {
check$1(typeof staticAttributes[sAttributes[i4]] === "number", "must specify all vertex attribute locations when using vaos");
bindings.push([staticAttributes[sAttributes[i4]] | 0, sAttributes[i4]]);
}
return bindings;
}
}
return null;
}
function parseProgram(options, env, attribLocations) {
var staticOptions = options.static;
var dynamicOptions = options.dynamic;
function parseShader(name) {
if (name in staticOptions) {
var id = stringStore.id(staticOptions[name]);
check$1.optional(function() {
shaderState.shader(shaderType[name], id, check$1.guessCommand());
});
var result = createStaticDecl(function() {
return id;
});
result.id = id;
return result;
} else if (name in dynamicOptions) {
var dyn = dynamicOptions[name];
return createDynamicDecl(dyn, function(env2, scope) {
var str8 = env2.invoke(scope, dyn);
var id2 = scope.def(env2.shared.strings, ".id(", str8, ")");
check$1.optional(function() {
scope(env2.shared.shader, ".shader(", shaderType[name], ",", id2, ",", env2.command, ");");
});
return id2;
});
}
return null;
}
var frag = parseShader(S_FRAG);
var vert = parseShader(S_VERT);
var program = null;
var progVar;
if (isStatic(frag) && isStatic(vert)) {
program = shaderState.program(vert.id, frag.id, null, attribLocations);
progVar = createStaticDecl(function(env2, scope) {
return env2.link(program);
});
} else {
progVar = new Declaration(frag && frag.thisDep || vert && vert.thisDep, frag && frag.contextDep || vert && vert.contextDep, frag && frag.propDep || vert && vert.propDep, function(env2, scope) {
var SHADER_STATE = env2.shared.shader;
var fragId;
if (frag) {
fragId = frag.append(env2, scope);
} else {
fragId = scope.def(SHADER_STATE, ".", S_FRAG);
}
var vertId;
if (vert) {
vertId = vert.append(env2, scope);
} else {
vertId = scope.def(SHADER_STATE, ".", S_VERT);
}
var progDef = SHADER_STATE + ".program(" + vertId + "," + fragId;
check$1.optional(function() {
progDef += "," + env2.command;
});
return scope.def(progDef + ")");
});
}
return {
frag,
vert,
progVar,
program
};
}
function parseDraw(options, env) {
var staticOptions = options.static;
var dynamicOptions = options.dynamic;
function parseElements() {
if (S_ELEMENTS in staticOptions) {
var elements2 = staticOptions[S_ELEMENTS];
if (isBufferArgs(elements2)) {
elements2 = elementState.getElements(elementState.create(elements2, true));
} else if (elements2) {
elements2 = elementState.getElements(elements2);
check$1.command(elements2, "invalid elements", env.commandStr);
}
var result = createStaticDecl(function(env2, scope) {
if (elements2) {
var result2 = env2.link(elements2);
env2.ELEMENTS = result2;
return result2;
}
env2.ELEMENTS = null;
return null;
});
result.value = elements2;
return result;
} else if (S_ELEMENTS in dynamicOptions) {
var dyn = dynamicOptions[S_ELEMENTS];
return createDynamicDecl(dyn, function(env2, scope) {
var shared = env2.shared;
var IS_BUFFER_ARGS = shared.isBufferArgs;
var ELEMENT_STATE2 = shared.elements;
var elementDefn = env2.invoke(scope, dyn);
var elements3 = scope.def("null");
var elementStream = scope.def(IS_BUFFER_ARGS, "(", elementDefn, ")");
var ifte = env2.cond(elementStream).then(elements3, "=", ELEMENT_STATE2, ".createStream(", elementDefn, ");").else(elements3, "=", ELEMENT_STATE2, ".getElements(", elementDefn, ");");
check$1.optional(function() {
env2.assert(ifte.else, "!" + elementDefn + "||" + elements3, "invalid elements");
});
scope.entry(ifte);
scope.exit(env2.cond(elementStream).then(ELEMENT_STATE2, ".destroyStream(", elements3, ");"));
env2.ELEMENTS = elements3;
return elements3;
});
}
return null;
}
var elements = parseElements();
function parsePrimitive() {
if (S_PRIMITIVE in staticOptions) {
var primitive = staticOptions[S_PRIMITIVE];
check$1.commandParameter(primitive, primTypes, "invalid primitve", env.commandStr);
return createStaticDecl(function(env2, scope) {
return primTypes[primitive];
});
} else if (S_PRIMITIVE in dynamicOptions) {
var dynPrimitive = dynamicOptions[S_PRIMITIVE];
return createDynamicDecl(dynPrimitive, function(env2, scope) {
var PRIM_TYPES = env2.constants.primTypes;
var prim = env2.invoke(scope, dynPrimitive);
check$1.optional(function() {
env2.assert(scope, prim + " in " + PRIM_TYPES, "invalid primitive, must be one of " + Object.keys(primTypes));
});
return scope.def(PRIM_TYPES, "[", prim, "]");
});
} else if (elements) {
if (isStatic(elements)) {
if (elements.value) {
return createStaticDecl(function(env2, scope) {
return scope.def(env2.ELEMENTS, ".primType");
});
} else {
return createStaticDecl(function() {
return GL_TRIANGLES$1;
});
}
} else {
return new Declaration(elements.thisDep, elements.contextDep, elements.propDep, function(env2, scope) {
var elements2 = env2.ELEMENTS;
return scope.def(elements2, "?", elements2, ".primType:", GL_TRIANGLES$1);
});
}
}
return null;
}
function parseParam(param, isOffset) {
if (param in staticOptions) {
var value2 = staticOptions[param] | 0;
check$1.command(!isOffset || value2 >= 0, "invalid " + param, env.commandStr);
return createStaticDecl(function(env2, scope) {
if (isOffset) {
env2.OFFSET = value2;
}
return value2;
});
} else if (param in dynamicOptions) {
var dynValue = dynamicOptions[param];
return createDynamicDecl(dynValue, function(env2, scope) {
var result = env2.invoke(scope, dynValue);
if (isOffset) {
env2.OFFSET = result;
check$1.optional(function() {
env2.assert(scope, result + ">=0", "invalid " + param);
});
}
return result;
});
} else if (isOffset && elements) {
return createStaticDecl(function(env2, scope) {
env2.OFFSET = "0";
return 0;
});
}
return null;
}
var OFFSET = parseParam(S_OFFSET, true);
function parseVertCount() {
if (S_COUNT in staticOptions) {
var count2 = staticOptions[S_COUNT] | 0;
check$1.command(typeof count2 === "number" && count2 >= 0, "invalid vertex count", env.commandStr);
return createStaticDecl(function() {
return count2;
});
} else if (S_COUNT in dynamicOptions) {
var dynCount = dynamicOptions[S_COUNT];
return createDynamicDecl(dynCount, function(env2, scope) {
var result2 = env2.invoke(scope, dynCount);
check$1.optional(function() {
env2.assert(scope, "typeof " + result2 + '==="number"&&' + result2 + ">=0&&" + result2 + "===(" + result2 + "|0)", "invalid vertex count");
});
return result2;
});
} else if (elements) {
if (isStatic(elements)) {
if (elements) {
if (OFFSET) {
return new Declaration(OFFSET.thisDep, OFFSET.contextDep, OFFSET.propDep, function(env2, scope) {
var result2 = scope.def(env2.ELEMENTS, ".vertCount-", env2.OFFSET);
check$1.optional(function() {
env2.assert(scope, result2 + ">=0", "invalid vertex offset/element buffer too small");
});
return result2;
});
} else {
return createStaticDecl(function(env2, scope) {
return scope.def(env2.ELEMENTS, ".vertCount");
});
}
} else {
var result = createStaticDecl(function() {
return -1;
});
check$1.optional(function() {
result.MISSING = true;
});
return result;
}
} else {
var variable = new Declaration(elements.thisDep || OFFSET.thisDep, elements.contextDep || OFFSET.contextDep, elements.propDep || OFFSET.propDep, function(env2, scope) {
var elements2 = env2.ELEMENTS;
if (env2.OFFSET) {
return scope.def(elements2, "?", elements2, ".vertCount-", env2.OFFSET, ":-1");
}
return scope.def(elements2, "?", elements2, ".vertCount:-1");
});
check$1.optional(function() {
variable.DYNAMIC = true;
});
return variable;
}
}
return null;
}
return {
elements,
primitive: parsePrimitive(),
count: parseVertCount(),
instances: parseParam(S_INSTANCES, false),
offset: OFFSET
};
}
function parseGLState(options, env) {
var staticOptions = options.static;
var dynamicOptions = options.dynamic;
var STATE = {};
GL_STATE_NAMES.forEach(function(prop) {
var param = propName(prop);
function parseParam(parseStatic, parseDynamic) {
if (prop in staticOptions) {
var value2 = parseStatic(staticOptions[prop]);
STATE[param] = createStaticDecl(function() {
return value2;
});
} else if (prop in dynamicOptions) {
var dyn = dynamicOptions[prop];
STATE[param] = createDynamicDecl(dyn, function(env2, scope) {
return parseDynamic(env2, scope, env2.invoke(scope, dyn));
});
}
}
switch (prop) {
case S_CULL_ENABLE:
case S_BLEND_ENABLE:
case S_DITHER:
case S_STENCIL_ENABLE:
case S_DEPTH_ENABLE:
case S_SCISSOR_ENABLE:
case S_POLYGON_OFFSET_ENABLE:
case S_SAMPLE_ALPHA:
case S_SAMPLE_ENABLE:
case S_DEPTH_MASK:
return parseParam(function(value2) {
check$1.commandType(value2, "boolean", prop, env.commandStr);
return value2;
}, function(env2, scope, value2) {
check$1.optional(function() {
env2.assert(scope, "typeof " + value2 + '==="boolean"', "invalid flag " + prop, env2.commandStr);
});
return value2;
});
case S_DEPTH_FUNC:
return parseParam(function(value2) {
check$1.commandParameter(value2, compareFuncs, "invalid " + prop, env.commandStr);
return compareFuncs[value2];
}, function(env2, scope, value2) {
var COMPARE_FUNCS = env2.constants.compareFuncs;
check$1.optional(function() {
env2.assert(scope, value2 + " in " + COMPARE_FUNCS, "invalid " + prop + ", must be one of " + Object.keys(compareFuncs));
});
return scope.def(COMPARE_FUNCS, "[", value2, "]");
});
case S_DEPTH_RANGE:
return parseParam(function(value2) {
check$1.command(isArrayLike2(value2) && value2.length === 2 && typeof value2[0] === "number" && typeof value2[1] === "number" && value2[0] <= value2[1], "depth range is 2d array", env.commandStr);
return value2;
}, function(env2, scope, value2) {
check$1.optional(function() {
env2.assert(scope, env2.shared.isArrayLike + "(" + value2 + ")&&" + value2 + ".length===2&&typeof " + value2 + '[0]==="number"&&typeof ' + value2 + '[1]==="number"&&' + value2 + "[0]<=" + value2 + "[1]", "depth range must be a 2d array");
});
var Z_NEAR = scope.def("+", value2, "[0]");
var Z_FAR = scope.def("+", value2, "[1]");
return [Z_NEAR, Z_FAR];
});
case S_BLEND_FUNC:
return parseParam(function(value2) {
check$1.commandType(value2, "object", "blend.func", env.commandStr);
var srcRGB = "srcRGB" in value2 ? value2.srcRGB : value2.src;
var srcAlpha = "srcAlpha" in value2 ? value2.srcAlpha : value2.src;
var dstRGB = "dstRGB" in value2 ? value2.dstRGB : value2.dst;
var dstAlpha = "dstAlpha" in value2 ? value2.dstAlpha : value2.dst;
check$1.commandParameter(srcRGB, blendFuncs, param + ".srcRGB", env.commandStr);
check$1.commandParameter(srcAlpha, blendFuncs, param + ".srcAlpha", env.commandStr);
check$1.commandParameter(dstRGB, blendFuncs, param + ".dstRGB", env.commandStr);
check$1.commandParameter(dstAlpha, blendFuncs, param + ".dstAlpha", env.commandStr);
check$1.command(invalidBlendCombinations.indexOf(srcRGB + ", " + dstRGB) === -1, "unallowed blending combination (srcRGB, dstRGB) = (" + srcRGB + ", " + dstRGB + ")", env.commandStr);
return [
blendFuncs[srcRGB],
blendFuncs[dstRGB],
blendFuncs[srcAlpha],
blendFuncs[dstAlpha]
];
}, function(env2, scope, value2) {
var BLEND_FUNCS = env2.constants.blendFuncs;
check$1.optional(function() {
env2.assert(scope, value2 + "&&typeof " + value2 + '==="object"', "invalid blend func, must be an object");
});
function read(prefix2, suffix) {
var func = scope.def('"', prefix2, suffix, '" in ', value2, "?", value2, ".", prefix2, suffix, ":", value2, ".", prefix2);
check$1.optional(function() {
env2.assert(scope, func + " in " + BLEND_FUNCS, "invalid " + prop + "." + prefix2 + suffix + ", must be one of " + Object.keys(blendFuncs));
});
return func;
}
var srcRGB = read("src", "RGB");
var dstRGB = read("dst", "RGB");
check$1.optional(function() {
var INVALID_BLEND_COMBINATIONS = env2.constants.invalidBlendCombinations;
env2.assert(scope, INVALID_BLEND_COMBINATIONS + ".indexOf(" + srcRGB + '+", "+' + dstRGB + ") === -1 ", "unallowed blending combination for (srcRGB, dstRGB)");
});
var SRC_RGB = scope.def(BLEND_FUNCS, "[", srcRGB, "]");
var SRC_ALPHA = scope.def(BLEND_FUNCS, "[", read("src", "Alpha"), "]");
var DST_RGB = scope.def(BLEND_FUNCS, "[", dstRGB, "]");
var DST_ALPHA = scope.def(BLEND_FUNCS, "[", read("dst", "Alpha"), "]");
return [SRC_RGB, DST_RGB, SRC_ALPHA, DST_ALPHA];
});
case S_BLEND_EQUATION:
return parseParam(function(value2) {
if (typeof value2 === "string") {
check$1.commandParameter(value2, blendEquations, "invalid " + prop, env.commandStr);
return [
blendEquations[value2],
blendEquations[value2]
];
} else if (typeof value2 === "object") {
check$1.commandParameter(value2.rgb, blendEquations, prop + ".rgb", env.commandStr);
check$1.commandParameter(value2.alpha, blendEquations, prop + ".alpha", env.commandStr);
return [
blendEquations[value2.rgb],
blendEquations[value2.alpha]
];
} else {
check$1.commandRaise("invalid blend.equation", env.commandStr);
}
}, function(env2, scope, value2) {
var BLEND_EQUATIONS = env2.constants.blendEquations;
var RGB = scope.def();
var ALPHA = scope.def();
var ifte = env2.cond("typeof ", value2, '==="string"');
check$1.optional(function() {
function checkProp(block, name, value3) {
env2.assert(block, value3 + " in " + BLEND_EQUATIONS, "invalid " + name + ", must be one of " + Object.keys(blendEquations));
}
checkProp(ifte.then, prop, value2);
env2.assert(ifte.else, value2 + "&&typeof " + value2 + '==="object"', "invalid " + prop);
checkProp(ifte.else, prop + ".rgb", value2 + ".rgb");
checkProp(ifte.else, prop + ".alpha", value2 + ".alpha");
});
ifte.then(RGB, "=", ALPHA, "=", BLEND_EQUATIONS, "[", value2, "];");
ifte.else(RGB, "=", BLEND_EQUATIONS, "[", value2, ".rgb];", ALPHA, "=", BLEND_EQUATIONS, "[", value2, ".alpha];");
scope(ifte);
return [RGB, ALPHA];
});
case S_BLEND_COLOR:
return parseParam(function(value2) {
check$1.command(isArrayLike2(value2) && value2.length === 4, "blend.color must be a 4d array", env.commandStr);
return loop(4, function(i4) {
return +value2[i4];
});
}, function(env2, scope, value2) {
check$1.optional(function() {
env2.assert(scope, env2.shared.isArrayLike + "(" + value2 + ")&&" + value2 + ".length===4", "blend.color must be a 4d array");
});
return loop(4, function(i4) {
return scope.def("+", value2, "[", i4, "]");
});
});
case S_STENCIL_MASK:
return parseParam(function(value2) {
check$1.commandType(value2, "number", param, env.commandStr);
return value2 | 0;
}, function(env2, scope, value2) {
check$1.optional(function() {
env2.assert(scope, "typeof " + value2 + '==="number"', "invalid stencil.mask");
});
return scope.def(value2, "|0");
});
case S_STENCIL_FUNC:
return parseParam(function(value2) {
check$1.commandType(value2, "object", param, env.commandStr);
var cmp = value2.cmp || "keep";
var ref = value2.ref || 0;
var mask = "mask" in value2 ? value2.mask : -1;
check$1.commandParameter(cmp, compareFuncs, prop + ".cmp", env.commandStr);
check$1.commandType(ref, "number", prop + ".ref", env.commandStr);
check$1.commandType(mask, "number", prop + ".mask", env.commandStr);
return [
compareFuncs[cmp],
ref,
mask
];
}, function(env2, scope, value2) {
var COMPARE_FUNCS = env2.constants.compareFuncs;
check$1.optional(function() {
function assert() {
env2.assert(scope, Array.prototype.join.call(arguments, ""), "invalid stencil.func");
}
assert(value2 + "&&typeof ", value2, '==="object"');
assert('!("cmp" in ', value2, ")||(", value2, ".cmp in ", COMPARE_FUNCS, ")");
});
var cmp = scope.def('"cmp" in ', value2, "?", COMPARE_FUNCS, "[", value2, ".cmp]", ":", GL_KEEP);
var ref = scope.def(value2, ".ref|0");
var mask = scope.def('"mask" in ', value2, "?", value2, ".mask|0:-1");
return [cmp, ref, mask];
});
case S_STENCIL_OPFRONT:
case S_STENCIL_OPBACK:
return parseParam(function(value2) {
check$1.commandType(value2, "object", param, env.commandStr);
var fail = value2.fail || "keep";
var zfail = value2.zfail || "keep";
var zpass = value2.zpass || "keep";
check$1.commandParameter(fail, stencilOps, prop + ".fail", env.commandStr);
check$1.commandParameter(zfail, stencilOps, prop + ".zfail", env.commandStr);
check$1.commandParameter(zpass, stencilOps, prop + ".zpass", env.commandStr);
return [
prop === S_STENCIL_OPBACK ? GL_BACK : GL_FRONT,
stencilOps[fail],
stencilOps[zfail],
stencilOps[zpass]
];
}, function(env2, scope, value2) {
var STENCIL_OPS = env2.constants.stencilOps;
check$1.optional(function() {
env2.assert(scope, value2 + "&&typeof " + value2 + '==="object"', "invalid " + prop);
});
function read(name) {
check$1.optional(function() {
env2.assert(scope, '!("' + name + '" in ' + value2 + ")||(" + value2 + "." + name + " in " + STENCIL_OPS + ")", "invalid " + prop + "." + name + ", must be one of " + Object.keys(stencilOps));
});
return scope.def('"', name, '" in ', value2, "?", STENCIL_OPS, "[", value2, ".", name, "]:", GL_KEEP);
}
return [
prop === S_STENCIL_OPBACK ? GL_BACK : GL_FRONT,
read("fail"),
read("zfail"),
read("zpass")
];
});
case S_POLYGON_OFFSET_OFFSET:
return parseParam(function(value2) {
check$1.commandType(value2, "object", param, env.commandStr);
var factor = value2.factor | 0;
var units = value2.units | 0;
check$1.commandType(factor, "number", param + ".factor", env.commandStr);
check$1.commandType(units, "number", param + ".units", env.commandStr);
return [factor, units];
}, function(env2, scope, value2) {
check$1.optional(function() {
env2.assert(scope, value2 + "&&typeof " + value2 + '==="object"', "invalid " + prop);
});
var FACTOR = scope.def(value2, ".factor|0");
var UNITS = scope.def(value2, ".units|0");
return [FACTOR, UNITS];
});
case S_CULL_FACE:
return parseParam(function(value2) {
var face = 0;
if (value2 === "front") {
face = GL_FRONT;
} else if (value2 === "back") {
face = GL_BACK;
}
check$1.command(!!face, param, env.commandStr);
return face;
}, function(env2, scope, value2) {
check$1.optional(function() {
env2.assert(scope, value2 + '==="front"||' + value2 + '==="back"', "invalid cull.face");
});
return scope.def(value2, '==="front"?', GL_FRONT, ":", GL_BACK);
});
case S_LINE_WIDTH:
return parseParam(function(value2) {
check$1.command(typeof value2 === "number" && value2 >= limits.lineWidthDims[0] && value2 <= limits.lineWidthDims[1], "invalid line width, must be a positive number between " + limits.lineWidthDims[0] + " and " + limits.lineWidthDims[1], env.commandStr);
return value2;
}, function(env2, scope, value2) {
check$1.optional(function() {
env2.assert(scope, "typeof " + value2 + '==="number"&&' + value2 + ">=" + limits.lineWidthDims[0] + "&&" + value2 + "<=" + limits.lineWidthDims[1], "invalid line width");
});
return value2;
});
case S_FRONT_FACE:
return parseParam(function(value2) {
check$1.commandParameter(value2, orientationType, param, env.commandStr);
return orientationType[value2];
}, function(env2, scope, value2) {
check$1.optional(function() {
env2.assert(scope, value2 + '==="cw"||' + value2 + '==="ccw"', "invalid frontFace, must be one of cw,ccw");
});
return scope.def(value2 + '==="cw"?' + GL_CW + ":" + GL_CCW);
});
case S_COLOR_MASK:
return parseParam(function(value2) {
check$1.command(isArrayLike2(value2) && value2.length === 4, "color.mask must be length 4 array", env.commandStr);
return value2.map(function(v3) {
return !!v3;
});
}, function(env2, scope, value2) {
check$1.optional(function() {
env2.assert(scope, env2.shared.isArrayLike + "(" + value2 + ")&&" + value2 + ".length===4", "invalid color.mask");
});
return loop(4, function(i4) {
return "!!" + value2 + "[" + i4 + "]";
});
});
case S_SAMPLE_COVERAGE:
return parseParam(function(value2) {
check$1.command(typeof value2 === "object" && value2, param, env.commandStr);
var sampleValue = "value" in value2 ? value2.value : 1;
var sampleInvert = !!value2.invert;
check$1.command(typeof sampleValue === "number" && sampleValue >= 0 && sampleValue <= 1, "sample.coverage.value must be a number between 0 and 1", env.commandStr);
return [sampleValue, sampleInvert];
}, function(env2, scope, value2) {
check$1.optional(function() {
env2.assert(scope, value2 + "&&typeof " + value2 + '==="object"', "invalid sample.coverage");
});
var VALUE = scope.def('"value" in ', value2, "?+", value2, ".value:1");
var INVERT = scope.def("!!", value2, ".invert");
return [VALUE, INVERT];
});
}
});
return STATE;
}
function parseUniforms(uniforms, env) {
var staticUniforms = uniforms.static;
var dynamicUniforms = uniforms.dynamic;
var UNIFORMS = {};
Object.keys(staticUniforms).forEach(function(name) {
var value2 = staticUniforms[name];
var result;
if (typeof value2 === "number" || typeof value2 === "boolean") {
result = createStaticDecl(function() {
return value2;
});
} else if (typeof value2 === "function") {
var reglType = value2._reglType;
if (reglType === "texture2d" || reglType === "textureCube") {
result = createStaticDecl(function(env2) {
return env2.link(value2);
});
} else if (reglType === "framebuffer" || reglType === "framebufferCube") {
check$1.command(value2.color.length > 0, 'missing color attachment for framebuffer sent to uniform "' + name + '"', env.commandStr);
result = createStaticDecl(function(env2) {
return env2.link(value2.color[0]);
});
} else {
check$1.commandRaise('invalid data for uniform "' + name + '"', env.commandStr);
}
} else if (isArrayLike2(value2)) {
result = createStaticDecl(function(env2) {
var ITEM = env2.global.def("[", loop(value2.length, function(i4) {
check$1.command(typeof value2[i4] === "number" || typeof value2[i4] === "boolean", "invalid uniform " + name, env2.commandStr);
return value2[i4];
}), "]");
return ITEM;
});
} else {
check$1.commandRaise('invalid or missing data for uniform "' + name + '"', env.commandStr);
}
result.value = value2;
UNIFORMS[name] = result;
});
Object.keys(dynamicUniforms).forEach(function(key) {
var dyn = dynamicUniforms[key];
UNIFORMS[key] = createDynamicDecl(dyn, function(env2, scope) {
return env2.invoke(scope, dyn);
});
});
return UNIFORMS;
}
function parseAttributes(attributes, env) {
var staticAttributes = attributes.static;
var dynamicAttributes = attributes.dynamic;
var attributeDefs = {};
Object.keys(staticAttributes).forEach(function(attribute) {
var value2 = staticAttributes[attribute];
var id = stringStore.id(attribute);
var record = new AttributeRecord2();
if (isBufferArgs(value2)) {
record.state = ATTRIB_STATE_POINTER;
record.buffer = bufferState.getBuffer(bufferState.create(value2, GL_ARRAY_BUFFER$2, false, true));
record.type = 0;
} else {
var buffer = bufferState.getBuffer(value2);
if (buffer) {
record.state = ATTRIB_STATE_POINTER;
record.buffer = buffer;
record.type = 0;
} else {
check$1.command(typeof value2 === "object" && value2, "invalid data for attribute " + attribute, env.commandStr);
if ("constant" in value2) {
var constant2 = value2.constant;
record.buffer = "null";
record.state = ATTRIB_STATE_CONSTANT;
if (typeof constant2 === "number") {
record.x = constant2;
} else {
check$1.command(isArrayLike2(constant2) && constant2.length > 0 && constant2.length <= 4, "invalid constant for attribute " + attribute, env.commandStr);
CUTE_COMPONENTS.forEach(function(c5, i4) {
if (i4 < constant2.length) {
record[c5] = constant2[i4];
}
});
}
} else {
if (isBufferArgs(value2.buffer)) {
buffer = bufferState.getBuffer(bufferState.create(value2.buffer, GL_ARRAY_BUFFER$2, false, true));
} else {
buffer = bufferState.getBuffer(value2.buffer);
}
check$1.command(!!buffer, 'missing buffer for attribute "' + attribute + '"', env.commandStr);
var offset = value2.offset | 0;
check$1.command(offset >= 0, 'invalid offset for attribute "' + attribute + '"', env.commandStr);
var stride = value2.stride | 0;
check$1.command(stride >= 0 && stride < 256, 'invalid stride for attribute "' + attribute + '", must be integer betweeen [0, 255]', env.commandStr);
var size2 = value2.size | 0;
check$1.command(!("size" in value2) || size2 > 0 && size2 <= 4, 'invalid size for attribute "' + attribute + '", must be 1,2,3,4', env.commandStr);
var normalized = !!value2.normalized;
var type2 = 0;
if ("type" in value2) {
check$1.commandParameter(value2.type, glTypes, "invalid type for attribute " + attribute, env.commandStr);
type2 = glTypes[value2.type];
}
var divisor = value2.divisor | 0;
if ("divisor" in value2) {
check$1.command(divisor === 0 || extInstancing, 'cannot specify divisor for attribute "' + attribute + '", instancing not supported', env.commandStr);
check$1.command(divisor >= 0, 'invalid divisor for attribute "' + attribute + '"', env.commandStr);
}
check$1.optional(function() {
var command = env.commandStr;
var VALID_KEYS = [
"buffer",
"offset",
"divisor",
"normalized",
"type",
"size",
"stride"
];
Object.keys(value2).forEach(function(prop) {
check$1.command(VALID_KEYS.indexOf(prop) >= 0, 'unknown parameter "' + prop + '" for attribute pointer "' + attribute + '" (valid parameters are ' + VALID_KEYS + ")", command);
});
});
record.buffer = buffer;
record.state = ATTRIB_STATE_POINTER;
record.size = size2;
record.normalized = normalized;
record.type = type2 || buffer.dtype;
record.offset = offset;
record.stride = stride;
record.divisor = divisor;
}
}
}
attributeDefs[attribute] = createStaticDecl(function(env2, scope) {
var cache3 = env2.attribCache;
if (id in cache3) {
return cache3[id];
}
var result = {
isStream: false
};
Object.keys(record).forEach(function(key) {
result[key] = record[key];
});
if (record.buffer) {
result.buffer = env2.link(record.buffer);
result.type = result.type || result.buffer + ".dtype";
}
cache3[id] = result;
return result;
});
});
Object.keys(dynamicAttributes).forEach(function(attribute) {
var dyn = dynamicAttributes[attribute];
function appendAttributeCode(env2, block) {
var VALUE = env2.invoke(block, dyn);
var shared = env2.shared;
var constants = env2.constants;
var IS_BUFFER_ARGS = shared.isBufferArgs;
var BUFFER_STATE = shared.buffer;
check$1.optional(function() {
env2.assert(block, VALUE + "&&(typeof " + VALUE + '==="object"||typeof ' + VALUE + '==="function")&&(' + IS_BUFFER_ARGS + "(" + VALUE + ")||" + BUFFER_STATE + ".getBuffer(" + VALUE + ")||" + BUFFER_STATE + ".getBuffer(" + VALUE + ".buffer)||" + IS_BUFFER_ARGS + "(" + VALUE + '.buffer)||("constant" in ' + VALUE + "&&(typeof " + VALUE + '.constant==="number"||' + shared.isArrayLike + "(" + VALUE + ".constant))))", 'invalid dynamic attribute "' + attribute + '"');
});
var result = {
isStream: block.def(false)
};
var defaultRecord = new AttributeRecord2();
defaultRecord.state = ATTRIB_STATE_POINTER;
Object.keys(defaultRecord).forEach(function(key) {
result[key] = block.def("" + defaultRecord[key]);
});
var BUFFER = result.buffer;
var TYPE = result.type;
block("if(", IS_BUFFER_ARGS, "(", VALUE, ")){", result.isStream, "=true;", BUFFER, "=", BUFFER_STATE, ".createStream(", GL_ARRAY_BUFFER$2, ",", VALUE, ");", TYPE, "=", BUFFER, ".dtype;", "}else{", BUFFER, "=", BUFFER_STATE, ".getBuffer(", VALUE, ");", "if(", BUFFER, "){", TYPE, "=", BUFFER, ".dtype;", '}else if("constant" in ', VALUE, "){", result.state, "=", ATTRIB_STATE_CONSTANT, ";", "if(typeof " + VALUE + '.constant === "number"){', result[CUTE_COMPONENTS[0]], "=", VALUE, ".constant;", CUTE_COMPONENTS.slice(1).map(function(n3) {
return result[n3];
}).join("="), "=0;", "}else{", CUTE_COMPONENTS.map(function(name, i4) {
return result[name] + "=" + VALUE + ".constant.length>" + i4 + "?" + VALUE + ".constant[" + i4 + "]:0;";
}).join(""), "}}else{", "if(", IS_BUFFER_ARGS, "(", VALUE, ".buffer)){", BUFFER, "=", BUFFER_STATE, ".createStream(", GL_ARRAY_BUFFER$2, ",", VALUE, ".buffer);", "}else{", BUFFER, "=", BUFFER_STATE, ".getBuffer(", VALUE, ".buffer);", "}", TYPE, '="type" in ', VALUE, "?", constants.glTypes, "[", VALUE, ".type]:", BUFFER, ".dtype;", result.normalized, "=!!", VALUE, ".normalized;");
function emitReadRecord(name) {
block(result[name], "=", VALUE, ".", name, "|0;");
}
emitReadRecord("size");
emitReadRecord("offset");
emitReadRecord("stride");
emitReadRecord("divisor");
block("}}");
block.exit("if(", result.isStream, "){", BUFFER_STATE, ".destroyStream(", BUFFER, ");", "}");
return result;
}
attributeDefs[attribute] = createDynamicDecl(dyn, appendAttributeCode);
});
return attributeDefs;
}
function parseVAO(options, env) {
var staticOptions = options.static;
var dynamicOptions = options.dynamic;
if (S_VAO in staticOptions) {
var vao = staticOptions[S_VAO];
if (vao !== null && attributeState.getVAO(vao) === null) {
vao = attributeState.createVAO(vao);
}
return createStaticDecl(function(env2) {
return env2.link(attributeState.getVAO(vao));
});
} else if (S_VAO in dynamicOptions) {
var dyn = dynamicOptions[S_VAO];
return createDynamicDecl(dyn, function(env2, scope) {
var vaoRef = env2.invoke(scope, dyn);
return scope.def(env2.shared.vao + ".getVAO(" + vaoRef + ")");
});
}
return null;
}
function parseContext(context) {
var staticContext = context.static;
var dynamicContext = context.dynamic;
var result = {};
Object.keys(staticContext).forEach(function(name) {
var value2 = staticContext[name];
result[name] = createStaticDecl(function(env, scope) {
if (typeof value2 === "number" || typeof value2 === "boolean") {
return "" + value2;
} else {
return env.link(value2);
}
});
});
Object.keys(dynamicContext).forEach(function(name) {
var dyn = dynamicContext[name];
result[name] = createDynamicDecl(dyn, function(env, scope) {
return env.invoke(scope, dyn);
});
});
return result;
}
function parseArguments(options, attributes, uniforms, context, env) {
var staticOptions = options.static;
var dynamicOptions = options.dynamic;
check$1.optional(function() {
var KEY_NAMES = [
S_FRAMEBUFFER,
S_VERT,
S_FRAG,
S_ELEMENTS,
S_PRIMITIVE,
S_OFFSET,
S_COUNT,
S_INSTANCES,
S_PROFILE,
S_VAO
].concat(GL_STATE_NAMES);
function checkKeys(dict) {
Object.keys(dict).forEach(function(key) {
check$1.command(KEY_NAMES.indexOf(key) >= 0, 'unknown parameter "' + key + '"', env.commandStr);
});
}
checkKeys(staticOptions);
checkKeys(dynamicOptions);
});
var attribLocations = parseAttribLocations(options, attributes);
var framebuffer = parseFramebuffer(options, env);
var viewportAndScissor = parseViewportScissor(options, framebuffer, env);
var draw4 = parseDraw(options, env);
var state2 = parseGLState(options, env);
var shader = parseProgram(options, env, attribLocations);
function copyBox(name) {
var defn = viewportAndScissor[name];
if (defn) {
state2[name] = defn;
}
}
copyBox(S_VIEWPORT);
copyBox(propName(S_SCISSOR_BOX));
var dirty = Object.keys(state2).length > 0;
var result = {
framebuffer,
draw: draw4,
shader,
state: state2,
dirty,
scopeVAO: null,
drawVAO: null,
useVAO: false,
attributes: {}
};
result.profile = parseProfile(options, env);
result.uniforms = parseUniforms(uniforms, env);
result.drawVAO = result.scopeVAO = parseVAO(options, env);
if (!result.drawVAO && shader.program && !attribLocations && extensions.angle_instanced_arrays) {
var useVAO = true;
var staticBindings = shader.program.attributes.map(function(attr) {
var binding = attributes.static[attr];
useVAO = useVAO && !!binding;
return binding;
});
if (useVAO && staticBindings.length > 0) {
var vao = attributeState.getVAO(attributeState.createVAO(staticBindings));
result.drawVAO = new Declaration(null, null, null, function(env2, scope) {
return env2.link(vao);
});
result.useVAO = true;
}
}
if (attribLocations) {
result.useVAO = true;
} else {
result.attributes = parseAttributes(attributes, env);
}
result.context = parseContext(context, env);
return result;
}
function emitContext(env, scope, context) {
var shared = env.shared;
var CONTEXT = shared.context;
var contextEnter = env.scope();
Object.keys(context).forEach(function(name) {
scope.save(CONTEXT, "." + name);
var defn = context[name];
var value2 = defn.append(env, scope);
if (Array.isArray(value2)) {
contextEnter(CONTEXT, ".", name, "=[", value2.join(), "];");
} else {
contextEnter(CONTEXT, ".", name, "=", value2, ";");
}
});
scope(contextEnter);
}
function emitPollFramebuffer(env, scope, framebuffer, skipCheck) {
var shared = env.shared;
var GL = shared.gl;
var FRAMEBUFFER_STATE = shared.framebuffer;
var EXT_DRAW_BUFFERS;
if (extDrawBuffers) {
EXT_DRAW_BUFFERS = scope.def(shared.extensions, ".webgl_draw_buffers");
}
var constants = env.constants;
var DRAW_BUFFERS = constants.drawBuffer;
var BACK_BUFFER = constants.backBuffer;
var NEXT;
if (framebuffer) {
NEXT = framebuffer.append(env, scope);
} else {
NEXT = scope.def(FRAMEBUFFER_STATE, ".next");
}
if (!skipCheck) {
scope("if(", NEXT, "!==", FRAMEBUFFER_STATE, ".cur){");
}
scope("if(", NEXT, "){", GL, ".bindFramebuffer(", GL_FRAMEBUFFER$2, ",", NEXT, ".framebuffer);");
if (extDrawBuffers) {
scope(EXT_DRAW_BUFFERS, ".drawBuffersWEBGL(", DRAW_BUFFERS, "[", NEXT, ".colorAttachments.length]);");
}
scope("}else{", GL, ".bindFramebuffer(", GL_FRAMEBUFFER$2, ",null);");
if (extDrawBuffers) {
scope(EXT_DRAW_BUFFERS, ".drawBuffersWEBGL(", BACK_BUFFER, ");");
}
scope("}", FRAMEBUFFER_STATE, ".cur=", NEXT, ";");
if (!skipCheck) {
scope("}");
}
}
function emitPollState(env, scope, args) {
var shared = env.shared;
var GL = shared.gl;
var CURRENT_VARS = env.current;
var NEXT_VARS = env.next;
var CURRENT_STATE = shared.current;
var NEXT_STATE = shared.next;
var block = env.cond(CURRENT_STATE, ".dirty");
GL_STATE_NAMES.forEach(function(prop) {
var param = propName(prop);
if (param in args.state) {
return;
}
var NEXT, CURRENT;
if (param in NEXT_VARS) {
NEXT = NEXT_VARS[param];
CURRENT = CURRENT_VARS[param];
var parts = loop(currentState[param].length, function(i4) {
return block.def(NEXT, "[", i4, "]");
});
block(env.cond(parts.map(function(p4, i4) {
return p4 + "!==" + CURRENT + "[" + i4 + "]";
}).join("||")).then(GL, ".", GL_VARIABLES[param], "(", parts, ");", parts.map(function(p4, i4) {
return CURRENT + "[" + i4 + "]=" + p4;
}).join(";"), ";"));
} else {
NEXT = block.def(NEXT_STATE, ".", param);
var ifte = env.cond(NEXT, "!==", CURRENT_STATE, ".", param);
block(ifte);
if (param in GL_FLAGS) {
ifte(env.cond(NEXT).then(GL, ".enable(", GL_FLAGS[param], ");").else(GL, ".disable(", GL_FLAGS[param], ");"), CURRENT_STATE, ".", param, "=", NEXT, ";");
} else {
ifte(GL, ".", GL_VARIABLES[param], "(", NEXT, ");", CURRENT_STATE, ".", param, "=", NEXT, ";");
}
}
});
if (Object.keys(args.state).length === 0) {
block(CURRENT_STATE, ".dirty=false;");
}
scope(block);
}
function emitSetOptions(env, scope, options, filter2) {
var shared = env.shared;
var CURRENT_VARS = env.current;
var CURRENT_STATE = shared.current;
var GL = shared.gl;
sortState(Object.keys(options)).forEach(function(param) {
var defn = options[param];
if (filter2 && !filter2(defn)) {
return;
}
var variable = defn.append(env, scope);
if (GL_FLAGS[param]) {
var flag = GL_FLAGS[param];
if (isStatic(defn)) {
if (variable) {
scope(GL, ".enable(", flag, ");");
} else {
scope(GL, ".disable(", flag, ");");
}
} else {
scope(env.cond(variable).then(GL, ".enable(", flag, ");").else(GL, ".disable(", flag, ");"));
}
scope(CURRENT_STATE, ".", param, "=", variable, ";");
} else if (isArrayLike2(variable)) {
var CURRENT = CURRENT_VARS[param];
scope(GL, ".", GL_VARIABLES[param], "(", variable, ");", variable.map(function(v3, i4) {
return CURRENT + "[" + i4 + "]=" + v3;
}).join(";"), ";");
} else {
scope(GL, ".", GL_VARIABLES[param], "(", variable, ");", CURRENT_STATE, ".", param, "=", variable, ";");
}
});
}
function injectExtensions(env, scope) {
if (extInstancing) {
env.instancing = scope.def(env.shared.extensions, ".angle_instanced_arrays");
}
}
function emitProfile(env, scope, args, useScope, incrementCounter) {
var shared = env.shared;
var STATS = env.stats;
var CURRENT_STATE = shared.current;
var TIMER = shared.timer;
var profileArg = args.profile;
function perfCounter() {
if (typeof performance === "undefined") {
return "Date.now()";
} else {
return "performance.now()";
}
}
var CPU_START, QUERY_COUNTER;
function emitProfileStart(block) {
CPU_START = scope.def();
block(CPU_START, "=", perfCounter(), ";");
if (typeof incrementCounter === "string") {
block(STATS, ".count+=", incrementCounter, ";");
} else {
block(STATS, ".count++;");
}
if (timer3) {
if (useScope) {
QUERY_COUNTER = scope.def();
block(QUERY_COUNTER, "=", TIMER, ".getNumPendingQueries();");
} else {
block(TIMER, ".beginQuery(", STATS, ");");
}
}
}
function emitProfileEnd(block) {
block(STATS, ".cpuTime+=", perfCounter(), "-", CPU_START, ";");
if (timer3) {
if (useScope) {
block(TIMER, ".pushScopeStats(", QUERY_COUNTER, ",", TIMER, ".getNumPendingQueries(),", STATS, ");");
} else {
block(TIMER, ".endQuery();");
}
}
}
function scopeProfile(value2) {
var prev = scope.def(CURRENT_STATE, ".profile");
scope(CURRENT_STATE, ".profile=", value2, ";");
scope.exit(CURRENT_STATE, ".profile=", prev, ";");
}
var USE_PROFILE;
if (profileArg) {
if (isStatic(profileArg)) {
if (profileArg.enable) {
emitProfileStart(scope);
emitProfileEnd(scope.exit);
scopeProfile("true");
} else {
scopeProfile("false");
}
return;
}
USE_PROFILE = profileArg.append(env, scope);
scopeProfile(USE_PROFILE);
} else {
USE_PROFILE = scope.def(CURRENT_STATE, ".profile");
}
var start = env.block();
emitProfileStart(start);
scope("if(", USE_PROFILE, "){", start, "}");
var end2 = env.block();
emitProfileEnd(end2);
scope.exit("if(", USE_PROFILE, "){", end2, "}");
}
function emitAttributes(env, scope, args, attributes, filter2) {
var shared = env.shared;
function typeLength(x6) {
switch (x6) {
case GL_FLOAT_VEC2:
case GL_INT_VEC2:
case GL_BOOL_VEC2:
return 2;
case GL_FLOAT_VEC3:
case GL_INT_VEC3:
case GL_BOOL_VEC3:
return 3;
case GL_FLOAT_VEC4:
case GL_INT_VEC4:
case GL_BOOL_VEC4:
return 4;
default:
return 1;
}
}
function emitBindAttribute(ATTRIBUTE, size2, record) {
var GL = shared.gl;
var LOCATION = scope.def(ATTRIBUTE, ".location");
var BINDING = scope.def(shared.attributes, "[", LOCATION, "]");
var STATE = record.state;
var BUFFER = record.buffer;
var CONST_COMPONENTS = [
record.x,
record.y,
record.z,
record.w
];
var COMMON_KEYS = [
"buffer",
"normalized",
"offset",
"stride"
];
function emitBuffer() {
scope("if(!", BINDING, ".buffer){", GL, ".enableVertexAttribArray(", LOCATION, ");}");
var TYPE = record.type;
var SIZE;
if (!record.size) {
SIZE = size2;
} else {
SIZE = scope.def(record.size, "||", size2);
}
scope("if(", BINDING, ".type!==", TYPE, "||", BINDING, ".size!==", SIZE, "||", COMMON_KEYS.map(function(key) {
return BINDING + "." + key + "!==" + record[key];
}).join("||"), "){", GL, ".bindBuffer(", GL_ARRAY_BUFFER$2, ",", BUFFER, ".buffer);", GL, ".vertexAttribPointer(", [
LOCATION,
SIZE,
TYPE,
record.normalized,
record.stride,
record.offset
], ");", BINDING, ".type=", TYPE, ";", BINDING, ".size=", SIZE, ";", COMMON_KEYS.map(function(key) {
return BINDING + "." + key + "=" + record[key] + ";";
}).join(""), "}");
if (extInstancing) {
var DIVISOR = record.divisor;
scope("if(", BINDING, ".divisor!==", DIVISOR, "){", env.instancing, ".vertexAttribDivisorANGLE(", [LOCATION, DIVISOR], ");", BINDING, ".divisor=", DIVISOR, ";}");
}
}
function emitConstant() {
scope("if(", BINDING, ".buffer){", GL, ".disableVertexAttribArray(", LOCATION, ");", BINDING, ".buffer=null;", "}if(", CUTE_COMPONENTS.map(function(c5, i4) {
return BINDING + "." + c5 + "!==" + CONST_COMPONENTS[i4];
}).join("||"), "){", GL, ".vertexAttrib4f(", LOCATION, ",", CONST_COMPONENTS, ");", CUTE_COMPONENTS.map(function(c5, i4) {
return BINDING + "." + c5 + "=" + CONST_COMPONENTS[i4] + ";";
}).join(""), "}");
}
if (STATE === ATTRIB_STATE_POINTER) {
emitBuffer();
} else if (STATE === ATTRIB_STATE_CONSTANT) {
emitConstant();
} else {
scope("if(", STATE, "===", ATTRIB_STATE_POINTER, "){");
emitBuffer();
scope("}else{");
emitConstant();
scope("}");
}
}
attributes.forEach(function(attribute) {
var name = attribute.name;
var arg = args.attributes[name];
var record;
if (arg) {
if (!filter2(arg)) {
return;
}
record = arg.append(env, scope);
} else {
if (!filter2(SCOPE_DECL)) {
return;
}
var scopeAttrib = env.scopeAttrib(name);
check$1.optional(function() {
env.assert(scope, scopeAttrib + ".state", "missing attribute " + name);
});
record = {};
Object.keys(new AttributeRecord2()).forEach(function(key) {
record[key] = scope.def(scopeAttrib, ".", key);
});
}
emitBindAttribute(env.link(attribute), typeLength(attribute.info.type), record);
});
}
function emitUniforms(env, scope, args, uniforms, filter2) {
var shared = env.shared;
var GL = shared.gl;
var infix;
for (var i4 = 0; i4 < uniforms.length; ++i4) {
var uniform = uniforms[i4];
var name = uniform.name;
var type2 = uniform.info.type;
var arg = args.uniforms[name];
var UNIFORM = env.link(uniform);
var LOCATION = UNIFORM + ".location";
var VALUE;
if (arg) {
if (!filter2(arg)) {
continue;
}
if (isStatic(arg)) {
var value2 = arg.value;
check$1.command(value2 !== null && typeof value2 !== "undefined", 'missing uniform "' + name + '"', env.commandStr);
if (type2 === GL_SAMPLER_2D || type2 === GL_SAMPLER_CUBE) {
check$1.command(typeof value2 === "function" && (type2 === GL_SAMPLER_2D && (value2._reglType === "texture2d" || value2._reglType === "framebuffer") || type2 === GL_SAMPLER_CUBE && (value2._reglType === "textureCube" || value2._reglType === "framebufferCube")), "invalid texture for uniform " + name, env.commandStr);
var TEX_VALUE = env.link(value2._texture || value2.color[0]._texture);
scope(GL, ".uniform1i(", LOCATION, ",", TEX_VALUE + ".bind());");
scope.exit(TEX_VALUE, ".unbind();");
} else if (type2 === GL_FLOAT_MAT2 || type2 === GL_FLOAT_MAT3 || type2 === GL_FLOAT_MAT4) {
check$1.optional(function() {
check$1.command(isArrayLike2(value2), "invalid matrix for uniform " + name, env.commandStr);
check$1.command(type2 === GL_FLOAT_MAT2 && value2.length === 4 || type2 === GL_FLOAT_MAT3 && value2.length === 9 || type2 === GL_FLOAT_MAT4 && value2.length === 16, "invalid length for matrix uniform " + name, env.commandStr);
});
var MAT_VALUE = env.global.def("new Float32Array([" + Array.prototype.slice.call(value2) + "])");
var dim = 2;
if (type2 === GL_FLOAT_MAT3) {
dim = 3;
} else if (type2 === GL_FLOAT_MAT4) {
dim = 4;
}
scope(GL, ".uniformMatrix", dim, "fv(", LOCATION, ",false,", MAT_VALUE, ");");
} else {
switch (type2) {
case GL_FLOAT$8:
check$1.commandType(value2, "number", "uniform " + name, env.commandStr);
infix = "1f";
break;
case GL_FLOAT_VEC2:
check$1.command(isArrayLike2(value2) && value2.length === 2, "uniform " + name, env.commandStr);
infix = "2f";
break;
case GL_FLOAT_VEC3:
check$1.command(isArrayLike2(value2) && value2.length === 3, "uniform " + name, env.commandStr);
infix = "3f";
break;
case GL_FLOAT_VEC4:
check$1.command(isArrayLike2(value2) && value2.length === 4, "uniform " + name, env.commandStr);
infix = "4f";
break;
case GL_BOOL:
check$1.commandType(value2, "boolean", "uniform " + name, env.commandStr);
infix = "1i";
break;
case GL_INT$3:
check$1.commandType(value2, "number", "uniform " + name, env.commandStr);
infix = "1i";
break;
case GL_BOOL_VEC2:
check$1.command(isArrayLike2(value2) && value2.length === 2, "uniform " + name, env.commandStr);
infix = "2i";
break;
case GL_INT_VEC2:
check$1.command(isArrayLike2(value2) && value2.length === 2, "uniform " + name, env.commandStr);
infix = "2i";
break;
case GL_BOOL_VEC3:
check$1.command(isArrayLike2(value2) && value2.length === 3, "uniform " + name, env.commandStr);
infix = "3i";
break;
case GL_INT_VEC3:
check$1.command(isArrayLike2(value2) && value2.length === 3, "uniform " + name, env.commandStr);
infix = "3i";
break;
case GL_BOOL_VEC4:
check$1.command(isArrayLike2(value2) && value2.length === 4, "uniform " + name, env.commandStr);
infix = "4i";
break;
case GL_INT_VEC4:
check$1.command(isArrayLike2(value2) && value2.length === 4, "uniform " + name, env.commandStr);
infix = "4i";
break;
}
scope(GL, ".uniform", infix, "(", LOCATION, ",", isArrayLike2(value2) ? Array.prototype.slice.call(value2) : value2, ");");
}
continue;
} else {
VALUE = arg.append(env, scope);
}
} else {
if (!filter2(SCOPE_DECL)) {
continue;
}
VALUE = scope.def(shared.uniforms, "[", stringStore.id(name), "]");
}
if (type2 === GL_SAMPLER_2D) {
check$1(!Array.isArray(VALUE), "must specify a scalar prop for textures");
scope("if(", VALUE, "&&", VALUE, '._reglType==="framebuffer"){', VALUE, "=", VALUE, ".color[0];", "}");
} else if (type2 === GL_SAMPLER_CUBE) {
check$1(!Array.isArray(VALUE), "must specify a scalar prop for cube maps");
scope("if(", VALUE, "&&", VALUE, '._reglType==="framebufferCube"){', VALUE, "=", VALUE, ".color[0];", "}");
}
check$1.optional(function() {
function emitCheck(pred, message) {
env.assert(scope, pred, 'bad data or missing for uniform "' + name + '". ' + message);
}
function checkType(type3) {
check$1(!Array.isArray(VALUE), "must not specify an array type for uniform");
emitCheck("typeof " + VALUE + '==="' + type3 + '"', "invalid type, expected " + type3);
}
function checkVector(n3, type3) {
if (Array.isArray(VALUE)) {
check$1(VALUE.length === n3, "must have length " + n3);
} else {
emitCheck(shared.isArrayLike + "(" + VALUE + ")&&" + VALUE + ".length===" + n3, "invalid vector, should have length " + n3, env.commandStr);
}
}
function checkTexture(target) {
check$1(!Array.isArray(VALUE), "must not specify a value type");
emitCheck("typeof " + VALUE + '==="function"&&' + VALUE + '._reglType==="texture' + (target === GL_TEXTURE_2D$3 ? "2d" : "Cube") + '"', "invalid texture type", env.commandStr);
}
switch (type2) {
case GL_INT$3:
checkType("number");
break;
case GL_INT_VEC2:
checkVector(2, "number");
break;
case GL_INT_VEC3:
checkVector(3, "number");
break;
case GL_INT_VEC4:
checkVector(4, "number");
break;
case GL_FLOAT$8:
checkType("number");
break;
case GL_FLOAT_VEC2:
checkVector(2, "number");
break;
case GL_FLOAT_VEC3:
checkVector(3, "number");
break;
case GL_FLOAT_VEC4:
checkVector(4, "number");
break;
case GL_BOOL:
checkType("boolean");
break;
case GL_BOOL_VEC2:
checkVector(2, "boolean");
break;
case GL_BOOL_VEC3:
checkVector(3, "boolean");
break;
case GL_BOOL_VEC4:
checkVector(4, "boolean");
break;
case GL_FLOAT_MAT2:
checkVector(4, "number");
break;
case GL_FLOAT_MAT3:
checkVector(9, "number");
break;
case GL_FLOAT_MAT4:
checkVector(16, "number");
break;
case GL_SAMPLER_2D:
checkTexture(GL_TEXTURE_2D$3);
break;
case GL_SAMPLER_CUBE:
checkTexture(GL_TEXTURE_CUBE_MAP$2);
break;
}
});
var unroll = 1;
switch (type2) {
case GL_SAMPLER_2D:
case GL_SAMPLER_CUBE:
var TEX = scope.def(VALUE, "._texture");
scope(GL, ".uniform1i(", LOCATION, ",", TEX, ".bind());");
scope.exit(TEX, ".unbind();");
continue;
case GL_INT$3:
case GL_BOOL:
infix = "1i";
break;
case GL_INT_VEC2:
case GL_BOOL_VEC2:
infix = "2i";
unroll = 2;
break;
case GL_INT_VEC3:
case GL_BOOL_VEC3:
infix = "3i";
unroll = 3;
break;
case GL_INT_VEC4:
case GL_BOOL_VEC4:
infix = "4i";
unroll = 4;
break;
case GL_FLOAT$8:
infix = "1f";
break;
case GL_FLOAT_VEC2:
infix = "2f";
unroll = 2;
break;
case GL_FLOAT_VEC3:
infix = "3f";
unroll = 3;
break;
case GL_FLOAT_VEC4:
infix = "4f";
unroll = 4;
break;
case GL_FLOAT_MAT2:
infix = "Matrix2fv";
break;
case GL_FLOAT_MAT3:
infix = "Matrix3fv";
break;
case GL_FLOAT_MAT4:
infix = "Matrix4fv";
break;
}
scope(GL, ".uniform", infix, "(", LOCATION, ",");
if (infix.charAt(0) === "M") {
var matSize = Math.pow(type2 - GL_FLOAT_MAT2 + 2, 2);
var STORAGE = env.global.def("new Float32Array(", matSize, ")");
if (Array.isArray(VALUE)) {
scope("false,(", loop(matSize, function(i5) {
return STORAGE + "[" + i5 + "]=" + VALUE[i5];
}), ",", STORAGE, ")");
} else {
scope("false,(Array.isArray(", VALUE, ")||", VALUE, " instanceof Float32Array)?", VALUE, ":(", loop(matSize, function(i5) {
return STORAGE + "[" + i5 + "]=" + VALUE + "[" + i5 + "]";
}), ",", STORAGE, ")");
}
} else if (unroll > 1) {
scope(loop(unroll, function(i5) {
return Array.isArray(VALUE) ? VALUE[i5] : VALUE + "[" + i5 + "]";
}));
} else {
check$1(!Array.isArray(VALUE), "uniform value must not be an array");
scope(VALUE);
}
scope(");");
}
}
function emitDraw(env, outer, inner, args) {
var shared = env.shared;
var GL = shared.gl;
var DRAW_STATE = shared.draw;
var drawOptions = args.draw;
function emitElements() {
var defn = drawOptions.elements;
var ELEMENTS2;
var scope = outer;
if (defn) {
if (defn.contextDep && args.contextDynamic || defn.propDep) {
scope = inner;
}
ELEMENTS2 = defn.append(env, scope);
} else {
ELEMENTS2 = scope.def(DRAW_STATE, ".", S_ELEMENTS);
}
if (ELEMENTS2) {
scope("if(" + ELEMENTS2 + ")" + GL + ".bindBuffer(" + GL_ELEMENT_ARRAY_BUFFER$1 + "," + ELEMENTS2 + ".buffer.buffer);");
}
return ELEMENTS2;
}
function emitCount() {
var defn = drawOptions.count;
var COUNT2;
var scope = outer;
if (defn) {
if (defn.contextDep && args.contextDynamic || defn.propDep) {
scope = inner;
}
COUNT2 = defn.append(env, scope);
check$1.optional(function() {
if (defn.MISSING) {
env.assert(outer, "false", "missing vertex count");
}
if (defn.DYNAMIC) {
env.assert(scope, COUNT2 + ">=0", "missing vertex count");
}
});
} else {
COUNT2 = scope.def(DRAW_STATE, ".", S_COUNT);
check$1.optional(function() {
env.assert(scope, COUNT2 + ">=0", "missing vertex count");
});
}
return COUNT2;
}
var ELEMENTS = emitElements();
function emitValue(name) {
var defn = drawOptions[name];
if (defn) {
if (defn.contextDep && args.contextDynamic || defn.propDep) {
return defn.append(env, inner);
} else {
return defn.append(env, outer);
}
} else {
return outer.def(DRAW_STATE, ".", name);
}
}
var PRIMITIVE = emitValue(S_PRIMITIVE);
var OFFSET = emitValue(S_OFFSET);
var COUNT = emitCount();
if (typeof COUNT === "number") {
if (COUNT === 0) {
return;
}
} else {
inner("if(", COUNT, "){");
inner.exit("}");
}
var INSTANCES, EXT_INSTANCING;
if (extInstancing) {
INSTANCES = emitValue(S_INSTANCES);
EXT_INSTANCING = env.instancing;
}
var ELEMENT_TYPE = ELEMENTS + ".type";
var elementsStatic = drawOptions.elements && isStatic(drawOptions.elements);
function emitInstancing() {
function drawElements() {
inner(EXT_INSTANCING, ".drawElementsInstancedANGLE(", [
PRIMITIVE,
COUNT,
ELEMENT_TYPE,
OFFSET + "<<((" + ELEMENT_TYPE + "-" + GL_UNSIGNED_BYTE$8 + ")>>1)",
INSTANCES
], ");");
}
function drawArrays() {
inner(EXT_INSTANCING, ".drawArraysInstancedANGLE(", [PRIMITIVE, OFFSET, COUNT, INSTANCES], ");");
}
if (ELEMENTS) {
if (!elementsStatic) {
inner("if(", ELEMENTS, "){");
drawElements();
inner("}else{");
drawArrays();
inner("}");
} else {
drawElements();
}
} else {
drawArrays();
}
}
function emitRegular() {
function drawElements() {
inner(GL + ".drawElements(" + [
PRIMITIVE,
COUNT,
ELEMENT_TYPE,
OFFSET + "<<((" + ELEMENT_TYPE + "-" + GL_UNSIGNED_BYTE$8 + ")>>1)"
] + ");");
}
function drawArrays() {
inner(GL + ".drawArrays(" + [PRIMITIVE, OFFSET, COUNT] + ");");
}
if (ELEMENTS) {
if (!elementsStatic) {
inner("if(", ELEMENTS, "){");
drawElements();
inner("}else{");
drawArrays();
inner("}");
} else {
drawElements();
}
} else {
drawArrays();
}
}
if (extInstancing && (typeof INSTANCES !== "number" || INSTANCES >= 0)) {
if (typeof INSTANCES === "string") {
inner("if(", INSTANCES, ">0){");
emitInstancing();
inner("}else if(", INSTANCES, "<0){");
emitRegular();
inner("}");
} else {
emitInstancing();
}
} else {
emitRegular();
}
}
function createBody(emitBody, parentEnv, args, program, count2) {
var env = createREGLEnvironment();
var scope = env.proc("body", count2);
check$1.optional(function() {
env.commandStr = parentEnv.commandStr;
env.command = env.link(parentEnv.commandStr);
});
if (extInstancing) {
env.instancing = scope.def(env.shared.extensions, ".angle_instanced_arrays");
}
emitBody(env, scope, args, program);
return env.compile().body;
}
function emitDrawBody(env, draw4, args, program) {
injectExtensions(env, draw4);
if (args.useVAO) {
if (args.drawVAO) {
draw4(env.shared.vao, ".setVAO(", args.drawVAO.append(env, draw4), ");");
} else {
draw4(env.shared.vao, ".setVAO(", env.shared.vao, ".targetVAO);");
}
} else {
draw4(env.shared.vao, ".setVAO(null);");
emitAttributes(env, draw4, args, program.attributes, function() {
return true;
});
}
emitUniforms(env, draw4, args, program.uniforms, function() {
return true;
});
emitDraw(env, draw4, draw4, args);
}
function emitDrawProc(env, args) {
var draw4 = env.proc("draw", 1);
injectExtensions(env, draw4);
emitContext(env, draw4, args.context);
emitPollFramebuffer(env, draw4, args.framebuffer);
emitPollState(env, draw4, args);
emitSetOptions(env, draw4, args.state);
emitProfile(env, draw4, args, false, true);
var program = args.shader.progVar.append(env, draw4);
draw4(env.shared.gl, ".useProgram(", program, ".program);");
if (args.shader.program) {
emitDrawBody(env, draw4, args, args.shader.program);
} else {
draw4(env.shared.vao, ".setVAO(null);");
var drawCache = env.global.def("{}");
var PROG_ID = draw4.def(program, ".id");
var CACHED_PROC = draw4.def(drawCache, "[", PROG_ID, "]");
draw4(env.cond(CACHED_PROC).then(CACHED_PROC, ".call(this,a0);").else(CACHED_PROC, "=", drawCache, "[", PROG_ID, "]=", env.link(function(program2) {
return createBody(emitDrawBody, env, args, program2, 1);
}), "(", program, ");", CACHED_PROC, ".call(this,a0);"));
}
if (Object.keys(args.state).length > 0) {
draw4(env.shared.current, ".dirty=true;");
}
}
function emitBatchDynamicShaderBody(env, scope, args, program) {
env.batchId = "a1";
injectExtensions(env, scope);
function all() {
return true;
}
emitAttributes(env, scope, args, program.attributes, all);
emitUniforms(env, scope, args, program.uniforms, all);
emitDraw(env, scope, scope, args);
}
function emitBatchBody(env, scope, args, program) {
injectExtensions(env, scope);
var contextDynamic = args.contextDep;
var BATCH_ID = scope.def();
var PROP_LIST = "a0";
var NUM_PROPS = "a1";
var PROPS = scope.def();
env.shared.props = PROPS;
env.batchId = BATCH_ID;
var outer = env.scope();
var inner = env.scope();
scope(outer.entry, "for(", BATCH_ID, "=0;", BATCH_ID, "<", NUM_PROPS, ";++", BATCH_ID, "){", PROPS, "=", PROP_LIST, "[", BATCH_ID, "];", inner, "}", outer.exit);
function isInnerDefn(defn) {
return defn.contextDep && contextDynamic || defn.propDep;
}
function isOuterDefn(defn) {
return !isInnerDefn(defn);
}
if (args.needsContext) {
emitContext(env, inner, args.context);
}
if (args.needsFramebuffer) {
emitPollFramebuffer(env, inner, args.framebuffer);
}
emitSetOptions(env, inner, args.state, isInnerDefn);
if (args.profile && isInnerDefn(args.profile)) {
emitProfile(env, inner, args, false, true);
}
if (!program) {
var progCache = env.global.def("{}");
var PROGRAM = args.shader.progVar.append(env, inner);
var PROG_ID = inner.def(PROGRAM, ".id");
var CACHED_PROC = inner.def(progCache, "[", PROG_ID, "]");
inner(env.shared.gl, ".useProgram(", PROGRAM, ".program);", "if(!", CACHED_PROC, "){", CACHED_PROC, "=", progCache, "[", PROG_ID, "]=", env.link(function(program2) {
return createBody(emitBatchDynamicShaderBody, env, args, program2, 2);
}), "(", PROGRAM, ");}", CACHED_PROC, ".call(this,a0[", BATCH_ID, "],", BATCH_ID, ");");
} else {
if (args.useVAO) {
if (args.drawVAO) {
if (isInnerDefn(args.drawVAO)) {
inner(env.shared.vao, ".setVAO(", args.drawVAO.append(env, inner), ");");
} else {
outer(env.shared.vao, ".setVAO(", args.drawVAO.append(env, outer), ");");
}
} else {
outer(env.shared.vao, ".setVAO(", env.shared.vao, ".targetVAO);");
}
} else {
outer(env.shared.vao, ".setVAO(null);");
emitAttributes(env, outer, args, program.attributes, isOuterDefn);
emitAttributes(env, inner, args, program.attributes, isInnerDefn);
}
emitUniforms(env, outer, args, program.uniforms, isOuterDefn);
emitUniforms(env, inner, args, program.uniforms, isInnerDefn);
emitDraw(env, outer, inner, args);
}
}
function emitBatchProc(env, args) {
var batch = env.proc("batch", 2);
env.batchId = "0";
injectExtensions(env, batch);
var contextDynamic = false;
var needsContext = true;
Object.keys(args.context).forEach(function(name) {
contextDynamic = contextDynamic || args.context[name].propDep;
});
if (!contextDynamic) {
emitContext(env, batch, args.context);
needsContext = false;
}
var framebuffer = args.framebuffer;
var needsFramebuffer = false;
if (framebuffer) {
if (framebuffer.propDep) {
contextDynamic = needsFramebuffer = true;
} else if (framebuffer.contextDep && contextDynamic) {
needsFramebuffer = true;
}
if (!needsFramebuffer) {
emitPollFramebuffer(env, batch, framebuffer);
}
} else {
emitPollFramebuffer(env, batch, null);
}
if (args.state.viewport && args.state.viewport.propDep) {
contextDynamic = true;
}
function isInnerDefn(defn) {
return defn.contextDep && contextDynamic || defn.propDep;
}
emitPollState(env, batch, args);
emitSetOptions(env, batch, args.state, function(defn) {
return !isInnerDefn(defn);
});
if (!args.profile || !isInnerDefn(args.profile)) {
emitProfile(env, batch, args, false, "a1");
}
args.contextDep = contextDynamic;
args.needsContext = needsContext;
args.needsFramebuffer = needsFramebuffer;
var progDefn = args.shader.progVar;
if (progDefn.contextDep && contextDynamic || progDefn.propDep) {
emitBatchBody(env, batch, args, null);
} else {
var PROGRAM = progDefn.append(env, batch);
batch(env.shared.gl, ".useProgram(", PROGRAM, ".program);");
if (args.shader.program) {
emitBatchBody(env, batch, args, args.shader.program);
} else {
batch(env.shared.vao, ".setVAO(null);");
var batchCache = env.global.def("{}");
var PROG_ID = batch.def(PROGRAM, ".id");
var CACHED_PROC = batch.def(batchCache, "[", PROG_ID, "]");
batch(env.cond(CACHED_PROC).then(CACHED_PROC, ".call(this,a0,a1);").else(CACHED_PROC, "=", batchCache, "[", PROG_ID, "]=", env.link(function(program) {
return createBody(emitBatchBody, env, args, program, 2);
}), "(", PROGRAM, ");", CACHED_PROC, ".call(this,a0,a1);"));
}
}
if (Object.keys(args.state).length > 0) {
batch(env.shared.current, ".dirty=true;");
}
}
function emitScopeProc(env, args) {
var scope = env.proc("scope", 3);
env.batchId = "a2";
var shared = env.shared;
var CURRENT_STATE = shared.current;
emitContext(env, scope, args.context);
if (args.framebuffer) {
args.framebuffer.append(env, scope);
}
sortState(Object.keys(args.state)).forEach(function(name) {
var defn = args.state[name];
var value2 = defn.append(env, scope);
if (isArrayLike2(value2)) {
value2.forEach(function(v3, i4) {
scope.set(env.next[name], "[" + i4 + "]", v3);
});
} else {
scope.set(shared.next, "." + name, value2);
}
});
emitProfile(env, scope, args, true, true);
[S_ELEMENTS, S_OFFSET, S_COUNT, S_INSTANCES, S_PRIMITIVE].forEach(function(opt) {
var variable = args.draw[opt];
if (!variable) {
return;
}
scope.set(shared.draw, "." + opt, "" + variable.append(env, scope));
});
Object.keys(args.uniforms).forEach(function(opt) {
var value2 = args.uniforms[opt].append(env, scope);
if (Array.isArray(value2)) {
value2 = "[" + value2.join() + "]";
}
scope.set(shared.uniforms, "[" + stringStore.id(opt) + "]", value2);
});
Object.keys(args.attributes).forEach(function(name) {
var record = args.attributes[name].append(env, scope);
var scopeAttrib = env.scopeAttrib(name);
Object.keys(new AttributeRecord2()).forEach(function(prop) {
scope.set(scopeAttrib, "." + prop, record[prop]);
});
});
if (args.scopeVAO) {
scope.set(shared.vao, ".targetVAO", args.scopeVAO.append(env, scope));
}
function saveShader(name) {
var shader = args.shader[name];
if (shader) {
scope.set(shared.shader, "." + name, shader.append(env, scope));
}
}
saveShader(S_VERT);
saveShader(S_FRAG);
if (Object.keys(args.state).length > 0) {
scope(CURRENT_STATE, ".dirty=true;");
scope.exit(CURRENT_STATE, ".dirty=true;");
}
scope("a1(", env.shared.context, ",a0,", env.batchId, ");");
}
function isDynamicObject(object) {
if (typeof object !== "object" || isArrayLike2(object)) {
return;
}
var props = Object.keys(object);
for (var i4 = 0; i4 < props.length; ++i4) {
if (dynamic.isDynamic(object[props[i4]])) {
return true;
}
}
return false;
}
function splatObject(env, options, name) {
var object = options.static[name];
if (!object || !isDynamicObject(object)) {
return;
}
var globals = env.global;
var keys2 = Object.keys(object);
var thisDep = false;
var contextDep = false;
var propDep = false;
var objectRef = env.global.def("{}");
keys2.forEach(function(key) {
var value2 = object[key];
if (dynamic.isDynamic(value2)) {
if (typeof value2 === "function") {
value2 = object[key] = dynamic.unbox(value2);
}
var deps = createDynamicDecl(value2, null);
thisDep = thisDep || deps.thisDep;
propDep = propDep || deps.propDep;
contextDep = contextDep || deps.contextDep;
} else {
globals(objectRef, ".", key, "=");
switch (typeof value2) {
case "number":
globals(value2);
break;
case "string":
globals('"', value2, '"');
break;
case "object":
if (Array.isArray(value2)) {
globals("[", value2.join(), "]");
}
break;
default:
globals(env.link(value2));
break;
}
globals(";");
}
});
function appendBlock(env2, block) {
keys2.forEach(function(key) {
var value2 = object[key];
if (!dynamic.isDynamic(value2)) {
return;
}
var ref = env2.invoke(block, value2);
block(objectRef, ".", key, "=", ref, ";");
});
}
options.dynamic[name] = new dynamic.DynamicVariable(DYN_THUNK, {
thisDep,
contextDep,
propDep,
ref: objectRef,
append: appendBlock
});
delete options.static[name];
}
function compileCommand(options, attributes, uniforms, context, stats2) {
var env = createREGLEnvironment();
env.stats = env.link(stats2);
Object.keys(attributes.static).forEach(function(key) {
splatObject(env, attributes, key);
});
NESTED_OPTIONS.forEach(function(name) {
splatObject(env, options, name);
});
var args = parseArguments(options, attributes, uniforms, context, env);
emitDrawProc(env, args);
emitScopeProc(env, args);
emitBatchProc(env, args);
return extend4(env.compile(), {
destroy: function() {
args.shader.program.destroy();
}
});
}
return {
next: nextState,
current: currentState,
procs: function() {
var env = createREGLEnvironment();
var poll = env.proc("poll");
var refresh = env.proc("refresh");
var common2 = env.block();
poll(common2);
refresh(common2);
var shared = env.shared;
var GL = shared.gl;
var NEXT_STATE = shared.next;
var CURRENT_STATE = shared.current;
common2(CURRENT_STATE, ".dirty=false;");
emitPollFramebuffer(env, poll);
emitPollFramebuffer(env, refresh, null, true);
var INSTANCING;
if (extInstancing) {
INSTANCING = env.link(extInstancing);
}
if (extensions.oes_vertex_array_object) {
refresh(env.link(extensions.oes_vertex_array_object), ".bindVertexArrayOES(null);");
}
for (var i4 = 0; i4 < limits.maxAttributes; ++i4) {
var BINDING = refresh.def(shared.attributes, "[", i4, "]");
var ifte = env.cond(BINDING, ".buffer");
ifte.then(GL, ".enableVertexAttribArray(", i4, ");", GL, ".bindBuffer(", GL_ARRAY_BUFFER$2, ",", BINDING, ".buffer.buffer);", GL, ".vertexAttribPointer(", i4, ",", BINDING, ".size,", BINDING, ".type,", BINDING, ".normalized,", BINDING, ".stride,", BINDING, ".offset);").else(GL, ".disableVertexAttribArray(", i4, ");", GL, ".vertexAttrib4f(", i4, ",", BINDING, ".x,", BINDING, ".y,", BINDING, ".z,", BINDING, ".w);", BINDING, ".buffer=null;");
refresh(ifte);
if (extInstancing) {
refresh(INSTANCING, ".vertexAttribDivisorANGLE(", i4, ",", BINDING, ".divisor);");
}
}
refresh(env.shared.vao, ".currentVAO=null;", env.shared.vao, ".setVAO(", env.shared.vao, ".targetVAO);");
Object.keys(GL_FLAGS).forEach(function(flag) {
var cap = GL_FLAGS[flag];
var NEXT = common2.def(NEXT_STATE, ".", flag);
var block = env.block();
block("if(", NEXT, "){", GL, ".enable(", cap, ")}else{", GL, ".disable(", cap, ")}", CURRENT_STATE, ".", flag, "=", NEXT, ";");
refresh(block);
poll("if(", NEXT, "!==", CURRENT_STATE, ".", flag, "){", block, "}");
});
Object.keys(GL_VARIABLES).forEach(function(name) {
var func = GL_VARIABLES[name];
var init = currentState[name];
var NEXT, CURRENT;
var block = env.block();
block(GL, ".", func, "(");
if (isArrayLike2(init)) {
var n3 = init.length;
NEXT = env.global.def(NEXT_STATE, ".", name);
CURRENT = env.global.def(CURRENT_STATE, ".", name);
block(loop(n3, function(i5) {
return NEXT + "[" + i5 + "]";
}), ");", loop(n3, function(i5) {
return CURRENT + "[" + i5 + "]=" + NEXT + "[" + i5 + "];";
}).join(""));
poll("if(", loop(n3, function(i5) {
return NEXT + "[" + i5 + "]!==" + CURRENT + "[" + i5 + "]";
}).join("||"), "){", block, "}");
} else {
NEXT = common2.def(NEXT_STATE, ".", name);
CURRENT = common2.def(CURRENT_STATE, ".", name);
block(NEXT, ");", CURRENT_STATE, ".", name, "=", NEXT, ";");
poll("if(", NEXT, "!==", CURRENT, "){", block, "}");
}
refresh(block);
});
return env.compile();
}(),
compile: compileCommand
};
}
function stats() {
return {
vaoCount: 0,
bufferCount: 0,
elementsCount: 0,
framebufferCount: 0,
shaderCount: 0,
textureCount: 0,
cubeCount: 0,
renderbufferCount: 0,
maxTextureUnits: 0
};
}
var GL_QUERY_RESULT_EXT = 34918;
var GL_QUERY_RESULT_AVAILABLE_EXT = 34919;
var GL_TIME_ELAPSED_EXT = 35007;
var createTimer = function(gl2, extensions) {
if (!extensions.ext_disjoint_timer_query) {
return null;
}
var queryPool = [];
function allocQuery() {
return queryPool.pop() || extensions.ext_disjoint_timer_query.createQueryEXT();
}
function freeQuery(query) {
queryPool.push(query);
}
var pendingQueries = [];
function beginQuery(stats2) {
var query = allocQuery();
extensions.ext_disjoint_timer_query.beginQueryEXT(GL_TIME_ELAPSED_EXT, query);
pendingQueries.push(query);
pushScopeStats(pendingQueries.length - 1, pendingQueries.length, stats2);
}
function endQuery() {
extensions.ext_disjoint_timer_query.endQueryEXT(GL_TIME_ELAPSED_EXT);
}
function PendingStats() {
this.startQueryIndex = -1;
this.endQueryIndex = -1;
this.sum = 0;
this.stats = null;
}
var pendingStatsPool = [];
function allocPendingStats() {
return pendingStatsPool.pop() || new PendingStats();
}
function freePendingStats(pendingStats2) {
pendingStatsPool.push(pendingStats2);
}
var pendingStats = [];
function pushScopeStats(start, end2, stats2) {
var ps = allocPendingStats();
ps.startQueryIndex = start;
ps.endQueryIndex = end2;
ps.sum = 0;
ps.stats = stats2;
pendingStats.push(ps);
}
var timeSum = [];
var queryPtr = [];
function update15() {
var ptr, i4;
var n3 = pendingQueries.length;
if (n3 === 0) {
return;
}
queryPtr.length = Math.max(queryPtr.length, n3 + 1);
timeSum.length = Math.max(timeSum.length, n3 + 1);
timeSum[0] = 0;
queryPtr[0] = 0;
var queryTime = 0;
ptr = 0;
for (i4 = 0; i4 < pendingQueries.length; ++i4) {
var query = pendingQueries[i4];
if (extensions.ext_disjoint_timer_query.getQueryObjectEXT(query, GL_QUERY_RESULT_AVAILABLE_EXT)) {
queryTime += extensions.ext_disjoint_timer_query.getQueryObjectEXT(query, GL_QUERY_RESULT_EXT);
freeQuery(query);
} else {
pendingQueries[ptr++] = query;
}
timeSum[i4 + 1] = queryTime;
queryPtr[i4 + 1] = ptr;
}
pendingQueries.length = ptr;
ptr = 0;
for (i4 = 0; i4 < pendingStats.length; ++i4) {
var stats2 = pendingStats[i4];
var start = stats2.startQueryIndex;
var end2 = stats2.endQueryIndex;
stats2.sum += timeSum[end2] - timeSum[start];
var startPtr = queryPtr[start];
var endPtr = queryPtr[end2];
if (endPtr === startPtr) {
stats2.stats.gpuTime += stats2.sum / 1e6;
freePendingStats(stats2);
} else {
stats2.startQueryIndex = startPtr;
stats2.endQueryIndex = endPtr;
pendingStats[ptr++] = stats2;
}
}
pendingStats.length = ptr;
}
return {
beginQuery,
endQuery,
pushScopeStats,
update: update15,
getNumPendingQueries: function() {
return pendingQueries.length;
},
clear: function() {
queryPool.push.apply(queryPool, pendingQueries);
for (var i4 = 0; i4 < queryPool.length; i4++) {
extensions.ext_disjoint_timer_query.deleteQueryEXT(queryPool[i4]);
}
pendingQueries.length = 0;
queryPool.length = 0;
},
restore: function() {
pendingQueries.length = 0;
queryPool.length = 0;
}
};
};
var GL_COLOR_BUFFER_BIT = 16384;
var GL_DEPTH_BUFFER_BIT = 256;
var GL_STENCIL_BUFFER_BIT = 1024;
var GL_ARRAY_BUFFER = 34962;
var CONTEXT_LOST_EVENT = "webglcontextlost";
var CONTEXT_RESTORED_EVENT = "webglcontextrestored";
var DYN_PROP = 1;
var DYN_CONTEXT = 2;
var DYN_STATE = 3;
function find4(haystack, needle) {
for (var i4 = 0; i4 < haystack.length; ++i4) {
if (haystack[i4] === needle) {
return i4;
}
}
return -1;
}
function wrapREGL(args) {
var config = parseArgs(args);
if (!config) {
return null;
}
var gl2 = config.gl;
var glAttributes = gl2.getContextAttributes();
var contextLost = gl2.isContextLost();
var extensionState = createExtensionCache(gl2, config);
if (!extensionState) {
return null;
}
var stringStore = createStringStore();
var stats$$1 = stats();
var extensions = extensionState.extensions;
var timer3 = createTimer(gl2, extensions);
var START_TIME = clock2();
var WIDTH = gl2.drawingBufferWidth;
var HEIGHT = gl2.drawingBufferHeight;
var contextState = {
tick: 0,
time: 0,
viewportWidth: WIDTH,
viewportHeight: HEIGHT,
framebufferWidth: WIDTH,
framebufferHeight: HEIGHT,
drawingBufferWidth: WIDTH,
drawingBufferHeight: HEIGHT,
pixelRatio: config.pixelRatio
};
var uniformState = {};
var drawState = {
elements: null,
primitive: 4,
count: -1,
offset: 0,
instances: -1
};
var limits = wrapLimits(gl2, extensions);
var bufferState = wrapBufferState(gl2, stats$$1, config, destroyBuffer);
var attributeState = wrapAttributeState(gl2, extensions, limits, stats$$1, bufferState);
function destroyBuffer(buffer) {
return attributeState.destroyBuffer(buffer);
}
var elementState = wrapElementsState(gl2, extensions, bufferState, stats$$1);
var shaderState = wrapShaderState(gl2, stringStore, stats$$1, config);
var textureState = createTextureSet(gl2, extensions, limits, function() {
core2.procs.poll();
}, contextState, stats$$1, config);
var renderbufferState = wrapRenderbuffers(gl2, extensions, limits, stats$$1, config);
var framebufferState = wrapFBOState(gl2, extensions, limits, textureState, renderbufferState, stats$$1);
var core2 = reglCore(gl2, stringStore, extensions, limits, bufferState, elementState, textureState, framebufferState, uniformState, attributeState, shaderState, drawState, contextState, timer3, config);
var readPixels = wrapReadPixels(gl2, framebufferState, core2.procs.poll, contextState, glAttributes, extensions, limits);
var nextState = core2.next;
var canvas = gl2.canvas;
var rafCallbacks = [];
var lossCallbacks = [];
var restoreCallbacks = [];
var destroyCallbacks = [config.onDestroy];
var activeRAF = null;
function handleRAF() {
if (rafCallbacks.length === 0) {
if (timer3) {
timer3.update();
}
activeRAF = null;
return;
}
activeRAF = raf.next(handleRAF);
poll();
for (var i4 = rafCallbacks.length - 1; i4 >= 0; --i4) {
var cb = rafCallbacks[i4];
if (cb) {
cb(contextState, null, 0);
}
}
gl2.flush();
if (timer3) {
timer3.update();
}
}
function startRAF() {
if (!activeRAF && rafCallbacks.length > 0) {
activeRAF = raf.next(handleRAF);
}
}
function stopRAF() {
if (activeRAF) {
raf.cancel(handleRAF);
activeRAF = null;
}
}
function handleContextLoss(event) {
event.preventDefault();
contextLost = true;
stopRAF();
lossCallbacks.forEach(function(cb) {
cb();
});
}
function handleContextRestored(event) {
gl2.getError();
contextLost = false;
extensionState.restore();
shaderState.restore();
bufferState.restore();
textureState.restore();
renderbufferState.restore();
framebufferState.restore();
attributeState.restore();
if (timer3) {
timer3.restore();
}
core2.procs.refresh();
startRAF();
restoreCallbacks.forEach(function(cb) {
cb();
});
}
if (canvas) {
canvas.addEventListener(CONTEXT_LOST_EVENT, handleContextLoss, false);
canvas.addEventListener(CONTEXT_RESTORED_EVENT, handleContextRestored, false);
}
function destroy() {
rafCallbacks.length = 0;
stopRAF();
if (canvas) {
canvas.removeEventListener(CONTEXT_LOST_EVENT, handleContextLoss);
canvas.removeEventListener(CONTEXT_RESTORED_EVENT, handleContextRestored);
}
shaderState.clear();
framebufferState.clear();
renderbufferState.clear();
textureState.clear();
elementState.clear();
bufferState.clear();
attributeState.clear();
if (timer3) {
timer3.clear();
}
destroyCallbacks.forEach(function(cb) {
cb();
});
}
function compileProcedure(options) {
check$1(!!options, "invalid args to regl({...})");
check$1.type(options, "object", "invalid args to regl({...})");
function flattenNestedOptions(options2) {
var result = extend4({}, options2);
delete result.uniforms;
delete result.attributes;
delete result.context;
delete result.vao;
if ("stencil" in result && result.stencil.op) {
result.stencil.opBack = result.stencil.opFront = result.stencil.op;
delete result.stencil.op;
}
function merge3(name) {
if (name in result) {
var child = result[name];
delete result[name];
Object.keys(child).forEach(function(prop) {
result[name + "." + prop] = child[prop];
});
}
}
merge3("blend");
merge3("depth");
merge3("cull");
merge3("stencil");
merge3("polygonOffset");
merge3("scissor");
merge3("sample");
if ("vao" in options2) {
result.vao = options2.vao;
}
return result;
}
function separateDynamic(object, useArrays) {
var staticItems = {};
var dynamicItems = {};
Object.keys(object).forEach(function(option) {
var value2 = object[option];
if (dynamic.isDynamic(value2)) {
dynamicItems[option] = dynamic.unbox(value2, option);
return;
} else if (useArrays && Array.isArray(value2)) {
for (var i4 = 0; i4 < value2.length; ++i4) {
if (dynamic.isDynamic(value2[i4])) {
dynamicItems[option] = dynamic.unbox(value2, option);
return;
}
}
}
staticItems[option] = value2;
});
return {
dynamic: dynamicItems,
static: staticItems
};
}
var context = separateDynamic(options.context || {}, true);
var uniforms = separateDynamic(options.uniforms || {}, true);
var attributes = separateDynamic(options.attributes || {}, false);
var opts = separateDynamic(flattenNestedOptions(options), false);
var stats$$12 = {
gpuTime: 0,
cpuTime: 0,
count: 0
};
var compiled = core2.compile(opts, attributes, uniforms, context, stats$$12);
var draw4 = compiled.draw;
var batch = compiled.batch;
var scope = compiled.scope;
var EMPTY_ARRAY = [];
function reserve(count2) {
while (EMPTY_ARRAY.length < count2) {
EMPTY_ARRAY.push(null);
}
return EMPTY_ARRAY;
}
function REGLCommand(args2, body) {
var i4;
if (contextLost) {
check$1.raise("context lost");
}
if (typeof args2 === "function") {
return scope.call(this, null, args2, 0);
} else if (typeof body === "function") {
if (typeof args2 === "number") {
for (i4 = 0; i4 < args2; ++i4) {
scope.call(this, null, body, i4);
}
} else if (Array.isArray(args2)) {
for (i4 = 0; i4 < args2.length; ++i4) {
scope.call(this, args2[i4], body, i4);
}
} else {
return scope.call(this, args2, body, 0);
}
} else if (typeof args2 === "number") {
if (args2 > 0) {
return batch.call(this, reserve(args2 | 0), args2 | 0);
}
} else if (Array.isArray(args2)) {
if (args2.length) {
return batch.call(this, args2, args2.length);
}
} else {
return draw4.call(this, args2);
}
}
return extend4(REGLCommand, {
stats: stats$$12,
destroy: function() {
compiled.destroy();
}
});
}
var setFBO = framebufferState.setFBO = compileProcedure({
framebuffer: dynamic.define.call(null, DYN_PROP, "framebuffer")
});
function clearImpl(_8, options) {
var clearFlags = 0;
core2.procs.poll();
var c5 = options.color;
if (c5) {
gl2.clearColor(+c5[0] || 0, +c5[1] || 0, +c5[2] || 0, +c5[3] || 0);
clearFlags |= GL_COLOR_BUFFER_BIT;
}
if ("depth" in options) {
gl2.clearDepth(+options.depth);
clearFlags |= GL_DEPTH_BUFFER_BIT;
}
if ("stencil" in options) {
gl2.clearStencil(options.stencil | 0);
clearFlags |= GL_STENCIL_BUFFER_BIT;
}
check$1(!!clearFlags, "called regl.clear with no buffer specified");
gl2.clear(clearFlags);
}
function clear(options) {
check$1(typeof options === "object" && options, "regl.clear() takes an object as input");
if ("framebuffer" in options) {
if (options.framebuffer && options.framebuffer_reglType === "framebufferCube") {
for (var i4 = 0; i4 < 6; ++i4) {
setFBO(extend4({
framebuffer: options.framebuffer.faces[i4]
}, options), clearImpl);
}
} else {
setFBO(options, clearImpl);
}
} else {
clearImpl(null, options);
}
}
function frame2(cb) {
check$1.type(cb, "function", "regl.frame() callback must be a function");
rafCallbacks.push(cb);
function cancel() {
var i4 = find4(rafCallbacks, cb);
check$1(i4 >= 0, "cannot cancel a frame twice");
function pendingCancel() {
var index2 = find4(rafCallbacks, pendingCancel);
rafCallbacks[index2] = rafCallbacks[rafCallbacks.length - 1];
rafCallbacks.length -= 1;
if (rafCallbacks.length <= 0) {
stopRAF();
}
}
rafCallbacks[i4] = pendingCancel;
}
startRAF();
return {
cancel
};
}
function pollViewport() {
var viewport = nextState.viewport;
var scissorBox = nextState.scissor_box;
viewport[0] = viewport[1] = scissorBox[0] = scissorBox[1] = 0;
contextState.viewportWidth = contextState.framebufferWidth = contextState.drawingBufferWidth = viewport[2] = scissorBox[2] = gl2.drawingBufferWidth;
contextState.viewportHeight = contextState.framebufferHeight = contextState.drawingBufferHeight = viewport[3] = scissorBox[3] = gl2.drawingBufferHeight;
}
function poll() {
contextState.tick += 1;
contextState.time = now2();
pollViewport();
core2.procs.poll();
}
function refresh() {
textureState.refresh();
pollViewport();
core2.procs.refresh();
if (timer3) {
timer3.update();
}
}
function now2() {
return (clock2() - START_TIME) / 1e3;
}
refresh();
function addListener(event, callback) {
check$1.type(callback, "function", "listener callback must be a function");
var callbacks;
switch (event) {
case "frame":
return frame2(callback);
case "lost":
callbacks = lossCallbacks;
break;
case "restore":
callbacks = restoreCallbacks;
break;
case "destroy":
callbacks = destroyCallbacks;
break;
default:
check$1.raise("invalid event, must be one of frame,lost,restore,destroy");
}
callbacks.push(callback);
return {
cancel: function() {
for (var i4 = 0; i4 < callbacks.length; ++i4) {
if (callbacks[i4] === callback) {
callbacks[i4] = callbacks[callbacks.length - 1];
callbacks.pop();
return;
}
}
}
};
}
var regl2 = extend4(compileProcedure, {
clear,
prop: dynamic.define.bind(null, DYN_PROP),
context: dynamic.define.bind(null, DYN_CONTEXT),
this: dynamic.define.bind(null, DYN_STATE),
draw: compileProcedure({}),
buffer: function(options) {
return bufferState.create(options, GL_ARRAY_BUFFER, false, false);
},
elements: function(options) {
return elementState.create(options, false);
},
texture: textureState.create2D,
cube: textureState.createCube,
renderbuffer: renderbufferState.create,
framebuffer: framebufferState.create,
framebufferCube: framebufferState.createCube,
vao: attributeState.createVAO,
attributes: glAttributes,
frame: frame2,
on: addListener,
limits,
hasExtension: function(name) {
return limits.extensions.indexOf(name.toLowerCase()) >= 0;
},
read: readPixels,
destroy,
_gl: gl2,
_refresh: refresh,
poll: function() {
poll();
if (timer3) {
timer3.update();
}
},
now: now2,
stats: stats$$1
});
config.onDone(null, regl2);
return regl2;
}
return wrapREGL;
});
}
});
// node_modules/gl-vec2/epsilon.js
var require_epsilon = __commonJS({
"node_modules/gl-vec2/epsilon.js"(exports, module2) {
module2.exports = 1e-6;
}
});
// node_modules/gl-vec2/create.js
var require_create = __commonJS({
"node_modules/gl-vec2/create.js"(exports, module2) {
module2.exports = create8;
function create8() {
var out = new Float32Array(2);
out[0] = 0;
out[1] = 0;
return out;
}
}
});
// node_modules/gl-vec2/clone.js
var require_clone = __commonJS({
"node_modules/gl-vec2/clone.js"(exports, module2) {
module2.exports = clone10;
function clone10(a4) {
var out = new Float32Array(2);
out[0] = a4[0];
out[1] = a4[1];
return out;
}
}
});
// node_modules/gl-vec2/fromValues.js
var require_fromValues = __commonJS({
"node_modules/gl-vec2/fromValues.js"(exports, module2) {
module2.exports = fromValues7;
function fromValues7(x6, y5) {
var out = new Float32Array(2);
out[0] = x6;
out[1] = y5;
return out;
}
}
});
// node_modules/gl-vec2/copy.js
var require_copy = __commonJS({
"node_modules/gl-vec2/copy.js"(exports, module2) {
module2.exports = copy8;
function copy8(out, a4) {
out[0] = a4[0];
out[1] = a4[1];
return out;
}
}
});
// node_modules/gl-vec2/set.js
var require_set = __commonJS({
"node_modules/gl-vec2/set.js"(exports, module2) {
module2.exports = set10;
function set10(out, x6, y5) {
out[0] = x6;
out[1] = y5;
return out;
}
}
});
// node_modules/gl-vec2/equals.js
var require_equals = __commonJS({
"node_modules/gl-vec2/equals.js"(exports, module2) {
module2.exports = equals7;
var EPSILON3 = require_epsilon();
function equals7(a4, b10) {
var a0 = a4[0];
var a1 = a4[1];
var b02 = b10[0];
var b12 = b10[1];
return Math.abs(a0 - b02) <= EPSILON3 * Math.max(1, Math.abs(a0), Math.abs(b02)) && Math.abs(a1 - b12) <= EPSILON3 * Math.max(1, Math.abs(a1), Math.abs(b12));
}
}
});
// node_modules/gl-vec2/exactEquals.js
var require_exactEquals = __commonJS({
"node_modules/gl-vec2/exactEquals.js"(exports, module2) {
module2.exports = exactEquals7;
function exactEquals7(a4, b10) {
return a4[0] === b10[0] && a4[1] === b10[1];
}
}
});
// node_modules/gl-vec2/add.js
var require_add = __commonJS({
"node_modules/gl-vec2/add.js"(exports, module2) {
module2.exports = add8;
function add8(out, a4, b10) {
out[0] = a4[0] + b10[0];
out[1] = a4[1] + b10[1];
return out;
}
}
});
// node_modules/gl-vec2/subtract.js
var require_subtract = __commonJS({
"node_modules/gl-vec2/subtract.js"(exports, module2) {
module2.exports = subtract6;
function subtract6(out, a4, b10) {
out[0] = a4[0] - b10[0];
out[1] = a4[1] - b10[1];
return out;
}
}
});
// node_modules/gl-vec2/sub.js
var require_sub = __commonJS({
"node_modules/gl-vec2/sub.js"(exports, module2) {
module2.exports = require_subtract();
}
});
// node_modules/gl-vec2/multiply.js
var require_multiply = __commonJS({
"node_modules/gl-vec2/multiply.js"(exports, module2) {
module2.exports = multiply7;
function multiply7(out, a4, b10) {
out[0] = a4[0] * b10[0];
out[1] = a4[1] * b10[1];
return out;
}
}
});
// node_modules/gl-vec2/mul.js
var require_mul = __commonJS({
"node_modules/gl-vec2/mul.js"(exports, module2) {
module2.exports = require_multiply();
}
});
// node_modules/gl-vec2/divide.js
var require_divide = __commonJS({
"node_modules/gl-vec2/divide.js"(exports, module2) {
module2.exports = divide4;
function divide4(out, a4, b10) {
out[0] = a4[0] / b10[0];
out[1] = a4[1] / b10[1];
return out;
}
}
});
// node_modules/gl-vec2/div.js
var require_div = __commonJS({
"node_modules/gl-vec2/div.js"(exports, module2) {
module2.exports = require_divide();
}
});
// node_modules/gl-vec2/inverse.js
var require_inverse = __commonJS({
"node_modules/gl-vec2/inverse.js"(exports, module2) {
module2.exports = inverse4;
function inverse4(out, a4) {
out[0] = 1 / a4[0];
out[1] = 1 / a4[1];
return out;
}
}
});
// node_modules/gl-vec2/min.js
var require_min = __commonJS({
"node_modules/gl-vec2/min.js"(exports, module2) {
module2.exports = min7;
function min7(out, a4, b10) {
out[0] = Math.min(a4[0], b10[0]);
out[1] = Math.min(a4[1], b10[1]);
return out;
}
}
});
// node_modules/gl-vec2/max.js
var require_max = __commonJS({
"node_modules/gl-vec2/max.js"(exports, module2) {
module2.exports = max8;
function max8(out, a4, b10) {
out[0] = Math.max(a4[0], b10[0]);
out[1] = Math.max(a4[1], b10[1]);
return out;
}
}
});
// node_modules/gl-vec2/rotate.js
var require_rotate = __commonJS({
"node_modules/gl-vec2/rotate.js"(exports, module2) {
module2.exports = rotate8;
function rotate8(out, a4, angle3) {
var c5 = Math.cos(angle3), s4 = Math.sin(angle3);
var x6 = a4[0], y5 = a4[1];
out[0] = x6 * c5 - y5 * s4;
out[1] = x6 * s4 + y5 * c5;
return out;
}
}
});
// node_modules/gl-vec2/floor.js
var require_floor = __commonJS({
"node_modules/gl-vec2/floor.js"(exports, module2) {
module2.exports = floor4;
function floor4(out, a4) {
out[0] = Math.floor(a4[0]);
out[1] = Math.floor(a4[1]);
return out;
}
}
});
// node_modules/gl-vec2/ceil.js
var require_ceil = __commonJS({
"node_modules/gl-vec2/ceil.js"(exports, module2) {
module2.exports = ceil4;
function ceil4(out, a4) {
out[0] = Math.ceil(a4[0]);
out[1] = Math.ceil(a4[1]);
return out;
}
}
});
// node_modules/gl-vec2/round.js
var require_round = __commonJS({
"node_modules/gl-vec2/round.js"(exports, module2) {
module2.exports = round5;
function round5(out, a4) {
out[0] = Math.round(a4[0]);
out[1] = Math.round(a4[1]);
return out;
}
}
});
// node_modules/gl-vec2/scale.js
var require_scale = __commonJS({
"node_modules/gl-vec2/scale.js"(exports, module2) {
module2.exports = scale12;
function scale12(out, a4, b10) {
out[0] = a4[0] * b10;
out[1] = a4[1] * b10;
return out;
}
}
});
// node_modules/gl-vec2/scaleAndAdd.js
var require_scaleAndAdd = __commonJS({
"node_modules/gl-vec2/scaleAndAdd.js"(exports, module2) {
module2.exports = scaleAndAdd4;
function scaleAndAdd4(out, a4, b10, scale12) {
out[0] = a4[0] + b10[0] * scale12;
out[1] = a4[1] + b10[1] * scale12;
return out;
}
}
});
// node_modules/gl-vec2/distance.js
var require_distance = __commonJS({
"node_modules/gl-vec2/distance.js"(exports, module2) {
module2.exports = distance15;
function distance15(a4, b10) {
var x6 = b10[0] - a4[0], y5 = b10[1] - a4[1];
return Math.sqrt(x6 * x6 + y5 * y5);
}
}
});
// node_modules/gl-vec2/dist.js
var require_dist = __commonJS({
"node_modules/gl-vec2/dist.js"(exports, module2) {
module2.exports = require_distance();
}
});
// node_modules/gl-vec2/squaredDistance.js
var require_squaredDistance = __commonJS({
"node_modules/gl-vec2/squaredDistance.js"(exports, module2) {
module2.exports = squaredDistance4;
function squaredDistance4(a4, b10) {
var x6 = b10[0] - a4[0], y5 = b10[1] - a4[1];
return x6 * x6 + y5 * y5;
}
}
});
// node_modules/gl-vec2/sqrDist.js
var require_sqrDist = __commonJS({
"node_modules/gl-vec2/sqrDist.js"(exports, module2) {
module2.exports = require_squaredDistance();
}
});
// node_modules/gl-vec2/length.js
var require_length = __commonJS({
"node_modules/gl-vec2/length.js"(exports, module2) {
module2.exports = length5;
function length5(a4) {
var x6 = a4[0], y5 = a4[1];
return Math.sqrt(x6 * x6 + y5 * y5);
}
}
});
// node_modules/gl-vec2/len.js
var require_len = __commonJS({
"node_modules/gl-vec2/len.js"(exports, module2) {
module2.exports = require_length();
}
});
// node_modules/gl-vec2/squaredLength.js
var require_squaredLength = __commonJS({
"node_modules/gl-vec2/squaredLength.js"(exports, module2) {
module2.exports = squaredLength5;
function squaredLength5(a4) {
var x6 = a4[0], y5 = a4[1];
return x6 * x6 + y5 * y5;
}
}
});
// node_modules/gl-vec2/sqrLen.js
var require_sqrLen = __commonJS({
"node_modules/gl-vec2/sqrLen.js"(exports, module2) {
module2.exports = require_squaredLength();
}
});
// node_modules/gl-vec2/negate.js
var require_negate = __commonJS({
"node_modules/gl-vec2/negate.js"(exports, module2) {
module2.exports = negate4;
function negate4(out, a4) {
out[0] = -a4[0];
out[1] = -a4[1];
return out;
}
}
});
// node_modules/gl-vec2/normalize.js
var require_normalize = __commonJS({
"node_modules/gl-vec2/normalize.js"(exports, module2) {
module2.exports = normalize5;
function normalize5(out, a4) {
var x6 = a4[0], y5 = a4[1];
var len5 = x6 * x6 + y5 * y5;
if (len5 > 0) {
len5 = 1 / Math.sqrt(len5);
out[0] = a4[0] * len5;
out[1] = a4[1] * len5;
}
return out;
}
}
});
// node_modules/gl-vec2/dot.js
var require_dot = __commonJS({
"node_modules/gl-vec2/dot.js"(exports, module2) {
module2.exports = dot7;
function dot7(a4, b10) {
return a4[0] * b10[0] + a4[1] * b10[1];
}
}
});
// node_modules/gl-vec2/cross.js
var require_cross = __commonJS({
"node_modules/gl-vec2/cross.js"(exports, module2) {
module2.exports = cross6;
function cross6(out, a4, b10) {
var z3 = a4[0] * b10[1] - a4[1] * b10[0];
out[0] = out[1] = 0;
out[2] = z3;
return out;
}
}
});
// node_modules/gl-vec2/lerp.js
var require_lerp = __commonJS({
"node_modules/gl-vec2/lerp.js"(exports, module2) {
module2.exports = lerp6;
function lerp6(out, a4, b10, t4) {
var ax = a4[0], ay = a4[1];
out[0] = ax + t4 * (b10[0] - ax);
out[1] = ay + t4 * (b10[1] - ay);
return out;
}
}
});
// node_modules/gl-vec2/random.js
var require_random = __commonJS({
"node_modules/gl-vec2/random.js"(exports, module2) {
module2.exports = random5;
function random5(out, scale12) {
scale12 = scale12 || 1;
var r4 = Math.random() * 2 * Math.PI;
out[0] = Math.cos(r4) * scale12;
out[1] = Math.sin(r4) * scale12;
return out;
}
}
});
// node_modules/gl-vec2/transformMat2.js
var require_transformMat2 = __commonJS({
"node_modules/gl-vec2/transformMat2.js"(exports, module2) {
module2.exports = transformMat22;
function transformMat22(out, a4, m4) {
var x6 = a4[0], y5 = a4[1];
out[0] = m4[0] * x6 + m4[2] * y5;
out[1] = m4[1] * x6 + m4[3] * y5;
return out;
}
}
});
// node_modules/gl-vec2/transformMat2d.js
var require_transformMat2d = __commonJS({
"node_modules/gl-vec2/transformMat2d.js"(exports, module2) {
module2.exports = transformMat2d2;
function transformMat2d2(out, a4, m4) {
var x6 = a4[0], y5 = a4[1];
out[0] = m4[0] * x6 + m4[2] * y5 + m4[4];
out[1] = m4[1] * x6 + m4[3] * y5 + m4[5];
return out;
}
}
});
// node_modules/gl-vec2/transformMat3.js
var require_transformMat3 = __commonJS({
"node_modules/gl-vec2/transformMat3.js"(exports, module2) {
module2.exports = transformMat33;
function transformMat33(out, a4, m4) {
var x6 = a4[0], y5 = a4[1];
out[0] = m4[0] * x6 + m4[3] * y5 + m4[6];
out[1] = m4[1] * x6 + m4[4] * y5 + m4[7];
return out;
}
}
});
// node_modules/gl-vec2/transformMat4.js
var require_transformMat4 = __commonJS({
"node_modules/gl-vec2/transformMat4.js"(exports, module2) {
module2.exports = transformMat44;
function transformMat44(out, a4, m4) {
var x6 = a4[0], y5 = a4[1];
out[0] = m4[0] * x6 + m4[4] * y5 + m4[12];
out[1] = m4[1] * x6 + m4[5] * y5 + m4[13];
return out;
}
}
});
// node_modules/gl-vec2/forEach.js
var require_forEach = __commonJS({
"node_modules/gl-vec2/forEach.js"(exports, module2) {
module2.exports = forEach4;
var vec = require_create()();
function forEach4(a4, stride, offset, count2, fn2, arg) {
var i4, l4;
if (!stride) {
stride = 2;
}
if (!offset) {
offset = 0;
}
if (count2) {
l4 = Math.min(count2 * stride + offset, a4.length);
} else {
l4 = a4.length;
}
for (i4 = offset; i4 < l4; i4 += stride) {
vec[0] = a4[i4];
vec[1] = a4[i4 + 1];
fn2(vec, vec, arg);
a4[i4] = vec[0];
a4[i4 + 1] = vec[1];
}
return a4;
}
}
});
// node_modules/gl-vec2/limit.js
var require_limit = __commonJS({
"node_modules/gl-vec2/limit.js"(exports, module2) {
module2.exports = limit;
function limit(out, a4, max8) {
var mSq = a4[0] * a4[0] + a4[1] * a4[1];
if (mSq > max8 * max8) {
var n3 = Math.sqrt(mSq);
out[0] = a4[0] / n3 * max8;
out[1] = a4[1] / n3 * max8;
} else {
out[0] = a4[0];
out[1] = a4[1];
}
return out;
}
}
});
// node_modules/gl-vec2/index.js
var require_gl_vec2 = __commonJS({
"node_modules/gl-vec2/index.js"(exports, module2) {
module2.exports = {
EPSILON: require_epsilon(),
create: require_create(),
clone: require_clone(),
fromValues: require_fromValues(),
copy: require_copy(),
set: require_set(),
equals: require_equals(),
exactEquals: require_exactEquals(),
add: require_add(),
subtract: require_subtract(),
sub: require_sub(),
multiply: require_multiply(),
mul: require_mul(),
divide: require_divide(),
div: require_div(),
inverse: require_inverse(),
min: require_min(),
max: require_max(),
rotate: require_rotate(),
floor: require_floor(),
ceil: require_ceil(),
round: require_round(),
scale: require_scale(),
scaleAndAdd: require_scaleAndAdd(),
distance: require_distance(),
dist: require_dist(),
squaredDistance: require_squaredDistance(),
sqrDist: require_sqrDist(),
length: require_length(),
len: require_len(),
squaredLength: require_squaredLength(),
sqrLen: require_sqrLen(),
negate: require_negate(),
normalize: require_normalize(),
dot: require_dot(),
cross: require_cross(),
lerp: require_lerp(),
random: require_random(),
transformMat2: require_transformMat2(),
transformMat2d: require_transformMat2d(),
transformMat3: require_transformMat3(),
transformMat4: require_transformMat4(),
forEach: require_forEach(),
limit: require_limit()
};
}
});
// node_modules/polyline-miter-util/index.js
var require_polyline_miter_util = __commonJS({
"node_modules/polyline-miter-util/index.js"(exports, module2) {
var add8 = require_add();
var set10 = require_set();
var normalize5 = require_normalize();
var subtract6 = require_subtract();
var dot7 = require_dot();
var tmp = [0, 0];
module2.exports.computeMiter = function computeMiter2(tangent, miter, lineA, lineB, halfThick) {
add8(tangent, lineA, lineB);
normalize5(tangent, tangent);
set10(miter, -tangent[1], tangent[0]);
set10(tmp, -lineA[1], lineA[0]);
return halfThick / dot7(miter, tmp);
};
module2.exports.normal = function normal2(out, dir) {
set10(out, -dir[1], dir[0]);
return out;
};
module2.exports.direction = function direction5(out, a4, b10) {
subtract6(out, a4, b10);
normalize5(out, out);
return out;
};
}
});
// node_modules/@antv/hierarchy/build/hierarchy.js
var require_hierarchy = __commonJS({
"node_modules/@antv/hierarchy/build/hierarchy.js"(exports, module2) {
(function webpackUniversalModuleDefinition(root, factory) {
if (typeof exports === "object" && typeof module2 === "object")
module2.exports = factory();
else if (typeof define === "function" && define.amd)
define([], factory);
else if (typeof exports === "object")
exports["Hierarchy"] = factory();
else
root["Hierarchy"] = factory();
})(typeof self !== "undefined" ? self : exports, function() {
return function(modules) {
var installedModules = {};
function __webpack_require__(moduleId) {
if (installedModules[moduleId]) {
return installedModules[moduleId].exports;
}
var module3 = installedModules[moduleId] = {
i: moduleId,
l: false,
exports: {}
};
modules[moduleId].call(module3.exports, module3, module3.exports, __webpack_require__);
module3.l = true;
return module3.exports;
}
__webpack_require__.m = modules;
__webpack_require__.c = installedModules;
__webpack_require__.d = function(exports2, name, getter) {
if (!__webpack_require__.o(exports2, name)) {
Object.defineProperty(exports2, name, {
configurable: false,
enumerable: true,
get: getter
});
}
};
__webpack_require__.n = function(module3) {
var getter = module3 && module3.__esModule ? function getDefault4() {
return module3["default"];
} : function getModuleExports() {
return module3;
};
__webpack_require__.d(getter, "a", getter);
return getter;
};
__webpack_require__.o = function(object, property) {
return Object.prototype.hasOwnProperty.call(object, property);
};
__webpack_require__.p = "";
return __webpack_require__(__webpack_require__.s = 31);
}([
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_type__ = __webpack_require__(4);
__webpack_exports__["a"] = function(value2) {
return Array.isArray ? Array.isArray(value2) : Object(__WEBPACK_IMPORTED_MODULE_0__is_type__["a"])(value2, "Array");
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var isArrayLike2 = function(value2) {
return value2 !== null && typeof value2 !== "function" && isFinite(value2.length);
};
__webpack_exports__["a"] = isArrayLike2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_array__ = __webpack_require__(0);
var __WEBPACK_IMPORTED_MODULE_1__is_object__ = __webpack_require__(13);
function each3(elements, func) {
if (!elements) {
return;
}
var rst;
if (Object(__WEBPACK_IMPORTED_MODULE_0__is_array__["a"])(elements)) {
for (var i4 = 0, len5 = elements.length; i4 < len5; i4++) {
rst = func(elements[i4], i4);
if (rst === false) {
break;
}
}
} else if (Object(__WEBPACK_IMPORTED_MODULE_1__is_object__["a"])(elements)) {
for (var k4 in elements) {
if (elements.hasOwnProperty(k4)) {
rst = func(elements[k4], k4);
if (rst === false) {
break;
}
}
}
}
}
__webpack_exports__["a"] = each3;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_type__ = __webpack_require__(4);
__webpack_exports__["a"] = function(value2) {
return Object(__WEBPACK_IMPORTED_MODULE_0__is_type__["a"])(value2, "Function");
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var toString7 = {}.toString;
var isType6 = function(value2, type2) {
return toString7.call(value2) === "[object " + type2 + "]";
};
__webpack_exports__["a"] = isType6;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_type__ = __webpack_require__(4);
var isNumber7 = function(value2) {
return Object(__WEBPACK_IMPORTED_MODULE_0__is_type__["a"])(value2, "Number");
};
__webpack_exports__["a"] = isNumber7;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var isNil2 = function(value2) {
return value2 === null || value2 === void 0;
};
__webpack_exports__["a"] = isNil2;
},
function(module3, exports2, __webpack_require__) {
var _require = __webpack_require__(33), mix2 = _require.mix;
module3.exports = {
assign: mix2
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_type__ = __webpack_require__(4);
__webpack_exports__["a"] = function(str8) {
return Object(__WEBPACK_IMPORTED_MODULE_0__is_type__["a"])(str8, "String");
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_object_like__ = __webpack_require__(15);
var __WEBPACK_IMPORTED_MODULE_1__is_type__ = __webpack_require__(4);
var isPlainObject3 = function(value2) {
if (!Object(__WEBPACK_IMPORTED_MODULE_0__is_object_like__["a"])(value2) || !Object(__WEBPACK_IMPORTED_MODULE_1__is_type__["a"])(value2, "Object")) {
return false;
}
if (Object.getPrototypeOf(value2) === null) {
return true;
}
var proto = value2;
while (Object.getPrototypeOf(proto) !== null) {
proto = Object.getPrototypeOf(proto);
}
return Object.getPrototypeOf(value2) === proto;
};
__webpack_exports__["a"] = isPlainObject3;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_nil__ = __webpack_require__(6);
__webpack_exports__["a"] = function(value2) {
if (Object(__WEBPACK_IMPORTED_MODULE_0__is_nil__["a"])(value2))
return "";
return value2.toString();
};
},
function(module3, exports2, __webpack_require__) {
var hierarchy2 = __webpack_require__(18);
var Layout2 = /* @__PURE__ */ function() {
function Layout3(root, options) {
if (options === void 0) {
options = {};
}
var me = this;
me.options = options;
me.rootNode = hierarchy2(root, options);
}
var _proto = Layout3.prototype;
_proto.execute = function execute() {
throw new Error("please override this method");
};
return Layout3;
}();
module3.exports = Layout2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_array_like__ = __webpack_require__(1);
var contains2 = function(arr, value2) {
if (!Object(__WEBPACK_IMPORTED_MODULE_0__is_array_like__["a"])(arr)) {
return false;
}
return arr.indexOf(value2) > -1;
};
__webpack_exports__["a"] = contains2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_exports__["a"] = function(value2) {
var type2 = typeof value2;
return value2 !== null && type2 === "object" || type2 === "function";
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__each__ = __webpack_require__(2);
var __WEBPACK_IMPORTED_MODULE_1__is_array_like__ = __webpack_require__(1);
var filter2 = function(arr, func) {
if (!Object(__WEBPACK_IMPORTED_MODULE_1__is_array_like__["a"])(arr)) {
return arr;
}
var result = [];
Object(__WEBPACK_IMPORTED_MODULE_0__each__["a"])(arr, function(value2, index2) {
if (func(value2, index2)) {
result.push(value2);
}
});
return result;
};
__webpack_exports__["a"] = filter2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var isObjectLike6 = function(value2) {
return typeof value2 === "object" && value2 !== null;
};
__webpack_exports__["a"] = isObjectLike6;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_exports__["a"] = mix2;
function _mix2(dist4, obj) {
for (var key in obj) {
if (obj.hasOwnProperty(key) && key !== "constructor" && obj[key] !== void 0) {
dist4[key] = obj[key];
}
}
}
function mix2(dist4, src1, src2, src3) {
if (src1)
_mix2(dist4, src1);
if (src2)
_mix2(dist4, src2);
if (src3)
_mix2(dist4, src3);
return dist4;
}
},
function(module3, exports2, __webpack_require__) {
var separateTree = __webpack_require__(30);
var VALID_DIRECTIONS = [
"LR",
"RL",
"TB",
"BT",
"H",
"V"
];
var HORIZONTAL_DIRECTIONS = ["LR", "RL", "H"];
var isHorizontal2 = function isHorizontal3(direction5) {
return HORIZONTAL_DIRECTIONS.indexOf(direction5) > -1;
};
var DEFAULT_DIRECTION = VALID_DIRECTIONS[0];
module3.exports = function(root, options, layoutAlgrithm) {
var direction5 = options.direction || DEFAULT_DIRECTION;
options.isHorizontal = isHorizontal2(direction5);
if (direction5 && VALID_DIRECTIONS.indexOf(direction5) === -1) {
throw new TypeError("Invalid direction: " + direction5);
}
if (direction5 === VALID_DIRECTIONS[0]) {
layoutAlgrithm(root, options);
} else if (direction5 === VALID_DIRECTIONS[1]) {
layoutAlgrithm(root, options);
root.right2left();
} else if (direction5 === VALID_DIRECTIONS[2]) {
layoutAlgrithm(root, options);
} else if (direction5 === VALID_DIRECTIONS[3]) {
layoutAlgrithm(root, options);
root.bottom2top();
} else if (direction5 === VALID_DIRECTIONS[4] || direction5 === VALID_DIRECTIONS[5]) {
var _separateTree = separateTree(root, options), left2 = _separateTree.left, right2 = _separateTree.right;
layoutAlgrithm(left2, options);
layoutAlgrithm(right2, options);
options.isHorizontal ? left2.right2left() : left2.bottom2top();
right2.translate(left2.x - right2.x, left2.y - right2.y);
root.x = left2.x;
root.y = right2.y;
var bb = root.getBoundingBox();
if (options.isHorizontal) {
if (bb.top < 0) {
root.translate(0, -bb.top);
}
} else {
if (bb.left < 0) {
root.translate(-bb.left, 0);
}
}
}
var fixedRoot = options.fixedRoot;
if (fixedRoot === void 0)
fixedRoot = true;
if (fixedRoot) {
root.translate(-(root.x + root.width / 2 + root.hgap), -(root.y + root.height / 2 + root.vgap));
}
return root;
};
},
function(module3, exports2, __webpack_require__) {
var util = __webpack_require__(7);
var PEM = 18;
var DEFAULT_HEIGHT = PEM * 2;
var DEFAULT_GAP = PEM;
var DEFAULT_OPTIONS37 = {
getId: function getId4(d3) {
return d3.id || d3.name;
},
getPreH: function getPreH(d3) {
return d3.preH || 0;
},
getPreV: function getPreV(d3) {
return d3.preV || 0;
},
getHGap: function getHGap4(d3) {
return d3.hgap || DEFAULT_GAP;
},
getVGap: function getVGap4(d3) {
return d3.vgap || DEFAULT_GAP;
},
getChildren: function getChildren(d3) {
return d3.children;
},
getHeight: function getHeight6(d3) {
return d3.height || DEFAULT_HEIGHT;
},
getWidth: function getWidth4(d3) {
var label17 = d3.label || " ";
return d3.width || label17.split("").length * PEM;
}
};
function Node5(data3, options) {
var me = this;
me.vgap = me.hgap = 0;
if (data3 instanceof Node5)
return data3;
me.data = data3;
var hgap = options.getHGap(data3);
var vgap = options.getVGap(data3);
me.preH = options.getPreH(data3);
me.preV = options.getPreV(data3);
me.width = options.getWidth(data3);
me.height = options.getHeight(data3);
me.width += me.preH;
me.height += me.preV;
me.id = options.getId(data3);
me.x = me.y = 0;
me.depth = 0;
if (!me.children) {
me.children = [];
}
me.addGap(hgap, vgap);
return me;
}
util.assign(Node5.prototype, {
isRoot: function isRoot() {
return this.depth === 0;
},
isLeaf: function isLeaf() {
return this.children.length === 0;
},
addGap: function addGap(hgap, vgap) {
var me = this;
me.hgap += hgap;
me.vgap += vgap;
me.width += 2 * hgap;
me.height += 2 * vgap;
},
eachNode: function eachNode(callback) {
var me = this;
var nodes = [me];
var current;
while (current = nodes.shift()) {
callback(current);
nodes = current.children.concat(nodes);
}
},
DFTraverse: function DFTraverse(callback) {
this.eachNode(callback);
},
BFTraverse: function BFTraverse(callback) {
var me = this;
var nodes = [me];
var current;
while (current = nodes.shift()) {
callback(current);
nodes = nodes.concat(current.children);
}
},
getBoundingBox: function getBoundingBox2() {
var bb = {
left: Number.MAX_VALUE,
top: Number.MAX_VALUE,
width: 0,
height: 0
};
this.eachNode(function(node) {
bb.left = Math.min(bb.left, node.x);
bb.top = Math.min(bb.top, node.y);
bb.width = Math.max(bb.width, node.x + node.width);
bb.height = Math.max(bb.height, node.y + node.height);
});
return bb;
},
translate: function translate6(tx, ty) {
if (tx === void 0) {
tx = 0;
}
if (ty === void 0) {
ty = 0;
}
this.eachNode(function(node) {
node.x += tx;
node.y += ty;
node.x += node.preH;
node.y += node.preV;
});
},
right2left: function right2left() {
var me = this;
var bb = me.getBoundingBox();
me.eachNode(function(node) {
node.x = node.x - (node.x - bb.left) * 2 - node.width;
});
me.translate(bb.width, 0);
},
bottom2top: function bottom2top() {
var me = this;
var bb = me.getBoundingBox();
me.eachNode(function(node) {
node.y = node.y - (node.y - bb.top) * 2 - node.height;
});
me.translate(0, bb.height);
}
});
function hierarchy2(data3, options, isolated) {
if (options === void 0) {
options = {};
}
options = util.assign({}, DEFAULT_OPTIONS37, options);
var root = new Node5(data3, options);
var nodes = [root];
var node;
if (!isolated && !data3.collapsed) {
while (node = nodes.shift()) {
if (!node.data.collapsed) {
var children = options.getChildren(node.data);
var length5 = children ? children.length : 0;
node.children = new Array(length5);
if (children && length5) {
for (var i4 = 0; i4 < length5; i4++) {
var child = new Node5(children[i4], options);
node.children[i4] = child;
nodes.push(child);
child.parent = node;
child.depth = node.depth + 1;
}
}
}
}
}
return root;
}
module3.exports = hierarchy2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_nil__ = __webpack_require__(6);
var __WEBPACK_IMPORTED_MODULE_1__keys__ = __webpack_require__(20);
function isMatch2(obj, attrs) {
var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys__["a"])(attrs);
var length5 = _keys.length;
if (Object(__WEBPACK_IMPORTED_MODULE_0__is_nil__["a"])(obj))
return !length5;
for (var i4 = 0; i4 < length5; i4 += 1) {
var key = _keys[i4];
if (attrs[key] !== obj[key] || !(key in obj)) {
return false;
}
}
return true;
}
__webpack_exports__["a"] = isMatch2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__each__ = __webpack_require__(2);
var __WEBPACK_IMPORTED_MODULE_1__is_function__ = __webpack_require__(3);
var keys2 = Object.keys ? function(obj) {
return Object.keys(obj);
} : function(obj) {
var result = [];
Object(__WEBPACK_IMPORTED_MODULE_0__each__["a"])(obj, function(value2, key) {
if (!(Object(__WEBPACK_IMPORTED_MODULE_1__is_function__["a"])(obj) && key === "prototype")) {
result.push(key);
}
});
return result;
};
__webpack_exports__["a"] = keys2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_array_like__ = __webpack_require__(1);
var splice3 = Array.prototype.splice;
var pullAt3 = function pullAt4(arr, indexes) {
if (!Object(__WEBPACK_IMPORTED_MODULE_0__is_array_like__["a"])(arr)) {
return [];
}
var length5 = arr ? indexes.length : 0;
var last2 = length5 - 1;
while (length5--) {
var previous = void 0;
var index2 = indexes[length5];
if (length5 === last2 || index2 !== previous) {
previous = index2;
splice3.call(arr, index2, 1);
}
}
return arr;
};
__webpack_exports__["a"] = pullAt3;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__contains__ = __webpack_require__(12);
var __WEBPACK_IMPORTED_MODULE_1__each__ = __webpack_require__(2);
var uniq5 = function(arr) {
var resultArr = [];
Object(__WEBPACK_IMPORTED_MODULE_1__each__["a"])(arr, function(item) {
if (!Object(__WEBPACK_IMPORTED_MODULE_0__contains__["a"])(resultArr, item)) {
resultArr.push(item);
}
});
return resultArr;
};
__webpack_exports__["a"] = uniq5;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_array__ = __webpack_require__(0);
var __WEBPACK_IMPORTED_MODULE_1__is_function__ = __webpack_require__(3);
var __WEBPACK_IMPORTED_MODULE_2__group_by__ = __webpack_require__(24);
var groupToMap2 = function(data3, condition) {
if (!condition) {
return {
0: data3
};
}
if (!Object(__WEBPACK_IMPORTED_MODULE_1__is_function__["a"])(condition)) {
var paramsCondition_1 = Object(__WEBPACK_IMPORTED_MODULE_0__is_array__["a"])(condition) ? condition : condition.replace(/\s+/g, "").split("*");
condition = function(row) {
var unique = "_";
for (var i4 = 0, l4 = paramsCondition_1.length; i4 < l4; i4++) {
unique += row[paramsCondition_1[i4]] && row[paramsCondition_1[i4]].toString();
}
return unique;
};
}
var groups = Object(__WEBPACK_IMPORTED_MODULE_2__group_by__["a"])(data3, condition);
return groups;
};
__webpack_exports__["a"] = groupToMap2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__each__ = __webpack_require__(2);
var __WEBPACK_IMPORTED_MODULE_1__is_array__ = __webpack_require__(0);
var __WEBPACK_IMPORTED_MODULE_2__is_function__ = __webpack_require__(3);
var hasOwnProperty4 = Object.prototype.hasOwnProperty;
function groupBy2(data3, condition) {
if (!condition || !Object(__WEBPACK_IMPORTED_MODULE_1__is_array__["a"])(data3)) {
return {};
}
var result = {};
var predicate = Object(__WEBPACK_IMPORTED_MODULE_2__is_function__["a"])(condition) ? condition : function(item) {
return item[condition];
};
var key;
Object(__WEBPACK_IMPORTED_MODULE_0__each__["a"])(data3, function(item) {
key = predicate(item);
if (hasOwnProperty4.call(result, key)) {
result[key].push(item);
} else {
result[key] = [item];
}
});
return result;
}
__webpack_exports__["a"] = groupBy2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_exports__["a"] = function(obj, key) {
return obj.hasOwnProperty(key);
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__each__ = __webpack_require__(2);
var __WEBPACK_IMPORTED_MODULE_1__is_function__ = __webpack_require__(3);
var values2 = Object.values ? function(obj) {
return Object.values(obj);
} : function(obj) {
var result = [];
Object(__WEBPACK_IMPORTED_MODULE_0__each__["a"])(obj, function(value2, key) {
if (!(Object(__WEBPACK_IMPORTED_MODULE_1__is_function__["a"])(obj) && key === "prototype")) {
result.push(value2);
}
});
return result;
};
__webpack_exports__["a"] = values2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var toString7 = {}.toString;
var getType3 = function(value2) {
return toString7.call(value2).replace(/^\[object /, "").replace(/]$/, "");
};
__webpack_exports__["a"] = getType3;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var objectProto5 = Object.prototype;
var isPrototype2 = function(value2) {
var Ctor = value2 && value2.constructor;
var proto = typeof Ctor === "function" && Ctor.prototype || objectProto5;
return value2 === proto;
};
__webpack_exports__["a"] = isPrototype2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_object_like__ = __webpack_require__(15);
var __WEBPACK_IMPORTED_MODULE_1__is_array_like__ = __webpack_require__(1);
var __WEBPACK_IMPORTED_MODULE_2__is_string__ = __webpack_require__(8);
var isEqual3 = function(value2, other2) {
if (value2 === other2) {
return true;
}
if (!value2 || !other2) {
return false;
}
if (Object(__WEBPACK_IMPORTED_MODULE_2__is_string__["a"])(value2) || Object(__WEBPACK_IMPORTED_MODULE_2__is_string__["a"])(other2)) {
return false;
}
if (Object(__WEBPACK_IMPORTED_MODULE_1__is_array_like__["a"])(value2) || Object(__WEBPACK_IMPORTED_MODULE_1__is_array_like__["a"])(other2)) {
if (value2.length !== other2.length) {
return false;
}
var rst = true;
for (var i4 = 0; i4 < value2.length; i4++) {
rst = isEqual3(value2[i4], other2[i4]);
if (!rst) {
break;
}
}
return rst;
}
if (Object(__WEBPACK_IMPORTED_MODULE_0__is_object_like__["a"])(value2) || Object(__WEBPACK_IMPORTED_MODULE_0__is_object_like__["a"])(other2)) {
var valueKeys = Object.keys(value2);
var otherKeys = Object.keys(other2);
if (valueKeys.length !== otherKeys.length) {
return false;
}
var rst = true;
for (var i4 = 0; i4 < valueKeys.length; i4++) {
rst = isEqual3(value2[valueKeys[i4]], other2[valueKeys[i4]]);
if (!rst) {
break;
}
}
return rst;
}
return false;
};
__webpack_exports__["a"] = isEqual3;
},
function(module3, exports2, __webpack_require__) {
var hierarchy2 = __webpack_require__(18);
module3.exports = function(root, options) {
var left2 = hierarchy2(root.data, options, true);
var right2 = hierarchy2(root.data, options, true);
var treeSize = root.children.length;
var rightTreeSize = Math.round(treeSize / 2);
var getSide = options.getSide || function(child2, index2) {
if (index2 < rightTreeSize) {
return "right";
}
return "left";
};
for (var i4 = 0; i4 < treeSize; i4++) {
var child = root.children[i4];
var side = getSide(child, i4);
if (side === "right") {
right2.children.push(child);
} else {
left2.children.push(child);
}
}
left2.eachNode(function(node) {
if (!node.isRoot()) {
node.side = "left";
}
});
right2.eachNode(function(node) {
if (!node.isRoot()) {
node.side = "right";
}
});
return {
left: left2,
right: right2
};
};
},
function(module3, exports2, __webpack_require__) {
var hierarchy2 = {
compactBox: __webpack_require__(32),
dendrogram: __webpack_require__(114),
indented: __webpack_require__(116),
mindmap: __webpack_require__(118)
};
module3.exports = hierarchy2;
},
function(module3, exports2, __webpack_require__) {
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
var TreeLayout = __webpack_require__(11);
var nonLayeredTidyTree = __webpack_require__(113);
var doTreeLayout = __webpack_require__(17);
var util = __webpack_require__(7);
var CompactBoxTreeLayout = /* @__PURE__ */ function(_TreeLayout) {
_inheritsLoose(CompactBoxTreeLayout2, _TreeLayout);
function CompactBoxTreeLayout2() {
return _TreeLayout.apply(this, arguments) || this;
}
var _proto = CompactBoxTreeLayout2.prototype;
_proto.execute = function execute() {
var me = this;
return doTreeLayout(me.rootNode, me.options, nonLayeredTidyTree);
};
return CompactBoxTreeLayout2;
}(TreeLayout);
var DEFAULT_OPTIONS37 = {};
function compactBoxLayout(root, options) {
options = util.assign({}, DEFAULT_OPTIONS37, options);
return new CompactBoxTreeLayout(root, options).execute();
}
module3.exports = compactBoxLayout;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
var __WEBPACK_IMPORTED_MODULE_0__contains__ = __webpack_require__(12);
__webpack_require__.d(__webpack_exports__, "contains", function() {
return __WEBPACK_IMPORTED_MODULE_0__contains__["a"];
});
__webpack_require__.d(__webpack_exports__, "includes", function() {
return __WEBPACK_IMPORTED_MODULE_0__contains__["a"];
});
var __WEBPACK_IMPORTED_MODULE_1__difference__ = __webpack_require__(34);
__webpack_require__.d(__webpack_exports__, "difference", function() {
return __WEBPACK_IMPORTED_MODULE_1__difference__["a"];
});
var __WEBPACK_IMPORTED_MODULE_2__find__ = __webpack_require__(35);
__webpack_require__.d(__webpack_exports__, "find", function() {
return __WEBPACK_IMPORTED_MODULE_2__find__["a"];
});
var __WEBPACK_IMPORTED_MODULE_3__find_index__ = __webpack_require__(36);
__webpack_require__.d(__webpack_exports__, "findIndex", function() {
return __WEBPACK_IMPORTED_MODULE_3__find_index__["a"];
});
var __WEBPACK_IMPORTED_MODULE_4__first_value__ = __webpack_require__(37);
__webpack_require__.d(__webpack_exports__, "firstValue", function() {
return __WEBPACK_IMPORTED_MODULE_4__first_value__["a"];
});
var __WEBPACK_IMPORTED_MODULE_5__flatten__ = __webpack_require__(38);
__webpack_require__.d(__webpack_exports__, "flatten", function() {
return __WEBPACK_IMPORTED_MODULE_5__flatten__["a"];
});
var __WEBPACK_IMPORTED_MODULE_6__flatten_deep__ = __webpack_require__(39);
__webpack_require__.d(__webpack_exports__, "flattenDeep", function() {
return __WEBPACK_IMPORTED_MODULE_6__flatten_deep__["a"];
});
var __WEBPACK_IMPORTED_MODULE_7__get_range__ = __webpack_require__(40);
__webpack_require__.d(__webpack_exports__, "getRange", function() {
return __WEBPACK_IMPORTED_MODULE_7__get_range__["a"];
});
var __WEBPACK_IMPORTED_MODULE_8__pull__ = __webpack_require__(41);
__webpack_require__.d(__webpack_exports__, "pull", function() {
return __WEBPACK_IMPORTED_MODULE_8__pull__["a"];
});
var __WEBPACK_IMPORTED_MODULE_9__pull_at__ = __webpack_require__(21);
__webpack_require__.d(__webpack_exports__, "pullAt", function() {
return __WEBPACK_IMPORTED_MODULE_9__pull_at__["a"];
});
var __WEBPACK_IMPORTED_MODULE_10__reduce__ = __webpack_require__(42);
__webpack_require__.d(__webpack_exports__, "reduce", function() {
return __WEBPACK_IMPORTED_MODULE_10__reduce__["a"];
});
var __WEBPACK_IMPORTED_MODULE_11__remove__ = __webpack_require__(43);
__webpack_require__.d(__webpack_exports__, "remove", function() {
return __WEBPACK_IMPORTED_MODULE_11__remove__["a"];
});
var __WEBPACK_IMPORTED_MODULE_12__sort_by__ = __webpack_require__(44);
__webpack_require__.d(__webpack_exports__, "sortBy", function() {
return __WEBPACK_IMPORTED_MODULE_12__sort_by__["a"];
});
var __WEBPACK_IMPORTED_MODULE_13__union__ = __webpack_require__(45);
__webpack_require__.d(__webpack_exports__, "union", function() {
return __WEBPACK_IMPORTED_MODULE_13__union__["a"];
});
var __WEBPACK_IMPORTED_MODULE_14__uniq__ = __webpack_require__(22);
__webpack_require__.d(__webpack_exports__, "uniq", function() {
return __WEBPACK_IMPORTED_MODULE_14__uniq__["a"];
});
var __WEBPACK_IMPORTED_MODULE_15__values_of_key__ = __webpack_require__(46);
__webpack_require__.d(__webpack_exports__, "valuesOfKey", function() {
return __WEBPACK_IMPORTED_MODULE_15__values_of_key__["a"];
});
var __WEBPACK_IMPORTED_MODULE_16__head__ = __webpack_require__(47);
__webpack_require__.d(__webpack_exports__, "head", function() {
return __WEBPACK_IMPORTED_MODULE_16__head__["a"];
});
var __WEBPACK_IMPORTED_MODULE_17__last__ = __webpack_require__(48);
__webpack_require__.d(__webpack_exports__, "last", function() {
return __WEBPACK_IMPORTED_MODULE_17__last__["a"];
});
var __WEBPACK_IMPORTED_MODULE_18__starts_with__ = __webpack_require__(49);
__webpack_require__.d(__webpack_exports__, "startsWith", function() {
return __WEBPACK_IMPORTED_MODULE_18__starts_with__["a"];
});
var __WEBPACK_IMPORTED_MODULE_19__ends_with__ = __webpack_require__(50);
__webpack_require__.d(__webpack_exports__, "endsWith", function() {
return __WEBPACK_IMPORTED_MODULE_19__ends_with__["a"];
});
var __WEBPACK_IMPORTED_MODULE_20__filter__ = __webpack_require__(14);
__webpack_require__.d(__webpack_exports__, "filter", function() {
return __WEBPACK_IMPORTED_MODULE_20__filter__["a"];
});
var __WEBPACK_IMPORTED_MODULE_21__every__ = __webpack_require__(51);
__webpack_require__.d(__webpack_exports__, "every", function() {
return __WEBPACK_IMPORTED_MODULE_21__every__["a"];
});
var __WEBPACK_IMPORTED_MODULE_22__some__ = __webpack_require__(52);
__webpack_require__.d(__webpack_exports__, "some", function() {
return __WEBPACK_IMPORTED_MODULE_22__some__["a"];
});
var __WEBPACK_IMPORTED_MODULE_23__group__ = __webpack_require__(53);
__webpack_require__.d(__webpack_exports__, "group", function() {
return __WEBPACK_IMPORTED_MODULE_23__group__["a"];
});
var __WEBPACK_IMPORTED_MODULE_24__group_by__ = __webpack_require__(24);
__webpack_require__.d(__webpack_exports__, "groupBy", function() {
return __WEBPACK_IMPORTED_MODULE_24__group_by__["a"];
});
var __WEBPACK_IMPORTED_MODULE_25__group_to_map__ = __webpack_require__(23);
__webpack_require__.d(__webpack_exports__, "groupToMap", function() {
return __WEBPACK_IMPORTED_MODULE_25__group_to_map__["a"];
});
var __WEBPACK_IMPORTED_MODULE_26__get_wrap_behavior__ = __webpack_require__(54);
__webpack_require__.d(__webpack_exports__, "getWrapBehavior", function() {
return __WEBPACK_IMPORTED_MODULE_26__get_wrap_behavior__["a"];
});
var __WEBPACK_IMPORTED_MODULE_27__wrap_behavior__ = __webpack_require__(55);
__webpack_require__.d(__webpack_exports__, "wrapBehavior", function() {
return __WEBPACK_IMPORTED_MODULE_27__wrap_behavior__["a"];
});
var __WEBPACK_IMPORTED_MODULE_28__number2color__ = __webpack_require__(56);
__webpack_require__.d(__webpack_exports__, "number2color", function() {
return __WEBPACK_IMPORTED_MODULE_28__number2color__["a"];
});
var __WEBPACK_IMPORTED_MODULE_29__parse_radius__ = __webpack_require__(57);
__webpack_require__.d(__webpack_exports__, "parseRadius", function() {
return __WEBPACK_IMPORTED_MODULE_29__parse_radius__["a"];
});
var __WEBPACK_IMPORTED_MODULE_30__clamp__ = __webpack_require__(58);
__webpack_require__.d(__webpack_exports__, "clamp", function() {
return __WEBPACK_IMPORTED_MODULE_30__clamp__["a"];
});
var __WEBPACK_IMPORTED_MODULE_31__fixed_base__ = __webpack_require__(59);
__webpack_require__.d(__webpack_exports__, "fixedBase", function() {
return __WEBPACK_IMPORTED_MODULE_31__fixed_base__["a"];
});
var __WEBPACK_IMPORTED_MODULE_32__is_decimal__ = __webpack_require__(60);
__webpack_require__.d(__webpack_exports__, "isDecimal", function() {
return __WEBPACK_IMPORTED_MODULE_32__is_decimal__["a"];
});
var __WEBPACK_IMPORTED_MODULE_33__is_even__ = __webpack_require__(61);
__webpack_require__.d(__webpack_exports__, "isEven", function() {
return __WEBPACK_IMPORTED_MODULE_33__is_even__["a"];
});
var __WEBPACK_IMPORTED_MODULE_34__is_integer__ = __webpack_require__(62);
__webpack_require__.d(__webpack_exports__, "isInteger", function() {
return __WEBPACK_IMPORTED_MODULE_34__is_integer__["a"];
});
var __WEBPACK_IMPORTED_MODULE_35__is_negative__ = __webpack_require__(63);
__webpack_require__.d(__webpack_exports__, "isNegative", function() {
return __WEBPACK_IMPORTED_MODULE_35__is_negative__["a"];
});
var __WEBPACK_IMPORTED_MODULE_36__is_number_equal__ = __webpack_require__(64);
__webpack_require__.d(__webpack_exports__, "isNumberEqual", function() {
return __WEBPACK_IMPORTED_MODULE_36__is_number_equal__["a"];
});
var __WEBPACK_IMPORTED_MODULE_37__is_odd__ = __webpack_require__(65);
__webpack_require__.d(__webpack_exports__, "isOdd", function() {
return __WEBPACK_IMPORTED_MODULE_37__is_odd__["a"];
});
var __WEBPACK_IMPORTED_MODULE_38__is_positive__ = __webpack_require__(66);
__webpack_require__.d(__webpack_exports__, "isPositive", function() {
return __WEBPACK_IMPORTED_MODULE_38__is_positive__["a"];
});
var __WEBPACK_IMPORTED_MODULE_39__max_by__ = __webpack_require__(67);
__webpack_require__.d(__webpack_exports__, "maxBy", function() {
return __WEBPACK_IMPORTED_MODULE_39__max_by__["a"];
});
var __WEBPACK_IMPORTED_MODULE_40__min_by__ = __webpack_require__(68);
__webpack_require__.d(__webpack_exports__, "minBy", function() {
return __WEBPACK_IMPORTED_MODULE_40__min_by__["a"];
});
var __WEBPACK_IMPORTED_MODULE_41__mod__ = __webpack_require__(69);
__webpack_require__.d(__webpack_exports__, "mod", function() {
return __WEBPACK_IMPORTED_MODULE_41__mod__["a"];
});
var __WEBPACK_IMPORTED_MODULE_42__to_degree__ = __webpack_require__(70);
__webpack_require__.d(__webpack_exports__, "toDegree", function() {
return __WEBPACK_IMPORTED_MODULE_42__to_degree__["a"];
});
var __WEBPACK_IMPORTED_MODULE_43__to_integer__ = __webpack_require__(71);
__webpack_require__.d(__webpack_exports__, "toInteger", function() {
return __WEBPACK_IMPORTED_MODULE_43__to_integer__["a"];
});
var __WEBPACK_IMPORTED_MODULE_44__to_radian__ = __webpack_require__(72);
__webpack_require__.d(__webpack_exports__, "toRadian", function() {
return __WEBPACK_IMPORTED_MODULE_44__to_radian__["a"];
});
var __WEBPACK_IMPORTED_MODULE_45__for_in__ = __webpack_require__(73);
__webpack_require__.d(__webpack_exports__, "forIn", function() {
return __WEBPACK_IMPORTED_MODULE_45__for_in__["a"];
});
var __WEBPACK_IMPORTED_MODULE_46__has__ = __webpack_require__(25);
__webpack_require__.d(__webpack_exports__, "has", function() {
return __WEBPACK_IMPORTED_MODULE_46__has__["a"];
});
var __WEBPACK_IMPORTED_MODULE_47__has_key__ = __webpack_require__(74);
__webpack_require__.d(__webpack_exports__, "hasKey", function() {
return __WEBPACK_IMPORTED_MODULE_47__has_key__["a"];
});
var __WEBPACK_IMPORTED_MODULE_48__has_value__ = __webpack_require__(75);
__webpack_require__.d(__webpack_exports__, "hasValue", function() {
return __WEBPACK_IMPORTED_MODULE_48__has_value__["a"];
});
var __WEBPACK_IMPORTED_MODULE_49__keys__ = __webpack_require__(20);
__webpack_require__.d(__webpack_exports__, "keys", function() {
return __WEBPACK_IMPORTED_MODULE_49__keys__["a"];
});
var __WEBPACK_IMPORTED_MODULE_50__is_match__ = __webpack_require__(19);
__webpack_require__.d(__webpack_exports__, "isMatch", function() {
return __WEBPACK_IMPORTED_MODULE_50__is_match__["a"];
});
var __WEBPACK_IMPORTED_MODULE_51__values__ = __webpack_require__(26);
__webpack_require__.d(__webpack_exports__, "values", function() {
return __WEBPACK_IMPORTED_MODULE_51__values__["a"];
});
var __WEBPACK_IMPORTED_MODULE_52__lower_case__ = __webpack_require__(76);
__webpack_require__.d(__webpack_exports__, "lowerCase", function() {
return __WEBPACK_IMPORTED_MODULE_52__lower_case__["a"];
});
var __WEBPACK_IMPORTED_MODULE_53__lower_first__ = __webpack_require__(77);
__webpack_require__.d(__webpack_exports__, "lowerFirst", function() {
return __WEBPACK_IMPORTED_MODULE_53__lower_first__["a"];
});
var __WEBPACK_IMPORTED_MODULE_54__substitute__ = __webpack_require__(78);
__webpack_require__.d(__webpack_exports__, "substitute", function() {
return __WEBPACK_IMPORTED_MODULE_54__substitute__["a"];
});
var __WEBPACK_IMPORTED_MODULE_55__upper_case__ = __webpack_require__(79);
__webpack_require__.d(__webpack_exports__, "upperCase", function() {
return __WEBPACK_IMPORTED_MODULE_55__upper_case__["a"];
});
var __WEBPACK_IMPORTED_MODULE_56__upper_first__ = __webpack_require__(80);
__webpack_require__.d(__webpack_exports__, "upperFirst", function() {
return __WEBPACK_IMPORTED_MODULE_56__upper_first__["a"];
});
var __WEBPACK_IMPORTED_MODULE_57__get_type__ = __webpack_require__(27);
__webpack_require__.d(__webpack_exports__, "getType", function() {
return __WEBPACK_IMPORTED_MODULE_57__get_type__["a"];
});
var __WEBPACK_IMPORTED_MODULE_58__is_arguments__ = __webpack_require__(81);
__webpack_require__.d(__webpack_exports__, "isArguments", function() {
return __WEBPACK_IMPORTED_MODULE_58__is_arguments__["a"];
});
var __WEBPACK_IMPORTED_MODULE_59__is_array__ = __webpack_require__(0);
__webpack_require__.d(__webpack_exports__, "isArray", function() {
return __WEBPACK_IMPORTED_MODULE_59__is_array__["a"];
});
var __WEBPACK_IMPORTED_MODULE_60__is_array_like__ = __webpack_require__(1);
__webpack_require__.d(__webpack_exports__, "isArrayLike", function() {
return __WEBPACK_IMPORTED_MODULE_60__is_array_like__["a"];
});
var __WEBPACK_IMPORTED_MODULE_61__is_boolean__ = __webpack_require__(82);
__webpack_require__.d(__webpack_exports__, "isBoolean", function() {
return __WEBPACK_IMPORTED_MODULE_61__is_boolean__["a"];
});
var __WEBPACK_IMPORTED_MODULE_62__is_date__ = __webpack_require__(83);
__webpack_require__.d(__webpack_exports__, "isDate", function() {
return __WEBPACK_IMPORTED_MODULE_62__is_date__["a"];
});
var __WEBPACK_IMPORTED_MODULE_63__is_error__ = __webpack_require__(84);
__webpack_require__.d(__webpack_exports__, "isError", function() {
return __WEBPACK_IMPORTED_MODULE_63__is_error__["a"];
});
var __WEBPACK_IMPORTED_MODULE_64__is_function__ = __webpack_require__(3);
__webpack_require__.d(__webpack_exports__, "isFunction", function() {
return __WEBPACK_IMPORTED_MODULE_64__is_function__["a"];
});
var __WEBPACK_IMPORTED_MODULE_65__is_finite__ = __webpack_require__(85);
__webpack_require__.d(__webpack_exports__, "isFinite", function() {
return __WEBPACK_IMPORTED_MODULE_65__is_finite__["a"];
});
var __WEBPACK_IMPORTED_MODULE_66__is_nil__ = __webpack_require__(6);
__webpack_require__.d(__webpack_exports__, "isNil", function() {
return __WEBPACK_IMPORTED_MODULE_66__is_nil__["a"];
});
var __WEBPACK_IMPORTED_MODULE_67__is_null__ = __webpack_require__(86);
__webpack_require__.d(__webpack_exports__, "isNull", function() {
return __WEBPACK_IMPORTED_MODULE_67__is_null__["a"];
});
var __WEBPACK_IMPORTED_MODULE_68__is_number__ = __webpack_require__(5);
__webpack_require__.d(__webpack_exports__, "isNumber", function() {
return __WEBPACK_IMPORTED_MODULE_68__is_number__["a"];
});
var __WEBPACK_IMPORTED_MODULE_69__is_object__ = __webpack_require__(13);
__webpack_require__.d(__webpack_exports__, "isObject", function() {
return __WEBPACK_IMPORTED_MODULE_69__is_object__["a"];
});
var __WEBPACK_IMPORTED_MODULE_70__is_object_like__ = __webpack_require__(15);
__webpack_require__.d(__webpack_exports__, "isObjectLike", function() {
return __WEBPACK_IMPORTED_MODULE_70__is_object_like__["a"];
});
var __WEBPACK_IMPORTED_MODULE_71__is_plain_object__ = __webpack_require__(9);
__webpack_require__.d(__webpack_exports__, "isPlainObject", function() {
return __WEBPACK_IMPORTED_MODULE_71__is_plain_object__["a"];
});
var __WEBPACK_IMPORTED_MODULE_72__is_prototype__ = __webpack_require__(28);
__webpack_require__.d(__webpack_exports__, "isPrototype", function() {
return __WEBPACK_IMPORTED_MODULE_72__is_prototype__["a"];
});
var __WEBPACK_IMPORTED_MODULE_73__is_reg_exp__ = __webpack_require__(87);
__webpack_require__.d(__webpack_exports__, "isRegExp", function() {
return __WEBPACK_IMPORTED_MODULE_73__is_reg_exp__["a"];
});
var __WEBPACK_IMPORTED_MODULE_74__is_string__ = __webpack_require__(8);
__webpack_require__.d(__webpack_exports__, "isString", function() {
return __WEBPACK_IMPORTED_MODULE_74__is_string__["a"];
});
var __WEBPACK_IMPORTED_MODULE_75__is_type__ = __webpack_require__(4);
__webpack_require__.d(__webpack_exports__, "isType", function() {
return __WEBPACK_IMPORTED_MODULE_75__is_type__["a"];
});
var __WEBPACK_IMPORTED_MODULE_76__is_undefined__ = __webpack_require__(88);
__webpack_require__.d(__webpack_exports__, "isUndefined", function() {
return __WEBPACK_IMPORTED_MODULE_76__is_undefined__["a"];
});
var __WEBPACK_IMPORTED_MODULE_77__is_element__ = __webpack_require__(89);
__webpack_require__.d(__webpack_exports__, "isElement", function() {
return __WEBPACK_IMPORTED_MODULE_77__is_element__["a"];
});
var __WEBPACK_IMPORTED_MODULE_78__request_animation_frame__ = __webpack_require__(90);
__webpack_require__.d(__webpack_exports__, "requestAnimationFrame", function() {
return __WEBPACK_IMPORTED_MODULE_78__request_animation_frame__["a"];
});
var __WEBPACK_IMPORTED_MODULE_79__clear_animation_frame__ = __webpack_require__(91);
__webpack_require__.d(__webpack_exports__, "clearAnimationFrame", function() {
return __WEBPACK_IMPORTED_MODULE_79__clear_animation_frame__["a"];
});
var __WEBPACK_IMPORTED_MODULE_80__augment__ = __webpack_require__(92);
__webpack_require__.d(__webpack_exports__, "augment", function() {
return __WEBPACK_IMPORTED_MODULE_80__augment__["a"];
});
var __WEBPACK_IMPORTED_MODULE_81__clone__ = __webpack_require__(93);
__webpack_require__.d(__webpack_exports__, "clone", function() {
return __WEBPACK_IMPORTED_MODULE_81__clone__["a"];
});
var __WEBPACK_IMPORTED_MODULE_82__debounce__ = __webpack_require__(94);
__webpack_require__.d(__webpack_exports__, "debounce", function() {
return __WEBPACK_IMPORTED_MODULE_82__debounce__["a"];
});
var __WEBPACK_IMPORTED_MODULE_83__memoize__ = __webpack_require__(95);
__webpack_require__.d(__webpack_exports__, "memoize", function() {
return __WEBPACK_IMPORTED_MODULE_83__memoize__["a"];
});
var __WEBPACK_IMPORTED_MODULE_84__deep_mix__ = __webpack_require__(96);
__webpack_require__.d(__webpack_exports__, "deepMix", function() {
return __WEBPACK_IMPORTED_MODULE_84__deep_mix__["a"];
});
var __WEBPACK_IMPORTED_MODULE_85__each__ = __webpack_require__(2);
__webpack_require__.d(__webpack_exports__, "each", function() {
return __WEBPACK_IMPORTED_MODULE_85__each__["a"];
});
var __WEBPACK_IMPORTED_MODULE_86__extend__ = __webpack_require__(97);
__webpack_require__.d(__webpack_exports__, "extend", function() {
return __WEBPACK_IMPORTED_MODULE_86__extend__["a"];
});
var __WEBPACK_IMPORTED_MODULE_87__index_of__ = __webpack_require__(98);
__webpack_require__.d(__webpack_exports__, "indexOf", function() {
return __WEBPACK_IMPORTED_MODULE_87__index_of__["a"];
});
var __WEBPACK_IMPORTED_MODULE_88__is_empty__ = __webpack_require__(99);
__webpack_require__.d(__webpack_exports__, "isEmpty", function() {
return __WEBPACK_IMPORTED_MODULE_88__is_empty__["a"];
});
var __WEBPACK_IMPORTED_MODULE_89__is_equal__ = __webpack_require__(29);
__webpack_require__.d(__webpack_exports__, "isEqual", function() {
return __WEBPACK_IMPORTED_MODULE_89__is_equal__["a"];
});
var __WEBPACK_IMPORTED_MODULE_90__is_equal_with__ = __webpack_require__(100);
__webpack_require__.d(__webpack_exports__, "isEqualWith", function() {
return __WEBPACK_IMPORTED_MODULE_90__is_equal_with__["a"];
});
var __WEBPACK_IMPORTED_MODULE_91__map__ = __webpack_require__(101);
__webpack_require__.d(__webpack_exports__, "map", function() {
return __WEBPACK_IMPORTED_MODULE_91__map__["a"];
});
var __WEBPACK_IMPORTED_MODULE_92__map_values__ = __webpack_require__(102);
__webpack_require__.d(__webpack_exports__, "mapValues", function() {
return __WEBPACK_IMPORTED_MODULE_92__map_values__["a"];
});
var __WEBPACK_IMPORTED_MODULE_93__mix__ = __webpack_require__(16);
__webpack_require__.d(__webpack_exports__, "mix", function() {
return __WEBPACK_IMPORTED_MODULE_93__mix__["a"];
});
__webpack_require__.d(__webpack_exports__, "assign", function() {
return __WEBPACK_IMPORTED_MODULE_93__mix__["a"];
});
var __WEBPACK_IMPORTED_MODULE_94__get__ = __webpack_require__(103);
__webpack_require__.d(__webpack_exports__, "get", function() {
return __WEBPACK_IMPORTED_MODULE_94__get__["a"];
});
var __WEBPACK_IMPORTED_MODULE_95__set__ = __webpack_require__(104);
__webpack_require__.d(__webpack_exports__, "set", function() {
return __WEBPACK_IMPORTED_MODULE_95__set__["a"];
});
var __WEBPACK_IMPORTED_MODULE_96__pick__ = __webpack_require__(105);
__webpack_require__.d(__webpack_exports__, "pick", function() {
return __WEBPACK_IMPORTED_MODULE_96__pick__["a"];
});
var __WEBPACK_IMPORTED_MODULE_97__throttle__ = __webpack_require__(106);
__webpack_require__.d(__webpack_exports__, "throttle", function() {
return __WEBPACK_IMPORTED_MODULE_97__throttle__["a"];
});
var __WEBPACK_IMPORTED_MODULE_98__to_array__ = __webpack_require__(107);
__webpack_require__.d(__webpack_exports__, "toArray", function() {
return __WEBPACK_IMPORTED_MODULE_98__to_array__["a"];
});
var __WEBPACK_IMPORTED_MODULE_99__to_string__ = __webpack_require__(10);
__webpack_require__.d(__webpack_exports__, "toString", function() {
return __WEBPACK_IMPORTED_MODULE_99__to_string__["a"];
});
var __WEBPACK_IMPORTED_MODULE_100__unique_id__ = __webpack_require__(108);
__webpack_require__.d(__webpack_exports__, "uniqueId", function() {
return __WEBPACK_IMPORTED_MODULE_100__unique_id__["a"];
});
var __WEBPACK_IMPORTED_MODULE_101__noop__ = __webpack_require__(109);
__webpack_require__.d(__webpack_exports__, "noop", function() {
return __WEBPACK_IMPORTED_MODULE_101__noop__["a"];
});
var __WEBPACK_IMPORTED_MODULE_102__identity__ = __webpack_require__(110);
__webpack_require__.d(__webpack_exports__, "identity", function() {
return __WEBPACK_IMPORTED_MODULE_102__identity__["a"];
});
var __WEBPACK_IMPORTED_MODULE_103__size__ = __webpack_require__(111);
__webpack_require__.d(__webpack_exports__, "size", function() {
return __WEBPACK_IMPORTED_MODULE_103__size__["a"];
});
var __WEBPACK_IMPORTED_MODULE_104__cache__ = __webpack_require__(112);
__webpack_require__.d(__webpack_exports__, "Cache", function() {
return __WEBPACK_IMPORTED_MODULE_104__cache__["a"];
});
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__filter__ = __webpack_require__(14);
var __WEBPACK_IMPORTED_MODULE_1__contains__ = __webpack_require__(12);
var difference2 = function(arr, values2) {
if (values2 === void 0) {
values2 = [];
}
return Object(__WEBPACK_IMPORTED_MODULE_0__filter__["a"])(arr, function(value2) {
return !Object(__WEBPACK_IMPORTED_MODULE_1__contains__["a"])(values2, value2);
});
};
__webpack_exports__["a"] = difference2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_function__ = __webpack_require__(3);
var __WEBPACK_IMPORTED_MODULE_1__is_match__ = __webpack_require__(19);
var __WEBPACK_IMPORTED_MODULE_2__is_array__ = __webpack_require__(0);
var __WEBPACK_IMPORTED_MODULE_3__is_plain_object__ = __webpack_require__(9);
function find4(arr, predicate) {
if (!Object(__WEBPACK_IMPORTED_MODULE_2__is_array__["a"])(arr))
return null;
var _predicate;
if (Object(__WEBPACK_IMPORTED_MODULE_0__is_function__["a"])(predicate)) {
_predicate = predicate;
}
if (Object(__WEBPACK_IMPORTED_MODULE_3__is_plain_object__["a"])(predicate)) {
_predicate = function(a4) {
return Object(__WEBPACK_IMPORTED_MODULE_1__is_match__["a"])(a4, predicate);
};
}
if (_predicate) {
for (var i4 = 0; i4 < arr.length; i4 += 1) {
if (_predicate(arr[i4])) {
return arr[i4];
}
}
}
return null;
}
__webpack_exports__["a"] = find4;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
function findIndex2(arr, predicate, fromIndex) {
if (fromIndex === void 0) {
fromIndex = 0;
}
for (var i4 = fromIndex; i4 < arr.length; i4++) {
if (predicate(arr[i4], i4)) {
return i4;
}
}
return -1;
}
__webpack_exports__["a"] = findIndex2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_nil__ = __webpack_require__(6);
var __WEBPACK_IMPORTED_MODULE_1__is_array__ = __webpack_require__(0);
var firstValue2 = function(data3, name) {
var rst = null;
for (var i4 = 0; i4 < data3.length; i4++) {
var obj = data3[i4];
var value2 = obj[name];
if (!Object(__WEBPACK_IMPORTED_MODULE_0__is_nil__["a"])(value2)) {
if (Object(__WEBPACK_IMPORTED_MODULE_1__is_array__["a"])(value2)) {
rst = value2[0];
} else {
rst = value2;
}
break;
}
}
return rst;
};
__webpack_exports__["a"] = firstValue2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_array__ = __webpack_require__(0);
var flatten2 = function(arr) {
if (!Object(__WEBPACK_IMPORTED_MODULE_0__is_array__["a"])(arr)) {
return [];
}
var rst = [];
for (var i4 = 0; i4 < arr.length; i4++) {
rst = rst.concat(arr[i4]);
}
return rst;
};
__webpack_exports__["a"] = flatten2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_array__ = __webpack_require__(0);
var flattenDeep = function(arr, result) {
if (result === void 0) {
result = [];
}
if (!Object(__WEBPACK_IMPORTED_MODULE_0__is_array__["a"])(arr)) {
result.push(arr);
} else {
for (var i4 = 0; i4 < arr.length; i4 += 1) {
flattenDeep(arr[i4], result);
}
}
return result;
};
__webpack_exports__["a"] = flattenDeep;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_array__ = __webpack_require__(0);
var __WEBPACK_IMPORTED_MODULE_1__filter__ = __webpack_require__(14);
var getRange2 = function(values2) {
values2 = Object(__WEBPACK_IMPORTED_MODULE_1__filter__["a"])(values2, function(v3) {
return !isNaN(v3);
});
if (!values2.length) {
return {
min: 0,
max: 0
};
}
if (Object(__WEBPACK_IMPORTED_MODULE_0__is_array__["a"])(values2[0])) {
var tmp = [];
for (var i4 = 0; i4 < values2.length; i4++) {
tmp = tmp.concat(values2[i4]);
}
values2 = tmp;
}
var max8 = Math.max.apply(null, values2);
var min7 = Math.min.apply(null, values2);
return {
min: min7,
max: max8
};
};
__webpack_exports__["a"] = getRange2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var arrPrototype2 = Array.prototype;
var splice3 = arrPrototype2.splice;
var indexOf3 = arrPrototype2.indexOf;
var pull = function(arr) {
var values2 = [];
for (var _i = 1; _i < arguments.length; _i++) {
values2[_i - 1] = arguments[_i];
}
for (var i4 = 0; i4 < values2.length; i4++) {
var value2 = values2[i4];
var fromIndex = -1;
while ((fromIndex = indexOf3.call(arr, value2)) > -1) {
splice3.call(arr, fromIndex, 1);
}
}
return arr;
};
__webpack_exports__["a"] = pull;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__each__ = __webpack_require__(2);
var __WEBPACK_IMPORTED_MODULE_1__is_array__ = __webpack_require__(0);
var __WEBPACK_IMPORTED_MODULE_2__is_plain_object__ = __webpack_require__(9);
var reduce2 = function(arr, fn2, init) {
if (!Object(__WEBPACK_IMPORTED_MODULE_1__is_array__["a"])(arr) && !Object(__WEBPACK_IMPORTED_MODULE_2__is_plain_object__["a"])(arr)) {
return arr;
}
var result = init;
Object(__WEBPACK_IMPORTED_MODULE_0__each__["a"])(arr, function(data3, i4) {
result = fn2(result, data3, i4);
});
return result;
};
__webpack_exports__["a"] = reduce2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_array_like__ = __webpack_require__(1);
var __WEBPACK_IMPORTED_MODULE_1__pull_at__ = __webpack_require__(21);
var remove2 = function(arr, predicate) {
var result = [];
if (!Object(__WEBPACK_IMPORTED_MODULE_0__is_array_like__["a"])(arr)) {
return result;
}
var i4 = -1;
var indexes = [];
var length5 = arr.length;
while (++i4 < length5) {
var value2 = arr[i4];
if (predicate(value2, i4, arr)) {
result.push(value2);
indexes.push(i4);
}
}
Object(__WEBPACK_IMPORTED_MODULE_1__pull_at__["a"])(arr, indexes);
return result;
};
__webpack_exports__["a"] = remove2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_array__ = __webpack_require__(0);
var __WEBPACK_IMPORTED_MODULE_1__is_string__ = __webpack_require__(8);
var __WEBPACK_IMPORTED_MODULE_2__is_function__ = __webpack_require__(3);
function sortBy2(arr, key) {
var comparer;
if (Object(__WEBPACK_IMPORTED_MODULE_2__is_function__["a"])(key)) {
comparer = function(a4, b10) {
return key(a4) - key(b10);
};
} else {
var keys_1 = [];
if (Object(__WEBPACK_IMPORTED_MODULE_1__is_string__["a"])(key)) {
keys_1.push(key);
} else if (Object(__WEBPACK_IMPORTED_MODULE_0__is_array__["a"])(key)) {
keys_1 = key;
}
comparer = function(a4, b10) {
for (var i4 = 0; i4 < keys_1.length; i4 += 1) {
var prop = keys_1[i4];
if (a4[prop] > b10[prop]) {
return 1;
}
if (a4[prop] < b10[prop]) {
return -1;
}
}
return 0;
};
}
arr.sort(comparer);
return arr;
}
__webpack_exports__["a"] = sortBy2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__uniq__ = __webpack_require__(22);
var union = function() {
var sources = [];
for (var _i = 0; _i < arguments.length; _i++) {
sources[_i] = arguments[_i];
}
return Object(__WEBPACK_IMPORTED_MODULE_0__uniq__["a"])([].concat.apply([], sources));
};
__webpack_exports__["a"] = union;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__each__ = __webpack_require__(2);
var __WEBPACK_IMPORTED_MODULE_1__is_array__ = __webpack_require__(0);
var __WEBPACK_IMPORTED_MODULE_2__is_nil__ = __webpack_require__(6);
__webpack_exports__["a"] = function(data3, name) {
var rst = [];
var tmpMap = {};
data3.forEach(function(obj) {
var value2 = obj[name];
if (!Object(__WEBPACK_IMPORTED_MODULE_2__is_nil__["a"])(value2)) {
if (!Object(__WEBPACK_IMPORTED_MODULE_1__is_array__["a"])(value2)) {
value2 = [value2];
}
Object(__WEBPACK_IMPORTED_MODULE_0__each__["a"])(value2, function(val) {
if (!tmpMap[val]) {
rst.push(val);
tmpMap[val] = true;
}
});
}
});
return rst;
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_exports__["a"] = head2;
var __WEBPACK_IMPORTED_MODULE_0__is_array_like__ = __webpack_require__(1);
function head2(o3) {
if (Object(__WEBPACK_IMPORTED_MODULE_0__is_array_like__["a"])(o3)) {
return o3[0];
}
return void 0;
}
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_exports__["a"] = last2;
var __WEBPACK_IMPORTED_MODULE_0__is_array_like__ = __webpack_require__(1);
function last2(o3) {
if (Object(__WEBPACK_IMPORTED_MODULE_0__is_array_like__["a"])(o3)) {
var arr = o3;
return arr[arr.length - 1];
}
return void 0;
}
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_array__ = __webpack_require__(0);
var __WEBPACK_IMPORTED_MODULE_1__is_string__ = __webpack_require__(8);
function startsWith(arr, e4) {
return Object(__WEBPACK_IMPORTED_MODULE_0__is_array__["a"])(arr) || Object(__WEBPACK_IMPORTED_MODULE_1__is_string__["a"])(arr) ? arr[0] === e4 : false;
}
__webpack_exports__["a"] = startsWith;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_array__ = __webpack_require__(0);
var __WEBPACK_IMPORTED_MODULE_1__is_string__ = __webpack_require__(8);
function endsWith(arr, e4) {
return Object(__WEBPACK_IMPORTED_MODULE_0__is_array__["a"])(arr) || Object(__WEBPACK_IMPORTED_MODULE_1__is_string__["a"])(arr) ? arr[arr.length - 1] === e4 : false;
}
__webpack_exports__["a"] = endsWith;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var every2 = function(arr, func) {
for (var i4 = 0; i4 < arr.length; i4++) {
if (!func(arr[i4], i4))
return false;
}
return true;
};
__webpack_exports__["a"] = every2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var some2 = function(arr, func) {
for (var i4 = 0; i4 < arr.length; i4++) {
if (func(arr[i4], i4))
return true;
}
return false;
};
__webpack_exports__["a"] = some2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__group_to_map__ = __webpack_require__(23);
__webpack_exports__["a"] = function(data3, condition) {
if (!condition) {
return [data3];
}
var groups = Object(__WEBPACK_IMPORTED_MODULE_0__group_to_map__["a"])(data3, condition);
var array = [];
for (var i4 in groups) {
array.push(groups[i4]);
}
return array;
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
function getWrapBehavior(obj, action) {
return obj["_wrap_" + action];
}
__webpack_exports__["a"] = getWrapBehavior;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
function wrapBehavior2(obj, action) {
if (obj["_wrap_" + action]) {
return obj["_wrap_" + action];
}
var method = function(e4) {
obj[action](e4);
};
obj["_wrap_" + action] = method;
return method;
}
__webpack_exports__["a"] = wrapBehavior2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var numColorCache = {};
function numberToColor(num) {
var color4 = numColorCache[num];
if (!color4) {
var str8 = num.toString(16);
for (var i4 = str8.length; i4 < 6; i4++) {
str8 = "0" + str8;
}
color4 = "#" + str8;
numColorCache[num] = color4;
}
return color4;
}
__webpack_exports__["a"] = numberToColor;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_array__ = __webpack_require__(0);
function parseRadius4(radius) {
var r1 = 0, r22 = 0, r32 = 0, r4 = 0;
if (Object(__WEBPACK_IMPORTED_MODULE_0__is_array__["a"])(radius)) {
if (radius.length === 1) {
r1 = r22 = r32 = r4 = radius[0];
} else if (radius.length === 2) {
r1 = r32 = radius[0];
r22 = r4 = radius[1];
} else if (radius.length === 3) {
r1 = radius[0];
r22 = r4 = radius[1];
r32 = radius[2];
} else {
r1 = radius[0];
r22 = radius[1];
r32 = radius[2];
r4 = radius[3];
}
} else {
r1 = r22 = r32 = r4 = radius;
}
return {
r1,
r2: r22,
r3: r32,
r4
};
}
__webpack_exports__["a"] = parseRadius4;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var clamp2 = function(a4, min7, max8) {
if (a4 < min7) {
return min7;
} else if (a4 > max8) {
return max8;
}
return a4;
};
__webpack_exports__["a"] = clamp2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var fixedBase2 = function(v3, base) {
var str8 = base.toString();
var index2 = str8.indexOf(".");
if (index2 === -1) {
return Math.round(v3);
}
var length5 = str8.substr(index2 + 1).length;
if (length5 > 20) {
length5 = 20;
}
return parseFloat(v3.toFixed(length5));
};
__webpack_exports__["a"] = fixedBase2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_number__ = __webpack_require__(5);
var isDecimal = function(num) {
return Object(__WEBPACK_IMPORTED_MODULE_0__is_number__["a"])(num) && num % 1 !== 0;
};
__webpack_exports__["a"] = isDecimal;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_number__ = __webpack_require__(5);
var isEven = function(num) {
return Object(__WEBPACK_IMPORTED_MODULE_0__is_number__["a"])(num) && num % 2 === 0;
};
__webpack_exports__["a"] = isEven;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_number__ = __webpack_require__(5);
var isInteger3 = Number.isInteger ? Number.isInteger : function(num) {
return Object(__WEBPACK_IMPORTED_MODULE_0__is_number__["a"])(num) && num % 1 === 0;
};
__webpack_exports__["a"] = isInteger3;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_number__ = __webpack_require__(5);
var isNegative = function(num) {
return Object(__WEBPACK_IMPORTED_MODULE_0__is_number__["a"])(num) && num < 0;
};
__webpack_exports__["a"] = isNegative;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_exports__["a"] = isNumberEqual3;
var PRECISION2 = 1e-5;
function isNumberEqual3(a4, b10, precision) {
if (precision === void 0) {
precision = PRECISION2;
}
return Math.abs(a4 - b10) < precision;
}
;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_number__ = __webpack_require__(5);
var isOdd = function(num) {
return Object(__WEBPACK_IMPORTED_MODULE_0__is_number__["a"])(num) && num % 2 !== 0;
};
__webpack_exports__["a"] = isOdd;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_number__ = __webpack_require__(5);
var isPositive = function(num) {
return Object(__WEBPACK_IMPORTED_MODULE_0__is_number__["a"])(num) && num > 0;
};
__webpack_exports__["a"] = isPositive;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__each__ = __webpack_require__(2);
var __WEBPACK_IMPORTED_MODULE_1__is_array__ = __webpack_require__(0);
var __WEBPACK_IMPORTED_MODULE_2__is_function__ = __webpack_require__(3);
__webpack_exports__["a"] = function(arr, fn2) {
if (!Object(__WEBPACK_IMPORTED_MODULE_1__is_array__["a"])(arr)) {
return void 0;
}
var max8 = arr[0];
var maxData;
if (Object(__WEBPACK_IMPORTED_MODULE_2__is_function__["a"])(fn2)) {
maxData = fn2(arr[0]);
} else {
maxData = arr[0][fn2];
}
var data3;
Object(__WEBPACK_IMPORTED_MODULE_0__each__["a"])(arr, function(val) {
if (Object(__WEBPACK_IMPORTED_MODULE_2__is_function__["a"])(fn2)) {
data3 = fn2(val);
} else {
data3 = val[fn2];
}
if (data3 > maxData) {
max8 = val;
maxData = data3;
}
});
return max8;
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__each__ = __webpack_require__(2);
var __WEBPACK_IMPORTED_MODULE_1__is_array__ = __webpack_require__(0);
var __WEBPACK_IMPORTED_MODULE_2__is_function__ = __webpack_require__(3);
__webpack_exports__["a"] = function(arr, fn2) {
if (!Object(__WEBPACK_IMPORTED_MODULE_1__is_array__["a"])(arr)) {
return void 0;
}
var min7 = arr[0];
var minData;
if (Object(__WEBPACK_IMPORTED_MODULE_2__is_function__["a"])(fn2)) {
minData = fn2(arr[0]);
} else {
minData = arr[0][fn2];
}
var data3;
Object(__WEBPACK_IMPORTED_MODULE_0__each__["a"])(arr, function(val) {
if (Object(__WEBPACK_IMPORTED_MODULE_2__is_function__["a"])(fn2)) {
data3 = fn2(val);
} else {
data3 = val[fn2];
}
if (data3 < minData) {
min7 = val;
minData = data3;
}
});
return min7;
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var mod3 = function(n3, m4) {
return (n3 % m4 + m4) % m4;
};
__webpack_exports__["a"] = mod3;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var DEGREE2 = 180 / Math.PI;
var toDegree = function(radian) {
return DEGREE2 * radian;
};
__webpack_exports__["a"] = toDegree;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_exports__["a"] = parseInt;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var RADIAN2 = Math.PI / 180;
var toRadian2 = function(degree4) {
return RADIAN2 * degree4;
};
__webpack_exports__["a"] = toRadian2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__each__ = __webpack_require__(2);
__webpack_exports__["a"] = __WEBPACK_IMPORTED_MODULE_0__each__["a"];
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__has__ = __webpack_require__(25);
__webpack_exports__["a"] = __WEBPACK_IMPORTED_MODULE_0__has__["a"];
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__contains__ = __webpack_require__(12);
var __WEBPACK_IMPORTED_MODULE_1__values__ = __webpack_require__(26);
__webpack_exports__["a"] = function(obj, value2) {
return Object(__WEBPACK_IMPORTED_MODULE_0__contains__["a"])(Object(__WEBPACK_IMPORTED_MODULE_1__values__["a"])(obj), value2);
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__to_string__ = __webpack_require__(10);
var lowerCase2 = function(str8) {
return Object(__WEBPACK_IMPORTED_MODULE_0__to_string__["a"])(str8).toLowerCase();
};
__webpack_exports__["a"] = lowerCase2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__to_string__ = __webpack_require__(10);
var lowerFirst = function(value2) {
var str8 = Object(__WEBPACK_IMPORTED_MODULE_0__to_string__["a"])(value2);
return str8.charAt(0).toLowerCase() + str8.substring(1);
};
__webpack_exports__["a"] = lowerFirst;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
function substitute4(str8, o3) {
if (!str8 || !o3) {
return str8;
}
return str8.replace(/\\?\{([^{}]+)\}/g, function(match, name) {
if (match.charAt(0) === "\\") {
return match.slice(1);
}
return o3[name] === void 0 ? "" : o3[name];
});
}
__webpack_exports__["a"] = substitute4;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__to_string__ = __webpack_require__(10);
var upperCase = function(str8) {
return Object(__WEBPACK_IMPORTED_MODULE_0__to_string__["a"])(str8).toUpperCase();
};
__webpack_exports__["a"] = upperCase;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__to_string__ = __webpack_require__(10);
var upperFirst2 = function(value2) {
var str8 = Object(__WEBPACK_IMPORTED_MODULE_0__to_string__["a"])(value2);
return str8.charAt(0).toUpperCase() + str8.substring(1);
};
__webpack_exports__["a"] = upperFirst2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_type__ = __webpack_require__(4);
var isArguments = function(value2) {
return Object(__WEBPACK_IMPORTED_MODULE_0__is_type__["a"])(value2, "Arguments");
};
__webpack_exports__["a"] = isArguments;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_type__ = __webpack_require__(4);
var isBoolean3 = function(value2) {
return Object(__WEBPACK_IMPORTED_MODULE_0__is_type__["a"])(value2, "Boolean");
};
__webpack_exports__["a"] = isBoolean3;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_type__ = __webpack_require__(4);
var isDate2 = function(value2) {
return Object(__WEBPACK_IMPORTED_MODULE_0__is_type__["a"])(value2, "Date");
};
__webpack_exports__["a"] = isDate2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_type__ = __webpack_require__(4);
var isError = function(value2) {
return Object(__WEBPACK_IMPORTED_MODULE_0__is_type__["a"])(value2, "Error");
};
__webpack_exports__["a"] = isError;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_number__ = __webpack_require__(5);
__webpack_exports__["a"] = function(value2) {
return Object(__WEBPACK_IMPORTED_MODULE_0__is_number__["a"])(value2) && isFinite(value2);
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var isNull3 = function(value2) {
return value2 === null;
};
__webpack_exports__["a"] = isNull3;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_type__ = __webpack_require__(4);
var isRegExp = function(str8) {
return Object(__WEBPACK_IMPORTED_MODULE_0__is_type__["a"])(str8, "RegExp");
};
__webpack_exports__["a"] = isRegExp;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var isUndefined2 = function(value2) {
return value2 === void 0;
};
__webpack_exports__["a"] = isUndefined2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var isElement2 = function(o3) {
return o3 instanceof Element || o3 instanceof HTMLDocument;
};
__webpack_exports__["a"] = isElement2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_exports__["a"] = requestAnimationFrame4;
function requestAnimationFrame4(fn2) {
var method = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || function(f3) {
return setTimeout(f3, 16);
};
return method(fn2);
}
;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_exports__["a"] = cancelAnimationFrame4;
function cancelAnimationFrame4(handler) {
var method = window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || window.msCancelAnimationFrame || clearTimeout;
method(handler);
}
;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__mix__ = __webpack_require__(16);
var __WEBPACK_IMPORTED_MODULE_1__is_function__ = __webpack_require__(3);
var augment = function() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var c5 = args[0];
for (var i4 = 1; i4 < args.length; i4++) {
var obj = args[i4];
if (Object(__WEBPACK_IMPORTED_MODULE_1__is_function__["a"])(obj)) {
obj = obj.prototype;
}
Object(__WEBPACK_IMPORTED_MODULE_0__mix__["a"])(c5.prototype, obj);
}
};
__webpack_exports__["a"] = augment;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_array__ = __webpack_require__(0);
var clone10 = function(obj) {
if (typeof obj !== "object" || obj === null) {
return obj;
}
var rst;
if (Object(__WEBPACK_IMPORTED_MODULE_0__is_array__["a"])(obj)) {
rst = [];
for (var i4 = 0, l4 = obj.length; i4 < l4; i4++) {
if (typeof obj[i4] === "object" && obj[i4] != null) {
rst[i4] = clone10(obj[i4]);
} else {
rst[i4] = obj[i4];
}
}
} else {
rst = {};
for (var k4 in obj) {
if (typeof obj[k4] === "object" && obj[k4] != null) {
rst[k4] = clone10(obj[k4]);
} else {
rst[k4] = obj[k4];
}
}
}
return rst;
};
__webpack_exports__["a"] = clone10;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
function debounce2(func, wait, immediate) {
var timeout2;
return function() {
var context = this, args = arguments;
var later = function() {
timeout2 = null;
if (!immediate) {
func.apply(context, args);
}
};
var callNow = immediate && !timeout2;
clearTimeout(timeout2);
timeout2 = setTimeout(later, wait);
if (callNow) {
func.apply(context, args);
}
};
}
__webpack_exports__["a"] = debounce2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_function__ = __webpack_require__(3);
__webpack_exports__["a"] = function(f3, resolver) {
if (!Object(__WEBPACK_IMPORTED_MODULE_0__is_function__["a"])(f3)) {
throw new TypeError("Expected a function");
}
var memoized = function() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var key = resolver ? resolver.apply(this, args) : args[0];
var cache3 = memoized.cache;
if (cache3.has(key)) {
return cache3.get(key);
}
var result = f3.apply(this, args);
cache3.set(key, result);
return result;
};
memoized.cache = new Map();
return memoized;
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_array__ = __webpack_require__(0);
var __WEBPACK_IMPORTED_MODULE_1__is_plain_object__ = __webpack_require__(9);
var MAX_MIX_LEVEL3 = 5;
function _deepMix2(dist4, src, level, maxLevel) {
level = level || 0;
maxLevel = maxLevel || MAX_MIX_LEVEL3;
for (var key in src) {
if (src.hasOwnProperty(key)) {
var value2 = src[key];
if (value2 !== null && Object(__WEBPACK_IMPORTED_MODULE_1__is_plain_object__["a"])(value2)) {
if (!Object(__WEBPACK_IMPORTED_MODULE_1__is_plain_object__["a"])(dist4[key])) {
dist4[key] = {};
}
if (level < maxLevel) {
_deepMix2(dist4[key], value2, level + 1, maxLevel);
} else {
dist4[key] = src[key];
}
} else if (Object(__WEBPACK_IMPORTED_MODULE_0__is_array__["a"])(value2)) {
dist4[key] = [];
dist4[key] = dist4[key].concat(value2);
} else if (value2 !== void 0) {
dist4[key] = value2;
}
}
}
}
var deepMix2 = function(rst) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
for (var i4 = 0; i4 < args.length; i4 += 1) {
_deepMix2(rst, args[i4]);
}
return rst;
};
__webpack_exports__["a"] = deepMix2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__mix__ = __webpack_require__(16);
var __WEBPACK_IMPORTED_MODULE_1__is_function__ = __webpack_require__(3);
var extend4 = function(subclass, superclass, overrides, staticOverrides) {
if (!Object(__WEBPACK_IMPORTED_MODULE_1__is_function__["a"])(superclass)) {
overrides = superclass;
superclass = subclass;
subclass = function() {
};
}
var create8 = Object.create ? function(proto, c5) {
return Object.create(proto, {
constructor: {
value: c5
}
});
} : function(proto, c5) {
function Tmp() {
}
Tmp.prototype = proto;
var o3 = new Tmp();
o3.constructor = c5;
return o3;
};
var superObj = create8(superclass.prototype, subclass);
subclass.prototype = Object(__WEBPACK_IMPORTED_MODULE_0__mix__["a"])(superObj, subclass.prototype);
subclass.superclass = create8(superclass.prototype, superclass);
Object(__WEBPACK_IMPORTED_MODULE_0__mix__["a"])(superObj, overrides);
Object(__WEBPACK_IMPORTED_MODULE_0__mix__["a"])(subclass, staticOverrides);
return subclass;
};
__webpack_exports__["a"] = extend4;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_array_like__ = __webpack_require__(1);
var indexOf3 = function(arr, obj) {
if (!Object(__WEBPACK_IMPORTED_MODULE_0__is_array_like__["a"])(arr)) {
return -1;
}
var m4 = Array.prototype.indexOf;
if (m4) {
return m4.call(arr, obj);
}
var index2 = -1;
for (var i4 = 0; i4 < arr.length; i4++) {
if (arr[i4] === obj) {
index2 = i4;
break;
}
}
return index2;
};
__webpack_exports__["a"] = indexOf3;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_nil__ = __webpack_require__(6);
var __WEBPACK_IMPORTED_MODULE_1__is_array_like__ = __webpack_require__(1);
var __WEBPACK_IMPORTED_MODULE_2__get_type__ = __webpack_require__(27);
var __WEBPACK_IMPORTED_MODULE_3__is_prototype__ = __webpack_require__(28);
var hasOwnProperty4 = Object.prototype.hasOwnProperty;
function isEmpty2(value2) {
if (Object(__WEBPACK_IMPORTED_MODULE_0__is_nil__["a"])(value2)) {
return true;
}
if (Object(__WEBPACK_IMPORTED_MODULE_1__is_array_like__["a"])(value2)) {
return !value2.length;
}
var type2 = Object(__WEBPACK_IMPORTED_MODULE_2__get_type__["a"])(value2);
if (type2 === "Map" || type2 === "Set") {
return !value2.size;
}
if (Object(__WEBPACK_IMPORTED_MODULE_3__is_prototype__["a"])(value2)) {
return !Object.keys(value2).length;
}
for (var key in value2) {
if (hasOwnProperty4.call(value2, key)) {
return false;
}
}
return true;
}
__webpack_exports__["a"] = isEmpty2;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_function__ = __webpack_require__(3);
var __WEBPACK_IMPORTED_MODULE_1__is_equal__ = __webpack_require__(29);
__webpack_exports__["a"] = function(value2, other2, fn2) {
if (!Object(__WEBPACK_IMPORTED_MODULE_0__is_function__["a"])(fn2)) {
return Object(__WEBPACK_IMPORTED_MODULE_1__is_equal__["a"])(value2, other2);
}
return !!fn2(value2, other2);
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__each__ = __webpack_require__(2);
var __WEBPACK_IMPORTED_MODULE_1__is_array_like__ = __webpack_require__(1);
var map6 = function(arr, func) {
if (!Object(__WEBPACK_IMPORTED_MODULE_1__is_array_like__["a"])(arr)) {
return arr;
}
var result = [];
Object(__WEBPACK_IMPORTED_MODULE_0__each__["a"])(arr, function(value2, index2) {
result.push(func(value2, index2));
});
return result;
};
__webpack_exports__["a"] = map6;
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_nil__ = __webpack_require__(6);
var __WEBPACK_IMPORTED_MODULE_1__is_object__ = __webpack_require__(13);
var identity5 = function(v3) {
return v3;
};
__webpack_exports__["a"] = function(object, func) {
if (func === void 0) {
func = identity5;
}
var r4 = {};
if (Object(__WEBPACK_IMPORTED_MODULE_1__is_object__["a"])(object) && !Object(__WEBPACK_IMPORTED_MODULE_0__is_nil__["a"])(object)) {
Object.keys(object).forEach(function(key) {
r4[key] = func(object[key], key);
});
}
return r4;
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_string__ = __webpack_require__(8);
__webpack_exports__["a"] = function(obj, key, defaultValue) {
var p4 = 0;
var keyArr = Object(__WEBPACK_IMPORTED_MODULE_0__is_string__["a"])(key) ? key.split(".") : key;
while (obj && p4 < keyArr.length) {
obj = obj[keyArr[p4++]];
}
return obj === void 0 || p4 < keyArr.length ? defaultValue : obj;
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_object__ = __webpack_require__(13);
var __WEBPACK_IMPORTED_MODULE_1__is_string__ = __webpack_require__(8);
var __WEBPACK_IMPORTED_MODULE_2__is_number__ = __webpack_require__(5);
__webpack_exports__["a"] = function(obj, path, value2) {
var o3 = obj;
var keyArr = Object(__WEBPACK_IMPORTED_MODULE_1__is_string__["a"])(path) ? path.split(".") : path;
keyArr.forEach(function(key, idx) {
if (idx < keyArr.length - 1) {
if (!Object(__WEBPACK_IMPORTED_MODULE_0__is_object__["a"])(o3[key])) {
o3[key] = Object(__WEBPACK_IMPORTED_MODULE_2__is_number__["a"])(keyArr[idx + 1]) ? [] : {};
}
o3 = o3[key];
} else {
o3[key] = value2;
}
});
return obj;
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__each__ = __webpack_require__(2);
var __WEBPACK_IMPORTED_MODULE_1__is_plain_object__ = __webpack_require__(9);
var hasOwnProperty4 = Object.prototype.hasOwnProperty;
__webpack_exports__["a"] = function(object, keys2) {
if (object === null || !Object(__WEBPACK_IMPORTED_MODULE_1__is_plain_object__["a"])(object)) {
return {};
}
var result = {};
Object(__WEBPACK_IMPORTED_MODULE_0__each__["a"])(keys2, function(key) {
if (hasOwnProperty4.call(object, key)) {
result[key] = object[key];
}
});
return result;
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_exports__["a"] = function(func, wait, options) {
var timeout2, context, args, result;
var previous = 0;
if (!options)
options = {};
var later = function() {
previous = options.leading === false ? 0 : Date.now();
timeout2 = null;
result = func.apply(context, args);
if (!timeout2)
context = args = null;
};
var throttled = function() {
var now2 = Date.now();
if (!previous && options.leading === false)
previous = now2;
var remaining = wait - (now2 - previous);
context = this;
args = arguments;
if (remaining <= 0 || remaining > wait) {
if (timeout2) {
clearTimeout(timeout2);
timeout2 = null;
}
previous = now2;
result = func.apply(context, args);
if (!timeout2)
context = args = null;
} else if (!timeout2 && options.trailing !== false) {
timeout2 = setTimeout(later, remaining);
}
return result;
};
throttled.cancel = function() {
clearTimeout(timeout2);
previous = 0;
timeout2 = context = args = null;
};
return throttled;
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__is_array_like__ = __webpack_require__(1);
__webpack_exports__["a"] = function(value2) {
return Object(__WEBPACK_IMPORTED_MODULE_0__is_array_like__["a"])(value2) ? Array.prototype.slice.call(value2) : [];
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var map6 = {};
__webpack_exports__["a"] = function(prefix2) {
prefix2 = prefix2 || "g";
if (!map6[prefix2]) {
map6[prefix2] = 1;
} else {
map6[prefix2] += 1;
}
return prefix2 + map6[prefix2];
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_exports__["a"] = function() {
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_exports__["a"] = function(v3) {
return v3;
};
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_exports__["a"] = size2;
var __WEBPACK_IMPORTED_MODULE_0__is_nil__ = __webpack_require__(6);
var __WEBPACK_IMPORTED_MODULE_1__is_array_like__ = __webpack_require__(1);
function size2(o3) {
if (Object(__WEBPACK_IMPORTED_MODULE_0__is_nil__["a"])(o3)) {
return 0;
}
if (Object(__WEBPACK_IMPORTED_MODULE_1__is_array_like__["a"])(o3)) {
return o3.length;
}
return Object.keys(o3).length;
}
},
function(module3, __webpack_exports__, __webpack_require__) {
"use strict";
var default_12 = function() {
function default_13() {
this.map = {};
}
default_13.prototype.has = function(key) {
return this.map[key] !== void 0;
};
default_13.prototype.get = function(key, def) {
var v3 = this.map[key];
return v3 === void 0 ? def : v3;
};
default_13.prototype.set = function(key, value2) {
this.map[key] = value2;
};
default_13.prototype.clear = function() {
this.map = {};
};
default_13.prototype.delete = function(key) {
delete this.map[key];
};
default_13.prototype.size = function() {
return Object.keys(this.map).length;
};
return default_13;
}();
__webpack_exports__["a"] = default_12;
},
function(module3, exports2) {
function WrappedTree(w4, h3, y5, c5) {
if (c5 === void 0) {
c5 = [];
}
var me = this;
me.w = w4 || 0;
me.h = h3 || 0;
me.y = y5 || 0;
me.x = 0;
me.c = c5 || [];
me.cs = c5.length;
me.prelim = 0;
me.mod = 0;
me.shift = 0;
me.change = 0;
me.tl = null;
me.tr = null;
me.el = null;
me.er = null;
me.msel = 0;
me.mser = 0;
}
WrappedTree.fromNode = function(root, isHorizontal2) {
if (!root)
return null;
var children = [];
root.children.forEach(function(child) {
children.push(WrappedTree.fromNode(child, isHorizontal2));
});
if (isHorizontal2)
return new WrappedTree(root.height, root.width, root.x, children);
return new WrappedTree(root.width, root.height, root.y, children);
};
function moveRight(node, move3, isHorizontal2) {
if (isHorizontal2) {
node.y += move3;
} else {
node.x += move3;
}
node.children.forEach(function(child) {
moveRight(child, move3, isHorizontal2);
});
}
function getMin(node, isHorizontal2) {
var res = isHorizontal2 ? node.y : node.x;
node.children.forEach(function(child) {
res = Math.min(getMin(child, isHorizontal2), res);
});
return res;
}
function normalize5(node, isHorizontal2) {
var min7 = getMin(node, isHorizontal2);
moveRight(node, -min7, isHorizontal2);
}
function convertBack(converted, root, isHorizontal2) {
if (isHorizontal2) {
root.y = converted.x;
} else {
root.x = converted.x;
}
converted.c.forEach(function(child, i4) {
convertBack(child, root.children[i4], isHorizontal2);
});
}
function layer(node, isHorizontal2, d3) {
if (d3 === void 0) {
d3 = 0;
}
if (isHorizontal2) {
node.x = d3;
d3 += node.width;
} else {
node.y = d3;
d3 += node.height;
}
node.children.forEach(function(child) {
layer(child, isHorizontal2, d3);
});
}
module3.exports = function(root, options) {
if (options === void 0) {
options = {};
}
var isHorizontal2 = options.isHorizontal;
function firstWalk(t4) {
if (t4.cs === 0) {
setExtremes(t4);
return;
}
firstWalk(t4.c[0]);
var ih = updateIYL(bottom(t4.c[0].el), 0, null);
for (var i4 = 1; i4 < t4.cs; ++i4) {
firstWalk(t4.c[i4]);
var min7 = bottom(t4.c[i4].er);
separate(t4, i4, ih);
ih = updateIYL(min7, i4, ih);
}
positionRoot(t4);
setExtremes(t4);
}
function setExtremes(t4) {
if (t4.cs === 0) {
t4.el = t4;
t4.er = t4;
t4.msel = t4.mser = 0;
} else {
t4.el = t4.c[0].el;
t4.msel = t4.c[0].msel;
t4.er = t4.c[t4.cs - 1].er;
t4.mser = t4.c[t4.cs - 1].mser;
}
}
function separate(t4, i4, ih) {
var sr = t4.c[i4 - 1];
var mssr = sr.mod;
var cl = t4.c[i4];
var mscl = cl.mod;
while (sr !== null && cl !== null) {
if (bottom(sr) > ih.low)
ih = ih.nxt;
var dist4 = mssr + sr.prelim + sr.w - (mscl + cl.prelim);
if (dist4 > 0) {
mscl += dist4;
moveSubtree2(t4, i4, ih.index, dist4);
}
var sy = bottom(sr);
var cy = bottom(cl);
if (sy <= cy) {
sr = nextRightContour(sr);
if (sr !== null)
mssr += sr.mod;
}
if (sy >= cy) {
cl = nextLeftContour(cl);
if (cl !== null)
mscl += cl.mod;
}
}
if (!sr && !!cl) {
setLeftThread(t4, i4, cl, mscl);
} else if (!!sr && !cl) {
setRightThread(t4, i4, sr, mssr);
}
}
function moveSubtree2(t4, i4, si, dist4) {
t4.c[i4].mod += dist4;
t4.c[i4].msel += dist4;
t4.c[i4].mser += dist4;
distributeExtra(t4, i4, si, dist4);
}
function nextLeftContour(t4) {
return t4.cs === 0 ? t4.tl : t4.c[0];
}
function nextRightContour(t4) {
return t4.cs === 0 ? t4.tr : t4.c[t4.cs - 1];
}
function bottom(t4) {
return t4.y + t4.h;
}
function setLeftThread(t4, i4, cl, modsumcl) {
var li = t4.c[0].el;
li.tl = cl;
var diff2 = modsumcl - cl.mod - t4.c[0].msel;
li.mod += diff2;
li.prelim -= diff2;
t4.c[0].el = t4.c[i4].el;
t4.c[0].msel = t4.c[i4].msel;
}
function setRightThread(t4, i4, sr, modsumsr) {
var ri = t4.c[i4].er;
ri.tr = sr;
var diff2 = modsumsr - sr.mod - t4.c[i4].mser;
ri.mod += diff2;
ri.prelim -= diff2;
t4.c[i4].er = t4.c[i4 - 1].er;
t4.c[i4].mser = t4.c[i4 - 1].mser;
}
function positionRoot(t4) {
t4.prelim = (t4.c[0].prelim + t4.c[0].mod + t4.c[t4.cs - 1].mod + t4.c[t4.cs - 1].prelim + t4.c[t4.cs - 1].w) / 2 - t4.w / 2;
}
function secondWalk(t4, modsum) {
modsum += t4.mod;
t4.x = t4.prelim + modsum;
addChildSpacing(t4);
for (var i4 = 0; i4 < t4.cs; i4++) {
secondWalk(t4.c[i4], modsum);
}
}
function distributeExtra(t4, i4, si, dist4) {
if (si !== i4 - 1) {
var nr = i4 - si;
t4.c[si + 1].shift += dist4 / nr;
t4.c[i4].shift -= dist4 / nr;
t4.c[i4].change -= dist4 - dist4 / nr;
}
}
function addChildSpacing(t4) {
var d3 = 0;
var modsumdelta = 0;
for (var i4 = 0; i4 < t4.cs; i4++) {
d3 += t4.c[i4].shift;
modsumdelta += d3 + t4.c[i4].change;
t4.c[i4].mod += modsumdelta;
}
}
function updateIYL(low, index2, ih) {
while (ih !== null && low >= ih.low) {
ih = ih.nxt;
}
return {
low,
index: index2,
nxt: ih
};
}
layer(root, isHorizontal2);
var wt = WrappedTree.fromNode(root, isHorizontal2);
firstWalk(wt);
secondWalk(wt, 0);
convertBack(wt, root, isHorizontal2);
normalize5(root, isHorizontal2);
return root;
};
},
function(module3, exports2, __webpack_require__) {
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
var TreeLayout = __webpack_require__(11);
var dendrogram = __webpack_require__(115);
var doTreeLayout = __webpack_require__(17);
var util = __webpack_require__(7);
var DendrogramLayout = /* @__PURE__ */ function(_TreeLayout) {
_inheritsLoose(DendrogramLayout2, _TreeLayout);
function DendrogramLayout2() {
return _TreeLayout.apply(this, arguments) || this;
}
var _proto = DendrogramLayout2.prototype;
_proto.execute = function execute() {
var me = this;
me.rootNode.width = 0;
return doTreeLayout(me.rootNode, me.options, dendrogram);
};
return DendrogramLayout2;
}(TreeLayout);
var DEFAULT_OPTIONS37 = {};
function dendrogramLayout(root, options) {
options = util.assign({}, DEFAULT_OPTIONS37, options);
return new DendrogramLayout(root, options).execute();
}
module3.exports = dendrogramLayout;
},
function(module3, exports2, __webpack_require__) {
var util = __webpack_require__(7);
function WrappedTree(height, children) {
if (height === void 0) {
height = 0;
}
if (children === void 0) {
children = [];
}
var me = this;
me.x = me.y = 0;
me.leftChild = me.rightChild = null;
me.height = 0;
me.children = children;
}
var DEFAULT_OPTIONS37 = {
isHorizontal: true,
nodeSep: 20,
nodeSize: 20,
rankSep: 200,
subTreeSep: 10
};
function convertBack(converted, root, isHorizontal2) {
if (isHorizontal2) {
root.x = converted.x;
root.y = converted.y;
} else {
root.x = converted.y;
root.y = converted.x;
}
converted.children.forEach(function(child, i4) {
convertBack(child, root.children[i4], isHorizontal2);
});
}
module3.exports = function(root, options) {
if (options === void 0) {
options = {};
}
options = util.assign({}, DEFAULT_OPTIONS37, options);
var maxDepth = 0;
function wrappedTreeFromNode(n3) {
if (!n3)
return null;
n3.width = 0;
if (n3.depth && n3.depth > maxDepth) {
maxDepth = n3.depth;
}
var children = n3.children;
var childrenCount = children.length;
var t4 = new WrappedTree(n3.height, []);
children.forEach(function(child, i4) {
var childWT = wrappedTreeFromNode(child);
t4.children.push(childWT);
if (i4 === 0) {
t4.leftChild = childWT;
}
if (i4 === childrenCount - 1) {
t4.rightChild = childWT;
}
});
t4.originNode = n3;
t4.isLeaf = n3.isLeaf();
return t4;
}
function getDrawingDepth(t4) {
if (t4.isLeaf || t4.children.length === 0) {
t4.drawingDepth = maxDepth;
} else {
var depths = t4.children.map(function(child) {
return getDrawingDepth(child);
});
var minChildDepth = Math.min.apply(null, depths);
t4.drawingDepth = minChildDepth - 1;
}
return t4.drawingDepth;
}
var prevLeaf;
function position2(t4) {
t4.x = t4.drawingDepth * options.rankSep;
if (t4.isLeaf) {
t4.y = 0;
if (prevLeaf) {
t4.y = prevLeaf.y + prevLeaf.height + options.nodeSep;
if (t4.originNode.parent !== prevLeaf.originNode.parent) {
t4.y += options.subTreeSep;
}
}
prevLeaf = t4;
} else {
t4.children.forEach(function(child) {
position2(child);
});
t4.y = (t4.leftChild.y + t4.rightChild.y) / 2;
}
}
var wt = wrappedTreeFromNode(root);
getDrawingDepth(wt);
position2(wt);
convertBack(wt, root, options.isHorizontal);
return root;
};
},
function(module3, exports2, __webpack_require__) {
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
var TreeLayout = __webpack_require__(11);
var indentedTree = __webpack_require__(117);
var separateTree = __webpack_require__(30);
var util = __webpack_require__(7);
var VALID_DIRECTIONS = [
"LR",
"RL",
"H"
];
var DEFAULT_DIRECTION = VALID_DIRECTIONS[0];
var IndentedLayout = /* @__PURE__ */ function(_TreeLayout) {
_inheritsLoose(IndentedLayout2, _TreeLayout);
function IndentedLayout2() {
return _TreeLayout.apply(this, arguments) || this;
}
var _proto = IndentedLayout2.prototype;
_proto.execute = function execute() {
var me = this;
var options = me.options;
var root = me.rootNode;
options.isHorizontal = true;
var _options$indent = options.indent, indent2 = _options$indent === void 0 ? 20 : _options$indent, _options$dropCap = options.dropCap, dropCap = _options$dropCap === void 0 ? true : _options$dropCap;
var direction5 = options.direction || DEFAULT_DIRECTION;
if (direction5 && VALID_DIRECTIONS.indexOf(direction5) === -1) {
throw new TypeError("Invalid direction: " + direction5);
}
if (direction5 === VALID_DIRECTIONS[0]) {
indentedTree(root, indent2, dropCap);
} else if (direction5 === VALID_DIRECTIONS[1]) {
indentedTree(root, indent2, dropCap);
root.right2left();
} else if (direction5 === VALID_DIRECTIONS[2]) {
var _separateTree = separateTree(root, options), left2 = _separateTree.left, right2 = _separateTree.right;
indentedTree(left2, indent2, dropCap);
left2.right2left();
indentedTree(right2, indent2, dropCap);
var bbox = left2.getBoundingBox();
right2.translate(bbox.width, 0);
root.x = right2.x - root.width / 2;
}
return root;
};
return IndentedLayout2;
}(TreeLayout);
var DEFAULT_OPTIONS37 = {};
function indentedLayout(root, options) {
options = util.assign({}, DEFAULT_OPTIONS37, options);
return new IndentedLayout(root, options).execute();
}
module3.exports = indentedLayout;
},
function(module3, exports2) {
function positionNode(node, previousNode, indent2, dropCap) {
var displacementX = typeof indent2 === "function" ? indent2(node) : indent2 * node.depth;
if (!dropCap) {
try {
if (node.id === node.parent.children[0].id) {
node.x += displacementX;
node.y = previousNode ? previousNode.y : 0;
return;
}
} catch (e4) {
}
}
node.x += displacementX;
node.y = previousNode ? previousNode.y + previousNode.height : 0;
return;
}
module3.exports = function(root, indent2, dropCap) {
var previousNode = null;
root.eachNode(function(node) {
positionNode(node, previousNode, indent2, dropCap);
previousNode = node;
});
};
},
function(module3, exports2, __webpack_require__) {
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
var TreeLayout = __webpack_require__(11);
var mindmap = __webpack_require__(119);
var doTreeLayout = __webpack_require__(17);
var util = __webpack_require__(7);
var MindmapLayout = /* @__PURE__ */ function(_TreeLayout) {
_inheritsLoose(MindmapLayout2, _TreeLayout);
function MindmapLayout2() {
return _TreeLayout.apply(this, arguments) || this;
}
var _proto = MindmapLayout2.prototype;
_proto.execute = function execute() {
var me = this;
return doTreeLayout(me.rootNode, me.options, mindmap);
};
return MindmapLayout2;
}(TreeLayout);
var DEFAULT_OPTIONS37 = {};
function mindmapLayout(root, options) {
options = util.assign({}, DEFAULT_OPTIONS37, options);
return new MindmapLayout(root, options).execute();
}
module3.exports = mindmapLayout;
},
function(module3, exports2, __webpack_require__) {
var util = __webpack_require__(7);
function secondWalk(node, options) {
var totalHeight = 0;
if (!node.children.length) {
totalHeight = node.height;
} else {
node.children.forEach(function(c5) {
totalHeight += secondWalk(c5, options);
});
}
node._subTreeSep = options.getSubTreeSep(node.data);
node.totalHeight = Math.max(node.height, totalHeight) + 2 * node._subTreeSep;
return node.totalHeight;
}
function thirdWalk(node) {
var children = node.children;
var len5 = children.length;
if (len5) {
children.forEach(function(c5) {
thirdWalk(c5);
});
var first = children[0];
var last2 = children[len5 - 1];
var childrenHeight = last2.y - first.y + last2.height;
var childrenTotalHeight = 0;
children.forEach(function(child) {
childrenTotalHeight += child.totalHeight;
});
if (childrenHeight > node.height) {
node.y = first.y + childrenHeight / 2 - node.height / 2;
} else if (children.length !== 1 || node.height > childrenTotalHeight) {
var offset = node.y + (node.height - childrenHeight) / 2 - first.y;
children.forEach(function(c5) {
c5.translate(0, offset);
});
} else {
node.y = (first.y + first.height / 2 + last2.y + last2.height / 2) / 2 - node.height / 2;
}
}
}
var DEFAULT_OPTIONS37 = {
getSubTreeSep: function getSubTreeSep() {
return 0;
}
};
module3.exports = function(root, options) {
if (options === void 0) {
options = {};
}
options = util.assign({}, DEFAULT_OPTIONS37, options);
root.parent = {
x: 0,
width: 0,
height: 0,
y: 0
};
root.BFTraverse(function(node) {
node.x = node.parent.x + node.parent.width;
});
root.parent = null;
secondWalk(root, options);
root.startY = 0;
root.y = root.totalHeight / 2 - root.height / 2;
root.eachNode(function(node) {
var children = node.children;
var len5 = children.length;
if (len5) {
var first = children[0];
first.startY = node.startY + node._subTreeSep;
if (len5 === 1) {
first.y = node.y + node.height / 2 - first.height / 2;
} else {
first.y = first.startY + first.totalHeight / 2 - first.height / 2;
for (var i4 = 1; i4 < len5; i4++) {
var c5 = children[i4];
c5.startY = children[i4 - 1].startY + children[i4 - 1].totalHeight;
c5.y = c5.startY + c5.totalHeight / 2 - c5.height / 2;
}
}
}
});
thirdWalk(root);
};
}
]);
});
}
});
// node_modules/insert-css/index.js
var require_insert_css = __commonJS({
"node_modules/insert-css/index.js"(exports, module2) {
var containers = [];
var styleElements = [];
var usage = "insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).";
function insertCss4(css, options) {
options = options || {};
if (css === void 0) {
throw new Error(usage);
}
var position2 = options.prepend === true ? "prepend" : "append";
var container2 = options.container !== void 0 ? options.container : document.querySelector("head");
var containerId = containers.indexOf(container2);
if (containerId === -1) {
containerId = containers.push(container2) - 1;
styleElements[containerId] = {};
}
var styleElement;
if (styleElements[containerId] !== void 0 && styleElements[containerId][position2] !== void 0) {
styleElement = styleElements[containerId][position2];
} else {
styleElement = styleElements[containerId][position2] = createStyleElement();
if (position2 === "prepend") {
container2.insertBefore(styleElement, container2.childNodes[0]);
} else {
container2.appendChild(styleElement);
}
}
if (css.charCodeAt(0) === 65279) {
css = css.substr(1, css.length);
}
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText += css;
} else {
styleElement.textContent += css;
}
return styleElement;
}
function createStyleElement() {
var styleElement = document.createElement("style");
styleElement.setAttribute("type", "text/css");
return styleElement;
}
module2.exports = insertCss4;
module2.exports.insertCss = insertCss4;
}
});
// node_modules/react/index.js
var require_react = __commonJS({
"node_modules/react/index.js"(exports, module2) {
module2.exports = (init_compat_module(), compat_module_exports);
}
});
// node_modules/@ant-design/charts/lib/errorBoundary/index.js
var require_errorBoundary = __commonJS({
"node_modules/@ant-design/charts/lib/errorBoundary/index.js"(exports) {
"use strict";
var __extends15 = exports && exports.__extends || function() {
var extendStatics = function(d3, b10) {
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d4, b11) {
d4.__proto__ = b11;
} || function(d4, b11) {
for (var p4 in b11)
if (Object.prototype.hasOwnProperty.call(b11, p4))
d4[p4] = b11[p4];
};
return extendStatics(d3, b10);
};
return function(d3, b10) {
if (typeof b10 !== "function" && b10 !== null)
throw new TypeError("Class extends value " + String(b10) + " is not a constructor or null");
extendStatics(d3, b10);
function __() {
this.constructor = d3;
}
d3.prototype = b10 === null ? Object.create(b10) : (__.prototype = b10.prototype, new __());
};
}();
var __createBinding4 = exports && exports.__createBinding || (Object.create ? function(o3, m4, k4, k22) {
if (k22 === void 0)
k22 = k4;
Object.defineProperty(o3, k22, { enumerable: true, get: function() {
return m4[k4];
} });
} : function(o3, m4, k4, k22) {
if (k22 === void 0)
k22 = k4;
o3[k22] = m4[k4];
});
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o3, v3) {
Object.defineProperty(o3, "default", { enumerable: true, value: v3 });
} : function(o3, v3) {
o3["default"] = v3;
});
var __importStar4 = exports && exports.__importStar || function(mod3) {
if (mod3 && mod3.__esModule)
return mod3;
var result = {};
if (mod3 != null) {
for (var k4 in mod3)
if (k4 !== "default" && Object.prototype.hasOwnProperty.call(mod3, k4))
__createBinding4(result, mod3, k4);
}
__setModuleDefault(result, mod3);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importStar4(require_react());
var ErrorBoundary3 = function(_super) {
__extends15(ErrorBoundary4, _super);
function ErrorBoundary4() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.state = {
hasError: false
};
_this.renderError = function(e4) {
var errorTemplate = _this.props.errorTemplate;
switch (e4) {
default:
return errorTemplate && typeof errorTemplate === "function" ? errorTemplate(e4) : react_1.default.createElement("h5", null, "\u7EC4\u4EF6\u51FA\u9519\u4E86\uFF0C\u8BF7\u6838\u67E5\u540E\u91CD\u8BD5\uFF1A ", e4.message);
}
};
return _this;
}
ErrorBoundary4.getDerivedStateFromError = function(error) {
return { hasError: true, error };
};
ErrorBoundary4.getDerivedStateFromProps = function(nextProps, state2) {
if (state2.children !== nextProps.children) {
return {
children: nextProps.children,
hasError: false,
error: void 0
};
}
return null;
};
ErrorBoundary4.prototype.render = function() {
if (this.state.hasError) {
return this.renderError(this.state.error);
}
return react_1.default.createElement(react_1.Fragment, null, this.props.children);
};
return ErrorBoundary4;
}(react_1.default.Component);
exports.default = ErrorBoundary3;
}
});
// node_modules/papaparse/papaparse.min.js
var require_papaparse_min = __commonJS({
"node_modules/papaparse/papaparse.min.js"(exports, module2) {
!function(e4, t4) {
typeof define == "function" && define.amd ? define([], t4) : typeof module2 == "object" && typeof exports != "undefined" ? module2.exports = t4() : e4.Papa = t4();
}(exports, function s4() {
"use strict";
var f3 = typeof self != "undefined" ? self : typeof window != "undefined" ? window : f3 !== void 0 ? f3 : {};
var n3 = !f3.document && !!f3.postMessage, o3 = n3 && /blob:/i.test((f3.location || {}).protocol), a4 = {}, h3 = 0, b10 = { parse: function(e4, t4) {
var i5 = (t4 = t4 || {}).dynamicTyping || false;
M3(i5) && (t4.dynamicTypingFunction = i5, i5 = {});
if (t4.dynamicTyping = i5, t4.transform = !!M3(t4.transform) && t4.transform, t4.worker && b10.WORKERS_SUPPORTED) {
var r4 = function() {
if (!b10.WORKERS_SUPPORTED)
return false;
var e6 = (i6 = f3.URL || f3.webkitURL || null, r5 = s4.toString(), b10.BLOB_URL || (b10.BLOB_URL = i6.createObjectURL(new Blob(["(", r5, ")();"], { type: "text/javascript" })))), t5 = new f3.Worker(e6);
var i6, r5;
return t5.onmessage = _8, t5.id = h3++, a4[t5.id] = t5;
}();
return r4.userStep = t4.step, r4.userChunk = t4.chunk, r4.userComplete = t4.complete, r4.userError = t4.error, t4.step = M3(t4.step), t4.chunk = M3(t4.chunk), t4.complete = M3(t4.complete), t4.error = M3(t4.error), delete t4.worker, void r4.postMessage({ input: e4, config: t4, workerId: r4.id });
}
var n4 = null;
b10.NODE_STREAM_INPUT, typeof e4 == "string" ? n4 = t4.download ? new l4(t4) : new p4(t4) : e4.readable === true && M3(e4.read) && M3(e4.on) ? n4 = new g4(t4) : (f3.File && e4 instanceof File || e4 instanceof Object) && (n4 = new c5(t4));
return n4.stream(e4);
}, unparse: function(e4, t4) {
var n4 = false, _9 = true, m5 = ",", y6 = "\r\n", s5 = '"', a5 = s5 + s5, i5 = false, r4 = null, o4 = false;
!function() {
if (typeof t4 != "object")
return;
typeof t4.delimiter != "string" || b10.BAD_DELIMITERS.filter(function(e6) {
return t4.delimiter.indexOf(e6) !== -1;
}).length || (m5 = t4.delimiter);
(typeof t4.quotes == "boolean" || typeof t4.quotes == "function" || Array.isArray(t4.quotes)) && (n4 = t4.quotes);
typeof t4.skipEmptyLines != "boolean" && typeof t4.skipEmptyLines != "string" || (i5 = t4.skipEmptyLines);
typeof t4.newline == "string" && (y6 = t4.newline);
typeof t4.quoteChar == "string" && (s5 = t4.quoteChar);
typeof t4.header == "boolean" && (_9 = t4.header);
if (Array.isArray(t4.columns)) {
if (t4.columns.length === 0)
throw new Error("Option columns is empty");
r4 = t4.columns;
}
t4.escapeChar !== void 0 && (a5 = t4.escapeChar + s5);
typeof t4.escapeFormulae == "boolean" && (o4 = t4.escapeFormulae);
}();
var h4 = new RegExp(j4(s5), "g");
typeof e4 == "string" && (e4 = JSON.parse(e4));
if (Array.isArray(e4)) {
if (!e4.length || Array.isArray(e4[0]))
return u4(null, e4, i5);
if (typeof e4[0] == "object")
return u4(r4 || Object.keys(e4[0]), e4, i5);
} else if (typeof e4 == "object")
return typeof e4.data == "string" && (e4.data = JSON.parse(e4.data)), Array.isArray(e4.data) && (e4.fields || (e4.fields = e4.meta && e4.meta.fields), e4.fields || (e4.fields = Array.isArray(e4.data[0]) ? e4.fields : typeof e4.data[0] == "object" ? Object.keys(e4.data[0]) : []), Array.isArray(e4.data[0]) || typeof e4.data[0] == "object" || (e4.data = [e4.data])), u4(e4.fields || [], e4.data || [], i5);
throw new Error("Unable to serialize unrecognized input");
function u4(e6, t5, i6) {
var r5 = "";
typeof e6 == "string" && (e6 = JSON.parse(e6)), typeof t5 == "string" && (t5 = JSON.parse(t5));
var n5 = Array.isArray(e6) && 0 < e6.length, s6 = !Array.isArray(t5[0]);
if (n5 && _9) {
for (var a6 = 0; a6 < e6.length; a6++)
0 < a6 && (r5 += m5), r5 += v4(e6[a6], a6);
0 < t5.length && (r5 += y6);
}
for (var o5 = 0; o5 < t5.length; o5++) {
var h5 = n5 ? e6.length : t5[o5].length, u5 = false, f4 = n5 ? Object.keys(t5[o5]).length === 0 : t5[o5].length === 0;
if (i6 && !n5 && (u5 = i6 === "greedy" ? t5[o5].join("").trim() === "" : t5[o5].length === 1 && t5[o5][0].length === 0), i6 === "greedy" && n5) {
for (var d4 = [], l5 = 0; l5 < h5; l5++) {
var c6 = s6 ? e6[l5] : l5;
d4.push(t5[o5][c6]);
}
u5 = d4.join("").trim() === "";
}
if (!u5) {
for (var p5 = 0; p5 < h5; p5++) {
0 < p5 && !f4 && (r5 += m5);
var g5 = n5 && s6 ? e6[p5] : p5;
r5 += v4(t5[o5][g5], p5);
}
o5 < t5.length - 1 && (!i6 || 0 < h5 && !f4) && (r5 += y6);
}
}
return r5;
}
function v4(e6, t5) {
if (e6 == null)
return "";
if (e6.constructor === Date)
return JSON.stringify(e6).slice(1, 25);
o4 === true && typeof e6 == "string" && e6.match(/^[=+\-@].*$/) !== null && (e6 = "'" + e6);
var i6 = e6.toString().replace(h4, a5), r5 = typeof n4 == "boolean" && n4 || typeof n4 == "function" && n4(e6, t5) || Array.isArray(n4) && n4[t5] || function(e7, t6) {
for (var i7 = 0; i7 < t6.length; i7++)
if (-1 < e7.indexOf(t6[i7]))
return true;
return false;
}(i6, b10.BAD_DELIMITERS) || -1 < i6.indexOf(m5) || i6.charAt(0) === " " || i6.charAt(i6.length - 1) === " ";
return r5 ? s5 + i6 + s5 : i6;
}
} };
if (b10.RECORD_SEP = String.fromCharCode(30), b10.UNIT_SEP = String.fromCharCode(31), b10.BYTE_ORDER_MARK = "\uFEFF", b10.BAD_DELIMITERS = ["\r", "\n", '"', b10.BYTE_ORDER_MARK], b10.WORKERS_SUPPORTED = !n3 && !!f3.Worker, b10.NODE_STREAM_INPUT = 1, b10.LocalChunkSize = 10485760, b10.RemoteChunkSize = 5242880, b10.DefaultDelimiter = ",", b10.Parser = E2, b10.ParserHandle = i4, b10.NetworkStreamer = l4, b10.FileStreamer = c5, b10.StringStreamer = p4, b10.ReadableStreamStreamer = g4, f3.jQuery) {
var d3 = f3.jQuery;
d3.fn.parse = function(o4) {
var i5 = o4.config || {}, h4 = [];
return this.each(function(e6) {
if (!(d3(this).prop("tagName").toUpperCase() === "INPUT" && d3(this).attr("type").toLowerCase() === "file" && f3.FileReader) || !this.files || this.files.length === 0)
return true;
for (var t4 = 0; t4 < this.files.length; t4++)
h4.push({ file: this.files[t4], inputElem: this, instanceConfig: d3.extend({}, i5) });
}), e4(), this;
function e4() {
if (h4.length !== 0) {
var e6, t4, i6, r4, n4 = h4[0];
if (M3(o4.before)) {
var s5 = o4.before(n4.file, n4.inputElem);
if (typeof s5 == "object") {
if (s5.action === "abort")
return e6 = "AbortError", t4 = n4.file, i6 = n4.inputElem, r4 = s5.reason, void (M3(o4.error) && o4.error({ name: e6 }, t4, i6, r4));
if (s5.action === "skip")
return void u4();
typeof s5.config == "object" && (n4.instanceConfig = d3.extend(n4.instanceConfig, s5.config));
} else if (s5 === "skip")
return void u4();
}
var a5 = n4.instanceConfig.complete;
n4.instanceConfig.complete = function(e7) {
M3(a5) && a5(e7, n4.file, n4.inputElem), u4();
}, b10.parse(n4.file, n4.instanceConfig);
} else
M3(o4.complete) && o4.complete();
}
function u4() {
h4.splice(0, 1), e4();
}
};
}
function u3(e4) {
this._handle = null, this._finished = false, this._completed = false, this._halted = false, this._input = null, this._baseIndex = 0, this._partialLine = "", this._rowCount = 0, this._start = 0, this._nextChunk = null, this.isFirstChunk = true, this._completeResults = { data: [], errors: [], meta: {} }, function(e6) {
var t4 = w4(e6);
t4.chunkSize = parseInt(t4.chunkSize), e6.step || e6.chunk || (t4.chunkSize = null);
this._handle = new i4(t4), (this._handle.streamer = this)._config = t4;
}.call(this, e4), this.parseChunk = function(e6, t4) {
if (this.isFirstChunk && M3(this._config.beforeFirstChunk)) {
var i5 = this._config.beforeFirstChunk(e6);
i5 !== void 0 && (e6 = i5);
}
this.isFirstChunk = false, this._halted = false;
var r4 = this._partialLine + e6;
this._partialLine = "";
var n4 = this._handle.parse(r4, this._baseIndex, !this._finished);
if (!this._handle.paused() && !this._handle.aborted()) {
var s5 = n4.meta.cursor;
this._finished || (this._partialLine = r4.substring(s5 - this._baseIndex), this._baseIndex = s5), n4 && n4.data && (this._rowCount += n4.data.length);
var a5 = this._finished || this._config.preview && this._rowCount >= this._config.preview;
if (o3)
f3.postMessage({ results: n4, workerId: b10.WORKER_ID, finished: a5 });
else if (M3(this._config.chunk) && !t4) {
if (this._config.chunk(n4, this._handle), this._handle.paused() || this._handle.aborted())
return void (this._halted = true);
n4 = void 0, this._completeResults = void 0;
}
return this._config.step || this._config.chunk || (this._completeResults.data = this._completeResults.data.concat(n4.data), this._completeResults.errors = this._completeResults.errors.concat(n4.errors), this._completeResults.meta = n4.meta), this._completed || !a5 || !M3(this._config.complete) || n4 && n4.meta.aborted || (this._config.complete(this._completeResults, this._input), this._completed = true), a5 || n4 && n4.meta.paused || this._nextChunk(), n4;
}
this._halted = true;
}, this._sendError = function(e6) {
M3(this._config.error) ? this._config.error(e6) : o3 && this._config.error && f3.postMessage({ workerId: b10.WORKER_ID, error: e6, finished: false });
};
}
function l4(e4) {
var r4;
(e4 = e4 || {}).chunkSize || (e4.chunkSize = b10.RemoteChunkSize), u3.call(this, e4), this._nextChunk = n3 ? function() {
this._readChunk(), this._chunkLoaded();
} : function() {
this._readChunk();
}, this.stream = function(e6) {
this._input = e6, this._nextChunk();
}, this._readChunk = function() {
if (this._finished)
this._chunkLoaded();
else {
if (r4 = new XMLHttpRequest(), this._config.withCredentials && (r4.withCredentials = this._config.withCredentials), n3 || (r4.onload = v3(this._chunkLoaded, this), r4.onerror = v3(this._chunkError, this)), r4.open(this._config.downloadRequestBody ? "POST" : "GET", this._input, !n3), this._config.downloadRequestHeaders) {
var e6 = this._config.downloadRequestHeaders;
for (var t4 in e6)
r4.setRequestHeader(t4, e6[t4]);
}
if (this._config.chunkSize) {
var i5 = this._start + this._config.chunkSize - 1;
r4.setRequestHeader("Range", "bytes=" + this._start + "-" + i5);
}
try {
r4.send(this._config.downloadRequestBody);
} catch (e7) {
this._chunkError(e7.message);
}
n3 && r4.status === 0 && this._chunkError();
}
}, this._chunkLoaded = function() {
r4.readyState === 4 && (r4.status < 200 || 400 <= r4.status ? this._chunkError() : (this._start += this._config.chunkSize ? this._config.chunkSize : r4.responseText.length, this._finished = !this._config.chunkSize || this._start >= function(e6) {
var t4 = e6.getResponseHeader("Content-Range");
if (t4 === null)
return -1;
return parseInt(t4.substring(t4.lastIndexOf("/") + 1));
}(r4), this.parseChunk(r4.responseText)));
}, this._chunkError = function(e6) {
var t4 = r4.statusText || e6;
this._sendError(new Error(t4));
};
}
function c5(e4) {
var r4, n4;
(e4 = e4 || {}).chunkSize || (e4.chunkSize = b10.LocalChunkSize), u3.call(this, e4);
var s5 = typeof FileReader != "undefined";
this.stream = function(e6) {
this._input = e6, n4 = e6.slice || e6.webkitSlice || e6.mozSlice, s5 ? ((r4 = new FileReader()).onload = v3(this._chunkLoaded, this), r4.onerror = v3(this._chunkError, this)) : r4 = new FileReaderSync(), this._nextChunk();
}, this._nextChunk = function() {
this._finished || this._config.preview && !(this._rowCount < this._config.preview) || this._readChunk();
}, this._readChunk = function() {
var e6 = this._input;
if (this._config.chunkSize) {
var t4 = Math.min(this._start + this._config.chunkSize, this._input.size);
e6 = n4.call(e6, this._start, t4);
}
var i5 = r4.readAsText(e6, this._config.encoding);
s5 || this._chunkLoaded({ target: { result: i5 } });
}, this._chunkLoaded = function(e6) {
this._start += this._config.chunkSize, this._finished = !this._config.chunkSize || this._start >= this._input.size, this.parseChunk(e6.target.result);
}, this._chunkError = function() {
this._sendError(r4.error);
};
}
function p4(e4) {
var i5;
u3.call(this, e4 = e4 || {}), this.stream = function(e6) {
return i5 = e6, this._nextChunk();
}, this._nextChunk = function() {
if (!this._finished) {
var e6, t4 = this._config.chunkSize;
return t4 ? (e6 = i5.substring(0, t4), i5 = i5.substring(t4)) : (e6 = i5, i5 = ""), this._finished = !i5, this.parseChunk(e6);
}
};
}
function g4(e4) {
u3.call(this, e4 = e4 || {});
var t4 = [], i5 = true, r4 = false;
this.pause = function() {
u3.prototype.pause.apply(this, arguments), this._input.pause();
}, this.resume = function() {
u3.prototype.resume.apply(this, arguments), this._input.resume();
}, this.stream = function(e6) {
this._input = e6, this._input.on("data", this._streamData), this._input.on("end", this._streamEnd), this._input.on("error", this._streamError);
}, this._checkIsFinished = function() {
r4 && t4.length === 1 && (this._finished = true);
}, this._nextChunk = function() {
this._checkIsFinished(), t4.length ? this.parseChunk(t4.shift()) : i5 = true;
}, this._streamData = v3(function(e6) {
try {
t4.push(typeof e6 == "string" ? e6 : e6.toString(this._config.encoding)), i5 && (i5 = false, this._checkIsFinished(), this.parseChunk(t4.shift()));
} catch (e7) {
this._streamError(e7);
}
}, this), this._streamError = v3(function(e6) {
this._streamCleanUp(), this._sendError(e6);
}, this), this._streamEnd = v3(function() {
this._streamCleanUp(), r4 = true, this._streamData("");
}, this), this._streamCleanUp = v3(function() {
this._input.removeListener("data", this._streamData), this._input.removeListener("end", this._streamEnd), this._input.removeListener("error", this._streamError);
}, this);
}
function i4(m5) {
var a5, o4, h4, r4 = Math.pow(2, 53), n4 = -r4, s5 = /^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/, u4 = /^(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))$/, t4 = this, i5 = 0, f4 = 0, d4 = false, e4 = false, l5 = [], c6 = { data: [], errors: [], meta: {} };
if (M3(m5.step)) {
var p5 = m5.step;
m5.step = function(e6) {
if (c6 = e6, _9())
g5();
else {
if (g5(), c6.data.length === 0)
return;
i5 += e6.data.length, m5.preview && i5 > m5.preview ? o4.abort() : (c6.data = c6.data[0], p5(c6, t4));
}
};
}
function y6(e6) {
return m5.skipEmptyLines === "greedy" ? e6.join("").trim() === "" : e6.length === 1 && e6[0].length === 0;
}
function g5() {
if (c6 && h4 && (k4("Delimiter", "UndetectableDelimiter", "Unable to auto-detect delimiting character; defaulted to '" + b10.DefaultDelimiter + "'"), h4 = false), m5.skipEmptyLines)
for (var e6 = 0; e6 < c6.data.length; e6++)
y6(c6.data[e6]) && c6.data.splice(e6--, 1);
return _9() && function() {
if (!c6)
return;
function e7(e8, t6) {
M3(m5.transformHeader) && (e8 = m5.transformHeader(e8, t6)), l5.push(e8);
}
if (Array.isArray(c6.data[0])) {
for (var t5 = 0; _9() && t5 < c6.data.length; t5++)
c6.data[t5].forEach(e7);
c6.data.splice(0, 1);
} else
c6.data.forEach(e7);
}(), function() {
if (!c6 || !m5.header && !m5.dynamicTyping && !m5.transform)
return c6;
function e7(e8, t6) {
var i6, r5 = m5.header ? {} : [];
for (i6 = 0; i6 < e8.length; i6++) {
var n5 = i6, s6 = e8[i6];
m5.header && (n5 = i6 >= l5.length ? "__parsed_extra" : l5[i6]), m5.transform && (s6 = m5.transform(s6, n5)), s6 = v4(n5, s6), n5 === "__parsed_extra" ? (r5[n5] = r5[n5] || [], r5[n5].push(s6)) : r5[n5] = s6;
}
return m5.header && (i6 > l5.length ? k4("FieldMismatch", "TooManyFields", "Too many fields: expected " + l5.length + " fields but parsed " + i6, f4 + t6) : i6 < l5.length && k4("FieldMismatch", "TooFewFields", "Too few fields: expected " + l5.length + " fields but parsed " + i6, f4 + t6)), r5;
}
var t5 = 1;
!c6.data.length || Array.isArray(c6.data[0]) ? (c6.data = c6.data.map(e7), t5 = c6.data.length) : c6.data = e7(c6.data, 0);
m5.header && c6.meta && (c6.meta.fields = l5);
return f4 += t5, c6;
}();
}
function _9() {
return m5.header && l5.length === 0;
}
function v4(e6, t5) {
return i6 = e6, m5.dynamicTypingFunction && m5.dynamicTyping[i6] === void 0 && (m5.dynamicTyping[i6] = m5.dynamicTypingFunction(i6)), (m5.dynamicTyping[i6] || m5.dynamicTyping) === true ? t5 === "true" || t5 === "TRUE" || t5 !== "false" && t5 !== "FALSE" && (function(e7) {
if (s5.test(e7)) {
var t6 = parseFloat(e7);
if (n4 < t6 && t6 < r4)
return true;
}
return false;
}(t5) ? parseFloat(t5) : u4.test(t5) ? new Date(t5) : t5 === "" ? null : t5) : t5;
var i6;
}
function k4(e6, t5, i6, r5) {
var n5 = { type: e6, code: t5, message: i6 };
r5 !== void 0 && (n5.row = r5), c6.errors.push(n5);
}
this.parse = function(e6, t5, i6) {
var r5 = m5.quoteChar || '"';
if (m5.newline || (m5.newline = function(e7, t6) {
e7 = e7.substring(0, 1048576);
var i7 = new RegExp(j4(t6) + "([^]*?)" + j4(t6), "gm"), r6 = (e7 = e7.replace(i7, "")).split("\r"), n6 = e7.split("\n"), s7 = 1 < n6.length && n6[0].length < r6[0].length;
if (r6.length === 1 || s7)
return "\n";
for (var a6 = 0, o5 = 0; o5 < r6.length; o5++)
r6[o5][0] === "\n" && a6++;
return a6 >= r6.length / 2 ? "\r\n" : "\r";
}(e6, r5)), h4 = false, m5.delimiter)
M3(m5.delimiter) && (m5.delimiter = m5.delimiter(e6), c6.meta.delimiter = m5.delimiter);
else {
var n5 = function(e7, t6, i7, r6, n6) {
var s7, a6, o5, h5;
n6 = n6 || [",", " ", "|", ";", b10.RECORD_SEP, b10.UNIT_SEP];
for (var u5 = 0; u5 < n6.length; u5++) {
var f5 = n6[u5], d5 = 0, l6 = 0, c7 = 0;
o5 = void 0;
for (var p6 = new E2({ comments: r6, delimiter: f5, newline: t6, preview: 10 }).parse(e7), g6 = 0; g6 < p6.data.length; g6++)
if (i7 && y6(p6.data[g6]))
c7++;
else {
var _10 = p6.data[g6].length;
l6 += _10, o5 !== void 0 ? 0 < _10 && (d5 += Math.abs(_10 - o5), o5 = _10) : o5 = _10;
}
0 < p6.data.length && (l6 /= p6.data.length - c7), (a6 === void 0 || d5 <= a6) && (h5 === void 0 || h5 < l6) && 1.99 < l6 && (a6 = d5, s7 = f5, h5 = l6);
}
return { successful: !!(m5.delimiter = s7), bestDelimiter: s7 };
}(e6, m5.newline, m5.skipEmptyLines, m5.comments, m5.delimitersToGuess);
n5.successful ? m5.delimiter = n5.bestDelimiter : (h4 = true, m5.delimiter = b10.DefaultDelimiter), c6.meta.delimiter = m5.delimiter;
}
var s6 = w4(m5);
return m5.preview && m5.header && s6.preview++, a5 = e6, o4 = new E2(s6), c6 = o4.parse(a5, t5, i6), g5(), d4 ? { meta: { paused: true } } : c6 || { meta: { paused: false } };
}, this.paused = function() {
return d4;
}, this.pause = function() {
d4 = true, o4.abort(), a5 = M3(m5.chunk) ? "" : a5.substring(o4.getCharIndex());
}, this.resume = function() {
t4.streamer._halted ? (d4 = false, t4.streamer.parseChunk(a5, true)) : setTimeout(t4.resume, 3);
}, this.aborted = function() {
return e4;
}, this.abort = function() {
e4 = true, o4.abort(), c6.meta.aborted = true, M3(m5.complete) && m5.complete(c6), a5 = "";
};
}
function j4(e4) {
return e4.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
function E2(e4) {
var S3, O3 = (e4 = e4 || {}).delimiter, x6 = e4.newline, I3 = e4.comments, T5 = e4.step, D3 = e4.preview, A4 = e4.fastMode, L3 = S3 = e4.quoteChar === void 0 ? '"' : e4.quoteChar;
if (e4.escapeChar !== void 0 && (L3 = e4.escapeChar), (typeof O3 != "string" || -1 < b10.BAD_DELIMITERS.indexOf(O3)) && (O3 = ","), I3 === O3)
throw new Error("Comment character same as delimiter");
I3 === true ? I3 = "#" : (typeof I3 != "string" || -1 < b10.BAD_DELIMITERS.indexOf(I3)) && (I3 = false), x6 !== "\n" && x6 !== "\r" && x6 !== "\r\n" && (x6 = "\n");
var F3 = 0, z3 = false;
this.parse = function(r4, t4, i5) {
if (typeof r4 != "string")
throw new Error("Input must be a string");
var n4 = r4.length, e6 = O3.length, s5 = x6.length, a5 = I3.length, o4 = M3(T5), h4 = [], u4 = [], f4 = [], d4 = F3 = 0;
if (!r4)
return C3();
if (A4 || A4 !== false && r4.indexOf(S3) === -1) {
for (var l5 = r4.split(x6), c6 = 0; c6 < l5.length; c6++) {
if (f4 = l5[c6], F3 += f4.length, c6 !== l5.length - 1)
F3 += x6.length;
else if (i5)
return C3();
if (!I3 || f4.substring(0, a5) !== I3) {
if (o4) {
if (h4 = [], k4(f4.split(O3)), R3(), z3)
return C3();
} else
k4(f4.split(O3));
if (D3 && D3 <= c6)
return h4 = h4.slice(0, D3), C3(true);
}
}
return C3();
}
for (var p5 = r4.indexOf(O3, F3), g5 = r4.indexOf(x6, F3), _9 = new RegExp(j4(L3) + j4(S3), "g"), m5 = r4.indexOf(S3, F3); ; )
if (r4[F3] !== S3)
if (I3 && f4.length === 0 && r4.substring(F3, F3 + a5) === I3) {
if (g5 === -1)
return C3();
F3 = g5 + s5, g5 = r4.indexOf(x6, F3), p5 = r4.indexOf(O3, F3);
} else if (p5 !== -1 && (p5 < g5 || g5 === -1))
f4.push(r4.substring(F3, p5)), F3 = p5 + e6, p5 = r4.indexOf(O3, F3);
else {
if (g5 === -1)
break;
if (f4.push(r4.substring(F3, g5)), w5(g5 + s5), o4 && (R3(), z3))
return C3();
if (D3 && h4.length >= D3)
return C3(true);
}
else
for (m5 = F3, F3++; ; ) {
if ((m5 = r4.indexOf(S3, m5 + 1)) === -1)
return i5 || u4.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: h4.length, index: F3 }), E3();
if (m5 === n4 - 1)
return E3(r4.substring(F3, m5).replace(_9, S3));
if (S3 !== L3 || r4[m5 + 1] !== L3) {
if (S3 === L3 || m5 === 0 || r4[m5 - 1] !== L3) {
p5 !== -1 && p5 < m5 + 1 && (p5 = r4.indexOf(O3, m5 + 1)), g5 !== -1 && g5 < m5 + 1 && (g5 = r4.indexOf(x6, m5 + 1));
var y6 = b11(g5 === -1 ? p5 : Math.min(p5, g5));
if (r4[m5 + 1 + y6] === O3) {
f4.push(r4.substring(F3, m5).replace(_9, S3)), r4[F3 = m5 + 1 + y6 + e6] !== S3 && (m5 = r4.indexOf(S3, F3)), p5 = r4.indexOf(O3, F3), g5 = r4.indexOf(x6, F3);
break;
}
var v4 = b11(g5);
if (r4.substring(m5 + 1 + v4, m5 + 1 + v4 + s5) === x6) {
if (f4.push(r4.substring(F3, m5).replace(_9, S3)), w5(m5 + 1 + v4 + s5), p5 = r4.indexOf(O3, F3), m5 = r4.indexOf(S3, F3), o4 && (R3(), z3))
return C3();
if (D3 && h4.length >= D3)
return C3(true);
break;
}
u4.push({ type: "Quotes", code: "InvalidQuotes", message: "Trailing quote on quoted field is malformed", row: h4.length, index: F3 }), m5++;
}
} else
m5++;
}
return E3();
function k4(e7) {
h4.push(e7), d4 = F3;
}
function b11(e7) {
var t5 = 0;
if (e7 !== -1) {
var i6 = r4.substring(m5 + 1, e7);
i6 && i6.trim() === "" && (t5 = i6.length);
}
return t5;
}
function E3(e7) {
return i5 || (e7 === void 0 && (e7 = r4.substring(F3)), f4.push(e7), F3 = n4, k4(f4), o4 && R3()), C3();
}
function w5(e7) {
F3 = e7, k4(f4), f4 = [], g5 = r4.indexOf(x6, F3);
}
function C3(e7) {
return { data: h4, errors: u4, meta: { delimiter: O3, linebreak: x6, aborted: z3, truncated: !!e7, cursor: d4 + (t4 || 0) } };
}
function R3() {
T5(C3()), h4 = [], u4 = [];
}
}, this.abort = function() {
z3 = true;
}, this.getCharIndex = function() {
return F3;
};
}
function _8(e4) {
var t4 = e4.data, i5 = a4[t4.workerId], r4 = false;
if (t4.error)
i5.userError(t4.error, t4.file);
else if (t4.results && t4.results.data) {
var n4 = { abort: function() {
r4 = true, m4(t4.workerId, { data: [], errors: [], meta: { aborted: true } });
}, pause: y5, resume: y5 };
if (M3(i5.userStep)) {
for (var s5 = 0; s5 < t4.results.data.length && (i5.userStep({ data: t4.results.data[s5], errors: t4.results.errors, meta: t4.results.meta }, n4), !r4); s5++)
;
delete t4.results;
} else
M3(i5.userChunk) && (i5.userChunk(t4.results, n4, t4.file), delete t4.results);
}
t4.finished && !r4 && m4(t4.workerId, t4.results);
}
function m4(e4, t4) {
var i5 = a4[e4];
M3(i5.userComplete) && i5.userComplete(t4), i5.terminate(), delete a4[e4];
}
function y5() {
throw new Error("Not implemented.");
}
function w4(e4) {
if (typeof e4 != "object" || e4 === null)
return e4;
var t4 = Array.isArray(e4) ? [] : {};
for (var i5 in e4)
t4[i5] = w4(e4[i5]);
return t4;
}
function v3(e4, t4) {
return function() {
e4.apply(t4, arguments);
};
}
function M3(e4) {
return typeof e4 == "function";
}
return o3 && (f3.onmessage = function(e4) {
var t4 = e4.data;
b10.WORKER_ID === void 0 && t4 && (b10.WORKER_ID = t4.workerId);
if (typeof t4.input == "string")
f3.postMessage({ workerId: b10.WORKER_ID, results: b10.parse(t4.input, t4.config), finished: true });
else if (f3.File && t4.input instanceof File || t4.input instanceof Object) {
var i5 = b10.parse(t4.input, t4.config);
i5 && f3.postMessage({ workerId: b10.WORKER_ID, results: i5, finished: true });
}
}), (l4.prototype = Object.create(u3.prototype)).constructor = l4, (c5.prototype = Object.create(u3.prototype)).constructor = c5, (p4.prototype = Object.create(p4.prototype)).constructor = p4, (g4.prototype = Object.create(u3.prototype)).constructor = g4, b10;
});
}
});
// node_modules/obsidian-dataview/lib/index.js
var require_lib4 = __commonJS({
"node_modules/obsidian-dataview/lib/index.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("obsidian");
var getAPI = (app) => {
var _a6;
if (app)
return (_a6 = app.plugins.plugins.dataview) === null || _a6 === void 0 ? void 0 : _a6.api;
else
return window["DataviewAPI"];
};
var isPluginEnabled = (app) => app.plugins.enabledPlugins.has("dataview");
exports.getAPI = getAPI;
exports.isPluginEnabled = isPluginEnabled;
}
});
// src/main.tsx
__export(exports, {
default: () => ChartsViewPlugin
});
// node_modules/file-select-dialog/dist/file-select-dialog.esm.js
var e = class extends Error {
};
var t = class extends e {
};
var n = class extends e {
};
var c = (e4, t4 = ",") => e4.join(t4);
var l = { accept: "*", multiple: false, strict: false };
var r = (e4) => {
const { accept: t4, multiple: n3, strict: r4 } = __spreadValues(__spreadValues({}, l), e4), i4 = p({ multiple: n3, accept: Array.isArray(t4) ? c(t4) : t4 });
return new Promise((e6) => {
i4.onchange = () => {
e6(s(i4.files, n3, r4)), i4.remove();
}, i4.click();
});
};
var s = (e4, c5, l4) => new Promise((r4, s4) => {
if (!e4)
return s4(new t());
const p4 = i(e4, c5, l4);
if (!p4)
return s4(new n());
r4(p4);
});
var i = (e4, t4, n3) => !t4 && n3 ? e4.length === 1 ? e4[0] : null : e4.length ? e4 : null;
var p = ({ accept: e4, multiple: t4 }) => {
const n3 = document.createElement("input");
return n3.type = "file", n3.multiple = t4, n3.accept = e4, n3;
};
// node_modules/js-yaml/dist/js-yaml.mjs
function isNothing(subject) {
return typeof subject === "undefined" || subject === null;
}
function isObject(subject) {
return typeof subject === "object" && subject !== null;
}
function toArray(sequence) {
if (Array.isArray(sequence))
return sequence;
else if (isNothing(sequence))
return [];
return [sequence];
}
function extend(target, source) {
var index2, length5, key, sourceKeys;
if (source) {
sourceKeys = Object.keys(source);
for (index2 = 0, length5 = sourceKeys.length; index2 < length5; index2 += 1) {
key = sourceKeys[index2];
target[key] = source[key];
}
}
return target;
}
function repeat(string, count2) {
var result = "", cycle;
for (cycle = 0; cycle < count2; cycle += 1) {
result += string;
}
return result;
}
function isNegativeZero(number) {
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
}
var isNothing_1 = isNothing;
var isObject_1 = isObject;
var toArray_1 = toArray;
var repeat_1 = repeat;
var isNegativeZero_1 = isNegativeZero;
var extend_1 = extend;
var common = {
isNothing: isNothing_1,
isObject: isObject_1,
toArray: toArray_1,
repeat: repeat_1,
isNegativeZero: isNegativeZero_1,
extend: extend_1
};
function formatError(exception2, compact) {
var where = "", message = exception2.reason || "(unknown reason)";
if (!exception2.mark)
return message;
if (exception2.mark.name) {
where += 'in "' + exception2.mark.name + '" ';
}
where += "(" + (exception2.mark.line + 1) + ":" + (exception2.mark.column + 1) + ")";
if (!compact && exception2.mark.snippet) {
where += "\n\n" + exception2.mark.snippet;
}
return message + " " + where;
}
function YAMLException$1(reason, mark) {
Error.call(this);
this.name = "YAMLException";
this.reason = reason;
this.mark = mark;
this.message = formatError(this, false);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
} else {
this.stack = new Error().stack || "";
}
}
YAMLException$1.prototype = Object.create(Error.prototype);
YAMLException$1.prototype.constructor = YAMLException$1;
YAMLException$1.prototype.toString = function toString(compact) {
return this.name + ": " + formatError(this, compact);
};
var exception = YAMLException$1;
function getLine(buffer, lineStart, lineEnd, position2, maxLineLength) {
var head2 = "";
var tail = "";
var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
if (position2 - lineStart > maxHalfLength) {
head2 = " ... ";
lineStart = position2 - maxHalfLength + head2.length;
}
if (lineEnd - position2 > maxHalfLength) {
tail = " ...";
lineEnd = position2 + maxHalfLength - tail.length;
}
return {
str: head2 + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
pos: position2 - lineStart + head2.length
};
}
function padStart(string, max8) {
return common.repeat(" ", max8 - string.length) + string;
}
function makeSnippet(mark, options) {
options = Object.create(options || null);
if (!mark.buffer)
return null;
if (!options.maxLength)
options.maxLength = 79;
if (typeof options.indent !== "number")
options.indent = 1;
if (typeof options.linesBefore !== "number")
options.linesBefore = 3;
if (typeof options.linesAfter !== "number")
options.linesAfter = 2;
var re = /\r?\n|\r|\0/g;
var lineStarts = [0];
var lineEnds = [];
var match;
var foundLineNo = -1;
while (match = re.exec(mark.buffer)) {
lineEnds.push(match.index);
lineStarts.push(match.index + match[0].length);
if (mark.position <= match.index && foundLineNo < 0) {
foundLineNo = lineStarts.length - 2;
}
}
if (foundLineNo < 0)
foundLineNo = lineStarts.length - 1;
var result = "", i4, line2;
var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
for (i4 = 1; i4 <= options.linesBefore; i4++) {
if (foundLineNo - i4 < 0)
break;
line2 = getLine(mark.buffer, lineStarts[foundLineNo - i4], lineEnds[foundLineNo - i4], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i4]), maxLineLength);
result = common.repeat(" ", options.indent) + padStart((mark.line - i4 + 1).toString(), lineNoLength) + " | " + line2.str + "\n" + result;
}
line2 = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line2.str + "\n";
result += common.repeat("-", options.indent + lineNoLength + 3 + line2.pos) + "^\n";
for (i4 = 1; i4 <= options.linesAfter; i4++) {
if (foundLineNo + i4 >= lineEnds.length)
break;
line2 = getLine(mark.buffer, lineStarts[foundLineNo + i4], lineEnds[foundLineNo + i4], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i4]), maxLineLength);
result += common.repeat(" ", options.indent) + padStart((mark.line + i4 + 1).toString(), lineNoLength) + " | " + line2.str + "\n";
}
return result.replace(/\n$/, "");
}
var snippet = makeSnippet;
var TYPE_CONSTRUCTOR_OPTIONS = [
"kind",
"multi",
"resolve",
"construct",
"instanceOf",
"predicate",
"represent",
"representName",
"defaultStyle",
"styleAliases"
];
var YAML_NODE_KINDS = [
"scalar",
"sequence",
"mapping"
];
function compileStyleAliases(map6) {
var result = {};
if (map6 !== null) {
Object.keys(map6).forEach(function(style) {
map6[style].forEach(function(alias) {
result[String(alias)] = style;
});
});
}
return result;
}
function Type$1(tag, options) {
options = options || {};
Object.keys(options).forEach(function(name) {
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
}
});
this.options = options;
this.tag = tag;
this.kind = options["kind"] || null;
this.resolve = options["resolve"] || function() {
return true;
};
this.construct = options["construct"] || function(data3) {
return data3;
};
this.instanceOf = options["instanceOf"] || null;
this.predicate = options["predicate"] || null;
this.represent = options["represent"] || null;
this.representName = options["representName"] || null;
this.defaultStyle = options["defaultStyle"] || null;
this.multi = options["multi"] || false;
this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
}
}
var type = Type$1;
function compileList(schema3, name) {
var result = [];
schema3[name].forEach(function(currentType) {
var newIndex = result.length;
result.forEach(function(previousType, previousIndex) {
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
newIndex = previousIndex;
}
});
result[newIndex] = currentType;
});
return result;
}
function compileMap() {
var result = {
scalar: {},
sequence: {},
mapping: {},
fallback: {},
multi: {
scalar: [],
sequence: [],
mapping: [],
fallback: []
}
}, index2, length5;
function collectType(type2) {
if (type2.multi) {
result.multi[type2.kind].push(type2);
result.multi["fallback"].push(type2);
} else {
result[type2.kind][type2.tag] = result["fallback"][type2.tag] = type2;
}
}
for (index2 = 0, length5 = arguments.length; index2 < length5; index2 += 1) {
arguments[index2].forEach(collectType);
}
return result;
}
function Schema$1(definition) {
return this.extend(definition);
}
Schema$1.prototype.extend = function extend2(definition) {
var implicit = [];
var explicit = [];
if (definition instanceof type) {
explicit.push(definition);
} else if (Array.isArray(definition)) {
explicit = explicit.concat(definition);
} else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
if (definition.implicit)
implicit = implicit.concat(definition.implicit);
if (definition.explicit)
explicit = explicit.concat(definition.explicit);
} else {
throw new exception("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
}
implicit.forEach(function(type$1) {
if (!(type$1 instanceof type)) {
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
}
if (type$1.loadKind && type$1.loadKind !== "scalar") {
throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
}
if (type$1.multi) {
throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
}
});
explicit.forEach(function(type$1) {
if (!(type$1 instanceof type)) {
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
}
});
var result = Object.create(Schema$1.prototype);
result.implicit = (this.implicit || []).concat(implicit);
result.explicit = (this.explicit || []).concat(explicit);
result.compiledImplicit = compileList(result, "implicit");
result.compiledExplicit = compileList(result, "explicit");
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
return result;
};
var schema = Schema$1;
var str = new type("tag:yaml.org,2002:str", {
kind: "scalar",
construct: function(data3) {
return data3 !== null ? data3 : "";
}
});
var seq = new type("tag:yaml.org,2002:seq", {
kind: "sequence",
construct: function(data3) {
return data3 !== null ? data3 : [];
}
});
var map = new type("tag:yaml.org,2002:map", {
kind: "mapping",
construct: function(data3) {
return data3 !== null ? data3 : {};
}
});
var failsafe = new schema({
explicit: [
str,
seq,
map
]
});
function resolveYamlNull(data3) {
if (data3 === null)
return true;
var max8 = data3.length;
return max8 === 1 && data3 === "~" || max8 === 4 && (data3 === "null" || data3 === "Null" || data3 === "NULL");
}
function constructYamlNull() {
return null;
}
function isNull(object) {
return object === null;
}
var _null = new type("tag:yaml.org,2002:null", {
kind: "scalar",
resolve: resolveYamlNull,
construct: constructYamlNull,
predicate: isNull,
represent: {
canonical: function() {
return "~";
},
lowercase: function() {
return "null";
},
uppercase: function() {
return "NULL";
},
camelcase: function() {
return "Null";
},
empty: function() {
return "";
}
},
defaultStyle: "lowercase"
});
function resolveYamlBoolean(data3) {
if (data3 === null)
return false;
var max8 = data3.length;
return max8 === 4 && (data3 === "true" || data3 === "True" || data3 === "TRUE") || max8 === 5 && (data3 === "false" || data3 === "False" || data3 === "FALSE");
}
function constructYamlBoolean(data3) {
return data3 === "true" || data3 === "True" || data3 === "TRUE";
}
function isBoolean(object) {
return Object.prototype.toString.call(object) === "[object Boolean]";
}
var bool = new type("tag:yaml.org,2002:bool", {
kind: "scalar",
resolve: resolveYamlBoolean,
construct: constructYamlBoolean,
predicate: isBoolean,
represent: {
lowercase: function(object) {
return object ? "true" : "false";
},
uppercase: function(object) {
return object ? "TRUE" : "FALSE";
},
camelcase: function(object) {
return object ? "True" : "False";
}
},
defaultStyle: "lowercase"
});
function isHexCode(c5) {
return 48 <= c5 && c5 <= 57 || 65 <= c5 && c5 <= 70 || 97 <= c5 && c5 <= 102;
}
function isOctCode(c5) {
return 48 <= c5 && c5 <= 55;
}
function isDecCode(c5) {
return 48 <= c5 && c5 <= 57;
}
function resolveYamlInteger(data3) {
if (data3 === null)
return false;
var max8 = data3.length, index2 = 0, hasDigits = false, ch2;
if (!max8)
return false;
ch2 = data3[index2];
if (ch2 === "-" || ch2 === "+") {
ch2 = data3[++index2];
}
if (ch2 === "0") {
if (index2 + 1 === max8)
return true;
ch2 = data3[++index2];
if (ch2 === "b") {
index2++;
for (; index2 < max8; index2++) {
ch2 = data3[index2];
if (ch2 === "_")
continue;
if (ch2 !== "0" && ch2 !== "1")
return false;
hasDigits = true;
}
return hasDigits && ch2 !== "_";
}
if (ch2 === "x") {
index2++;
for (; index2 < max8; index2++) {
ch2 = data3[index2];
if (ch2 === "_")
continue;
if (!isHexCode(data3.charCodeAt(index2)))
return false;
hasDigits = true;
}
return hasDigits && ch2 !== "_";
}
if (ch2 === "o") {
index2++;
for (; index2 < max8; index2++) {
ch2 = data3[index2];
if (ch2 === "_")
continue;
if (!isOctCode(data3.charCodeAt(index2)))
return false;
hasDigits = true;
}
return hasDigits && ch2 !== "_";
}
}
if (ch2 === "_")
return false;
for (; index2 < max8; index2++) {
ch2 = data3[index2];
if (ch2 === "_")
continue;
if (!isDecCode(data3.charCodeAt(index2))) {
return false;
}
hasDigits = true;
}
if (!hasDigits || ch2 === "_")
return false;
return true;
}
function constructYamlInteger(data3) {
var value2 = data3, sign = 1, ch2;
if (value2.indexOf("_") !== -1) {
value2 = value2.replace(/_/g, "");
}
ch2 = value2[0];
if (ch2 === "-" || ch2 === "+") {
if (ch2 === "-")
sign = -1;
value2 = value2.slice(1);
ch2 = value2[0];
}
if (value2 === "0")
return 0;
if (ch2 === "0") {
if (value2[1] === "b")
return sign * parseInt(value2.slice(2), 2);
if (value2[1] === "x")
return sign * parseInt(value2.slice(2), 16);
if (value2[1] === "o")
return sign * parseInt(value2.slice(2), 8);
}
return sign * parseInt(value2, 10);
}
function isInteger(object) {
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
}
var int = new type("tag:yaml.org,2002:int", {
kind: "scalar",
resolve: resolveYamlInteger,
construct: constructYamlInteger,
predicate: isInteger,
represent: {
binary: function(obj) {
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
},
octal: function(obj) {
return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
},
decimal: function(obj) {
return obj.toString(10);
},
hexadecimal: function(obj) {
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
}
},
defaultStyle: "decimal",
styleAliases: {
binary: [2, "bin"],
octal: [8, "oct"],
decimal: [10, "dec"],
hexadecimal: [16, "hex"]
}
});
var YAML_FLOAT_PATTERN = new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
function resolveYamlFloat(data3) {
if (data3 === null)
return false;
if (!YAML_FLOAT_PATTERN.test(data3) || data3[data3.length - 1] === "_") {
return false;
}
return true;
}
function constructYamlFloat(data3) {
var value2, sign;
value2 = data3.replace(/_/g, "").toLowerCase();
sign = value2[0] === "-" ? -1 : 1;
if ("+-".indexOf(value2[0]) >= 0) {
value2 = value2.slice(1);
}
if (value2 === ".inf") {
return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
} else if (value2 === ".nan") {
return NaN;
}
return sign * parseFloat(value2, 10);
}
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
function representYamlFloat(object, style) {
var res;
if (isNaN(object)) {
switch (style) {
case "lowercase":
return ".nan";
case "uppercase":
return ".NAN";
case "camelcase":
return ".NaN";
}
} else if (Number.POSITIVE_INFINITY === object) {
switch (style) {
case "lowercase":
return ".inf";
case "uppercase":
return ".INF";
case "camelcase":
return ".Inf";
}
} else if (Number.NEGATIVE_INFINITY === object) {
switch (style) {
case "lowercase":
return "-.inf";
case "uppercase":
return "-.INF";
case "camelcase":
return "-.Inf";
}
} else if (common.isNegativeZero(object)) {
return "-0.0";
}
res = object.toString(10);
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
}
function isFloat(object) {
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
}
var float = new type("tag:yaml.org,2002:float", {
kind: "scalar",
resolve: resolveYamlFloat,
construct: constructYamlFloat,
predicate: isFloat,
represent: representYamlFloat,
defaultStyle: "lowercase"
});
var json = failsafe.extend({
implicit: [
_null,
bool,
int,
float
]
});
var core = json;
var YAML_DATE_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
var YAML_TIMESTAMP_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");
function resolveYamlTimestamp(data3) {
if (data3 === null)
return false;
if (YAML_DATE_REGEXP.exec(data3) !== null)
return true;
if (YAML_TIMESTAMP_REGEXP.exec(data3) !== null)
return true;
return false;
}
function constructYamlTimestamp(data3) {
var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
match = YAML_DATE_REGEXP.exec(data3);
if (match === null)
match = YAML_TIMESTAMP_REGEXP.exec(data3);
if (match === null)
throw new Error("Date resolve error");
year = +match[1];
month = +match[2] - 1;
day = +match[3];
if (!match[4]) {
return new Date(Date.UTC(year, month, day));
}
hour = +match[4];
minute = +match[5];
second = +match[6];
if (match[7]) {
fraction = match[7].slice(0, 3);
while (fraction.length < 3) {
fraction += "0";
}
fraction = +fraction;
}
if (match[9]) {
tz_hour = +match[10];
tz_minute = +(match[11] || 0);
delta = (tz_hour * 60 + tz_minute) * 6e4;
if (match[9] === "-")
delta = -delta;
}
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
if (delta)
date.setTime(date.getTime() - delta);
return date;
}
function representYamlTimestamp(object) {
return object.toISOString();
}
var timestamp = new type("tag:yaml.org,2002:timestamp", {
kind: "scalar",
resolve: resolveYamlTimestamp,
construct: constructYamlTimestamp,
instanceOf: Date,
represent: representYamlTimestamp
});
function resolveYamlMerge(data3) {
return data3 === "<<" || data3 === null;
}
var merge = new type("tag:yaml.org,2002:merge", {
kind: "scalar",
resolve: resolveYamlMerge
});
var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
function resolveYamlBinary(data3) {
if (data3 === null)
return false;
var code, idx, bitlen = 0, max8 = data3.length, map6 = BASE64_MAP;
for (idx = 0; idx < max8; idx++) {
code = map6.indexOf(data3.charAt(idx));
if (code > 64)
continue;
if (code < 0)
return false;
bitlen += 6;
}
return bitlen % 8 === 0;
}
function constructYamlBinary(data3) {
var idx, tailbits, input = data3.replace(/[\r\n=]/g, ""), max8 = input.length, map6 = BASE64_MAP, bits = 0, result = [];
for (idx = 0; idx < max8; idx++) {
if (idx % 4 === 0 && idx) {
result.push(bits >> 16 & 255);
result.push(bits >> 8 & 255);
result.push(bits & 255);
}
bits = bits << 6 | map6.indexOf(input.charAt(idx));
}
tailbits = max8 % 4 * 6;
if (tailbits === 0) {
result.push(bits >> 16 & 255);
result.push(bits >> 8 & 255);
result.push(bits & 255);
} else if (tailbits === 18) {
result.push(bits >> 10 & 255);
result.push(bits >> 2 & 255);
} else if (tailbits === 12) {
result.push(bits >> 4 & 255);
}
return new Uint8Array(result);
}
function representYamlBinary(object) {
var result = "", bits = 0, idx, tail, max8 = object.length, map6 = BASE64_MAP;
for (idx = 0; idx < max8; idx++) {
if (idx % 3 === 0 && idx) {
result += map6[bits >> 18 & 63];
result += map6[bits >> 12 & 63];
result += map6[bits >> 6 & 63];
result += map6[bits & 63];
}
bits = (bits << 8) + object[idx];
}
tail = max8 % 3;
if (tail === 0) {
result += map6[bits >> 18 & 63];
result += map6[bits >> 12 & 63];
result += map6[bits >> 6 & 63];
result += map6[bits & 63];
} else if (tail === 2) {
result += map6[bits >> 10 & 63];
result += map6[bits >> 4 & 63];
result += map6[bits << 2 & 63];
result += map6[64];
} else if (tail === 1) {
result += map6[bits >> 2 & 63];
result += map6[bits << 4 & 63];
result += map6[64];
result += map6[64];
}
return result;
}
function isBinary(obj) {
return Object.prototype.toString.call(obj) === "[object Uint8Array]";
}
var binary = new type("tag:yaml.org,2002:binary", {
kind: "scalar",
resolve: resolveYamlBinary,
construct: constructYamlBinary,
predicate: isBinary,
represent: representYamlBinary
});
var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
var _toString$2 = Object.prototype.toString;
function resolveYamlOmap(data3) {
if (data3 === null)
return true;
var objectKeys = [], index2, length5, pair, pairKey, pairHasKey, object = data3;
for (index2 = 0, length5 = object.length; index2 < length5; index2 += 1) {
pair = object[index2];
pairHasKey = false;
if (_toString$2.call(pair) !== "[object Object]")
return false;
for (pairKey in pair) {
if (_hasOwnProperty$3.call(pair, pairKey)) {
if (!pairHasKey)
pairHasKey = true;
else
return false;
}
}
if (!pairHasKey)
return false;
if (objectKeys.indexOf(pairKey) === -1)
objectKeys.push(pairKey);
else
return false;
}
return true;
}
function constructYamlOmap(data3) {
return data3 !== null ? data3 : [];
}
var omap = new type("tag:yaml.org,2002:omap", {
kind: "sequence",
resolve: resolveYamlOmap,
construct: constructYamlOmap
});
var _toString$1 = Object.prototype.toString;
function resolveYamlPairs(data3) {
if (data3 === null)
return true;
var index2, length5, pair, keys2, result, object = data3;
result = new Array(object.length);
for (index2 = 0, length5 = object.length; index2 < length5; index2 += 1) {
pair = object[index2];
if (_toString$1.call(pair) !== "[object Object]")
return false;
keys2 = Object.keys(pair);
if (keys2.length !== 1)
return false;
result[index2] = [keys2[0], pair[keys2[0]]];
}
return true;
}
function constructYamlPairs(data3) {
if (data3 === null)
return [];
var index2, length5, pair, keys2, result, object = data3;
result = new Array(object.length);
for (index2 = 0, length5 = object.length; index2 < length5; index2 += 1) {
pair = object[index2];
keys2 = Object.keys(pair);
result[index2] = [keys2[0], pair[keys2[0]]];
}
return result;
}
var pairs = new type("tag:yaml.org,2002:pairs", {
kind: "sequence",
resolve: resolveYamlPairs,
construct: constructYamlPairs
});
var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
function resolveYamlSet(data3) {
if (data3 === null)
return true;
var key, object = data3;
for (key in object) {
if (_hasOwnProperty$2.call(object, key)) {
if (object[key] !== null)
return false;
}
}
return true;
}
function constructYamlSet(data3) {
return data3 !== null ? data3 : {};
}
var set = new type("tag:yaml.org,2002:set", {
kind: "mapping",
resolve: resolveYamlSet,
construct: constructYamlSet
});
var _default = core.extend({
implicit: [
timestamp,
merge
],
explicit: [
binary,
omap,
pairs,
set
]
});
var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
var CONTEXT_FLOW_IN = 1;
var CONTEXT_FLOW_OUT = 2;
var CONTEXT_BLOCK_IN = 3;
var CONTEXT_BLOCK_OUT = 4;
var CHOMPING_CLIP = 1;
var CHOMPING_STRIP = 2;
var CHOMPING_KEEP = 3;
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
function _class(obj) {
return Object.prototype.toString.call(obj);
}
function is_EOL(c5) {
return c5 === 10 || c5 === 13;
}
function is_WHITE_SPACE(c5) {
return c5 === 9 || c5 === 32;
}
function is_WS_OR_EOL(c5) {
return c5 === 9 || c5 === 32 || c5 === 10 || c5 === 13;
}
function is_FLOW_INDICATOR(c5) {
return c5 === 44 || c5 === 91 || c5 === 93 || c5 === 123 || c5 === 125;
}
function fromHexCode(c5) {
var lc;
if (48 <= c5 && c5 <= 57) {
return c5 - 48;
}
lc = c5 | 32;
if (97 <= lc && lc <= 102) {
return lc - 97 + 10;
}
return -1;
}
function escapedHexLen(c5) {
if (c5 === 120) {
return 2;
}
if (c5 === 117) {
return 4;
}
if (c5 === 85) {
return 8;
}
return 0;
}
function fromDecimalCode(c5) {
if (48 <= c5 && c5 <= 57) {
return c5 - 48;
}
return -1;
}
function simpleEscapeSequence(c5) {
return c5 === 48 ? "\0" : c5 === 97 ? "\x07" : c5 === 98 ? "\b" : c5 === 116 ? " " : c5 === 9 ? " " : c5 === 110 ? "\n" : c5 === 118 ? "\v" : c5 === 102 ? "\f" : c5 === 114 ? "\r" : c5 === 101 ? "" : c5 === 32 ? " " : c5 === 34 ? '"' : c5 === 47 ? "/" : c5 === 92 ? "\\" : c5 === 78 ? "\x85" : c5 === 95 ? "\xA0" : c5 === 76 ? "\u2028" : c5 === 80 ? "\u2029" : "";
}
function charFromCodepoint(c5) {
if (c5 <= 65535) {
return String.fromCharCode(c5);
}
return String.fromCharCode((c5 - 65536 >> 10) + 55296, (c5 - 65536 & 1023) + 56320);
}
var simpleEscapeCheck = new Array(256);
var simpleEscapeMap = new Array(256);
for (i4 = 0; i4 < 256; i4++) {
simpleEscapeCheck[i4] = simpleEscapeSequence(i4) ? 1 : 0;
simpleEscapeMap[i4] = simpleEscapeSequence(i4);
}
var i4;
function State$1(input, options) {
this.input = input;
this.filename = options["filename"] || null;
this.schema = options["schema"] || _default;
this.onWarning = options["onWarning"] || null;
this.legacy = options["legacy"] || false;
this.json = options["json"] || false;
this.listener = options["listener"] || null;
this.implicitTypes = this.schema.compiledImplicit;
this.typeMap = this.schema.compiledTypeMap;
this.length = input.length;
this.position = 0;
this.line = 0;
this.lineStart = 0;
this.lineIndent = 0;
this.firstTabInLine = -1;
this.documents = [];
}
function generateError(state2, message) {
var mark = {
name: state2.filename,
buffer: state2.input.slice(0, -1),
position: state2.position,
line: state2.line,
column: state2.position - state2.lineStart
};
mark.snippet = snippet(mark);
return new exception(message, mark);
}
function throwError(state2, message) {
throw generateError(state2, message);
}
function throwWarning(state2, message) {
if (state2.onWarning) {
state2.onWarning.call(null, generateError(state2, message));
}
}
var directiveHandlers = {
YAML: function handleYamlDirective(state2, name, args) {
var match, major, minor;
if (state2.version !== null) {
throwError(state2, "duplication of %YAML directive");
}
if (args.length !== 1) {
throwError(state2, "YAML directive accepts exactly one argument");
}
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
if (match === null) {
throwError(state2, "ill-formed argument of the YAML directive");
}
major = parseInt(match[1], 10);
minor = parseInt(match[2], 10);
if (major !== 1) {
throwError(state2, "unacceptable YAML version of the document");
}
state2.version = args[0];
state2.checkLineBreaks = minor < 2;
if (minor !== 1 && minor !== 2) {
throwWarning(state2, "unsupported YAML version of the document");
}
},
TAG: function handleTagDirective(state2, name, args) {
var handle, prefix2;
if (args.length !== 2) {
throwError(state2, "TAG directive accepts exactly two arguments");
}
handle = args[0];
prefix2 = args[1];
if (!PATTERN_TAG_HANDLE.test(handle)) {
throwError(state2, "ill-formed tag handle (first argument) of the TAG directive");
}
if (_hasOwnProperty$1.call(state2.tagMap, handle)) {
throwError(state2, 'there is a previously declared suffix for "' + handle + '" tag handle');
}
if (!PATTERN_TAG_URI.test(prefix2)) {
throwError(state2, "ill-formed tag prefix (second argument) of the TAG directive");
}
try {
prefix2 = decodeURIComponent(prefix2);
} catch (err) {
throwError(state2, "tag prefix is malformed: " + prefix2);
}
state2.tagMap[handle] = prefix2;
}
};
function captureSegment(state2, start, end2, checkJson) {
var _position, _length, _character, _result;
if (start < end2) {
_result = state2.input.slice(start, end2);
if (checkJson) {
for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
_character = _result.charCodeAt(_position);
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
throwError(state2, "expected valid JSON character");
}
}
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
throwError(state2, "the stream contains non-printable characters");
}
state2.result += _result;
}
}
function mergeMappings(state2, destination, source, overridableKeys) {
var sourceKeys, key, index2, quantity;
if (!common.isObject(source)) {
throwError(state2, "cannot merge mappings; the provided source object is unacceptable");
}
sourceKeys = Object.keys(source);
for (index2 = 0, quantity = sourceKeys.length; index2 < quantity; index2 += 1) {
key = sourceKeys[index2];
if (!_hasOwnProperty$1.call(destination, key)) {
destination[key] = source[key];
overridableKeys[key] = true;
}
}
}
function storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
var index2, quantity;
if (Array.isArray(keyNode)) {
keyNode = Array.prototype.slice.call(keyNode);
for (index2 = 0, quantity = keyNode.length; index2 < quantity; index2 += 1) {
if (Array.isArray(keyNode[index2])) {
throwError(state2, "nested arrays are not supported inside keys");
}
if (typeof keyNode === "object" && _class(keyNode[index2]) === "[object Object]") {
keyNode[index2] = "[object Object]";
}
}
}
if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
keyNode = "[object Object]";
}
keyNode = String(keyNode);
if (_result === null) {
_result = {};
}
if (keyTag === "tag:yaml.org,2002:merge") {
if (Array.isArray(valueNode)) {
for (index2 = 0, quantity = valueNode.length; index2 < quantity; index2 += 1) {
mergeMappings(state2, _result, valueNode[index2], overridableKeys);
}
} else {
mergeMappings(state2, _result, valueNode, overridableKeys);
}
} else {
if (!state2.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
state2.line = startLine || state2.line;
state2.lineStart = startLineStart || state2.lineStart;
state2.position = startPos || state2.position;
throwError(state2, "duplicated mapping key");
}
if (keyNode === "__proto__") {
Object.defineProperty(_result, keyNode, {
configurable: true,
enumerable: true,
writable: true,
value: valueNode
});
} else {
_result[keyNode] = valueNode;
}
delete overridableKeys[keyNode];
}
return _result;
}
function readLineBreak(state2) {
var ch2;
ch2 = state2.input.charCodeAt(state2.position);
if (ch2 === 10) {
state2.position++;
} else if (ch2 === 13) {
state2.position++;
if (state2.input.charCodeAt(state2.position) === 10) {
state2.position++;
}
} else {
throwError(state2, "a line break is expected");
}
state2.line += 1;
state2.lineStart = state2.position;
state2.firstTabInLine = -1;
}
function skipSeparationSpace(state2, allowComments, checkIndent) {
var lineBreaks = 0, ch2 = state2.input.charCodeAt(state2.position);
while (ch2 !== 0) {
while (is_WHITE_SPACE(ch2)) {
if (ch2 === 9 && state2.firstTabInLine === -1) {
state2.firstTabInLine = state2.position;
}
ch2 = state2.input.charCodeAt(++state2.position);
}
if (allowComments && ch2 === 35) {
do {
ch2 = state2.input.charCodeAt(++state2.position);
} while (ch2 !== 10 && ch2 !== 13 && ch2 !== 0);
}
if (is_EOL(ch2)) {
readLineBreak(state2);
ch2 = state2.input.charCodeAt(state2.position);
lineBreaks++;
state2.lineIndent = 0;
while (ch2 === 32) {
state2.lineIndent++;
ch2 = state2.input.charCodeAt(++state2.position);
}
} else {
break;
}
}
if (checkIndent !== -1 && lineBreaks !== 0 && state2.lineIndent < checkIndent) {
throwWarning(state2, "deficient indentation");
}
return lineBreaks;
}
function testDocumentSeparator(state2) {
var _position = state2.position, ch2;
ch2 = state2.input.charCodeAt(_position);
if ((ch2 === 45 || ch2 === 46) && ch2 === state2.input.charCodeAt(_position + 1) && ch2 === state2.input.charCodeAt(_position + 2)) {
_position += 3;
ch2 = state2.input.charCodeAt(_position);
if (ch2 === 0 || is_WS_OR_EOL(ch2)) {
return true;
}
}
return false;
}
function writeFoldedLines(state2, count2) {
if (count2 === 1) {
state2.result += " ";
} else if (count2 > 1) {
state2.result += common.repeat("\n", count2 - 1);
}
}
function readPlainScalar(state2, nodeIndent, withinFlowCollection) {
var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state2.kind, _result = state2.result, ch2;
ch2 = state2.input.charCodeAt(state2.position);
if (is_WS_OR_EOL(ch2) || is_FLOW_INDICATOR(ch2) || ch2 === 35 || ch2 === 38 || ch2 === 42 || ch2 === 33 || ch2 === 124 || ch2 === 62 || ch2 === 39 || ch2 === 34 || ch2 === 37 || ch2 === 64 || ch2 === 96) {
return false;
}
if (ch2 === 63 || ch2 === 45) {
following = state2.input.charCodeAt(state2.position + 1);
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
return false;
}
}
state2.kind = "scalar";
state2.result = "";
captureStart = captureEnd = state2.position;
hasPendingContent = false;
while (ch2 !== 0) {
if (ch2 === 58) {
following = state2.input.charCodeAt(state2.position + 1);
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
break;
}
} else if (ch2 === 35) {
preceding = state2.input.charCodeAt(state2.position - 1);
if (is_WS_OR_EOL(preceding)) {
break;
}
} else if (state2.position === state2.lineStart && testDocumentSeparator(state2) || withinFlowCollection && is_FLOW_INDICATOR(ch2)) {
break;
} else if (is_EOL(ch2)) {
_line = state2.line;
_lineStart = state2.lineStart;
_lineIndent = state2.lineIndent;
skipSeparationSpace(state2, false, -1);
if (state2.lineIndent >= nodeIndent) {
hasPendingContent = true;
ch2 = state2.input.charCodeAt(state2.position);
continue;
} else {
state2.position = captureEnd;
state2.line = _line;
state2.lineStart = _lineStart;
state2.lineIndent = _lineIndent;
break;
}
}
if (hasPendingContent) {
captureSegment(state2, captureStart, captureEnd, false);
writeFoldedLines(state2, state2.line - _line);
captureStart = captureEnd = state2.position;
hasPendingContent = false;
}
if (!is_WHITE_SPACE(ch2)) {
captureEnd = state2.position + 1;
}
ch2 = state2.input.charCodeAt(++state2.position);
}
captureSegment(state2, captureStart, captureEnd, false);
if (state2.result) {
return true;
}
state2.kind = _kind;
state2.result = _result;
return false;
}
function readSingleQuotedScalar(state2, nodeIndent) {
var ch2, captureStart, captureEnd;
ch2 = state2.input.charCodeAt(state2.position);
if (ch2 !== 39) {
return false;
}
state2.kind = "scalar";
state2.result = "";
state2.position++;
captureStart = captureEnd = state2.position;
while ((ch2 = state2.input.charCodeAt(state2.position)) !== 0) {
if (ch2 === 39) {
captureSegment(state2, captureStart, state2.position, true);
ch2 = state2.input.charCodeAt(++state2.position);
if (ch2 === 39) {
captureStart = state2.position;
state2.position++;
captureEnd = state2.position;
} else {
return true;
}
} else if (is_EOL(ch2)) {
captureSegment(state2, captureStart, captureEnd, true);
writeFoldedLines(state2, skipSeparationSpace(state2, false, nodeIndent));
captureStart = captureEnd = state2.position;
} else if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
throwError(state2, "unexpected end of the document within a single quoted scalar");
} else {
state2.position++;
captureEnd = state2.position;
}
}
throwError(state2, "unexpected end of the stream within a single quoted scalar");
}
function readDoubleQuotedScalar(state2, nodeIndent) {
var captureStart, captureEnd, hexLength, hexResult, tmp, ch2;
ch2 = state2.input.charCodeAt(state2.position);
if (ch2 !== 34) {
return false;
}
state2.kind = "scalar";
state2.result = "";
state2.position++;
captureStart = captureEnd = state2.position;
while ((ch2 = state2.input.charCodeAt(state2.position)) !== 0) {
if (ch2 === 34) {
captureSegment(state2, captureStart, state2.position, true);
state2.position++;
return true;
} else if (ch2 === 92) {
captureSegment(state2, captureStart, state2.position, true);
ch2 = state2.input.charCodeAt(++state2.position);
if (is_EOL(ch2)) {
skipSeparationSpace(state2, false, nodeIndent);
} else if (ch2 < 256 && simpleEscapeCheck[ch2]) {
state2.result += simpleEscapeMap[ch2];
state2.position++;
} else if ((tmp = escapedHexLen(ch2)) > 0) {
hexLength = tmp;
hexResult = 0;
for (; hexLength > 0; hexLength--) {
ch2 = state2.input.charCodeAt(++state2.position);
if ((tmp = fromHexCode(ch2)) >= 0) {
hexResult = (hexResult << 4) + tmp;
} else {
throwError(state2, "expected hexadecimal character");
}
}
state2.result += charFromCodepoint(hexResult);
state2.position++;
} else {
throwError(state2, "unknown escape sequence");
}
captureStart = captureEnd = state2.position;
} else if (is_EOL(ch2)) {
captureSegment(state2, captureStart, captureEnd, true);
writeFoldedLines(state2, skipSeparationSpace(state2, false, nodeIndent));
captureStart = captureEnd = state2.position;
} else if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
throwError(state2, "unexpected end of the document within a double quoted scalar");
} else {
state2.position++;
captureEnd = state2.position;
}
}
throwError(state2, "unexpected end of the stream within a double quoted scalar");
}
function readFlowCollection(state2, nodeIndent) {
var readNext = true, _line, _lineStart, _pos, _tag = state2.tag, _result, _anchor = state2.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = Object.create(null), keyNode, keyTag, valueNode, ch2;
ch2 = state2.input.charCodeAt(state2.position);
if (ch2 === 91) {
terminator = 93;
isMapping = false;
_result = [];
} else if (ch2 === 123) {
terminator = 125;
isMapping = true;
_result = {};
} else {
return false;
}
if (state2.anchor !== null) {
state2.anchorMap[state2.anchor] = _result;
}
ch2 = state2.input.charCodeAt(++state2.position);
while (ch2 !== 0) {
skipSeparationSpace(state2, true, nodeIndent);
ch2 = state2.input.charCodeAt(state2.position);
if (ch2 === terminator) {
state2.position++;
state2.tag = _tag;
state2.anchor = _anchor;
state2.kind = isMapping ? "mapping" : "sequence";
state2.result = _result;
return true;
} else if (!readNext) {
throwError(state2, "missed comma between flow collection entries");
} else if (ch2 === 44) {
throwError(state2, "expected the node content, but found ','");
}
keyTag = keyNode = valueNode = null;
isPair = isExplicitPair = false;
if (ch2 === 63) {
following = state2.input.charCodeAt(state2.position + 1);
if (is_WS_OR_EOL(following)) {
isPair = isExplicitPair = true;
state2.position++;
skipSeparationSpace(state2, true, nodeIndent);
}
}
_line = state2.line;
_lineStart = state2.lineStart;
_pos = state2.position;
composeNode(state2, nodeIndent, CONTEXT_FLOW_IN, false, true);
keyTag = state2.tag;
keyNode = state2.result;
skipSeparationSpace(state2, true, nodeIndent);
ch2 = state2.input.charCodeAt(state2.position);
if ((isExplicitPair || state2.line === _line) && ch2 === 58) {
isPair = true;
ch2 = state2.input.charCodeAt(++state2.position);
skipSeparationSpace(state2, true, nodeIndent);
composeNode(state2, nodeIndent, CONTEXT_FLOW_IN, false, true);
valueNode = state2.result;
}
if (isMapping) {
storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
} else if (isPair) {
_result.push(storeMappingPair(state2, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
} else {
_result.push(keyNode);
}
skipSeparationSpace(state2, true, nodeIndent);
ch2 = state2.input.charCodeAt(state2.position);
if (ch2 === 44) {
readNext = true;
ch2 = state2.input.charCodeAt(++state2.position);
} else {
readNext = false;
}
}
throwError(state2, "unexpected end of the stream within a flow collection");
}
function readBlockScalar(state2, nodeIndent) {
var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch2;
ch2 = state2.input.charCodeAt(state2.position);
if (ch2 === 124) {
folding = false;
} else if (ch2 === 62) {
folding = true;
} else {
return false;
}
state2.kind = "scalar";
state2.result = "";
while (ch2 !== 0) {
ch2 = state2.input.charCodeAt(++state2.position);
if (ch2 === 43 || ch2 === 45) {
if (CHOMPING_CLIP === chomping) {
chomping = ch2 === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
} else {
throwError(state2, "repeat of a chomping mode identifier");
}
} else if ((tmp = fromDecimalCode(ch2)) >= 0) {
if (tmp === 0) {
throwError(state2, "bad explicit indentation width of a block scalar; it cannot be less than one");
} else if (!detectedIndent) {
textIndent = nodeIndent + tmp - 1;
detectedIndent = true;
} else {
throwError(state2, "repeat of an indentation width identifier");
}
} else {
break;
}
}
if (is_WHITE_SPACE(ch2)) {
do {
ch2 = state2.input.charCodeAt(++state2.position);
} while (is_WHITE_SPACE(ch2));
if (ch2 === 35) {
do {
ch2 = state2.input.charCodeAt(++state2.position);
} while (!is_EOL(ch2) && ch2 !== 0);
}
}
while (ch2 !== 0) {
readLineBreak(state2);
state2.lineIndent = 0;
ch2 = state2.input.charCodeAt(state2.position);
while ((!detectedIndent || state2.lineIndent < textIndent) && ch2 === 32) {
state2.lineIndent++;
ch2 = state2.input.charCodeAt(++state2.position);
}
if (!detectedIndent && state2.lineIndent > textIndent) {
textIndent = state2.lineIndent;
}
if (is_EOL(ch2)) {
emptyLines++;
continue;
}
if (state2.lineIndent < textIndent) {
if (chomping === CHOMPING_KEEP) {
state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
} else if (chomping === CHOMPING_CLIP) {
if (didReadContent) {
state2.result += "\n";
}
}
break;
}
if (folding) {
if (is_WHITE_SPACE(ch2)) {
atMoreIndented = true;
state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
} else if (atMoreIndented) {
atMoreIndented = false;
state2.result += common.repeat("\n", emptyLines + 1);
} else if (emptyLines === 0) {
if (didReadContent) {
state2.result += " ";
}
} else {
state2.result += common.repeat("\n", emptyLines);
}
} else {
state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
}
didReadContent = true;
detectedIndent = true;
emptyLines = 0;
captureStart = state2.position;
while (!is_EOL(ch2) && ch2 !== 0) {
ch2 = state2.input.charCodeAt(++state2.position);
}
captureSegment(state2, captureStart, state2.position, false);
}
return true;
}
function readBlockSequence(state2, nodeIndent) {
var _line, _tag = state2.tag, _anchor = state2.anchor, _result = [], following, detected = false, ch2;
if (state2.firstTabInLine !== -1)
return false;
if (state2.anchor !== null) {
state2.anchorMap[state2.anchor] = _result;
}
ch2 = state2.input.charCodeAt(state2.position);
while (ch2 !== 0) {
if (state2.firstTabInLine !== -1) {
state2.position = state2.firstTabInLine;
throwError(state2, "tab characters must not be used in indentation");
}
if (ch2 !== 45) {
break;
}
following = state2.input.charCodeAt(state2.position + 1);
if (!is_WS_OR_EOL(following)) {
break;
}
detected = true;
state2.position++;
if (skipSeparationSpace(state2, true, -1)) {
if (state2.lineIndent <= nodeIndent) {
_result.push(null);
ch2 = state2.input.charCodeAt(state2.position);
continue;
}
}
_line = state2.line;
composeNode(state2, nodeIndent, CONTEXT_BLOCK_IN, false, true);
_result.push(state2.result);
skipSeparationSpace(state2, true, -1);
ch2 = state2.input.charCodeAt(state2.position);
if ((state2.line === _line || state2.lineIndent > nodeIndent) && ch2 !== 0) {
throwError(state2, "bad indentation of a sequence entry");
} else if (state2.lineIndent < nodeIndent) {
break;
}
}
if (detected) {
state2.tag = _tag;
state2.anchor = _anchor;
state2.kind = "sequence";
state2.result = _result;
return true;
}
return false;
}
function readBlockMapping(state2, nodeIndent, flowIndent) {
var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state2.tag, _anchor = state2.anchor, _result = {}, overridableKeys = Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch2;
if (state2.firstTabInLine !== -1)
return false;
if (state2.anchor !== null) {
state2.anchorMap[state2.anchor] = _result;
}
ch2 = state2.input.charCodeAt(state2.position);
while (ch2 !== 0) {
if (!atExplicitKey && state2.firstTabInLine !== -1) {
state2.position = state2.firstTabInLine;
throwError(state2, "tab characters must not be used in indentation");
}
following = state2.input.charCodeAt(state2.position + 1);
_line = state2.line;
if ((ch2 === 63 || ch2 === 58) && is_WS_OR_EOL(following)) {
if (ch2 === 63) {
if (atExplicitKey) {
storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
keyTag = keyNode = valueNode = null;
}
detected = true;
atExplicitKey = true;
allowCompact = true;
} else if (atExplicitKey) {
atExplicitKey = false;
allowCompact = true;
} else {
throwError(state2, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
}
state2.position += 1;
ch2 = following;
} else {
_keyLine = state2.line;
_keyLineStart = state2.lineStart;
_keyPos = state2.position;
if (!composeNode(state2, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
break;
}
if (state2.line === _line) {
ch2 = state2.input.charCodeAt(state2.position);
while (is_WHITE_SPACE(ch2)) {
ch2 = state2.input.charCodeAt(++state2.position);
}
if (ch2 === 58) {
ch2 = state2.input.charCodeAt(++state2.position);
if (!is_WS_OR_EOL(ch2)) {
throwError(state2, "a whitespace character is expected after the key-value separator within a block mapping");
}
if (atExplicitKey) {
storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
keyTag = keyNode = valueNode = null;
}
detected = true;
atExplicitKey = false;
allowCompact = false;
keyTag = state2.tag;
keyNode = state2.result;
} else if (detected) {
throwError(state2, "can not read an implicit mapping pair; a colon is missed");
} else {
state2.tag = _tag;
state2.anchor = _anchor;
return true;
}
} else if (detected) {
throwError(state2, "can not read a block mapping entry; a multiline key may not be an implicit key");
} else {
state2.tag = _tag;
state2.anchor = _anchor;
return true;
}
}
if (state2.line === _line || state2.lineIndent > nodeIndent) {
if (atExplicitKey) {
_keyLine = state2.line;
_keyLineStart = state2.lineStart;
_keyPos = state2.position;
}
if (composeNode(state2, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
if (atExplicitKey) {
keyNode = state2.result;
} else {
valueNode = state2.result;
}
}
if (!atExplicitKey) {
storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
keyTag = keyNode = valueNode = null;
}
skipSeparationSpace(state2, true, -1);
ch2 = state2.input.charCodeAt(state2.position);
}
if ((state2.line === _line || state2.lineIndent > nodeIndent) && ch2 !== 0) {
throwError(state2, "bad indentation of a mapping entry");
} else if (state2.lineIndent < nodeIndent) {
break;
}
}
if (atExplicitKey) {
storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
}
if (detected) {
state2.tag = _tag;
state2.anchor = _anchor;
state2.kind = "mapping";
state2.result = _result;
}
return detected;
}
function readTagProperty(state2) {
var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch2;
ch2 = state2.input.charCodeAt(state2.position);
if (ch2 !== 33)
return false;
if (state2.tag !== null) {
throwError(state2, "duplication of a tag property");
}
ch2 = state2.input.charCodeAt(++state2.position);
if (ch2 === 60) {
isVerbatim = true;
ch2 = state2.input.charCodeAt(++state2.position);
} else if (ch2 === 33) {
isNamed = true;
tagHandle = "!!";
ch2 = state2.input.charCodeAt(++state2.position);
} else {
tagHandle = "!";
}
_position = state2.position;
if (isVerbatim) {
do {
ch2 = state2.input.charCodeAt(++state2.position);
} while (ch2 !== 0 && ch2 !== 62);
if (state2.position < state2.length) {
tagName = state2.input.slice(_position, state2.position);
ch2 = state2.input.charCodeAt(++state2.position);
} else {
throwError(state2, "unexpected end of the stream within a verbatim tag");
}
} else {
while (ch2 !== 0 && !is_WS_OR_EOL(ch2)) {
if (ch2 === 33) {
if (!isNamed) {
tagHandle = state2.input.slice(_position - 1, state2.position + 1);
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
throwError(state2, "named tag handle cannot contain such characters");
}
isNamed = true;
_position = state2.position + 1;
} else {
throwError(state2, "tag suffix cannot contain exclamation marks");
}
}
ch2 = state2.input.charCodeAt(++state2.position);
}
tagName = state2.input.slice(_position, state2.position);
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
throwError(state2, "tag suffix cannot contain flow indicator characters");
}
}
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
throwError(state2, "tag name cannot contain such characters: " + tagName);
}
try {
tagName = decodeURIComponent(tagName);
} catch (err) {
throwError(state2, "tag name is malformed: " + tagName);
}
if (isVerbatim) {
state2.tag = tagName;
} else if (_hasOwnProperty$1.call(state2.tagMap, tagHandle)) {
state2.tag = state2.tagMap[tagHandle] + tagName;
} else if (tagHandle === "!") {
state2.tag = "!" + tagName;
} else if (tagHandle === "!!") {
state2.tag = "tag:yaml.org,2002:" + tagName;
} else {
throwError(state2, 'undeclared tag handle "' + tagHandle + '"');
}
return true;
}
function readAnchorProperty(state2) {
var _position, ch2;
ch2 = state2.input.charCodeAt(state2.position);
if (ch2 !== 38)
return false;
if (state2.anchor !== null) {
throwError(state2, "duplication of an anchor property");
}
ch2 = state2.input.charCodeAt(++state2.position);
_position = state2.position;
while (ch2 !== 0 && !is_WS_OR_EOL(ch2) && !is_FLOW_INDICATOR(ch2)) {
ch2 = state2.input.charCodeAt(++state2.position);
}
if (state2.position === _position) {
throwError(state2, "name of an anchor node must contain at least one character");
}
state2.anchor = state2.input.slice(_position, state2.position);
return true;
}
function readAlias(state2) {
var _position, alias, ch2;
ch2 = state2.input.charCodeAt(state2.position);
if (ch2 !== 42)
return false;
ch2 = state2.input.charCodeAt(++state2.position);
_position = state2.position;
while (ch2 !== 0 && !is_WS_OR_EOL(ch2) && !is_FLOW_INDICATOR(ch2)) {
ch2 = state2.input.charCodeAt(++state2.position);
}
if (state2.position === _position) {
throwError(state2, "name of an alias node must contain at least one character");
}
alias = state2.input.slice(_position, state2.position);
if (!_hasOwnProperty$1.call(state2.anchorMap, alias)) {
throwError(state2, 'unidentified alias "' + alias + '"');
}
state2.result = state2.anchorMap[alias];
skipSeparationSpace(state2, true, -1);
return true;
}
function composeNode(state2, parentIndent, nodeContext, allowToSeek, allowCompact) {
var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type2, flowIndent, blockIndent;
if (state2.listener !== null) {
state2.listener("open", state2);
}
state2.tag = null;
state2.anchor = null;
state2.kind = null;
state2.result = null;
allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
if (allowToSeek) {
if (skipSeparationSpace(state2, true, -1)) {
atNewLine = true;
if (state2.lineIndent > parentIndent) {
indentStatus = 1;
} else if (state2.lineIndent === parentIndent) {
indentStatus = 0;
} else if (state2.lineIndent < parentIndent) {
indentStatus = -1;
}
}
}
if (indentStatus === 1) {
while (readTagProperty(state2) || readAnchorProperty(state2)) {
if (skipSeparationSpace(state2, true, -1)) {
atNewLine = true;
allowBlockCollections = allowBlockStyles;
if (state2.lineIndent > parentIndent) {
indentStatus = 1;
} else if (state2.lineIndent === parentIndent) {
indentStatus = 0;
} else if (state2.lineIndent < parentIndent) {
indentStatus = -1;
}
} else {
allowBlockCollections = false;
}
}
}
if (allowBlockCollections) {
allowBlockCollections = atNewLine || allowCompact;
}
if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
flowIndent = parentIndent;
} else {
flowIndent = parentIndent + 1;
}
blockIndent = state2.position - state2.lineStart;
if (indentStatus === 1) {
if (allowBlockCollections && (readBlockSequence(state2, blockIndent) || readBlockMapping(state2, blockIndent, flowIndent)) || readFlowCollection(state2, flowIndent)) {
hasContent = true;
} else {
if (allowBlockScalars && readBlockScalar(state2, flowIndent) || readSingleQuotedScalar(state2, flowIndent) || readDoubleQuotedScalar(state2, flowIndent)) {
hasContent = true;
} else if (readAlias(state2)) {
hasContent = true;
if (state2.tag !== null || state2.anchor !== null) {
throwError(state2, "alias node should not have any properties");
}
} else if (readPlainScalar(state2, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
hasContent = true;
if (state2.tag === null) {
state2.tag = "?";
}
}
if (state2.anchor !== null) {
state2.anchorMap[state2.anchor] = state2.result;
}
}
} else if (indentStatus === 0) {
hasContent = allowBlockCollections && readBlockSequence(state2, blockIndent);
}
}
if (state2.tag === null) {
if (state2.anchor !== null) {
state2.anchorMap[state2.anchor] = state2.result;
}
} else if (state2.tag === "?") {
if (state2.result !== null && state2.kind !== "scalar") {
throwError(state2, 'unacceptable node kind for !> tag; it should be "scalar", not "' + state2.kind + '"');
}
for (typeIndex = 0, typeQuantity = state2.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
type2 = state2.implicitTypes[typeIndex];
if (type2.resolve(state2.result)) {
state2.result = type2.construct(state2.result);
state2.tag = type2.tag;
if (state2.anchor !== null) {
state2.anchorMap[state2.anchor] = state2.result;
}
break;
}
}
} else if (state2.tag !== "!") {
if (_hasOwnProperty$1.call(state2.typeMap[state2.kind || "fallback"], state2.tag)) {
type2 = state2.typeMap[state2.kind || "fallback"][state2.tag];
} else {
type2 = null;
typeList = state2.typeMap.multi[state2.kind || "fallback"];
for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
if (state2.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
type2 = typeList[typeIndex];
break;
}
}
}
if (!type2) {
throwError(state2, "unknown tag !<" + state2.tag + ">");
}
if (state2.result !== null && type2.kind !== state2.kind) {
throwError(state2, "unacceptable node kind for !<" + state2.tag + '> tag; it should be "' + type2.kind + '", not "' + state2.kind + '"');
}
if (!type2.resolve(state2.result, state2.tag)) {
throwError(state2, "cannot resolve a node with !<" + state2.tag + "> explicit tag");
} else {
state2.result = type2.construct(state2.result, state2.tag);
if (state2.anchor !== null) {
state2.anchorMap[state2.anchor] = state2.result;
}
}
}
if (state2.listener !== null) {
state2.listener("close", state2);
}
return state2.tag !== null || state2.anchor !== null || hasContent;
}
function readDocument(state2) {
var documentStart = state2.position, _position, directiveName, directiveArgs, hasDirectives = false, ch2;
state2.version = null;
state2.checkLineBreaks = state2.legacy;
state2.tagMap = Object.create(null);
state2.anchorMap = Object.create(null);
while ((ch2 = state2.input.charCodeAt(state2.position)) !== 0) {
skipSeparationSpace(state2, true, -1);
ch2 = state2.input.charCodeAt(state2.position);
if (state2.lineIndent > 0 || ch2 !== 37) {
break;
}
hasDirectives = true;
ch2 = state2.input.charCodeAt(++state2.position);
_position = state2.position;
while (ch2 !== 0 && !is_WS_OR_EOL(ch2)) {
ch2 = state2.input.charCodeAt(++state2.position);
}
directiveName = state2.input.slice(_position, state2.position);
directiveArgs = [];
if (directiveName.length < 1) {
throwError(state2, "directive name must not be less than one character in length");
}
while (ch2 !== 0) {
while (is_WHITE_SPACE(ch2)) {
ch2 = state2.input.charCodeAt(++state2.position);
}
if (ch2 === 35) {
do {
ch2 = state2.input.charCodeAt(++state2.position);
} while (ch2 !== 0 && !is_EOL(ch2));
break;
}
if (is_EOL(ch2))
break;
_position = state2.position;
while (ch2 !== 0 && !is_WS_OR_EOL(ch2)) {
ch2 = state2.input.charCodeAt(++state2.position);
}
directiveArgs.push(state2.input.slice(_position, state2.position));
}
if (ch2 !== 0)
readLineBreak(state2);
if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
directiveHandlers[directiveName](state2, directiveName, directiveArgs);
} else {
throwWarning(state2, 'unknown document directive "' + directiveName + '"');
}
}
skipSeparationSpace(state2, true, -1);
if (state2.lineIndent === 0 && state2.input.charCodeAt(state2.position) === 45 && state2.input.charCodeAt(state2.position + 1) === 45 && state2.input.charCodeAt(state2.position + 2) === 45) {
state2.position += 3;
skipSeparationSpace(state2, true, -1);
} else if (hasDirectives) {
throwError(state2, "directives end mark is expected");
}
composeNode(state2, state2.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
skipSeparationSpace(state2, true, -1);
if (state2.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state2.input.slice(documentStart, state2.position))) {
throwWarning(state2, "non-ASCII line breaks are interpreted as content");
}
state2.documents.push(state2.result);
if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
if (state2.input.charCodeAt(state2.position) === 46) {
state2.position += 3;
skipSeparationSpace(state2, true, -1);
}
return;
}
if (state2.position < state2.length - 1) {
throwError(state2, "end of the stream or a document separator is expected");
} else {
return;
}
}
function loadDocuments(input, options) {
input = String(input);
options = options || {};
if (input.length !== 0) {
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
input += "\n";
}
if (input.charCodeAt(0) === 65279) {
input = input.slice(1);
}
}
var state2 = new State$1(input, options);
var nullpos = input.indexOf("\0");
if (nullpos !== -1) {
state2.position = nullpos;
throwError(state2, "null byte is not allowed in input");
}
state2.input += "\0";
while (state2.input.charCodeAt(state2.position) === 32) {
state2.lineIndent += 1;
state2.position += 1;
}
while (state2.position < state2.length - 1) {
readDocument(state2);
}
return state2.documents;
}
function loadAll$1(input, iterator, options) {
if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
options = iterator;
iterator = null;
}
var documents = loadDocuments(input, options);
if (typeof iterator !== "function") {
return documents;
}
for (var index2 = 0, length5 = documents.length; index2 < length5; index2 += 1) {
iterator(documents[index2]);
}
}
function load$1(input, options) {
var documents = loadDocuments(input, options);
if (documents.length === 0) {
return void 0;
} else if (documents.length === 1) {
return documents[0];
}
throw new exception("expected a single document in the stream, but found more");
}
var loadAll_1 = loadAll$1;
var load_1 = load$1;
var loader = {
loadAll: loadAll_1,
load: load_1
};
var _toString = Object.prototype.toString;
var _hasOwnProperty = Object.prototype.hasOwnProperty;
var CHAR_BOM = 65279;
var CHAR_TAB = 9;
var CHAR_LINE_FEED = 10;
var CHAR_CARRIAGE_RETURN = 13;
var CHAR_SPACE = 32;
var CHAR_EXCLAMATION = 33;
var CHAR_DOUBLE_QUOTE = 34;
var CHAR_SHARP = 35;
var CHAR_PERCENT = 37;
var CHAR_AMPERSAND = 38;
var CHAR_SINGLE_QUOTE = 39;
var CHAR_ASTERISK = 42;
var CHAR_COMMA = 44;
var CHAR_MINUS = 45;
var CHAR_COLON = 58;
var CHAR_EQUALS = 61;
var CHAR_GREATER_THAN = 62;
var CHAR_QUESTION = 63;
var CHAR_COMMERCIAL_AT = 64;
var CHAR_LEFT_SQUARE_BRACKET = 91;
var CHAR_RIGHT_SQUARE_BRACKET = 93;
var CHAR_GRAVE_ACCENT = 96;
var CHAR_LEFT_CURLY_BRACKET = 123;
var CHAR_VERTICAL_LINE = 124;
var CHAR_RIGHT_CURLY_BRACKET = 125;
var ESCAPE_SEQUENCES = {};
ESCAPE_SEQUENCES[0] = "\\0";
ESCAPE_SEQUENCES[7] = "\\a";
ESCAPE_SEQUENCES[8] = "\\b";
ESCAPE_SEQUENCES[9] = "\\t";
ESCAPE_SEQUENCES[10] = "\\n";
ESCAPE_SEQUENCES[11] = "\\v";
ESCAPE_SEQUENCES[12] = "\\f";
ESCAPE_SEQUENCES[13] = "\\r";
ESCAPE_SEQUENCES[27] = "\\e";
ESCAPE_SEQUENCES[34] = '\\"';
ESCAPE_SEQUENCES[92] = "\\\\";
ESCAPE_SEQUENCES[133] = "\\N";
ESCAPE_SEQUENCES[160] = "\\_";
ESCAPE_SEQUENCES[8232] = "\\L";
ESCAPE_SEQUENCES[8233] = "\\P";
var DEPRECATED_BOOLEANS_SYNTAX = [
"y",
"Y",
"yes",
"Yes",
"YES",
"on",
"On",
"ON",
"n",
"N",
"no",
"No",
"NO",
"off",
"Off",
"OFF"
];
var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
function compileStyleMap(schema3, map6) {
var result, keys2, index2, length5, tag, style, type2;
if (map6 === null)
return {};
result = {};
keys2 = Object.keys(map6);
for (index2 = 0, length5 = keys2.length; index2 < length5; index2 += 1) {
tag = keys2[index2];
style = String(map6[tag]);
if (tag.slice(0, 2) === "!!") {
tag = "tag:yaml.org,2002:" + tag.slice(2);
}
type2 = schema3.compiledTypeMap["fallback"][tag];
if (type2 && _hasOwnProperty.call(type2.styleAliases, style)) {
style = type2.styleAliases[style];
}
result[tag] = style;
}
return result;
}
function encodeHex(character) {
var string, handle, length5;
string = character.toString(16).toUpperCase();
if (character <= 255) {
handle = "x";
length5 = 2;
} else if (character <= 65535) {
handle = "u";
length5 = 4;
} else if (character <= 4294967295) {
handle = "U";
length5 = 8;
} else {
throw new exception("code point within a string may not be greater than 0xFFFFFFFF");
}
return "\\" + handle + common.repeat("0", length5 - string.length) + string;
}
var QUOTING_TYPE_SINGLE = 1;
var QUOTING_TYPE_DOUBLE = 2;
function State(options) {
this.schema = options["schema"] || _default;
this.indent = Math.max(1, options["indent"] || 2);
this.noArrayIndent = options["noArrayIndent"] || false;
this.skipInvalid = options["skipInvalid"] || false;
this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
this.sortKeys = options["sortKeys"] || false;
this.lineWidth = options["lineWidth"] || 80;
this.noRefs = options["noRefs"] || false;
this.noCompatMode = options["noCompatMode"] || false;
this.condenseFlow = options["condenseFlow"] || false;
this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
this.forceQuotes = options["forceQuotes"] || false;
this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
this.implicitTypes = this.schema.compiledImplicit;
this.explicitTypes = this.schema.compiledExplicit;
this.tag = null;
this.result = "";
this.duplicates = [];
this.usedDuplicates = null;
}
function indentString(string, spaces) {
var ind = common.repeat(" ", spaces), position2 = 0, next = -1, result = "", line2, length5 = string.length;
while (position2 < length5) {
next = string.indexOf("\n", position2);
if (next === -1) {
line2 = string.slice(position2);
position2 = length5;
} else {
line2 = string.slice(position2, next + 1);
position2 = next + 1;
}
if (line2.length && line2 !== "\n")
result += ind;
result += line2;
}
return result;
}
function generateNextLine(state2, level) {
return "\n" + common.repeat(" ", state2.indent * level);
}
function testImplicitResolving(state2, str8) {
var index2, length5, type2;
for (index2 = 0, length5 = state2.implicitTypes.length; index2 < length5; index2 += 1) {
type2 = state2.implicitTypes[index2];
if (type2.resolve(str8)) {
return true;
}
}
return false;
}
function isWhitespace(c5) {
return c5 === CHAR_SPACE || c5 === CHAR_TAB;
}
function isPrintable(c5) {
return 32 <= c5 && c5 <= 126 || 161 <= c5 && c5 <= 55295 && c5 !== 8232 && c5 !== 8233 || 57344 <= c5 && c5 <= 65533 && c5 !== CHAR_BOM || 65536 <= c5 && c5 <= 1114111;
}
function isNsCharOrWhitespace(c5) {
return isPrintable(c5) && c5 !== CHAR_BOM && c5 !== CHAR_CARRIAGE_RETURN && c5 !== CHAR_LINE_FEED;
}
function isPlainSafe(c5, prev, inblock) {
var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c5);
var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c5);
return (inblock ? cIsNsCharOrWhitespace : cIsNsCharOrWhitespace && c5 !== CHAR_COMMA && c5 !== CHAR_LEFT_SQUARE_BRACKET && c5 !== CHAR_RIGHT_SQUARE_BRACKET && c5 !== CHAR_LEFT_CURLY_BRACKET && c5 !== CHAR_RIGHT_CURLY_BRACKET) && c5 !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c5 === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar;
}
function isPlainSafeFirst(c5) {
return isPrintable(c5) && c5 !== CHAR_BOM && !isWhitespace(c5) && c5 !== CHAR_MINUS && c5 !== CHAR_QUESTION && c5 !== CHAR_COLON && c5 !== CHAR_COMMA && c5 !== CHAR_LEFT_SQUARE_BRACKET && c5 !== CHAR_RIGHT_SQUARE_BRACKET && c5 !== CHAR_LEFT_CURLY_BRACKET && c5 !== CHAR_RIGHT_CURLY_BRACKET && c5 !== CHAR_SHARP && c5 !== CHAR_AMPERSAND && c5 !== CHAR_ASTERISK && c5 !== CHAR_EXCLAMATION && c5 !== CHAR_VERTICAL_LINE && c5 !== CHAR_EQUALS && c5 !== CHAR_GREATER_THAN && c5 !== CHAR_SINGLE_QUOTE && c5 !== CHAR_DOUBLE_QUOTE && c5 !== CHAR_PERCENT && c5 !== CHAR_COMMERCIAL_AT && c5 !== CHAR_GRAVE_ACCENT;
}
function isPlainSafeLast(c5) {
return !isWhitespace(c5) && c5 !== CHAR_COLON;
}
function codePointAt(string, pos) {
var first = string.charCodeAt(pos), second;
if (first >= 55296 && first <= 56319 && pos + 1 < string.length) {
second = string.charCodeAt(pos + 1);
if (second >= 56320 && second <= 57343) {
return (first - 55296) * 1024 + second - 56320 + 65536;
}
}
return first;
}
function needIndentIndicator(string) {
var leadingSpaceRe = /^\n* /;
return leadingSpaceRe.test(string);
}
var STYLE_PLAIN = 1;
var STYLE_SINGLE = 2;
var STYLE_LITERAL = 3;
var STYLE_FOLDED = 4;
var STYLE_DOUBLE = 5;
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
var i4;
var char = 0;
var prevChar = null;
var hasLineBreak = false;
var hasFoldableLine = false;
var shouldTrackWidth = lineWidth !== -1;
var previousLineBreak = -1;
var plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
if (singleLineOnly || forceQuotes) {
for (i4 = 0; i4 < string.length; char >= 65536 ? i4 += 2 : i4++) {
char = codePointAt(string, i4);
if (!isPrintable(char)) {
return STYLE_DOUBLE;
}
plain = plain && isPlainSafe(char, prevChar, inblock);
prevChar = char;
}
} else {
for (i4 = 0; i4 < string.length; char >= 65536 ? i4 += 2 : i4++) {
char = codePointAt(string, i4);
if (char === CHAR_LINE_FEED) {
hasLineBreak = true;
if (shouldTrackWidth) {
hasFoldableLine = hasFoldableLine || i4 - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
previousLineBreak = i4;
}
} else if (!isPrintable(char)) {
return STYLE_DOUBLE;
}
plain = plain && isPlainSafe(char, prevChar, inblock);
prevChar = char;
}
hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i4 - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
}
if (!hasLineBreak && !hasFoldableLine) {
if (plain && !forceQuotes && !testAmbiguousType(string)) {
return STYLE_PLAIN;
}
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
}
if (indentPerLevel > 9 && needIndentIndicator(string)) {
return STYLE_DOUBLE;
}
if (!forceQuotes) {
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
}
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
}
function writeScalar(state2, string, level, iskey, inblock) {
state2.dump = function() {
if (string.length === 0) {
return state2.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
}
if (!state2.noCompatMode) {
if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
return state2.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
}
}
var indent2 = state2.indent * Math.max(1, level);
var lineWidth = state2.lineWidth === -1 ? -1 : Math.max(Math.min(state2.lineWidth, 40), state2.lineWidth - indent2);
var singleLineOnly = iskey || state2.flowLevel > -1 && level >= state2.flowLevel;
function testAmbiguity(string2) {
return testImplicitResolving(state2, string2);
}
switch (chooseScalarStyle(string, singleLineOnly, state2.indent, lineWidth, testAmbiguity, state2.quotingType, state2.forceQuotes && !iskey, inblock)) {
case STYLE_PLAIN:
return string;
case STYLE_SINGLE:
return "'" + string.replace(/'/g, "''") + "'";
case STYLE_LITERAL:
return "|" + blockHeader(string, state2.indent) + dropEndingNewline(indentString(string, indent2));
case STYLE_FOLDED:
return ">" + blockHeader(string, state2.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent2));
case STYLE_DOUBLE:
return '"' + escapeString(string) + '"';
default:
throw new exception("impossible error: invalid scalar style");
}
}();
}
function blockHeader(string, indentPerLevel) {
var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
var clip = string[string.length - 1] === "\n";
var keep = clip && (string[string.length - 2] === "\n" || string === "\n");
var chomp = keep ? "+" : clip ? "" : "-";
return indentIndicator + chomp + "\n";
}
function dropEndingNewline(string) {
return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
}
function foldString(string, width2) {
var lineRe = /(\n+)([^\n]*)/g;
var result = function() {
var nextLF = string.indexOf("\n");
nextLF = nextLF !== -1 ? nextLF : string.length;
lineRe.lastIndex = nextLF;
return foldLine(string.slice(0, nextLF), width2);
}();
var prevMoreIndented = string[0] === "\n" || string[0] === " ";
var moreIndented;
var match;
while (match = lineRe.exec(string)) {
var prefix2 = match[1], line2 = match[2];
moreIndented = line2[0] === " ";
result += prefix2 + (!prevMoreIndented && !moreIndented && line2 !== "" ? "\n" : "") + foldLine(line2, width2);
prevMoreIndented = moreIndented;
}
return result;
}
function foldLine(line2, width2) {
if (line2 === "" || line2[0] === " ")
return line2;
var breakRe = / [^ ]/g;
var match;
var start = 0, end2, curr = 0, next = 0;
var result = "";
while (match = breakRe.exec(line2)) {
next = match.index;
if (next - start > width2) {
end2 = curr > start ? curr : next;
result += "\n" + line2.slice(start, end2);
start = end2 + 1;
}
curr = next;
}
result += "\n";
if (line2.length - start > width2 && curr > start) {
result += line2.slice(start, curr) + "\n" + line2.slice(curr + 1);
} else {
result += line2.slice(start);
}
return result.slice(1);
}
function escapeString(string) {
var result = "";
var char = 0;
var escapeSeq;
for (var i4 = 0; i4 < string.length; char >= 65536 ? i4 += 2 : i4++) {
char = codePointAt(string, i4);
escapeSeq = ESCAPE_SEQUENCES[char];
if (!escapeSeq && isPrintable(char)) {
result += string[i4];
if (char >= 65536)
result += string[i4 + 1];
} else {
result += escapeSeq || encodeHex(char);
}
}
return result;
}
function writeFlowSequence(state2, level, object) {
var _result = "", _tag = state2.tag, index2, length5, value2;
for (index2 = 0, length5 = object.length; index2 < length5; index2 += 1) {
value2 = object[index2];
if (state2.replacer) {
value2 = state2.replacer.call(object, String(index2), value2);
}
if (writeNode(state2, level, value2, false, false) || typeof value2 === "undefined" && writeNode(state2, level, null, false, false)) {
if (_result !== "")
_result += "," + (!state2.condenseFlow ? " " : "");
_result += state2.dump;
}
}
state2.tag = _tag;
state2.dump = "[" + _result + "]";
}
function writeBlockSequence(state2, level, object, compact) {
var _result = "", _tag = state2.tag, index2, length5, value2;
for (index2 = 0, length5 = object.length; index2 < length5; index2 += 1) {
value2 = object[index2];
if (state2.replacer) {
value2 = state2.replacer.call(object, String(index2), value2);
}
if (writeNode(state2, level + 1, value2, true, true, false, true) || typeof value2 === "undefined" && writeNode(state2, level + 1, null, true, true, false, true)) {
if (!compact || _result !== "") {
_result += generateNextLine(state2, level);
}
if (state2.dump && CHAR_LINE_FEED === state2.dump.charCodeAt(0)) {
_result += "-";
} else {
_result += "- ";
}
_result += state2.dump;
}
}
state2.tag = _tag;
state2.dump = _result || "[]";
}
function writeFlowMapping(state2, level, object) {
var _result = "", _tag = state2.tag, objectKeyList = Object.keys(object), index2, length5, objectKey, objectValue, pairBuffer;
for (index2 = 0, length5 = objectKeyList.length; index2 < length5; index2 += 1) {
pairBuffer = "";
if (_result !== "")
pairBuffer += ", ";
if (state2.condenseFlow)
pairBuffer += '"';
objectKey = objectKeyList[index2];
objectValue = object[objectKey];
if (state2.replacer) {
objectValue = state2.replacer.call(object, objectKey, objectValue);
}
if (!writeNode(state2, level, objectKey, false, false)) {
continue;
}
if (state2.dump.length > 1024)
pairBuffer += "? ";
pairBuffer += state2.dump + (state2.condenseFlow ? '"' : "") + ":" + (state2.condenseFlow ? "" : " ");
if (!writeNode(state2, level, objectValue, false, false)) {
continue;
}
pairBuffer += state2.dump;
_result += pairBuffer;
}
state2.tag = _tag;
state2.dump = "{" + _result + "}";
}
function writeBlockMapping(state2, level, object, compact) {
var _result = "", _tag = state2.tag, objectKeyList = Object.keys(object), index2, length5, objectKey, objectValue, explicitPair, pairBuffer;
if (state2.sortKeys === true) {
objectKeyList.sort();
} else if (typeof state2.sortKeys === "function") {
objectKeyList.sort(state2.sortKeys);
} else if (state2.sortKeys) {
throw new exception("sortKeys must be a boolean or a function");
}
for (index2 = 0, length5 = objectKeyList.length; index2 < length5; index2 += 1) {
pairBuffer = "";
if (!compact || _result !== "") {
pairBuffer += generateNextLine(state2, level);
}
objectKey = objectKeyList[index2];
objectValue = object[objectKey];
if (state2.replacer) {
objectValue = state2.replacer.call(object, objectKey, objectValue);
}
if (!writeNode(state2, level + 1, objectKey, true, true, true)) {
continue;
}
explicitPair = state2.tag !== null && state2.tag !== "?" || state2.dump && state2.dump.length > 1024;
if (explicitPair) {
if (state2.dump && CHAR_LINE_FEED === state2.dump.charCodeAt(0)) {
pairBuffer += "?";
} else {
pairBuffer += "? ";
}
}
pairBuffer += state2.dump;
if (explicitPair) {
pairBuffer += generateNextLine(state2, level);
}
if (!writeNode(state2, level + 1, objectValue, true, explicitPair)) {
continue;
}
if (state2.dump && CHAR_LINE_FEED === state2.dump.charCodeAt(0)) {
pairBuffer += ":";
} else {
pairBuffer += ": ";
}
pairBuffer += state2.dump;
_result += pairBuffer;
}
state2.tag = _tag;
state2.dump = _result || "{}";
}
function detectType(state2, object, explicit) {
var _result, typeList, index2, length5, type2, style;
typeList = explicit ? state2.explicitTypes : state2.implicitTypes;
for (index2 = 0, length5 = typeList.length; index2 < length5; index2 += 1) {
type2 = typeList[index2];
if ((type2.instanceOf || type2.predicate) && (!type2.instanceOf || typeof object === "object" && object instanceof type2.instanceOf) && (!type2.predicate || type2.predicate(object))) {
if (explicit) {
if (type2.multi && type2.representName) {
state2.tag = type2.representName(object);
} else {
state2.tag = type2.tag;
}
} else {
state2.tag = "?";
}
if (type2.represent) {
style = state2.styleMap[type2.tag] || type2.defaultStyle;
if (_toString.call(type2.represent) === "[object Function]") {
_result = type2.represent(object, style);
} else if (_hasOwnProperty.call(type2.represent, style)) {
_result = type2.represent[style](object, style);
} else {
throw new exception("!<" + type2.tag + '> tag resolver accepts not "' + style + '" style');
}
state2.dump = _result;
}
return true;
}
}
return false;
}
function writeNode(state2, level, object, block, compact, iskey, isblockseq) {
state2.tag = null;
state2.dump = object;
if (!detectType(state2, object, false)) {
detectType(state2, object, true);
}
var type2 = _toString.call(state2.dump);
var inblock = block;
var tagStr;
if (block) {
block = state2.flowLevel < 0 || state2.flowLevel > level;
}
var objectOrArray = type2 === "[object Object]" || type2 === "[object Array]", duplicateIndex, duplicate;
if (objectOrArray) {
duplicateIndex = state2.duplicates.indexOf(object);
duplicate = duplicateIndex !== -1;
}
if (state2.tag !== null && state2.tag !== "?" || duplicate || state2.indent !== 2 && level > 0) {
compact = false;
}
if (duplicate && state2.usedDuplicates[duplicateIndex]) {
state2.dump = "*ref_" + duplicateIndex;
} else {
if (objectOrArray && duplicate && !state2.usedDuplicates[duplicateIndex]) {
state2.usedDuplicates[duplicateIndex] = true;
}
if (type2 === "[object Object]") {
if (block && Object.keys(state2.dump).length !== 0) {
writeBlockMapping(state2, level, state2.dump, compact);
if (duplicate) {
state2.dump = "&ref_" + duplicateIndex + state2.dump;
}
} else {
writeFlowMapping(state2, level, state2.dump);
if (duplicate) {
state2.dump = "&ref_" + duplicateIndex + " " + state2.dump;
}
}
} else if (type2 === "[object Array]") {
if (block && state2.dump.length !== 0) {
if (state2.noArrayIndent && !isblockseq && level > 0) {
writeBlockSequence(state2, level - 1, state2.dump, compact);
} else {
writeBlockSequence(state2, level, state2.dump, compact);
}
if (duplicate) {
state2.dump = "&ref_" + duplicateIndex + state2.dump;
}
} else {
writeFlowSequence(state2, level, state2.dump);
if (duplicate) {
state2.dump = "&ref_" + duplicateIndex + " " + state2.dump;
}
}
} else if (type2 === "[object String]") {
if (state2.tag !== "?") {
writeScalar(state2, state2.dump, level, iskey, inblock);
}
} else if (type2 === "[object Undefined]") {
return false;
} else {
if (state2.skipInvalid)
return false;
throw new exception("unacceptable kind of an object to dump " + type2);
}
if (state2.tag !== null && state2.tag !== "?") {
tagStr = encodeURI(state2.tag[0] === "!" ? state2.tag.slice(1) : state2.tag).replace(/!/g, "%21");
if (state2.tag[0] === "!") {
tagStr = "!" + tagStr;
} else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
tagStr = "!!" + tagStr.slice(18);
} else {
tagStr = "!<" + tagStr + ">";
}
state2.dump = tagStr + " " + state2.dump;
}
}
return true;
}
function getDuplicateReferences(object, state2) {
var objects = [], duplicatesIndexes = [], index2, length5;
inspectNode(object, objects, duplicatesIndexes);
for (index2 = 0, length5 = duplicatesIndexes.length; index2 < length5; index2 += 1) {
state2.duplicates.push(objects[duplicatesIndexes[index2]]);
}
state2.usedDuplicates = new Array(length5);
}
function inspectNode(object, objects, duplicatesIndexes) {
var objectKeyList, index2, length5;
if (object !== null && typeof object === "object") {
index2 = objects.indexOf(object);
if (index2 !== -1) {
if (duplicatesIndexes.indexOf(index2) === -1) {
duplicatesIndexes.push(index2);
}
} else {
objects.push(object);
if (Array.isArray(object)) {
for (index2 = 0, length5 = object.length; index2 < length5; index2 += 1) {
inspectNode(object[index2], objects, duplicatesIndexes);
}
} else {
objectKeyList = Object.keys(object);
for (index2 = 0, length5 = objectKeyList.length; index2 < length5; index2 += 1) {
inspectNode(object[objectKeyList[index2]], objects, duplicatesIndexes);
}
}
}
}
}
function dump$1(input, options) {
options = options || {};
var state2 = new State(options);
if (!state2.noRefs)
getDuplicateReferences(input, state2);
var value2 = input;
if (state2.replacer) {
value2 = state2.replacer.call({ "": value2 }, "", value2);
}
if (writeNode(state2, 0, value2, true, true))
return state2.dump + "\n";
return "";
}
var dump_1 = dump$1;
var dumper = {
dump: dump_1
};
function renamed(from, to) {
return function() {
throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
};
}
var Type = type;
var Schema = schema;
var FAILSAFE_SCHEMA = failsafe;
var JSON_SCHEMA = json;
var CORE_SCHEMA = core;
var DEFAULT_SCHEMA = _default;
var load = loader.load;
var loadAll = loader.loadAll;
var dump = dumper.dump;
var YAMLException = exception;
var types = {
binary,
float,
map,
null: _null,
pairs,
set,
timestamp,
bool,
int,
merge,
omap,
seq,
str
};
var safeLoad = renamed("safeLoad", "load");
var safeLoadAll = renamed("safeLoadAll", "loadAll");
var safeDump = renamed("safeDump", "dump");
var jsYaml = {
Type,
Schema,
FAILSAFE_SCHEMA,
JSON_SCHEMA,
CORE_SCHEMA,
DEFAULT_SCHEMA,
load,
loadAll,
dump,
YAMLException,
types,
safeLoad,
safeLoadAll,
safeDump
};
var js_yaml_default = jsYaml;
// node_modules/react/index.mjs
init_compat_module();
init_compat_module();
// node_modules/react-dom/index.mjs
init_compat_module();
init_compat_module();
// src/main.tsx
var import_obsidian5 = __toModule(require("obsidian"));
// node_modules/@antv/g2/esm/index.js
var esm_exports3 = {};
__export(esm_exports3, {
Action: () => base_default12,
BRUSH_FILTER_EVENTS: () => EVENTS3,
Chart: () => chart_default,
ComponentController: () => Controller,
Coordinate: () => base_default7,
DIRECTION: () => DIRECTION,
ELEMENT_RANGE_HIGHLIGHT_EVENTS: () => EVENTS2,
Element: () => element_default2,
Event: () => event_default,
Facet: () => Facet,
Geometry: () => base_default13,
GeometryLabel: () => base_default14,
Interaction: () => interaction_default,
InteractionAction: () => base_default12,
LAYER: () => LAYER,
Scale: () => base_default4,
TooltipController: () => tooltip_default,
Util: () => Util,
VERSION: () => VERSION,
VIEW_LIFE_CIRCLE: () => VIEW_LIFE_CIRCLE,
View: () => view_default,
getActionClass: () => getActionClass,
getAnimation: () => getAnimation,
getEngine: () => getEngine,
getFacet: () => getFacet,
getGeometryLabel: () => getGeometryLabel,
getGeometryLabelLayout: () => getGeometryLabelLayout,
getInteraction: () => getInteraction,
getShapeFactory: () => getShapeFactory,
getTheme: () => getTheme,
registerAction: () => registerAction,
registerAnimation: () => registerAnimation,
registerComponentController: () => registerComponentController,
registerEngine: () => registerEngine,
registerFacet: () => registerFacet,
registerGeometry: () => registerGeometry,
registerGeometryLabel: () => registerGeometryLabel,
registerGeometryLabelLayout: () => registerGeometryLabelLayout,
registerInteraction: () => registerInteraction,
registerShape: () => registerShape,
registerShapeFactory: () => registerShapeFactory,
registerTheme: () => registerTheme
});
// node_modules/tslib/modules/index.js
var import_tslib = __toModule(require_tslib());
var {
__extends,
__assign,
__rest,
__decorate,
__param,
__metadata,
__awaiter,
__generator,
__exportStar,
__createBinding,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet
} = import_tslib.default;
// node_modules/@antv/util/esm/is-array-like.js
var isArrayLike = function(value2) {
return value2 !== null && typeof value2 !== "function" && isFinite(value2.length);
};
var is_array_like_default = isArrayLike;
// node_modules/@antv/util/esm/contains.js
var contains = function(arr, value2) {
if (!is_array_like_default(arr)) {
return false;
}
return arr.indexOf(value2) > -1;
};
var contains_default = contains;
// node_modules/@antv/util/esm/filter.js
var filter = function(arr, func) {
if (!is_array_like_default(arr)) {
return arr;
}
var result = [];
for (var index2 = 0; index2 < arr.length; index2++) {
var value2 = arr[index2];
if (func(value2, index2)) {
result.push(value2);
}
}
return result;
};
var filter_default = filter;
// node_modules/@antv/util/esm/difference.js
var difference = function(arr, values2) {
if (values2 === void 0) {
values2 = [];
}
return filter_default(arr, function(value2) {
return !contains_default(values2, value2);
});
};
var difference_default = difference;
// node_modules/@antv/util/esm/is-type.js
var toString2 = {}.toString;
var isType = function(value2, type2) {
return toString2.call(value2) === "[object " + type2 + "]";
};
var is_type_default = isType;
// node_modules/@antv/util/esm/is-function.js
var is_function_default = function(value2) {
return is_type_default(value2, "Function");
};
// node_modules/@antv/util/esm/is-nil.js
var isNil = function(value2) {
return value2 === null || value2 === void 0;
};
var is_nil_default = isNil;
// node_modules/@antv/util/esm/is-array.js
var is_array_default = function(value2) {
return Array.isArray ? Array.isArray(value2) : is_type_default(value2, "Array");
};
// node_modules/@antv/util/esm/is-object.js
var is_object_default = function(value2) {
var type2 = typeof value2;
return value2 !== null && type2 === "object" || type2 === "function";
};
// node_modules/@antv/util/esm/each.js
function each(elements, func) {
if (!elements) {
return;
}
var rst;
if (is_array_default(elements)) {
for (var i4 = 0, len5 = elements.length; i4 < len5; i4++) {
rst = func(elements[i4], i4);
if (rst === false) {
break;
}
}
} else if (is_object_default(elements)) {
for (var k4 in elements) {
if (elements.hasOwnProperty(k4)) {
rst = func(elements[k4], k4);
if (rst === false) {
break;
}
}
}
}
}
var each_default = each;
// node_modules/@antv/util/esm/keys.js
var keys = Object.keys ? function(obj) {
return Object.keys(obj);
} : function(obj) {
var result = [];
each_default(obj, function(value2, key) {
if (!(is_function_default(obj) && key === "prototype")) {
result.push(key);
}
});
return result;
};
var keys_default = keys;
// node_modules/@antv/util/esm/is-match.js
function isMatch(obj, attrs) {
var _keys = keys_default(attrs);
var length5 = _keys.length;
if (is_nil_default(obj))
return !length5;
for (var i4 = 0; i4 < length5; i4 += 1) {
var key = _keys[i4];
if (attrs[key] !== obj[key] || !(key in obj)) {
return false;
}
}
return true;
}
var is_match_default = isMatch;
// node_modules/@antv/util/esm/is-object-like.js
var isObjectLike = function(value2) {
return typeof value2 === "object" && value2 !== null;
};
var is_object_like_default = isObjectLike;
// node_modules/@antv/util/esm/is-plain-object.js
var isPlainObject = function(value2) {
if (!is_object_like_default(value2) || !is_type_default(value2, "Object")) {
return false;
}
if (Object.getPrototypeOf(value2) === null) {
return true;
}
var proto = value2;
while (Object.getPrototypeOf(proto) !== null) {
proto = Object.getPrototypeOf(proto);
}
return Object.getPrototypeOf(value2) === proto;
};
var is_plain_object_default = isPlainObject;
// node_modules/@antv/util/esm/find.js
function find(arr, predicate) {
if (!is_array_default(arr))
return null;
var _predicate;
if (is_function_default(predicate)) {
_predicate = predicate;
}
if (is_plain_object_default(predicate)) {
_predicate = function(a4) {
return is_match_default(a4, predicate);
};
}
if (_predicate) {
for (var i4 = 0; i4 < arr.length; i4 += 1) {
if (_predicate(arr[i4])) {
return arr[i4];
}
}
}
return null;
}
var find_default = find;
// node_modules/@antv/util/esm/find-index.js
function findIndex(arr, predicate, fromIndex) {
if (fromIndex === void 0) {
fromIndex = 0;
}
for (var i4 = fromIndex; i4 < arr.length; i4++) {
if (predicate(arr[i4], i4)) {
return i4;
}
}
return -1;
}
var find_index_default = findIndex;
// node_modules/@antv/util/esm/first-value.js
var firstValue = function(data3, name) {
var rst = null;
for (var i4 = 0; i4 < data3.length; i4++) {
var obj = data3[i4];
var value2 = obj[name];
if (!is_nil_default(value2)) {
if (is_array_default(value2)) {
rst = value2[0];
} else {
rst = value2;
}
break;
}
}
return rst;
};
var first_value_default = firstValue;
// node_modules/@antv/util/esm/flatten.js
var flatten = function(arr) {
if (!is_array_default(arr)) {
return [];
}
var rst = [];
for (var i4 = 0; i4 < arr.length; i4++) {
rst = rst.concat(arr[i4]);
}
return rst;
};
var flatten_default = flatten;
// node_modules/@antv/util/esm/max.js
var max_default = function(arr) {
if (!is_array_default(arr)) {
return void 0;
}
return arr.reduce(function(prev, curr) {
return Math.max(prev, curr);
}, arr[0]);
};
// node_modules/@antv/util/esm/min.js
var min_default = function(arr) {
if (!is_array_default(arr)) {
return void 0;
}
return arr.reduce(function(prev, curr) {
return Math.min(prev, curr);
}, arr[0]);
};
// node_modules/@antv/util/esm/get-range.js
var getRange = function(values2) {
var filterValues = values2.filter(function(v3) {
return !isNaN(v3);
});
if (!filterValues.length) {
return {
min: 0,
max: 0
};
}
if (is_array_default(values2[0])) {
var tmp = [];
for (var i4 = 0; i4 < values2.length; i4++) {
tmp = tmp.concat(values2[i4]);
}
filterValues = tmp;
}
var max8 = max_default(filterValues);
var min7 = min_default(filterValues);
return {
min: min7,
max: max8
};
};
var get_range_default = getRange;
// node_modules/@antv/util/esm/pull.js
var arrPrototype = Array.prototype;
var splice = arrPrototype.splice;
var indexOf = arrPrototype.indexOf;
// node_modules/@antv/util/esm/pull-at.js
var splice2 = Array.prototype.splice;
var pullAt = function pullAt2(arr, indexes) {
if (!is_array_like_default(arr)) {
return [];
}
var length5 = arr ? indexes.length : 0;
var last2 = length5 - 1;
while (length5--) {
var previous = void 0;
var index2 = indexes[length5];
if (length5 === last2 || index2 !== previous) {
previous = index2;
splice2.call(arr, index2, 1);
}
}
return arr;
};
var pull_at_default = pullAt;
// node_modules/@antv/util/esm/reduce.js
var reduce = function(arr, fn2, init) {
if (!is_array_default(arr) && !is_plain_object_default(arr)) {
return arr;
}
var result = init;
each_default(arr, function(data3, i4) {
result = fn2(result, data3, i4);
});
return result;
};
var reduce_default = reduce;
// node_modules/@antv/util/esm/remove.js
var remove = function(arr, predicate) {
var result = [];
if (!is_array_like_default(arr)) {
return result;
}
var i4 = -1;
var indexes = [];
var length5 = arr.length;
while (++i4 < length5) {
var value2 = arr[i4];
if (predicate(value2, i4, arr)) {
result.push(value2);
indexes.push(i4);
}
}
pull_at_default(arr, indexes);
return result;
};
var remove_default = remove;
// node_modules/@antv/util/esm/is-string.js
var is_string_default = function(str8) {
return is_type_default(str8, "String");
};
// node_modules/@antv/util/esm/sort-by.js
function sortBy(arr, key) {
var comparer;
if (is_function_default(key)) {
comparer = function(a4, b10) {
return key(a4) - key(b10);
};
} else {
var keys_1 = [];
if (is_string_default(key)) {
keys_1.push(key);
} else if (is_array_default(key)) {
keys_1 = key;
}
comparer = function(a4, b10) {
for (var i4 = 0; i4 < keys_1.length; i4 += 1) {
var prop = keys_1[i4];
if (a4[prop] > b10[prop]) {
return 1;
}
if (a4[prop] < b10[prop]) {
return -1;
}
}
return 0;
};
}
arr.sort(comparer);
return arr;
}
var sort_by_default = sortBy;
// node_modules/@antv/util/esm/uniq.js
function uniq(arr, cache3) {
if (cache3 === void 0) {
cache3 = new Map();
}
var r4 = [];
if (Array.isArray(arr)) {
for (var i4 = 0, len5 = arr.length; i4 < len5; i4++) {
var item = arr[i4];
if (!cache3.has(item)) {
r4.push(item);
cache3.set(item, true);
}
}
}
return r4;
}
// node_modules/@antv/util/esm/values-of-key.js
var values_of_key_default = function(data3, name) {
var rst = [];
var tmpMap = {};
for (var i4 = 0; i4 < data3.length; i4++) {
var obj = data3[i4];
var value2 = obj[name];
if (!is_nil_default(value2)) {
if (!is_array_default(value2)) {
value2 = [value2];
}
for (var j4 = 0; j4 < value2.length; j4++) {
var val = value2[j4];
if (!tmpMap[val]) {
rst.push(val);
tmpMap[val] = true;
}
}
}
}
return rst;
};
// node_modules/@antv/util/esm/head.js
function head(o3) {
if (is_array_like_default(o3)) {
return o3[0];
}
return void 0;
}
// node_modules/@antv/util/esm/last.js
function last(o3) {
if (is_array_like_default(o3)) {
var arr = o3;
return arr[arr.length - 1];
}
return void 0;
}
// node_modules/@antv/util/esm/every.js
var every = function(arr, func) {
for (var i4 = 0; i4 < arr.length; i4++) {
if (!func(arr[i4], i4))
return false;
}
return true;
};
var every_default = every;
// node_modules/@antv/util/esm/some.js
var some = function(arr, func) {
for (var i4 = 0; i4 < arr.length; i4++) {
if (func(arr[i4], i4))
return true;
}
return false;
};
var some_default = some;
// node_modules/@antv/util/esm/group-by.js
var hasOwnProperty = Object.prototype.hasOwnProperty;
function groupBy(data3, condition) {
if (!condition || !is_array_default(data3)) {
return {};
}
var result = {};
var predicate = is_function_default(condition) ? condition : function(item2) {
return item2[condition];
};
var key;
for (var i4 = 0; i4 < data3.length; i4++) {
var item = data3[i4];
key = predicate(item);
if (hasOwnProperty.call(result, key)) {
result[key].push(item);
} else {
result[key] = [item];
}
}
return result;
}
var group_by_default = groupBy;
// node_modules/@antv/util/esm/group-to-map.js
function groupToMap(data3, condition) {
if (!condition) {
return {
0: data3
};
}
if (!is_function_default(condition)) {
var paramscondition_1 = is_array_default(condition) ? condition : condition.replace(/\s+/g, "").split("*");
condition = function(row) {
var unique = "_";
for (var i4 = 0, l4 = paramscondition_1.length; i4 < l4; i4++) {
unique += row[paramscondition_1[i4]] && row[paramscondition_1[i4]].toString();
}
return unique;
};
}
return group_by_default(data3, condition);
}
// node_modules/@antv/util/esm/group.js
var group_default = function(data3, condition) {
if (!condition) {
return [data3];
}
var groups = groupToMap(data3, condition);
var array = [];
for (var i4 in groups) {
array.push(groups[i4]);
}
return array;
};
// node_modules/@antv/util/esm/wrap-behavior.js
function wrapBehavior(obj, action) {
if (obj["_wrap_" + action]) {
return obj["_wrap_" + action];
}
var method = function(e4) {
obj[action](e4);
};
obj["_wrap_" + action] = method;
return method;
}
var wrap_behavior_default = wrapBehavior;
// node_modules/@antv/util/esm/clamp.js
var clamp = function(a4, min7, max8) {
if (a4 < min7) {
return min7;
} else if (a4 > max8) {
return max8;
}
return a4;
};
var clamp_default = clamp;
// node_modules/@antv/util/esm/fixed-base.js
var fixedBase = function(v3, base) {
var str8 = base.toString();
var index2 = str8.indexOf(".");
if (index2 === -1) {
return Math.round(v3);
}
var length5 = str8.substr(index2 + 1).length;
if (length5 > 20) {
length5 = 20;
}
return parseFloat(v3.toFixed(length5));
};
var fixed_base_default = fixedBase;
// node_modules/@antv/util/esm/is-number.js
var isNumber = function(value2) {
return is_type_default(value2, "Number");
};
var is_number_default = isNumber;
// node_modules/@antv/util/esm/is-integer.js
var isInteger2 = Number.isInteger ? Number.isInteger : function(num) {
return is_number_default(num) && num % 1 === 0;
};
// node_modules/@antv/util/esm/is-number-equal.js
var PRECISION = 1e-5;
function isNumberEqual(a4, b10, precision) {
if (precision === void 0) {
precision = PRECISION;
}
return Math.abs(a4 - b10) < precision;
}
// node_modules/@antv/util/esm/max-by.js
var max_by_default = function(arr, fn2) {
if (!is_array_default(arr)) {
return void 0;
}
var maxItem;
var max8 = -Infinity;
for (var i4 = 0; i4 < arr.length; i4++) {
var item = arr[i4];
var v3 = is_function_default(fn2) ? fn2(item) : item[fn2];
if (v3 > max8) {
maxItem = item;
max8 = v3;
}
}
return maxItem;
};
// node_modules/@antv/util/esm/min-by.js
var min_by_default = function(arr, fn2) {
if (!is_array_default(arr)) {
return void 0;
}
var minItem;
var min7 = Infinity;
for (var i4 = 0; i4 < arr.length; i4++) {
var item = arr[i4];
var v3 = is_function_default(fn2) ? fn2(item) : item[fn2];
if (v3 < min7) {
minItem = item;
min7 = v3;
}
}
return minItem;
};
// node_modules/@antv/util/esm/mod.js
var mod = function(n3, m4) {
return (n3 % m4 + m4) % m4;
};
var mod_default = mod;
// node_modules/@antv/util/esm/to-degree.js
var DEGREE = 180 / Math.PI;
// node_modules/@antv/util/esm/to-radian.js
var RADIAN = Math.PI / 180;
var toRadian = function(degree4) {
return RADIAN * degree4;
};
var to_radian_default = toRadian;
// node_modules/@antv/util/esm/for-in.js
var for_in_default = each_default;
// node_modules/@antv/util/esm/has.js
var has_default = function(obj, key) {
return obj.hasOwnProperty(key);
};
// node_modules/@antv/util/esm/has-key.js
var has_key_default = has_default;
// node_modules/@antv/util/esm/values.js
var values = Object.values ? function(obj) {
return Object.values(obj);
} : function(obj) {
var result = [];
each_default(obj, function(value2, key) {
if (!(is_function_default(obj) && key === "prototype")) {
result.push(value2);
}
});
return result;
};
var values_default = values;
// node_modules/@antv/util/esm/to-string.js
var to_string_default = function(value2) {
if (is_nil_default(value2))
return "";
return value2.toString();
};
// node_modules/@antv/util/esm/lower-case.js
var lowerCase = function(str8) {
return to_string_default(str8).toLowerCase();
};
var lower_case_default = lowerCase;
// node_modules/@antv/util/esm/substitute.js
function substitute(str8, o3) {
if (!str8 || !o3) {
return str8;
}
return str8.replace(/\\?\{([^{}]+)\}/g, function(match, name) {
if (match.charAt(0) === "\\") {
return match.slice(1);
}
return o3[name] === void 0 ? "" : o3[name];
});
}
var substitute_default = substitute;
// node_modules/@antv/util/esm/upper-first.js
var upperFirst = function(value2) {
var str8 = to_string_default(value2);
return str8.charAt(0).toUpperCase() + str8.substring(1);
};
var upper_first_default = upperFirst;
// node_modules/@antv/util/esm/get-type.js
var toString3 = {}.toString;
var getType = function(value2) {
return toString3.call(value2).replace(/^\[object /, "").replace(/]$/, "");
};
var get_type_default = getType;
// node_modules/@antv/util/esm/is-boolean.js
var isBoolean2 = function(value2) {
return is_type_default(value2, "Boolean");
};
var is_boolean_default = isBoolean2;
// node_modules/@antv/util/esm/is-date.js
var isDate = function(value2) {
return is_type_default(value2, "Date");
};
var is_date_default = isDate;
// node_modules/@antv/util/esm/is-null.js
var isNull2 = function(value2) {
return value2 === null;
};
var is_null_default = isNull2;
// node_modules/@antv/util/esm/is-prototype.js
var objectProto = Object.prototype;
var isPrototype = function(value2) {
var Ctor = value2 && value2.constructor;
var proto = typeof Ctor === "function" && Ctor.prototype || objectProto;
return value2 === proto;
};
var is_prototype_default = isPrototype;
// node_modules/@antv/util/esm/is-undefined.js
var isUndefined = function(value2) {
return value2 === void 0;
};
var is_undefined_default = isUndefined;
// node_modules/@antv/util/esm/is-element.js
var isElement = function(o3) {
return o3 instanceof Element || o3 instanceof HTMLDocument;
};
var is_element_default = isElement;
// node_modules/@antv/util/esm/request-animation-frame.js
function requestAnimationFrame2(fn2) {
var method = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || function(f3) {
return setTimeout(f3, 16);
};
return method(fn2);
}
// node_modules/@antv/util/esm/clear-animation-frame.js
function cancelAnimationFrame2(handler) {
var method = window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || window.msCancelAnimationFrame || clearTimeout;
method(handler);
}
// node_modules/@antv/util/esm/mix.js
function _mix(dist4, obj) {
for (var key in obj) {
if (obj.hasOwnProperty(key) && key !== "constructor" && obj[key] !== void 0) {
dist4[key] = obj[key];
}
}
}
function mix(dist4, src1, src2, src3) {
if (src1)
_mix(dist4, src1);
if (src2)
_mix(dist4, src2);
if (src3)
_mix(dist4, src3);
return dist4;
}
// node_modules/@antv/util/esm/clone.js
var clone = function(obj) {
if (typeof obj !== "object" || obj === null) {
return obj;
}
var rst;
if (is_array_default(obj)) {
rst = [];
for (var i4 = 0, l4 = obj.length; i4 < l4; i4++) {
if (typeof obj[i4] === "object" && obj[i4] != null) {
rst[i4] = clone(obj[i4]);
} else {
rst[i4] = obj[i4];
}
}
} else {
rst = {};
for (var k4 in obj) {
if (typeof obj[k4] === "object" && obj[k4] != null) {
rst[k4] = clone(obj[k4]);
} else {
rst[k4] = obj[k4];
}
}
}
return rst;
};
var clone_default = clone;
// node_modules/@antv/util/esm/debounce.js
function debounce(func, wait, immediate) {
var timeout2;
return function() {
var context = this, args = arguments;
var later = function() {
timeout2 = null;
if (!immediate) {
func.apply(context, args);
}
};
var callNow = immediate && !timeout2;
clearTimeout(timeout2);
timeout2 = setTimeout(later, wait);
if (callNow) {
func.apply(context, args);
}
};
}
var debounce_default = debounce;
// node_modules/@antv/util/esm/memoize.js
var memoize_default = function(f3, resolver) {
if (!is_function_default(f3)) {
throw new TypeError("Expected a function");
}
var memoized = function() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var key = resolver ? resolver.apply(this, args) : args[0];
var cache3 = memoized.cache;
if (cache3.has(key)) {
return cache3.get(key);
}
var result = f3.apply(this, args);
cache3.set(key, result);
return result;
};
memoized.cache = new Map();
return memoized;
};
// node_modules/@antv/util/esm/deep-mix.js
var MAX_MIX_LEVEL = 5;
function _deepMix(dist4, src, level, maxLevel) {
level = level || 0;
maxLevel = maxLevel || MAX_MIX_LEVEL;
for (var key in src) {
if (src.hasOwnProperty(key)) {
var value2 = src[key];
if (value2 !== null && is_plain_object_default(value2)) {
if (!is_plain_object_default(dist4[key])) {
dist4[key] = {};
}
if (level < maxLevel) {
_deepMix(dist4[key], value2, level + 1, maxLevel);
} else {
dist4[key] = src[key];
}
} else if (is_array_default(value2)) {
dist4[key] = [];
dist4[key] = dist4[key].concat(value2);
} else if (value2 !== void 0) {
dist4[key] = value2;
}
}
}
}
var deepMix = function(rst) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
for (var i4 = 0; i4 < args.length; i4 += 1) {
_deepMix(rst, args[i4]);
}
return rst;
};
var deep_mix_default = deepMix;
// node_modules/@antv/util/esm/index-of.js
var indexOf2 = function(arr, obj) {
if (!is_array_like_default(arr)) {
return -1;
}
var m4 = Array.prototype.indexOf;
if (m4) {
return m4.call(arr, obj);
}
var index2 = -1;
for (var i4 = 0; i4 < arr.length; i4++) {
if (arr[i4] === obj) {
index2 = i4;
break;
}
}
return index2;
};
var index_of_default = indexOf2;
// node_modules/@antv/util/esm/is-empty.js
var hasOwnProperty2 = Object.prototype.hasOwnProperty;
function isEmpty(value2) {
if (is_nil_default(value2)) {
return true;
}
if (is_array_like_default(value2)) {
return !value2.length;
}
var type2 = get_type_default(value2);
if (type2 === "Map" || type2 === "Set") {
return !value2.size;
}
if (is_prototype_default(value2)) {
return !Object.keys(value2).length;
}
for (var key in value2) {
if (hasOwnProperty2.call(value2, key)) {
return false;
}
}
return true;
}
var is_empty_default = isEmpty;
// node_modules/@antv/util/esm/is-equal.js
var isEqual = function(value2, other2) {
if (value2 === other2) {
return true;
}
if (!value2 || !other2) {
return false;
}
if (is_string_default(value2) || is_string_default(other2)) {
return false;
}
if (is_array_like_default(value2) || is_array_like_default(other2)) {
if (value2.length !== other2.length) {
return false;
}
var rst = true;
for (var i4 = 0; i4 < value2.length; i4++) {
rst = isEqual(value2[i4], other2[i4]);
if (!rst) {
break;
}
}
return rst;
}
if (is_object_like_default(value2) || is_object_like_default(other2)) {
var valueKeys = Object.keys(value2);
var otherKeys = Object.keys(other2);
if (valueKeys.length !== otherKeys.length) {
return false;
}
var rst = true;
for (var i4 = 0; i4 < valueKeys.length; i4++) {
rst = isEqual(value2[valueKeys[i4]], other2[valueKeys[i4]]);
if (!rst) {
break;
}
}
return rst;
}
return false;
};
var is_equal_default = isEqual;
// node_modules/@antv/util/esm/map.js
var map2 = function(arr, func) {
if (!is_array_like_default(arr)) {
return arr;
}
var result = [];
for (var index2 = 0; index2 < arr.length; index2++) {
var value2 = arr[index2];
result.push(func(value2, index2));
}
return result;
};
var map_default = map2;
// node_modules/@antv/util/esm/map-values.js
var identity = function(v3) {
return v3;
};
var map_values_default = function(object, func) {
if (func === void 0) {
func = identity;
}
var r4 = {};
if (is_object_default(object) && !is_nil_default(object)) {
Object.keys(object).forEach(function(key) {
r4[key] = func(object[key], key);
});
}
return r4;
};
// node_modules/@antv/util/esm/get.js
var get_default = function(obj, key, defaultValue) {
var p4 = 0;
var keyArr = is_string_default(key) ? key.split(".") : key;
while (obj && p4 < keyArr.length) {
obj = obj[keyArr[p4++]];
}
return obj === void 0 || p4 < keyArr.length ? defaultValue : obj;
};
// node_modules/@antv/util/esm/set.js
var set_default = function(obj, path, value2) {
var o3 = obj;
var keyArr = is_string_default(path) ? path.split(".") : path;
keyArr.forEach(function(key, idx) {
if (idx < keyArr.length - 1) {
if (!is_object_default(o3[key])) {
o3[key] = is_number_default(keyArr[idx + 1]) ? [] : {};
}
o3 = o3[key];
} else {
o3[key] = value2;
}
});
return obj;
};
// node_modules/@antv/util/esm/pick.js
var hasOwnProperty3 = Object.prototype.hasOwnProperty;
var pick_default = function(object, keys2) {
if (object === null || !is_plain_object_default(object)) {
return {};
}
var result = {};
each_default(keys2, function(key) {
if (hasOwnProperty3.call(object, key)) {
result[key] = object[key];
}
});
return result;
};
// node_modules/@antv/util/esm/omit.js
var omit_default = function(obj, keys2) {
return reduce_default(obj, function(r4, curr, key) {
if (!keys2.includes(key)) {
r4[key] = curr;
}
return r4;
}, {});
};
// node_modules/@antv/util/esm/throttle.js
var throttle_default = function(func, wait, options) {
var timeout2, context, args, result;
var previous = 0;
if (!options)
options = {};
var later = function() {
previous = options.leading === false ? 0 : Date.now();
timeout2 = null;
result = func.apply(context, args);
if (!timeout2)
context = args = null;
};
var throttled = function() {
var now2 = Date.now();
if (!previous && options.leading === false)
previous = now2;
var remaining = wait - (now2 - previous);
context = this;
args = arguments;
if (remaining <= 0 || remaining > wait) {
if (timeout2) {
clearTimeout(timeout2);
timeout2 = null;
}
previous = now2;
result = func.apply(context, args);
if (!timeout2)
context = args = null;
} else if (!timeout2 && options.trailing !== false) {
timeout2 = setTimeout(later, remaining);
}
return result;
};
throttled.cancel = function() {
clearTimeout(timeout2);
previous = 0;
timeout2 = context = args = null;
};
return throttled;
};
// node_modules/@antv/util/esm/to-array.js
var to_array_default = function(value2) {
return is_array_like_default(value2) ? Array.prototype.slice.call(value2) : [];
};
// node_modules/@antv/util/esm/unique-id.js
var map3 = {};
var unique_id_default = function(prefix2) {
prefix2 = prefix2 || "g";
if (!map3[prefix2]) {
map3[prefix2] = 1;
} else {
map3[prefix2] += 1;
}
return prefix2 + map3[prefix2];
};
// node_modules/@antv/util/esm/noop.js
var noop_default = function() {
};
// node_modules/@antv/util/esm/size.js
function size(o3) {
if (is_nil_default(o3)) {
return 0;
}
if (is_array_like_default(o3)) {
return o3.length;
}
return Object.keys(o3).length;
}
// node_modules/@antv/util/esm/measure-text-width.js
var ctx;
var measure_text_width_default = memoize_default(function(text, font) {
if (font === void 0) {
font = {};
}
var fontSize = font.fontSize, fontFamily = font.fontFamily, fontWeight = font.fontWeight, fontStyle = font.fontStyle, fontVariant = font.fontVariant;
if (!ctx) {
ctx = document.createElement("canvas").getContext("2d");
}
ctx.font = [fontStyle, fontVariant, fontWeight, fontSize + "px", fontFamily].join(" ");
return ctx.measureText(is_string_default(text) ? text : "").width;
}, function(text, font) {
if (font === void 0) {
font = {};
}
return __spreadArrays([text], values_default(font)).join("");
});
// node_modules/@antv/util/esm/get-ellipsis-text.js
var get_ellipsis_text_default = function(text, maxWidth, font, str8) {
if (str8 === void 0) {
str8 = "...";
}
var STEP = 16;
var PLACEHOLDER_WIDTH = measure_text_width_default(str8, font);
var leftText = !is_string_default(text) ? to_string_default(text) : text;
var leftWidth = maxWidth;
var r4 = [];
var currentText;
var currentWidth;
if (measure_text_width_default(text, font) <= maxWidth) {
return text;
}
while (true) {
currentText = leftText.substr(0, STEP);
currentWidth = measure_text_width_default(currentText, font);
if (currentWidth + PLACEHOLDER_WIDTH > leftWidth) {
if (currentWidth > leftWidth) {
break;
}
}
r4.push(currentText);
leftWidth -= currentWidth;
leftText = leftText.substr(STEP);
if (!leftText) {
return r4.join("");
}
}
while (true) {
currentText = leftText.substr(0, 1);
currentWidth = measure_text_width_default(currentText, font);
if (currentWidth + PLACEHOLDER_WIDTH > leftWidth) {
break;
}
r4.push(currentText);
leftWidth -= currentWidth;
leftText = leftText.substr(1);
if (!leftText) {
return r4.join("");
}
}
return "" + r4.join("") + str8;
};
// node_modules/@antv/util/esm/cache.js
var default_1 = function() {
function default_12() {
this.map = {};
}
default_12.prototype.has = function(key) {
return this.map[key] !== void 0;
};
default_12.prototype.get = function(key, def) {
var v3 = this.map[key];
return v3 === void 0 ? def : v3;
};
default_12.prototype.set = function(key, value2) {
this.map[key] = value2;
};
default_12.prototype.clear = function() {
this.map = {};
};
default_12.prototype.delete = function(key) {
delete this.map[key];
};
default_12.prototype.size = function() {
return Object.keys(this.map).length;
};
return default_12;
}();
var cache_default = default_1;
// node_modules/@antv/g2/esm/constant.js
var LAYER;
(function(LAYER2) {
LAYER2["FORE"] = "fore";
LAYER2["MID"] = "mid";
LAYER2["BG"] = "bg";
})(LAYER || (LAYER = {}));
var DIRECTION;
(function(DIRECTION2) {
DIRECTION2["TOP"] = "top";
DIRECTION2["TOP_LEFT"] = "top-left";
DIRECTION2["TOP_RIGHT"] = "top-right";
DIRECTION2["RIGHT"] = "right";
DIRECTION2["RIGHT_TOP"] = "right-top";
DIRECTION2["RIGHT_BOTTOM"] = "right-bottom";
DIRECTION2["LEFT"] = "left";
DIRECTION2["LEFT_TOP"] = "left-top";
DIRECTION2["LEFT_BOTTOM"] = "left-bottom";
DIRECTION2["BOTTOM"] = "bottom";
DIRECTION2["BOTTOM_LEFT"] = "bottom-left";
DIRECTION2["BOTTOM_RIGHT"] = "bottom-right";
DIRECTION2["RADIUS"] = "radius";
DIRECTION2["CIRCLE"] = "circle";
DIRECTION2["NONE"] = "none";
})(DIRECTION || (DIRECTION = {}));
var COMPONENT_TYPE;
(function(COMPONENT_TYPE2) {
COMPONENT_TYPE2["AXIS"] = "axis";
COMPONENT_TYPE2["GRID"] = "grid";
COMPONENT_TYPE2["LEGEND"] = "legend";
COMPONENT_TYPE2["TOOLTIP"] = "tooltip";
COMPONENT_TYPE2["ANNOTATION"] = "annotation";
COMPONENT_TYPE2["SLIDER"] = "slider";
COMPONENT_TYPE2["SCROLLBAR"] = "scrollbar";
COMPONENT_TYPE2["OTHER"] = "other";
})(COMPONENT_TYPE || (COMPONENT_TYPE = {}));
var GROUP_Z_INDEX = {
FORE: 3,
MID: 2,
BG: 1
};
var VIEW_LIFE_CIRCLE;
(function(VIEW_LIFE_CIRCLE2) {
VIEW_LIFE_CIRCLE2["BEFORE_RENDER"] = "beforerender";
VIEW_LIFE_CIRCLE2["AFTER_RENDER"] = "afterrender";
VIEW_LIFE_CIRCLE2["BEFORE_PAINT"] = "beforepaint";
VIEW_LIFE_CIRCLE2["AFTER_PAINT"] = "afterpaint";
VIEW_LIFE_CIRCLE2["BEFORE_CHANGE_DATA"] = "beforechangedata";
VIEW_LIFE_CIRCLE2["AFTER_CHANGE_DATA"] = "afterchangedata";
VIEW_LIFE_CIRCLE2["BEFORE_CLEAR"] = "beforeclear";
VIEW_LIFE_CIRCLE2["AFTER_CLEAR"] = "afterclear";
VIEW_LIFE_CIRCLE2["BEFORE_DESTROY"] = "beforedestroy";
VIEW_LIFE_CIRCLE2["BEFORE_CHANGE_SIZE"] = "beforechangesize";
VIEW_LIFE_CIRCLE2["AFTER_CHANGE_SIZE"] = "afterchangesize";
})(VIEW_LIFE_CIRCLE || (VIEW_LIFE_CIRCLE = {}));
var GEOMETRY_LIFE_CIRCLE;
(function(GEOMETRY_LIFE_CIRCLE2) {
GEOMETRY_LIFE_CIRCLE2["BEFORE_DRAW_ANIMATE"] = "beforeanimate";
GEOMETRY_LIFE_CIRCLE2["AFTER_DRAW_ANIMATE"] = "afteranimate";
})(GEOMETRY_LIFE_CIRCLE || (GEOMETRY_LIFE_CIRCLE = {}));
var PLOT_EVENTS;
(function(PLOT_EVENTS2) {
PLOT_EVENTS2["MOUSE_ENTER"] = "plot:mouseenter";
PLOT_EVENTS2["MOUSE_DOWN"] = "plot:mousedown";
PLOT_EVENTS2["MOUSE_MOVE"] = "plot:mousemove";
PLOT_EVENTS2["MOUSE_UP"] = "plot:mouseup";
PLOT_EVENTS2["MOUSE_LEAVE"] = "plot:mouseleave";
PLOT_EVENTS2["TOUCH_START"] = "plot:touchstart";
PLOT_EVENTS2["TOUCH_MOVE"] = "plot:touchmove";
PLOT_EVENTS2["TOUCH_END"] = "plot:touchend";
PLOT_EVENTS2["TOUCH_CANCEL"] = "plot:touchcancel";
PLOT_EVENTS2["CLICK"] = "plot:click";
PLOT_EVENTS2["DBLCLICK"] = "plot:dblclick";
PLOT_EVENTS2["CONTEXTMENU"] = "plot:contextmenu";
PLOT_EVENTS2["LEAVE"] = "plot:leave";
PLOT_EVENTS2["ENTER"] = "plot:enter";
})(PLOT_EVENTS || (PLOT_EVENTS = {}));
var ELEMENT_STATE;
(function(ELEMENT_STATE2) {
ELEMENT_STATE2["ACTIVE"] = "active";
ELEMENT_STATE2["INACTIVE"] = "inactive";
ELEMENT_STATE2["SELECTED"] = "selected";
ELEMENT_STATE2["DEFAULT"] = "default";
})(ELEMENT_STATE || (ELEMENT_STATE = {}));
var GROUP_ATTRS = ["color", "shape", "size"];
var FIELD_ORIGIN = "_origin";
var MIN_CHART_WIDTH = 1;
var MIN_CHART_HEIGHT = 1;
var COMPONENT_MAX_VIEW_PERCENTAGE = 0.25;
// node_modules/@antv/g2/esm/engine/index.js
var ENGINES = {};
function getEngine(name) {
var G2 = ENGINES[name];
if (!G2) {
throw new Error("G engine '".concat(name, "' is not exist, please register it at first."));
}
return G2;
}
function registerEngine(name, engine) {
ENGINES[name] = engine;
}
// node_modules/@antv/dom-util/esm/add-event-listener.js
function addEventListener(target, eventType, callback) {
if (target) {
if (typeof target.addEventListener === "function") {
target.addEventListener(eventType, callback, false);
return {
remove: function() {
target.removeEventListener(eventType, callback, false);
}
};
}
if (typeof target.attachEvent === "function") {
target.attachEvent("on" + eventType, callback);
return {
remove: function() {
target.detachEvent("on" + eventType, callback);
}
};
}
}
}
// node_modules/@antv/dom-util/esm/create-dom.js
var TABLE;
var TABLE_TR;
var FRAGMENT_REG;
var CONTAINERS;
function initConstants() {
TABLE = document.createElement("table");
TABLE_TR = document.createElement("tr");
FRAGMENT_REG = /^\s*<(\w+|!)[^>]*>/;
CONTAINERS = {
tr: document.createElement("tbody"),
tbody: TABLE,
thead: TABLE,
tfoot: TABLE,
td: TABLE_TR,
th: TABLE_TR,
"*": document.createElement("div")
};
}
function createDom(str8) {
if (!TABLE) {
initConstants();
}
var name = FRAGMENT_REG.test(str8) && RegExp.$1;
if (!name || !(name in CONTAINERS)) {
name = "*";
}
var container2 = CONTAINERS[name];
str8 = str8.replace(/(^\s*)|(\s*$)/g, "");
container2.innerHTML = "" + str8;
var dom = container2.childNodes[0];
container2.removeChild(dom);
return dom;
}
// node_modules/@antv/dom-util/esm/get-style.js
function getStyle(dom, name, defaultValue) {
var v3;
try {
v3 = window.getComputedStyle ? window.getComputedStyle(dom, null)[name] : dom.style[name];
} catch (e4) {
} finally {
v3 = v3 === void 0 ? defaultValue : v3;
}
return v3;
}
// node_modules/@antv/dom-util/esm/get-height.js
function getHeight(el, defaultValue) {
var height = getStyle(el, "height", defaultValue);
if (height === "auto") {
height = el.offsetHeight;
}
return parseFloat(height);
}
// node_modules/@antv/dom-util/esm/get-outer-height.js
function getOuterHeight(el, defaultValue) {
var height = getHeight(el, defaultValue);
var bTop = parseFloat(getStyle(el, "borderTopWidth")) || 0;
var pTop = parseFloat(getStyle(el, "paddingTop")) || 0;
var pBottom = parseFloat(getStyle(el, "paddingBottom")) || 0;
var bBottom = parseFloat(getStyle(el, "borderBottomWidth")) || 0;
var mTop = parseFloat(getStyle(el, "marginTop")) || 0;
var mBottom = parseFloat(getStyle(el, "marginBottom")) || 0;
return height + bTop + bBottom + pTop + pBottom + mTop + mBottom;
}
// node_modules/@antv/dom-util/esm/get-width.js
function getHeight2(el, defaultValue) {
var width2 = getStyle(el, "width", defaultValue);
if (width2 === "auto") {
width2 = el.offsetWidth;
}
return parseFloat(width2);
}
// node_modules/@antv/dom-util/esm/get-outer-width.js
function getOuterWidth(el, defaultValue) {
var width2 = getHeight2(el, defaultValue);
var bLeft = parseFloat(getStyle(el, "borderLeftWidth")) || 0;
var pLeft = parseFloat(getStyle(el, "paddingLeft")) || 0;
var pRight = parseFloat(getStyle(el, "paddingRight")) || 0;
var bRight = parseFloat(getStyle(el, "borderRightWidth")) || 0;
var mRight = parseFloat(getStyle(el, "marginRight")) || 0;
var mLeft = parseFloat(getStyle(el, "marginLeft")) || 0;
return width2 + bLeft + bRight + pLeft + pRight + mLeft + mRight;
}
// node_modules/@antv/dom-util/esm/modify-css.js
function modifyCSS(dom, css) {
if (dom) {
for (var key in css) {
if (css.hasOwnProperty(key)) {
dom.style[key] = css[key];
}
}
}
return dom;
}
// node_modules/@antv/g2/esm/util/dom.js
function getElementSize(ele) {
var style = getComputedStyle(ele);
return {
width: (ele.clientWidth || parseInt(style.width, 10)) - parseInt(style.paddingLeft, 10) - parseInt(style.paddingRight, 10),
height: (ele.clientHeight || parseInt(style.height, 10)) - parseInt(style.paddingTop, 10) - parseInt(style.paddingBottom, 10)
};
}
function isNumber2(v3) {
return typeof v3 === "number" && !isNaN(v3);
}
function getChartSize(ele, autoFit, width2, height) {
var w4 = width2;
var h3 = height;
if (autoFit) {
var size2 = getElementSize(ele);
w4 = size2.width ? size2.width : w4;
h3 = size2.height ? size2.height : h3;
}
return {
width: Math.max(isNumber2(w4) ? w4 : MIN_CHART_WIDTH, MIN_CHART_WIDTH),
height: Math.max(isNumber2(h3) ? h3 : MIN_CHART_HEIGHT, MIN_CHART_HEIGHT)
};
}
function removeDom(dom) {
var parent = dom.parentNode;
if (parent) {
parent.removeChild(dom);
}
}
// node_modules/@antv/event-emitter/esm/index.js
var WILDCARD = "*";
var EventEmitter = function() {
function EventEmitter2() {
this._events = {};
}
EventEmitter2.prototype.on = function(evt, callback, once) {
if (!this._events[evt]) {
this._events[evt] = [];
}
this._events[evt].push({
callback,
once: !!once
});
return this;
};
EventEmitter2.prototype.once = function(evt, callback) {
this.on(evt, callback, true);
return this;
};
EventEmitter2.prototype.emit = function(evt) {
var _this = this;
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var events = this._events[evt] || [];
var wildcardEvents = this._events[WILDCARD] || [];
var doEmit = function(es) {
var length5 = es.length;
for (var i4 = 0; i4 < length5; i4++) {
if (!es[i4]) {
continue;
}
var _a6 = es[i4], callback = _a6.callback, once = _a6.once;
if (once) {
es.splice(i4, 1);
if (es.length === 0) {
delete _this._events[evt];
}
length5--;
i4--;
}
callback.apply(_this, args);
}
};
doEmit(events);
doEmit(wildcardEvents);
};
EventEmitter2.prototype.off = function(evt, callback) {
if (!evt) {
this._events = {};
} else {
if (!callback) {
delete this._events[evt];
} else {
var events = this._events[evt] || [];
var length_1 = events.length;
for (var i4 = 0; i4 < length_1; i4++) {
if (events[i4].callback === callback) {
events.splice(i4, 1);
length_1--;
i4--;
}
}
if (events.length === 0) {
delete this._events[evt];
}
}
}
return this;
};
EventEmitter2.prototype.getEvents = function() {
return this._events;
};
return EventEmitter2;
}();
var esm_default = EventEmitter;
// node_modules/@antv/g2/esm/base.js
var Base = function(_super) {
__extends(Base4, _super);
function Base4(cfg) {
var _this = _super.call(this) || this;
_this.destroyed = false;
var _a6 = cfg.visible, visible = _a6 === void 0 ? true : _a6;
_this.visible = visible;
return _this;
}
Base4.prototype.show = function() {
var visible = this.visible;
if (!visible) {
this.changeVisible(true);
}
};
Base4.prototype.hide = function() {
var visible = this.visible;
if (visible) {
this.changeVisible(false);
}
};
Base4.prototype.destroy = function() {
this.off();
this.destroyed = true;
};
Base4.prototype.changeVisible = function(visible) {
if (this.visible === visible) {
return;
}
this.visible = visible;
};
return Base4;
}(esm_default);
var base_default = Base;
// node_modules/@antv/g-base/esm/util/path.js
var path_exports = {};
__export(path_exports, {
catmullRomToBezier: () => catmullRomToBezier,
fillPath: () => fillPath,
fillPathByDiff: () => fillPathByDiff,
formatPath: () => formatPath,
intersection: () => intersection,
parsePathArray: () => parsePathArray,
parsePathString: () => parsePathString,
pathToAbsolute: () => pathToAbsolute,
pathToCurve: () => pathToCurve,
rectPath: () => rectPath
});
var SPACES = " \n\v\f\r \xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029";
var PATH_COMMAND = new RegExp("([a-z])[" + SPACES + ",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[" + SPACES + "]*,?[" + SPACES + "]*)+)", "ig");
var PATH_VALUES = new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[" + SPACES + "]*,?[" + SPACES + "]*", "ig");
var parsePathString = function(pathString) {
if (!pathString) {
return null;
}
if (is_array_default(pathString)) {
return pathString;
}
var paramCounts = {
a: 7,
c: 6,
o: 2,
h: 1,
l: 2,
m: 2,
r: 4,
q: 4,
s: 4,
t: 2,
v: 1,
u: 3,
z: 0
};
var data3 = [];
String(pathString).replace(PATH_COMMAND, function(a4, b10, c5) {
var params = [];
var name = b10.toLowerCase();
c5.replace(PATH_VALUES, function(a5, b11) {
b11 && params.push(+b11);
});
if (name === "m" && params.length > 2) {
data3.push([b10].concat(params.splice(0, 2)));
name = "l";
b10 = b10 === "m" ? "l" : "L";
}
if (name === "o" && params.length === 1) {
data3.push([b10, params[0]]);
}
if (name === "r") {
data3.push([b10].concat(params));
} else {
while (params.length >= paramCounts[name]) {
data3.push([b10].concat(params.splice(0, paramCounts[name])));
if (!paramCounts[name]) {
break;
}
}
}
return pathString;
});
return data3;
};
var catmullRomToBezier = function(crp, z3) {
var d3 = [];
for (var i4 = 0, iLen = crp.length; iLen - 2 * !z3 > i4; i4 += 2) {
var p4 = [
{
x: +crp[i4 - 2],
y: +crp[i4 - 1]
},
{
x: +crp[i4],
y: +crp[i4 + 1]
},
{
x: +crp[i4 + 2],
y: +crp[i4 + 3]
},
{
x: +crp[i4 + 4],
y: +crp[i4 + 5]
}
];
if (z3) {
if (!i4) {
p4[0] = {
x: +crp[iLen - 2],
y: +crp[iLen - 1]
};
} else if (iLen - 4 === i4) {
p4[3] = {
x: +crp[0],
y: +crp[1]
};
} else if (iLen - 2 === i4) {
p4[2] = {
x: +crp[0],
y: +crp[1]
};
p4[3] = {
x: +crp[2],
y: +crp[3]
};
}
} else {
if (iLen - 4 === i4) {
p4[3] = p4[2];
} else if (!i4) {
p4[0] = {
x: +crp[i4],
y: +crp[i4 + 1]
};
}
}
d3.push([
"C",
(-p4[0].x + 6 * p4[1].x + p4[2].x) / 6,
(-p4[0].y + 6 * p4[1].y + p4[2].y) / 6,
(p4[1].x + 6 * p4[2].x - p4[3].x) / 6,
(p4[1].y + 6 * p4[2].y - p4[3].y) / 6,
p4[2].x,
p4[2].y
]);
}
return d3;
};
var ellipsePath = function(x6, y5, rx, ry, a4) {
var res = [];
if (a4 === null && ry === null) {
ry = rx;
}
x6 = +x6;
y5 = +y5;
rx = +rx;
ry = +ry;
if (a4 !== null) {
var rad = Math.PI / 180;
var x1 = x6 + rx * Math.cos(-ry * rad);
var x22 = x6 + rx * Math.cos(-a4 * rad);
var y1 = y5 + rx * Math.sin(-ry * rad);
var y22 = y5 + rx * Math.sin(-a4 * rad);
res = [
["M", x1, y1],
["A", rx, rx, 0, +(a4 - ry > 180), 0, x22, y22]
];
} else {
res = [["M", x6, y5], ["m", 0, -ry], ["a", rx, ry, 0, 1, 1, 0, 2 * ry], ["a", rx, ry, 0, 1, 1, 0, -2 * ry], ["z"]];
}
return res;
};
var pathToAbsolute = function(pathArray) {
pathArray = parsePathString(pathArray);
if (!pathArray || !pathArray.length) {
return [["M", 0, 0]];
}
var res = [];
var x6 = 0;
var y5 = 0;
var mx = 0;
var my = 0;
var start = 0;
var pa0;
var dots;
if (pathArray[0][0] === "M") {
x6 = +pathArray[0][1];
y5 = +pathArray[0][2];
mx = x6;
my = y5;
start++;
res[0] = ["M", x6, y5];
}
var crz = pathArray.length === 3 && pathArray[0][0] === "M" && pathArray[1][0].toUpperCase() === "R" && pathArray[2][0].toUpperCase() === "Z";
for (var r4 = void 0, pa = void 0, i4 = start, ii = pathArray.length; i4 < ii; i4++) {
res.push(r4 = []);
pa = pathArray[i4];
pa0 = pa[0];
if (pa0 !== pa0.toUpperCase()) {
r4[0] = pa0.toUpperCase();
switch (r4[0]) {
case "A":
r4[1] = pa[1];
r4[2] = pa[2];
r4[3] = pa[3];
r4[4] = pa[4];
r4[5] = pa[5];
r4[6] = +pa[6] + x6;
r4[7] = +pa[7] + y5;
break;
case "V":
r4[1] = +pa[1] + y5;
break;
case "H":
r4[1] = +pa[1] + x6;
break;
case "R":
dots = [x6, y5].concat(pa.slice(1));
for (var j4 = 2, jj = dots.length; j4 < jj; j4++) {
dots[j4] = +dots[j4] + x6;
dots[++j4] = +dots[j4] + y5;
}
res.pop();
res = res.concat(catmullRomToBezier(dots, crz));
break;
case "O":
res.pop();
dots = ellipsePath(x6, y5, pa[1], pa[2]);
dots.push(dots[0]);
res = res.concat(dots);
break;
case "U":
res.pop();
res = res.concat(ellipsePath(x6, y5, pa[1], pa[2], pa[3]));
r4 = ["U"].concat(res[res.length - 1].slice(-2));
break;
case "M":
mx = +pa[1] + x6;
my = +pa[2] + y5;
break;
default:
for (var j4 = 1, jj = pa.length; j4 < jj; j4++) {
r4[j4] = +pa[j4] + (j4 % 2 ? x6 : y5);
}
}
} else if (pa0 === "R") {
dots = [x6, y5].concat(pa.slice(1));
res.pop();
res = res.concat(catmullRomToBezier(dots, crz));
r4 = ["R"].concat(pa.slice(-2));
} else if (pa0 === "O") {
res.pop();
dots = ellipsePath(x6, y5, pa[1], pa[2]);
dots.push(dots[0]);
res = res.concat(dots);
} else if (pa0 === "U") {
res.pop();
res = res.concat(ellipsePath(x6, y5, pa[1], pa[2], pa[3]));
r4 = ["U"].concat(res[res.length - 1].slice(-2));
} else {
for (var k4 = 0, kk = pa.length; k4 < kk; k4++) {
r4[k4] = pa[k4];
}
}
pa0 = pa0.toUpperCase();
if (pa0 !== "O") {
switch (r4[0]) {
case "Z":
x6 = +mx;
y5 = +my;
break;
case "H":
x6 = r4[1];
break;
case "V":
y5 = r4[1];
break;
case "M":
mx = r4[r4.length - 2];
my = r4[r4.length - 1];
break;
default:
x6 = r4[r4.length - 2];
y5 = r4[r4.length - 1];
}
}
}
return res;
};
var l2c = function(x1, y1, x22, y22) {
return [x1, y1, x22, y22, x22, y22];
};
var q2c = function(x1, y1, ax, ay, x22, y22) {
var _13 = 1 / 3;
var _23 = 2 / 3;
return [_13 * x1 + _23 * ax, _13 * y1 + _23 * ay, _13 * x22 + _23 * ax, _13 * y22 + _23 * ay, x22, y22];
};
var a2c = function(x1, y1, rx, ry, angle3, large_arc_flag, sweep_flag, x22, y22, recursive) {
if (rx === ry) {
rx += 1;
}
var _120 = Math.PI * 120 / 180;
var rad = Math.PI / 180 * (+angle3 || 0);
var res = [];
var xy;
var f1;
var f22;
var cx;
var cy;
var rotate8 = function(x7, y6, rad2) {
var X2 = x7 * Math.cos(rad2) - y6 * Math.sin(rad2);
var Y2 = x7 * Math.sin(rad2) + y6 * Math.cos(rad2);
return {
x: X2,
y: Y2
};
};
if (!recursive) {
xy = rotate8(x1, y1, -rad);
x1 = xy.x;
y1 = xy.y;
xy = rotate8(x22, y22, -rad);
x22 = xy.x;
y22 = xy.y;
if (x1 === x22 && y1 === y22) {
x22 += 1;
y22 += 1;
}
var x6 = (x1 - x22) / 2;
var y5 = (y1 - y22) / 2;
var h3 = x6 * x6 / (rx * rx) + y5 * y5 / (ry * ry);
if (h3 > 1) {
h3 = Math.sqrt(h3);
rx = h3 * rx;
ry = h3 * ry;
}
var rx2 = rx * rx;
var ry2 = ry * ry;
var k4 = (large_arc_flag === sweep_flag ? -1 : 1) * Math.sqrt(Math.abs((rx2 * ry2 - rx2 * y5 * y5 - ry2 * x6 * x6) / (rx2 * y5 * y5 + ry2 * x6 * x6)));
cx = k4 * rx * y5 / ry + (x1 + x22) / 2;
cy = k4 * -ry * x6 / rx + (y1 + y22) / 2;
f1 = Math.asin(((y1 - cy) / ry).toFixed(9));
f22 = Math.asin(((y22 - cy) / ry).toFixed(9));
f1 = x1 < cx ? Math.PI - f1 : f1;
f22 = x22 < cx ? Math.PI - f22 : f22;
f1 < 0 && (f1 = Math.PI * 2 + f1);
f22 < 0 && (f22 = Math.PI * 2 + f22);
if (sweep_flag && f1 > f22) {
f1 = f1 - Math.PI * 2;
}
if (!sweep_flag && f22 > f1) {
f22 = f22 - Math.PI * 2;
}
} else {
f1 = recursive[0];
f22 = recursive[1];
cx = recursive[2];
cy = recursive[3];
}
var df = f22 - f1;
if (Math.abs(df) > _120) {
var f2old = f22;
var x2old = x22;
var y2old = y22;
f22 = f1 + _120 * (sweep_flag && f22 > f1 ? 1 : -1);
x22 = cx + rx * Math.cos(f22);
y22 = cy + ry * Math.sin(f22);
res = a2c(x22, y22, rx, ry, angle3, 0, sweep_flag, x2old, y2old, [f22, f2old, cx, cy]);
}
df = f22 - f1;
var c1 = Math.cos(f1);
var s1 = Math.sin(f1);
var c22 = Math.cos(f22);
var s22 = Math.sin(f22);
var t4 = Math.tan(df / 4);
var hx = 4 / 3 * rx * t4;
var hy = 4 / 3 * ry * t4;
var m1 = [x1, y1];
var m22 = [x1 + hx * s1, y1 - hy * c1];
var m32 = [x22 + hx * s22, y22 - hy * c22];
var m4 = [x22, y22];
m22[0] = 2 * m1[0] - m22[0];
m22[1] = 2 * m1[1] - m22[1];
if (recursive) {
return [m22, m32, m4].concat(res);
}
res = [m22, m32, m4].concat(res).join().split(",");
var newres = [];
for (var i4 = 0, ii = res.length; i4 < ii; i4++) {
newres[i4] = i4 % 2 ? rotate8(res[i4 - 1], res[i4], rad).y : rotate8(res[i4], res[i4 + 1], rad).x;
}
return newres;
};
var pathToCurve = function(path, path2) {
var p4 = pathToAbsolute(path);
var p22 = path2 && pathToAbsolute(path2);
var attrs = {
x: 0,
y: 0,
bx: 0,
by: 0,
X: 0,
Y: 0,
qx: null,
qy: null
};
var attrs2 = {
x: 0,
y: 0,
bx: 0,
by: 0,
X: 0,
Y: 0,
qx: null,
qy: null
};
var pcoms1 = [];
var pcoms2 = [];
var pfirst = "";
var pcom = "";
var ii;
var processPath = function(path3, d3, pcom2) {
var nx;
var ny;
if (!path3) {
return ["C", d3.x, d3.y, d3.x, d3.y, d3.x, d3.y];
}
!(path3[0] in {
T: 1,
Q: 1
}) && (d3.qx = d3.qy = null);
switch (path3[0]) {
case "M":
d3.X = path3[1];
d3.Y = path3[2];
break;
case "A":
path3 = ["C"].concat(a2c.apply(0, [d3.x, d3.y].concat(path3.slice(1))));
break;
case "S":
if (pcom2 === "C" || pcom2 === "S") {
nx = d3.x * 2 - d3.bx;
ny = d3.y * 2 - d3.by;
} else {
nx = d3.x;
ny = d3.y;
}
path3 = ["C", nx, ny].concat(path3.slice(1));
break;
case "T":
if (pcom2 === "Q" || pcom2 === "T") {
d3.qx = d3.x * 2 - d3.qx;
d3.qy = d3.y * 2 - d3.qy;
} else {
d3.qx = d3.x;
d3.qy = d3.y;
}
path3 = ["C"].concat(q2c(d3.x, d3.y, d3.qx, d3.qy, path3[1], path3[2]));
break;
case "Q":
d3.qx = path3[1];
d3.qy = path3[2];
path3 = ["C"].concat(q2c(d3.x, d3.y, path3[1], path3[2], path3[3], path3[4]));
break;
case "L":
path3 = ["C"].concat(l2c(d3.x, d3.y, path3[1], path3[2]));
break;
case "H":
path3 = ["C"].concat(l2c(d3.x, d3.y, path3[1], d3.y));
break;
case "V":
path3 = ["C"].concat(l2c(d3.x, d3.y, d3.x, path3[1]));
break;
case "Z":
path3 = ["C"].concat(l2c(d3.x, d3.y, d3.X, d3.Y));
break;
default:
break;
}
return path3;
};
var fixArc = function(pp, i5) {
if (pp[i5].length > 7) {
pp[i5].shift();
var pi2 = pp[i5];
while (pi2.length) {
pcoms1[i5] = "A";
p22 && (pcoms2[i5] = "A");
pp.splice(i5++, 0, ["C"].concat(pi2.splice(0, 6)));
}
pp.splice(i5, 1);
ii = Math.max(p4.length, p22 && p22.length || 0);
}
};
var fixM = function(path1, path22, a1, a22, i5) {
if (path1 && path22 && path1[i5][0] === "M" && path22[i5][0] !== "M") {
path22.splice(i5, 0, ["M", a22.x, a22.y]);
a1.bx = 0;
a1.by = 0;
a1.x = path1[i5][1];
a1.y = path1[i5][2];
ii = Math.max(p4.length, p22 && p22.length || 0);
}
};
ii = Math.max(p4.length, p22 && p22.length || 0);
for (var i4 = 0; i4 < ii; i4++) {
p4[i4] && (pfirst = p4[i4][0]);
if (pfirst !== "C") {
pcoms1[i4] = pfirst;
i4 && (pcom = pcoms1[i4 - 1]);
}
p4[i4] = processPath(p4[i4], attrs, pcom);
if (pcoms1[i4] !== "A" && pfirst === "C")
pcoms1[i4] = "C";
fixArc(p4, i4);
if (p22) {
p22[i4] && (pfirst = p22[i4][0]);
if (pfirst !== "C") {
pcoms2[i4] = pfirst;
i4 && (pcom = pcoms2[i4 - 1]);
}
p22[i4] = processPath(p22[i4], attrs2, pcom);
if (pcoms2[i4] !== "A" && pfirst === "C") {
pcoms2[i4] = "C";
}
fixArc(p22, i4);
}
fixM(p4, p22, attrs, attrs2, i4);
fixM(p22, p4, attrs2, attrs, i4);
var seg = p4[i4];
var seg2 = p22 && p22[i4];
var seglen = seg.length;
var seg2len = p22 && seg2.length;
attrs.x = seg[seglen - 2];
attrs.y = seg[seglen - 1];
attrs.bx = parseFloat(seg[seglen - 4]) || attrs.x;
attrs.by = parseFloat(seg[seglen - 3]) || attrs.y;
attrs2.bx = p22 && (parseFloat(seg2[seg2len - 4]) || attrs2.x);
attrs2.by = p22 && (parseFloat(seg2[seg2len - 3]) || attrs2.y);
attrs2.x = p22 && seg2[seg2len - 2];
attrs2.y = p22 && seg2[seg2len - 1];
}
return p22 ? [p4, p22] : p4;
};
var p2s = /,?([a-z]),?/gi;
var parsePathArray = function(path) {
return path.join(",").replace(p2s, "$1");
};
var base3 = function(t4, p1, p22, p32, p4) {
var t1 = -3 * p1 + 9 * p22 - 9 * p32 + 3 * p4;
var t22 = t4 * t1 + 6 * p1 - 12 * p22 + 6 * p32;
return t4 * t22 - 3 * p1 + 3 * p22;
};
var bezlen = function(x1, y1, x22, y22, x32, y32, x42, y42, z3) {
if (z3 === null) {
z3 = 1;
}
z3 = z3 > 1 ? 1 : z3 < 0 ? 0 : z3;
var z22 = z3 / 2;
var n3 = 12;
var Tvalues = [
-0.1252,
0.1252,
-0.3678,
0.3678,
-0.5873,
0.5873,
-0.7699,
0.7699,
-0.9041,
0.9041,
-0.9816,
0.9816
];
var Cvalues = [0.2491, 0.2491, 0.2335, 0.2335, 0.2032, 0.2032, 0.1601, 0.1601, 0.1069, 0.1069, 0.0472, 0.0472];
var sum = 0;
for (var i4 = 0; i4 < n3; i4++) {
var ct = z22 * Tvalues[i4] + z22;
var xbase = base3(ct, x1, x22, x32, x42);
var ybase = base3(ct, y1, y22, y32, y42);
var comb = xbase * xbase + ybase * ybase;
sum += Cvalues[i4] * Math.sqrt(comb);
}
return z22 * sum;
};
var curveDim = function(x0, y0, x1, y1, x22, y22, x32, y32) {
var tvalues = [];
var bounds = [[], []];
var a4;
var b10;
var c5;
var t4;
for (var i4 = 0; i4 < 2; ++i4) {
if (i4 === 0) {
b10 = 6 * x0 - 12 * x1 + 6 * x22;
a4 = -3 * x0 + 9 * x1 - 9 * x22 + 3 * x32;
c5 = 3 * x1 - 3 * x0;
} else {
b10 = 6 * y0 - 12 * y1 + 6 * y22;
a4 = -3 * y0 + 9 * y1 - 9 * y22 + 3 * y32;
c5 = 3 * y1 - 3 * y0;
}
if (Math.abs(a4) < 1e-12) {
if (Math.abs(b10) < 1e-12) {
continue;
}
t4 = -c5 / b10;
if (t4 > 0 && t4 < 1) {
tvalues.push(t4);
}
continue;
}
var b2ac = b10 * b10 - 4 * c5 * a4;
var sqrtb2ac = Math.sqrt(b2ac);
if (b2ac < 0) {
continue;
}
var t1 = (-b10 + sqrtb2ac) / (2 * a4);
if (t1 > 0 && t1 < 1) {
tvalues.push(t1);
}
var t22 = (-b10 - sqrtb2ac) / (2 * a4);
if (t22 > 0 && t22 < 1) {
tvalues.push(t22);
}
}
var j4 = tvalues.length;
var jlen = j4;
var mt;
while (j4--) {
t4 = tvalues[j4];
mt = 1 - t4;
bounds[0][j4] = mt * mt * mt * x0 + 3 * mt * mt * t4 * x1 + 3 * mt * t4 * t4 * x22 + t4 * t4 * t4 * x32;
bounds[1][j4] = mt * mt * mt * y0 + 3 * mt * mt * t4 * y1 + 3 * mt * t4 * t4 * y22 + t4 * t4 * t4 * y32;
}
bounds[0][jlen] = x0;
bounds[1][jlen] = y0;
bounds[0][jlen + 1] = x32;
bounds[1][jlen + 1] = y32;
bounds[0].length = bounds[1].length = jlen + 2;
return {
min: {
x: Math.min.apply(0, bounds[0]),
y: Math.min.apply(0, bounds[1])
},
max: {
x: Math.max.apply(0, bounds[0]),
y: Math.max.apply(0, bounds[1])
}
};
};
var intersect = function(x1, y1, x22, y22, x32, y32, x42, y42) {
if (Math.max(x1, x22) < Math.min(x32, x42) || Math.min(x1, x22) > Math.max(x32, x42) || Math.max(y1, y22) < Math.min(y32, y42) || Math.min(y1, y22) > Math.max(y32, y42)) {
return;
}
var nx = (x1 * y22 - y1 * x22) * (x32 - x42) - (x1 - x22) * (x32 * y42 - y32 * x42);
var ny = (x1 * y22 - y1 * x22) * (y32 - y42) - (y1 - y22) * (x32 * y42 - y32 * x42);
var denominator = (x1 - x22) * (y32 - y42) - (y1 - y22) * (x32 - x42);
if (!denominator) {
return;
}
var px = nx / denominator;
var py = ny / denominator;
var px2 = +px.toFixed(2);
var py2 = +py.toFixed(2);
if (px2 < +Math.min(x1, x22).toFixed(2) || px2 > +Math.max(x1, x22).toFixed(2) || px2 < +Math.min(x32, x42).toFixed(2) || px2 > +Math.max(x32, x42).toFixed(2) || py2 < +Math.min(y1, y22).toFixed(2) || py2 > +Math.max(y1, y22).toFixed(2) || py2 < +Math.min(y32, y42).toFixed(2) || py2 > +Math.max(y32, y42).toFixed(2)) {
return;
}
return {
x: px,
y: py
};
};
var isPointInsideBBox = function(bbox, x6, y5) {
return x6 >= bbox.x && x6 <= bbox.x + bbox.width && y5 >= bbox.y && y5 <= bbox.y + bbox.height;
};
var rectPath = function(x6, y5, w4, h3, r4) {
if (r4) {
return [
["M", +x6 + +r4, y5],
["l", w4 - r4 * 2, 0],
["a", r4, r4, 0, 0, 1, r4, r4],
["l", 0, h3 - r4 * 2],
["a", r4, r4, 0, 0, 1, -r4, r4],
["l", r4 * 2 - w4, 0],
["a", r4, r4, 0, 0, 1, -r4, -r4],
["l", 0, r4 * 2 - h3],
["a", r4, r4, 0, 0, 1, r4, -r4],
["z"]
];
}
var res = [["M", x6, y5], ["l", w4, 0], ["l", 0, h3], ["l", -w4, 0], ["z"]];
res.parsePathArray = parsePathArray;
return res;
};
var box = function(x6, y5, width2, height) {
if (x6 === null) {
x6 = y5 = width2 = height = 0;
}
if (y5 === null) {
y5 = x6.y;
width2 = x6.width;
height = x6.height;
x6 = x6.x;
}
return {
x: x6,
y: y5,
width: width2,
w: width2,
height,
h: height,
x2: x6 + width2,
y2: y5 + height,
cx: x6 + width2 / 2,
cy: y5 + height / 2,
r1: Math.min(width2, height) / 2,
r2: Math.max(width2, height) / 2,
r0: Math.sqrt(width2 * width2 + height * height) / 2,
path: rectPath(x6, y5, width2, height),
vb: [x6, y5, width2, height].join(" ")
};
};
var isBBoxIntersect = function(bbox1, bbox2) {
bbox1 = box(bbox1);
bbox2 = box(bbox2);
return isPointInsideBBox(bbox2, bbox1.x, bbox1.y) || isPointInsideBBox(bbox2, bbox1.x2, bbox1.y) || isPointInsideBBox(bbox2, bbox1.x, bbox1.y2) || isPointInsideBBox(bbox2, bbox1.x2, bbox1.y2) || isPointInsideBBox(bbox1, bbox2.x, bbox2.y) || isPointInsideBBox(bbox1, bbox2.x2, bbox2.y) || isPointInsideBBox(bbox1, bbox2.x, bbox2.y2) || isPointInsideBBox(bbox1, bbox2.x2, bbox2.y2) || (bbox1.x < bbox2.x2 && bbox1.x > bbox2.x || bbox2.x < bbox1.x2 && bbox2.x > bbox1.x) && (bbox1.y < bbox2.y2 && bbox1.y > bbox2.y || bbox2.y < bbox1.y2 && bbox2.y > bbox1.y);
};
var bezierBBox = function(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {
if (!is_array_default(p1x)) {
p1x = [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y];
}
var bbox = curveDim.apply(null, p1x);
return box(bbox.min.x, bbox.min.y, bbox.max.x - bbox.min.x, bbox.max.y - bbox.min.y);
};
var findDotsAtSegment = function(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t4) {
var t1 = 1 - t4;
var t13 = Math.pow(t1, 3);
var t12 = Math.pow(t1, 2);
var t22 = t4 * t4;
var t32 = t22 * t4;
var x6 = t13 * p1x + t12 * 3 * t4 * c1x + t1 * 3 * t4 * t4 * c2x + t32 * p2x;
var y5 = t13 * p1y + t12 * 3 * t4 * c1y + t1 * 3 * t4 * t4 * c2y + t32 * p2y;
var mx = p1x + 2 * t4 * (c1x - p1x) + t22 * (c2x - 2 * c1x + p1x);
var my = p1y + 2 * t4 * (c1y - p1y) + t22 * (c2y - 2 * c1y + p1y);
var nx = c1x + 2 * t4 * (c2x - c1x) + t22 * (p2x - 2 * c2x + c1x);
var ny = c1y + 2 * t4 * (c2y - c1y) + t22 * (p2y - 2 * c2y + c1y);
var ax = t1 * p1x + t4 * c1x;
var ay = t1 * p1y + t4 * c1y;
var cx = t1 * c2x + t4 * p2x;
var cy = t1 * c2y + t4 * p2y;
var alpha = 90 - Math.atan2(mx - nx, my - ny) * 180 / Math.PI;
return {
x: x6,
y: y5,
m: {
x: mx,
y: my
},
n: {
x: nx,
y: ny
},
start: {
x: ax,
y: ay
},
end: {
x: cx,
y: cy
},
alpha
};
};
var interHelper = function(bez1, bez2, justCount) {
var bbox1 = bezierBBox(bez1);
var bbox2 = bezierBBox(bez2);
if (!isBBoxIntersect(bbox1, bbox2)) {
return justCount ? 0 : [];
}
var l1 = bezlen.apply(0, bez1);
var l22 = bezlen.apply(0, bez2);
var n1 = ~~(l1 / 8);
var n22 = ~~(l22 / 8);
var dots1 = [];
var dots2 = [];
var xy = {};
var res = justCount ? 0 : [];
for (var i4 = 0; i4 < n1 + 1; i4++) {
var d3 = findDotsAtSegment.apply(0, bez1.concat(i4 / n1));
dots1.push({
x: d3.x,
y: d3.y,
t: i4 / n1
});
}
for (var i4 = 0; i4 < n22 + 1; i4++) {
var d3 = findDotsAtSegment.apply(0, bez2.concat(i4 / n22));
dots2.push({
x: d3.x,
y: d3.y,
t: i4 / n22
});
}
for (var i4 = 0; i4 < n1; i4++) {
for (var j4 = 0; j4 < n22; j4++) {
var di = dots1[i4];
var di1 = dots1[i4 + 1];
var dj = dots2[j4];
var dj1 = dots2[j4 + 1];
var ci = Math.abs(di1.x - di.x) < 1e-3 ? "y" : "x";
var cj = Math.abs(dj1.x - dj.x) < 1e-3 ? "y" : "x";
var is = intersect(di.x, di.y, di1.x, di1.y, dj.x, dj.y, dj1.x, dj1.y);
if (is) {
if (xy[is.x.toFixed(4)] === is.y.toFixed(4)) {
continue;
}
xy[is.x.toFixed(4)] = is.y.toFixed(4);
var t1 = di.t + Math.abs((is[ci] - di[ci]) / (di1[ci] - di[ci])) * (di1.t - di.t);
var t22 = dj.t + Math.abs((is[cj] - dj[cj]) / (dj1[cj] - dj[cj])) * (dj1.t - dj.t);
if (t1 >= 0 && t1 <= 1 && t22 >= 0 && t22 <= 1) {
if (justCount) {
res += 1;
} else {
res.push({
x: is.x,
y: is.y,
t1,
t2: t22
});
}
}
}
}
}
return res;
};
var interPathHelper = function(path1, path2, justCount) {
path1 = pathToCurve(path1);
path2 = pathToCurve(path2);
var x1;
var y1;
var x22;
var y22;
var x1m;
var y1m;
var x2m;
var y2m;
var bez1;
var bez2;
var res = justCount ? 0 : [];
for (var i4 = 0, ii = path1.length; i4 < ii; i4++) {
var pi2 = path1[i4];
if (pi2[0] === "M") {
x1 = x1m = pi2[1];
y1 = y1m = pi2[2];
} else {
if (pi2[0] === "C") {
bez1 = [x1, y1].concat(pi2.slice(1));
x1 = bez1[6];
y1 = bez1[7];
} else {
bez1 = [x1, y1, x1, y1, x1m, y1m, x1m, y1m];
x1 = x1m;
y1 = y1m;
}
for (var j4 = 0, jj = path2.length; j4 < jj; j4++) {
var pj = path2[j4];
if (pj[0] === "M") {
x22 = x2m = pj[1];
y22 = y2m = pj[2];
} else {
if (pj[0] === "C") {
bez2 = [x22, y22].concat(pj.slice(1));
x22 = bez2[6];
y22 = bez2[7];
} else {
bez2 = [x22, y22, x22, y22, x2m, y2m, x2m, y2m];
x22 = x2m;
y22 = y2m;
}
var intr = interHelper(bez1, bez2, justCount);
if (justCount) {
res += intr;
} else {
for (var k4 = 0, kk = intr.length; k4 < kk; k4++) {
intr[k4].segment1 = i4;
intr[k4].segment2 = j4;
intr[k4].bez1 = bez1;
intr[k4].bez2 = bez2;
}
res = res.concat(intr);
}
}
}
}
}
return res;
};
var intersection = function(path1, path2) {
return interPathHelper(path1, path2);
};
function decasteljau(points, t4) {
var left2 = [];
var right2 = [];
function recurse(points2, t5) {
if (points2.length === 1) {
left2.push(points2[0]);
right2.push(points2[0]);
} else {
var middlePoints = [];
for (var i4 = 0; i4 < points2.length - 1; i4++) {
if (i4 === 0) {
left2.push(points2[0]);
}
if (i4 === points2.length - 2) {
right2.push(points2[i4 + 1]);
}
middlePoints[i4] = [
(1 - t5) * points2[i4][0] + t5 * points2[i4 + 1][0],
(1 - t5) * points2[i4][1] + t5 * points2[i4 + 1][1]
];
}
recurse(middlePoints, t5);
}
}
if (points.length) {
recurse(points, t4);
}
return { left: left2, right: right2.reverse() };
}
function splitCurve(start, end2, count2) {
var points = [[start[1], start[2]]];
count2 = count2 || 2;
var segments = [];
if (end2[0] === "A") {
points.push(end2[6]);
points.push(end2[7]);
} else if (end2[0] === "C") {
points.push([end2[1], end2[2]]);
points.push([end2[3], end2[4]]);
points.push([end2[5], end2[6]]);
} else if (end2[0] === "S" || end2[0] === "Q") {
points.push([end2[1], end2[2]]);
points.push([end2[3], end2[4]]);
} else {
points.push([end2[1], end2[2]]);
}
var leftSegments = points;
var t4 = 1 / count2;
for (var i4 = 0; i4 < count2 - 1; i4++) {
var rt = t4 / (1 - t4 * i4);
var split = decasteljau(leftSegments, rt);
segments.push(split.left);
leftSegments = split.right;
}
segments.push(leftSegments);
var result = segments.map(function(segment) {
var cmd = [];
if (segment.length === 4) {
cmd.push("C");
cmd = cmd.concat(segment[2]);
}
if (segment.length >= 3) {
if (segment.length === 3) {
cmd.push("Q");
}
cmd = cmd.concat(segment[1]);
}
if (segment.length === 2) {
cmd.push("L");
}
cmd = cmd.concat(segment[segment.length - 1]);
return cmd;
});
return result;
}
var splitSegment = function(start, end2, count2) {
if (count2 === 1) {
return [[].concat(start)];
}
var segments = [];
if (end2[0] === "L" || end2[0] === "C" || end2[0] === "Q") {
segments = segments.concat(splitCurve(start, end2, count2));
} else {
var temp = [].concat(start);
if (temp[0] === "M") {
temp[0] = "L";
}
for (var i4 = 0; i4 <= count2 - 1; i4++) {
segments.push(temp);
}
}
return segments;
};
var fillPath = function(source, target) {
if (source.length === 1) {
return source;
}
var sourceLen = source.length - 1;
var targetLen = target.length - 1;
var ratio = sourceLen / targetLen;
var segmentsToFill = [];
if (source.length === 1 && source[0][0] === "M") {
for (var i4 = 0; i4 < targetLen - sourceLen; i4++) {
source.push(source[0]);
}
return source;
}
for (var i4 = 0; i4 < targetLen; i4++) {
var index2 = Math.floor(ratio * i4);
segmentsToFill[index2] = (segmentsToFill[index2] || 0) + 1;
}
var filled = segmentsToFill.reduce(function(filled2, count2, i5) {
if (i5 === sourceLen) {
return filled2.concat(source[sourceLen]);
}
return filled2.concat(splitSegment(source[i5], source[i5 + 1], count2));
}, []);
filled.unshift(source[0]);
if (target[targetLen] === "Z" || target[targetLen] === "z") {
filled.push("Z");
}
return filled;
};
var isEqual2 = function(obj1, obj2) {
if (obj1.length !== obj2.length) {
return false;
}
var result = true;
each_default(obj1, function(item, i4) {
if (item !== obj2[i4]) {
result = false;
return false;
}
});
return result;
};
function getMinDiff(del, add8, modify) {
var type2 = null;
var min7 = modify;
if (add8 < min7) {
min7 = add8;
type2 = "add";
}
if (del < min7) {
min7 = del;
type2 = "del";
}
return {
type: type2,
min: min7
};
}
var levenshteinDistance = function(source, target) {
var sourceLen = source.length;
var targetLen = target.length;
var sourceSegment;
var targetSegment;
var temp = 0;
if (sourceLen === 0 || targetLen === 0) {
return null;
}
var dist4 = [];
for (var i4 = 0; i4 <= sourceLen; i4++) {
dist4[i4] = [];
dist4[i4][0] = { min: i4 };
}
for (var j4 = 0; j4 <= targetLen; j4++) {
dist4[0][j4] = { min: j4 };
}
for (var i4 = 1; i4 <= sourceLen; i4++) {
sourceSegment = source[i4 - 1];
for (var j4 = 1; j4 <= targetLen; j4++) {
targetSegment = target[j4 - 1];
if (isEqual2(sourceSegment, targetSegment)) {
temp = 0;
} else {
temp = 1;
}
var del = dist4[i4 - 1][j4].min + 1;
var add8 = dist4[i4][j4 - 1].min + 1;
var modify = dist4[i4 - 1][j4 - 1].min + temp;
dist4[i4][j4] = getMinDiff(del, add8, modify);
}
}
return dist4;
};
var fillPathByDiff = function(source, target) {
var diffMatrix = levenshteinDistance(source, target);
var sourceLen = source.length;
var targetLen = target.length;
var changes = [];
var index2 = 1;
var minPos = 1;
if (diffMatrix[sourceLen][targetLen].min !== sourceLen) {
for (var i4 = 1; i4 <= sourceLen; i4++) {
var min7 = diffMatrix[i4][i4].min;
minPos = i4;
for (var j4 = index2; j4 <= targetLen; j4++) {
if (diffMatrix[i4][j4].min < min7) {
min7 = diffMatrix[i4][j4].min;
minPos = j4;
}
}
index2 = minPos;
if (diffMatrix[i4][index2].type) {
changes.push({ index: i4 - 1, type: diffMatrix[i4][index2].type });
}
}
for (var i4 = changes.length - 1; i4 >= 0; i4--) {
index2 = changes[i4].index;
if (changes[i4].type === "add") {
source.splice(index2, 0, [].concat(source[index2]));
} else {
source.splice(index2, 1);
}
}
}
sourceLen = source.length;
var diff2 = targetLen - sourceLen;
if (sourceLen < targetLen) {
for (var i4 = 0; i4 < diff2; i4++) {
if (source[sourceLen - 1][0] === "z" || source[sourceLen - 1][0] === "Z") {
source.splice(sourceLen - 2, 0, source[sourceLen - 2]);
} else {
source.push(source[sourceLen - 1]);
}
sourceLen += 1;
}
}
return source;
};
function _splitPoints(points, former, count2) {
var result = [].concat(points);
var index2;
var t4 = 1 / (count2 + 1);
var formerEnd = _getSegmentPoints(former)[0];
for (var i4 = 1; i4 <= count2; i4++) {
t4 *= i4;
index2 = Math.floor(points.length * t4);
if (index2 === 0) {
result.unshift([formerEnd[0] * t4 + points[index2][0] * (1 - t4), formerEnd[1] * t4 + points[index2][1] * (1 - t4)]);
} else {
result.splice(index2, 0, [
formerEnd[0] * t4 + points[index2][0] * (1 - t4),
formerEnd[1] * t4 + points[index2][1] * (1 - t4)
]);
}
}
return result;
}
function _getSegmentPoints(segment) {
var points = [];
switch (segment[0]) {
case "M":
points.push([segment[1], segment[2]]);
break;
case "L":
points.push([segment[1], segment[2]]);
break;
case "A":
points.push([segment[6], segment[7]]);
break;
case "Q":
points.push([segment[3], segment[4]]);
points.push([segment[1], segment[2]]);
break;
case "T":
points.push([segment[1], segment[2]]);
break;
case "C":
points.push([segment[5], segment[6]]);
points.push([segment[1], segment[2]]);
points.push([segment[3], segment[4]]);
break;
case "S":
points.push([segment[3], segment[4]]);
points.push([segment[1], segment[2]]);
break;
case "H":
points.push([segment[1], segment[1]]);
break;
case "V":
points.push([segment[1], segment[1]]);
break;
default:
}
return points;
}
var formatPath = function(fromPath, toPath) {
if (fromPath.length <= 1) {
return fromPath;
}
var points;
for (var i4 = 0; i4 < toPath.length; i4++) {
if (fromPath[i4][0] !== toPath[i4][0]) {
points = _getSegmentPoints(fromPath[i4]);
switch (toPath[i4][0]) {
case "M":
fromPath[i4] = ["M"].concat(points[0]);
break;
case "L":
fromPath[i4] = ["L"].concat(points[0]);
break;
case "A":
fromPath[i4] = [].concat(toPath[i4]);
fromPath[i4][6] = points[0][0];
fromPath[i4][7] = points[0][1];
break;
case "Q":
if (points.length < 2) {
if (i4 > 0) {
points = _splitPoints(points, fromPath[i4 - 1], 1);
} else {
fromPath[i4] = toPath[i4];
break;
}
}
fromPath[i4] = ["Q"].concat(points.reduce(function(arr, i5) {
return arr.concat(i5);
}, []));
break;
case "T":
fromPath[i4] = ["T"].concat(points[0]);
break;
case "C":
if (points.length < 3) {
if (i4 > 0) {
points = _splitPoints(points, fromPath[i4 - 1], 2);
} else {
fromPath[i4] = toPath[i4];
break;
}
}
fromPath[i4] = ["C"].concat(points.reduce(function(arr, i5) {
return arr.concat(i5);
}, []));
break;
case "S":
if (points.length < 2) {
if (i4 > 0) {
points = _splitPoints(points, fromPath[i4 - 1], 1);
} else {
fromPath[i4] = toPath[i4];
break;
}
}
fromPath[i4] = ["S"].concat(points.reduce(function(arr, i5) {
return arr.concat(i5);
}, []));
break;
default:
fromPath[i4] = toPath[i4];
}
}
}
return fromPath;
};
// node_modules/@antv/g-base/esm/event/graph-event.js
var GraphEvent = function() {
function GraphEvent2(type2, event) {
this.bubbles = true;
this.target = null;
this.currentTarget = null;
this.delegateTarget = null;
this.delegateObject = null;
this.defaultPrevented = false;
this.propagationStopped = false;
this.shape = null;
this.fromShape = null;
this.toShape = null;
this.propagationPath = [];
this.type = type2;
this.name = type2;
this.originalEvent = event;
this.timeStamp = event.timeStamp;
}
GraphEvent2.prototype.preventDefault = function() {
this.defaultPrevented = true;
if (this.originalEvent.preventDefault) {
this.originalEvent.preventDefault();
}
};
GraphEvent2.prototype.stopPropagation = function() {
this.propagationStopped = true;
};
GraphEvent2.prototype.toString = function() {
var type2 = this.type;
return "[Event (type=" + type2 + ")]";
};
GraphEvent2.prototype.save = function() {
};
GraphEvent2.prototype.restore = function() {
};
return GraphEvent2;
}();
var graph_event_default = GraphEvent;
// node_modules/@antv/g-base/esm/util/util.js
function removeFromArray(arr, obj) {
var index2 = arr.indexOf(obj);
if (index2 !== -1) {
arr.splice(index2, 1);
}
}
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
function isParent(container2, shape) {
if (container2.isCanvas()) {
return true;
}
var parent = shape.getParent();
var isParent2 = false;
while (parent) {
if (parent === container2) {
isParent2 = true;
break;
}
parent = parent.getParent();
}
return isParent2;
}
function isAllowCapture(element) {
return element.cfg.visible && element.cfg.capture;
}
// node_modules/@antv/g-base/esm/abstract/base.js
var Base2 = function(_super) {
__extends(Base4, _super);
function Base4(cfg) {
var _this = _super.call(this) || this;
_this.destroyed = false;
var defaultCfg2 = _this.getDefaultCfg();
_this.cfg = mix(defaultCfg2, cfg);
return _this;
}
Base4.prototype.getDefaultCfg = function() {
return {};
};
Base4.prototype.get = function(name) {
return this.cfg[name];
};
Base4.prototype.set = function(name, value2) {
this.cfg[name] = value2;
};
Base4.prototype.destroy = function() {
this.cfg = {
destroyed: true
};
this.off();
this.destroyed = true;
};
return Base4;
}(esm_default);
var base_default2 = Base2;
// node_modules/detect-browser/es/index.js
var __spreadArray2 = function(to, from, pack2) {
if (pack2 || arguments.length === 2)
for (var i4 = 0, l4 = from.length, ar; i4 < l4; i4++) {
if (ar || !(i4 in from)) {
if (!ar)
ar = Array.prototype.slice.call(from, 0, i4);
ar[i4] = from[i4];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
var BrowserInfo = function() {
function BrowserInfo2(name, version3, os) {
this.name = name;
this.version = version3;
this.os = os;
this.type = "browser";
}
return BrowserInfo2;
}();
var NodeInfo = function() {
function NodeInfo2(version3) {
this.version = version3;
this.type = "node";
this.name = "node";
this.os = process.platform;
}
return NodeInfo2;
}();
var SearchBotDeviceInfo = function() {
function SearchBotDeviceInfo2(name, version3, os, bot) {
this.name = name;
this.version = version3;
this.os = os;
this.bot = bot;
this.type = "bot-device";
}
return SearchBotDeviceInfo2;
}();
var BotInfo = function() {
function BotInfo2() {
this.type = "bot";
this.bot = true;
this.name = "bot";
this.version = null;
this.os = null;
}
return BotInfo2;
}();
var ReactNativeInfo = function() {
function ReactNativeInfo2() {
this.type = "react-native";
this.name = "react-native";
this.version = null;
this.os = null;
}
return ReactNativeInfo2;
}();
var SEARCHBOX_UA_REGEX = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/;
var SEARCHBOT_OS_REGEX = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/;
var REQUIRED_VERSION_PARTS = 3;
var userAgentRules = [
["aol", /AOLShield\/([0-9\._]+)/],
["edge", /Edge\/([0-9\._]+)/],
["edge-ios", /EdgiOS\/([0-9\._]+)/],
["yandexbrowser", /YaBrowser\/([0-9\._]+)/],
["kakaotalk", /KAKAOTALK\s([0-9\.]+)/],
["samsung", /SamsungBrowser\/([0-9\.]+)/],
["silk", /\bSilk\/([0-9._-]+)\b/],
["miui", /MiuiBrowser\/([0-9\.]+)$/],
["beaker", /BeakerBrowser\/([0-9\.]+)/],
["edge-chromium", /EdgA?\/([0-9\.]+)/],
[
"chromium-webview",
/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/
],
["chrome", /(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],
["phantomjs", /PhantomJS\/([0-9\.]+)(:?\s|$)/],
["crios", /CriOS\/([0-9\.]+)(:?\s|$)/],
["firefox", /Firefox\/([0-9\.]+)(?:\s|$)/],
["fxios", /FxiOS\/([0-9\.]+)/],
["opera-mini", /Opera Mini.*Version\/([0-9\.]+)/],
["opera", /Opera\/([0-9\.]+)(?:\s|$)/],
["opera", /OPR\/([0-9\.]+)(:?\s|$)/],
["pie", /^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],
["pie", /^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],
["netfront", /^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],
["ie", /Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],
["ie", /MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],
["ie", /MSIE\s(7\.0)/],
["bb10", /BB10;\sTouch.*Version\/([0-9\.]+)/],
["android", /Android\s([0-9\.]+)/],
["ios", /Version\/([0-9\._]+).*Mobile.*Safari.*/],
["safari", /Version\/([0-9\._]+).*Safari/],
["facebook", /FB[AS]V\/([0-9\.]+)/],
["instagram", /Instagram\s([0-9\.]+)/],
["ios-webview", /AppleWebKit\/([0-9\.]+).*Mobile/],
["ios-webview", /AppleWebKit\/([0-9\.]+).*Gecko\)$/],
["curl", /^curl\/([0-9\.]+)$/],
["searchbot", SEARCHBOX_UA_REGEX]
];
var operatingSystemRules = [
["iOS", /iP(hone|od|ad)/],
["Android OS", /Android/],
["BlackBerry OS", /BlackBerry|BB10/],
["Windows Mobile", /IEMobile/],
["Amazon OS", /Kindle/],
["Windows 3.11", /Win16/],
["Windows 95", /(Windows 95)|(Win95)|(Windows_95)/],
["Windows 98", /(Windows 98)|(Win98)/],
["Windows 2000", /(Windows NT 5.0)|(Windows 2000)/],
["Windows XP", /(Windows NT 5.1)|(Windows XP)/],
["Windows Server 2003", /(Windows NT 5.2)/],
["Windows Vista", /(Windows NT 6.0)/],
["Windows 7", /(Windows NT 6.1)/],
["Windows 8", /(Windows NT 6.2)/],
["Windows 8.1", /(Windows NT 6.3)/],
["Windows 10", /(Windows NT 10.0)/],
["Windows ME", /Windows ME/],
["Windows CE", /Windows CE|WinCE|Microsoft Pocket Internet Explorer/],
["Open BSD", /OpenBSD/],
["Sun OS", /SunOS/],
["Chrome OS", /CrOS/],
["Linux", /(Linux)|(X11)/],
["Mac OS", /(Mac_PowerPC)|(Macintosh)/],
["QNX", /QNX/],
["BeOS", /BeOS/],
["OS/2", /OS\/2/]
];
function detect(userAgent) {
if (!!userAgent) {
return parseUserAgent(userAgent);
}
if (typeof document === "undefined" && typeof navigator !== "undefined" && navigator.product === "ReactNative") {
return new ReactNativeInfo();
}
if (typeof navigator !== "undefined") {
return parseUserAgent(navigator.userAgent);
}
return getNodeVersion();
}
function matchUserAgent(ua) {
return ua !== "" && userAgentRules.reduce(function(matched, _a6) {
var browser2 = _a6[0], regex = _a6[1];
if (matched) {
return matched;
}
var uaMatch = regex.exec(ua);
return !!uaMatch && [browser2, uaMatch];
}, false);
}
function parseUserAgent(ua) {
var matchedRule = matchUserAgent(ua);
if (!matchedRule) {
return null;
}
var name = matchedRule[0], match = matchedRule[1];
if (name === "searchbot") {
return new BotInfo();
}
var versionParts = match[1] && match[1].split(".").join("_").split("_").slice(0, 3);
if (versionParts) {
if (versionParts.length < REQUIRED_VERSION_PARTS) {
versionParts = __spreadArray2(__spreadArray2([], versionParts, true), createVersionParts(REQUIRED_VERSION_PARTS - versionParts.length), true);
}
} else {
versionParts = [];
}
var version3 = versionParts.join(".");
var os = detectOS(ua);
var searchBotMatch = SEARCHBOT_OS_REGEX.exec(ua);
if (searchBotMatch && searchBotMatch[1]) {
return new SearchBotDeviceInfo(name, version3, os, searchBotMatch[1]);
}
return new BrowserInfo(name, version3, os);
}
function detectOS(ua) {
for (var ii = 0, count2 = operatingSystemRules.length; ii < count2; ii++) {
var _a6 = operatingSystemRules[ii], os = _a6[0], regex = _a6[1];
var match = regex.exec(ua);
if (match) {
return os;
}
}
return null;
}
function getNodeVersion() {
var isNode = typeof process !== "undefined" && process.version;
return isNode ? new NodeInfo(process.version.slice(1)) : null;
}
function createVersionParts(count2) {
var output = [];
for (var ii = 0; ii < count2; ii++) {
output.push("0");
}
return output;
}
// node_modules/gl-matrix/esm/common.js
var EPSILON = 1e-6;
var ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array;
var RANDOM = Math.random;
var degree = Math.PI / 180;
if (!Math.hypot)
Math.hypot = function() {
var y5 = 0, i4 = arguments.length;
while (i4--) {
y5 += arguments[i4] * arguments[i4];
}
return Math.sqrt(y5);
};
// node_modules/gl-matrix/esm/mat3.js
var mat3_exports = {};
__export(mat3_exports, {
add: () => add,
adjoint: () => adjoint,
clone: () => clone2,
copy: () => copy,
create: () => create,
determinant: () => determinant,
equals: () => equals,
exactEquals: () => exactEquals,
frob: () => frob,
fromMat2d: () => fromMat2d,
fromMat4: () => fromMat4,
fromQuat: () => fromQuat,
fromRotation: () => fromRotation,
fromScaling: () => fromScaling,
fromTranslation: () => fromTranslation,
fromValues: () => fromValues,
identity: () => identity2,
invert: () => invert,
mul: () => mul,
multiply: () => multiply,
multiplyScalar: () => multiplyScalar,
multiplyScalarAndAdd: () => multiplyScalarAndAdd,
normalFromMat4: () => normalFromMat4,
projection: () => projection,
rotate: () => rotate,
scale: () => scale,
set: () => set2,
str: () => str2,
sub: () => sub,
subtract: () => subtract,
translate: () => translate,
transpose: () => transpose
});
function create() {
var out = new ARRAY_TYPE(9);
if (ARRAY_TYPE != Float32Array) {
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[5] = 0;
out[6] = 0;
out[7] = 0;
}
out[0] = 1;
out[4] = 1;
out[8] = 1;
return out;
}
function fromMat4(out, a4) {
out[0] = a4[0];
out[1] = a4[1];
out[2] = a4[2];
out[3] = a4[4];
out[4] = a4[5];
out[5] = a4[6];
out[6] = a4[8];
out[7] = a4[9];
out[8] = a4[10];
return out;
}
function clone2(a4) {
var out = new ARRAY_TYPE(9);
out[0] = a4[0];
out[1] = a4[1];
out[2] = a4[2];
out[3] = a4[3];
out[4] = a4[4];
out[5] = a4[5];
out[6] = a4[6];
out[7] = a4[7];
out[8] = a4[8];
return out;
}
function copy(out, a4) {
out[0] = a4[0];
out[1] = a4[1];
out[2] = a4[2];
out[3] = a4[3];
out[4] = a4[4];
out[5] = a4[5];
out[6] = a4[6];
out[7] = a4[7];
out[8] = a4[8];
return out;
}
function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) {
var out = new ARRAY_TYPE(9);
out[0] = m00;
out[1] = m01;
out[2] = m02;
out[3] = m10;
out[4] = m11;
out[5] = m12;
out[6] = m20;
out[7] = m21;
out[8] = m22;
return out;
}
function set2(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) {
out[0] = m00;
out[1] = m01;
out[2] = m02;
out[3] = m10;
out[4] = m11;
out[5] = m12;
out[6] = m20;
out[7] = m21;
out[8] = m22;
return out;
}
function identity2(out) {
out[0] = 1;
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = 1;
out[5] = 0;
out[6] = 0;
out[7] = 0;
out[8] = 1;
return out;
}
function transpose(out, a4) {
if (out === a4) {
var a01 = a4[1], a02 = a4[2], a12 = a4[5];
out[1] = a4[3];
out[2] = a4[6];
out[3] = a01;
out[5] = a4[7];
out[6] = a02;
out[7] = a12;
} else {
out[0] = a4[0];
out[1] = a4[3];
out[2] = a4[6];
out[3] = a4[1];
out[4] = a4[4];
out[5] = a4[7];
out[6] = a4[2];
out[7] = a4[5];
out[8] = a4[8];
}
return out;
}
function invert(out, a4) {
var a00 = a4[0], a01 = a4[1], a02 = a4[2];
var a10 = a4[3], a11 = a4[4], a12 = a4[5];
var a20 = a4[6], a21 = a4[7], a22 = a4[8];
var b01 = a22 * a11 - a12 * a21;
var b11 = -a22 * a10 + a12 * a20;
var b21 = a21 * a10 - a11 * a20;
var det = a00 * b01 + a01 * b11 + a02 * b21;
if (!det) {
return null;
}
det = 1 / det;
out[0] = b01 * det;
out[1] = (-a22 * a01 + a02 * a21) * det;
out[2] = (a12 * a01 - a02 * a11) * det;
out[3] = b11 * det;
out[4] = (a22 * a00 - a02 * a20) * det;
out[5] = (-a12 * a00 + a02 * a10) * det;
out[6] = b21 * det;
out[7] = (-a21 * a00 + a01 * a20) * det;
out[8] = (a11 * a00 - a01 * a10) * det;
return out;
}
function adjoint(out, a4) {
var a00 = a4[0], a01 = a4[1], a02 = a4[2];
var a10 = a4[3], a11 = a4[4], a12 = a4[5];
var a20 = a4[6], a21 = a4[7], a22 = a4[8];
out[0] = a11 * a22 - a12 * a21;
out[1] = a02 * a21 - a01 * a22;
out[2] = a01 * a12 - a02 * a11;
out[3] = a12 * a20 - a10 * a22;
out[4] = a00 * a22 - a02 * a20;
out[5] = a02 * a10 - a00 * a12;
out[6] = a10 * a21 - a11 * a20;
out[7] = a01 * a20 - a00 * a21;
out[8] = a00 * a11 - a01 * a10;
return out;
}
function determinant(a4) {
var a00 = a4[0], a01 = a4[1], a02 = a4[2];
var a10 = a4[3], a11 = a4[4], a12 = a4[5];
var a20 = a4[6], a21 = a4[7], a22 = a4[8];
return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);
}
function multiply(out, a4, b10) {
var a00 = a4[0], a01 = a4[1], a02 = a4[2];
var a10 = a4[3], a11 = a4[4], a12 = a4[5];
var a20 = a4[6], a21 = a4[7], a22 = a4[8];
var b00 = b10[0], b01 = b10[1], b02 = b10[2];
var b102 = b10[3], b11 = b10[4], b12 = b10[5];
var b20 = b10[6], b21 = b10[7], b222 = b10[8];
out[0] = b00 * a00 + b01 * a10 + b02 * a20;
out[1] = b00 * a01 + b01 * a11 + b02 * a21;
out[2] = b00 * a02 + b01 * a12 + b02 * a22;
out[3] = b102 * a00 + b11 * a10 + b12 * a20;
out[4] = b102 * a01 + b11 * a11 + b12 * a21;
out[5] = b102 * a02 + b11 * a12 + b12 * a22;
out[6] = b20 * a00 + b21 * a10 + b222 * a20;
out[7] = b20 * a01 + b21 * a11 + b222 * a21;
out[8] = b20 * a02 + b21 * a12 + b222 * a22;
return out;
}
function translate(out, a4, v3) {
var a00 = a4[0], a01 = a4[1], a02 = a4[2], a10 = a4[3], a11 = a4[4], a12 = a4[5], a20 = a4[6], a21 = a4[7], a22 = a4[8], x6 = v3[0], y5 = v3[1];
out[0] = a00;
out[1] = a01;
out[2] = a02;
out[3] = a10;
out[4] = a11;
out[5] = a12;
out[6] = x6 * a00 + y5 * a10 + a20;
out[7] = x6 * a01 + y5 * a11 + a21;
out[8] = x6 * a02 + y5 * a12 + a22;
return out;
}
function rotate(out, a4, rad) {
var a00 = a4[0], a01 = a4[1], a02 = a4[2], a10 = a4[3], a11 = a4[4], a12 = a4[5], a20 = a4[6], a21 = a4[7], a22 = a4[8], s4 = Math.sin(rad), c5 = Math.cos(rad);
out[0] = c5 * a00 + s4 * a10;
out[1] = c5 * a01 + s4 * a11;
out[2] = c5 * a02 + s4 * a12;
out[3] = c5 * a10 - s4 * a00;
out[4] = c5 * a11 - s4 * a01;
out[5] = c5 * a12 - s4 * a02;
out[6] = a20;
out[7] = a21;
out[8] = a22;
return out;
}
function scale(out, a4, v3) {
var x6 = v3[0], y5 = v3[1];
out[0] = x6 * a4[0];
out[1] = x6 * a4[1];
out[2] = x6 * a4[2];
out[3] = y5 * a4[3];
out[4] = y5 * a4[4];
out[5] = y5 * a4[5];
out[6] = a4[6];
out[7] = a4[7];
out[8] = a4[8];
return out;
}
function fromTranslation(out, v3) {
out[0] = 1;
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = 1;
out[5] = 0;
out[6] = v3[0];
out[7] = v3[1];
out[8] = 1;
return out;
}
function fromRotation(out, rad) {
var s4 = Math.sin(rad), c5 = Math.cos(rad);
out[0] = c5;
out[1] = s4;
out[2] = 0;
out[3] = -s4;
out[4] = c5;
out[5] = 0;
out[6] = 0;
out[7] = 0;
out[8] = 1;
return out;
}
function fromScaling(out, v3) {
out[0] = v3[0];
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = v3[1];
out[5] = 0;
out[6] = 0;
out[7] = 0;
out[8] = 1;
return out;
}
function fromMat2d(out, a4) {
out[0] = a4[0];
out[1] = a4[1];
out[2] = 0;
out[3] = a4[2];
out[4] = a4[3];
out[5] = 0;
out[6] = a4[4];
out[7] = a4[5];
out[8] = 1;
return out;
}
function fromQuat(out, q4) {
var x6 = q4[0], y5 = q4[1], z3 = q4[2], w4 = q4[3];
var x22 = x6 + x6;
var y22 = y5 + y5;
var z22 = z3 + z3;
var xx = x6 * x22;
var yx = y5 * x22;
var yy = y5 * y22;
var zx = z3 * x22;
var zy = z3 * y22;
var zz = z3 * z22;
var wx = w4 * x22;
var wy = w4 * y22;
var wz = w4 * z22;
out[0] = 1 - yy - zz;
out[3] = yx - wz;
out[6] = zx + wy;
out[1] = yx + wz;
out[4] = 1 - xx - zz;
out[7] = zy - wx;
out[2] = zx - wy;
out[5] = zy + wx;
out[8] = 1 - xx - yy;
return out;
}
function normalFromMat4(out, a4) {
var a00 = a4[0], a01 = a4[1], a02 = a4[2], a03 = a4[3];
var a10 = a4[4], a11 = a4[5], a12 = a4[6], a13 = a4[7];
var a20 = a4[8], a21 = a4[9], a22 = a4[10], a23 = a4[11];
var a30 = a4[12], a31 = a4[13], a32 = a4[14], a33 = a4[15];
var b00 = a00 * a11 - a01 * a10;
var b01 = a00 * a12 - a02 * a10;
var b02 = a00 * a13 - a03 * a10;
var b03 = a01 * a12 - a02 * a11;
var b04 = a01 * a13 - a03 * a11;
var b05 = a02 * a13 - a03 * a12;
var b06 = a20 * a31 - a21 * a30;
var b07 = a20 * a32 - a22 * a30;
var b08 = a20 * a33 - a23 * a30;
var b09 = a21 * a32 - a22 * a31;
var b10 = a21 * a33 - a23 * a31;
var b11 = a22 * a33 - a23 * a32;
var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
if (!det) {
return null;
}
det = 1 / det;
out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
return out;
}
function projection(out, width2, height) {
out[0] = 2 / width2;
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = -2 / height;
out[5] = 0;
out[6] = -1;
out[7] = 1;
out[8] = 1;
return out;
}
function str2(a4) {
return "mat3(" + a4[0] + ", " + a4[1] + ", " + a4[2] + ", " + a4[3] + ", " + a4[4] + ", " + a4[5] + ", " + a4[6] + ", " + a4[7] + ", " + a4[8] + ")";
}
function frob(a4) {
return Math.hypot(a4[0], a4[1], a4[2], a4[3], a4[4], a4[5], a4[6], a4[7], a4[8]);
}
function add(out, a4, b10) {
out[0] = a4[0] + b10[0];
out[1] = a4[1] + b10[1];
out[2] = a4[2] + b10[2];
out[3] = a4[3] + b10[3];
out[4] = a4[4] + b10[4];
out[5] = a4[5] + b10[5];
out[6] = a4[6] + b10[6];
out[7] = a4[7] + b10[7];
out[8] = a4[8] + b10[8];
return out;
}
function subtract(out, a4, b10) {
out[0] = a4[0] - b10[0];
out[1] = a4[1] - b10[1];
out[2] = a4[2] - b10[2];
out[3] = a4[3] - b10[3];
out[4] = a4[4] - b10[4];
out[5] = a4[5] - b10[5];
out[6] = a4[6] - b10[6];
out[7] = a4[7] - b10[7];
out[8] = a4[8] - b10[8];
return out;
}
function multiplyScalar(out, a4, b10) {
out[0] = a4[0] * b10;
out[1] = a4[1] * b10;
out[2] = a4[2] * b10;
out[3] = a4[3] * b10;
out[4] = a4[4] * b10;
out[5] = a4[5] * b10;
out[6] = a4[6] * b10;
out[7] = a4[7] * b10;
out[8] = a4[8] * b10;
return out;
}
function multiplyScalarAndAdd(out, a4, b10, scale12) {
out[0] = a4[0] + b10[0] * scale12;
out[1] = a4[1] + b10[1] * scale12;
out[2] = a4[2] + b10[2] * scale12;
out[3] = a4[3] + b10[3] * scale12;
out[4] = a4[4] + b10[4] * scale12;
out[5] = a4[5] + b10[5] * scale12;
out[6] = a4[6] + b10[6] * scale12;
out[7] = a4[7] + b10[7] * scale12;
out[8] = a4[8] + b10[8] * scale12;
return out;
}
function exactEquals(a4, b10) {
return a4[0] === b10[0] && a4[1] === b10[1] && a4[2] === b10[2] && a4[3] === b10[3] && a4[4] === b10[4] && a4[5] === b10[5] && a4[6] === b10[6] && a4[7] === b10[7] && a4[8] === b10[8];
}
function equals(a4, b10) {
var a0 = a4[0], a1 = a4[1], a22 = a4[2], a32 = a4[3], a42 = a4[4], a5 = a4[5], a6 = a4[6], a7 = a4[7], a8 = a4[8];
var b02 = b10[0], b12 = b10[1], b23 = b10[2], b32 = b10[3], b42 = b10[4], b52 = b10[5], b62 = b10[6], b72 = b10[7], b82 = b10[8];
return Math.abs(a0 - b02) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b02)) && Math.abs(a1 - b12) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b12)) && Math.abs(a22 - b23) <= EPSILON * Math.max(1, Math.abs(a22), Math.abs(b23)) && Math.abs(a32 - b32) <= EPSILON * Math.max(1, Math.abs(a32), Math.abs(b32)) && Math.abs(a42 - b42) <= EPSILON * Math.max(1, Math.abs(a42), Math.abs(b42)) && Math.abs(a5 - b52) <= EPSILON * Math.max(1, Math.abs(a5), Math.abs(b52)) && Math.abs(a6 - b62) <= EPSILON * Math.max(1, Math.abs(a6), Math.abs(b62)) && Math.abs(a7 - b72) <= EPSILON * Math.max(1, Math.abs(a7), Math.abs(b72)) && Math.abs(a8 - b82) <= EPSILON * Math.max(1, Math.abs(a8), Math.abs(b82));
}
var mul = multiply;
var sub = subtract;
// node_modules/gl-matrix/esm/mat4.js
var mat4_exports = {};
__export(mat4_exports, {
add: () => add2,
adjoint: () => adjoint2,
clone: () => clone3,
copy: () => copy2,
create: () => create2,
determinant: () => determinant2,
equals: () => equals2,
exactEquals: () => exactEquals2,
frob: () => frob2,
fromQuat: () => fromQuat3,
fromQuat2: () => fromQuat2,
fromRotation: () => fromRotation2,
fromRotationTranslation: () => fromRotationTranslation,
fromRotationTranslationScale: () => fromRotationTranslationScale,
fromRotationTranslationScaleOrigin: () => fromRotationTranslationScaleOrigin,
fromScaling: () => fromScaling2,
fromTranslation: () => fromTranslation2,
fromValues: () => fromValues2,
fromXRotation: () => fromXRotation,
fromYRotation: () => fromYRotation,
fromZRotation: () => fromZRotation,
frustum: () => frustum,
getRotation: () => getRotation,
getScaling: () => getScaling,
getTranslation: () => getTranslation,
identity: () => identity3,
invert: () => invert2,
lookAt: () => lookAt,
mul: () => mul2,
multiply: () => multiply2,
multiplyScalar: () => multiplyScalar2,
multiplyScalarAndAdd: () => multiplyScalarAndAdd2,
ortho: () => ortho,
orthoNO: () => orthoNO,
orthoZO: () => orthoZO,
perspective: () => perspective,
perspectiveFromFieldOfView: () => perspectiveFromFieldOfView,
perspectiveNO: () => perspectiveNO,
perspectiveZO: () => perspectiveZO,
rotate: () => rotate2,
rotateX: () => rotateX,
rotateY: () => rotateY,
rotateZ: () => rotateZ,
scale: () => scale2,
set: () => set3,
str: () => str3,
sub: () => sub2,
subtract: () => subtract2,
targetTo: () => targetTo,
translate: () => translate2,
transpose: () => transpose2
});
function create2() {
var out = new ARRAY_TYPE(16);
if (ARRAY_TYPE != Float32Array) {
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = 0;
out[6] = 0;
out[7] = 0;
out[8] = 0;
out[9] = 0;
out[11] = 0;
out[12] = 0;
out[13] = 0;
out[14] = 0;
}
out[0] = 1;
out[5] = 1;
out[10] = 1;
out[15] = 1;
return out;
}
function clone3(a4) {
var out = new ARRAY_TYPE(16);
out[0] = a4[0];
out[1] = a4[1];
out[2] = a4[2];
out[3] = a4[3];
out[4] = a4[4];
out[5] = a4[5];
out[6] = a4[6];
out[7] = a4[7];
out[8] = a4[8];
out[9] = a4[9];
out[10] = a4[10];
out[11] = a4[11];
out[12] = a4[12];
out[13] = a4[13];
out[14] = a4[14];
out[15] = a4[15];
return out;
}
function copy2(out, a4) {
out[0] = a4[0];
out[1] = a4[1];
out[2] = a4[2];
out[3] = a4[3];
out[4] = a4[4];
out[5] = a4[5];
out[6] = a4[6];
out[7] = a4[7];
out[8] = a4[8];
out[9] = a4[9];
out[10] = a4[10];
out[11] = a4[11];
out[12] = a4[12];
out[13] = a4[13];
out[14] = a4[14];
out[15] = a4[15];
return out;
}
function fromValues2(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
var out = new ARRAY_TYPE(16);
out[0] = m00;
out[1] = m01;
out[2] = m02;
out[3] = m03;
out[4] = m10;
out[5] = m11;
out[6] = m12;
out[7] = m13;
out[8] = m20;
out[9] = m21;
out[10] = m22;
out[11] = m23;
out[12] = m30;
out[13] = m31;
out[14] = m32;
out[15] = m33;
return out;
}
function set3(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
out[0] = m00;
out[1] = m01;
out[2] = m02;
out[3] = m03;
out[4] = m10;
out[5] = m11;
out[6] = m12;
out[7] = m13;
out[8] = m20;
out[9] = m21;
out[10] = m22;
out[11] = m23;
out[12] = m30;
out[13] = m31;
out[14] = m32;
out[15] = m33;
return out;
}
function identity3(out) {
out[0] = 1;
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = 0;
out[5] = 1;
out[6] = 0;
out[7] = 0;
out[8] = 0;
out[9] = 0;
out[10] = 1;
out[11] = 0;
out[12] = 0;
out[13] = 0;
out[14] = 0;
out[15] = 1;
return out;
}
function transpose2(out, a4) {
if (out === a4) {
var a01 = a4[1], a02 = a4[2], a03 = a4[3];
var a12 = a4[6], a13 = a4[7];
var a23 = a4[11];
out[1] = a4[4];
out[2] = a4[8];
out[3] = a4[12];
out[4] = a01;
out[6] = a4[9];
out[7] = a4[13];
out[8] = a02;
out[9] = a12;
out[11] = a4[14];
out[12] = a03;
out[13] = a13;
out[14] = a23;
} else {
out[0] = a4[0];
out[1] = a4[4];
out[2] = a4[8];
out[3] = a4[12];
out[4] = a4[1];
out[5] = a4[5];
out[6] = a4[9];
out[7] = a4[13];
out[8] = a4[2];
out[9] = a4[6];
out[10] = a4[10];
out[11] = a4[14];
out[12] = a4[3];
out[13] = a4[7];
out[14] = a4[11];
out[15] = a4[15];
}
return out;
}
function invert2(out, a4) {
var a00 = a4[0], a01 = a4[1], a02 = a4[2], a03 = a4[3];
var a10 = a4[4], a11 = a4[5], a12 = a4[6], a13 = a4[7];
var a20 = a4[8], a21 = a4[9], a22 = a4[10], a23 = a4[11];
var a30 = a4[12], a31 = a4[13], a32 = a4[14], a33 = a4[15];
var b00 = a00 * a11 - a01 * a10;
var b01 = a00 * a12 - a02 * a10;
var b02 = a00 * a13 - a03 * a10;
var b03 = a01 * a12 - a02 * a11;
var b04 = a01 * a13 - a03 * a11;
var b05 = a02 * a13 - a03 * a12;
var b06 = a20 * a31 - a21 * a30;
var b07 = a20 * a32 - a22 * a30;
var b08 = a20 * a33 - a23 * a30;
var b09 = a21 * a32 - a22 * a31;
var b10 = a21 * a33 - a23 * a31;
var b11 = a22 * a33 - a23 * a32;
var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
if (!det) {
return null;
}
det = 1 / det;
out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;
out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;
out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;
out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;
out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;
out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;
out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;
return out;
}
function adjoint2(out, a4) {
var a00 = a4[0], a01 = a4[1], a02 = a4[2], a03 = a4[3];
var a10 = a4[4], a11 = a4[5], a12 = a4[6], a13 = a4[7];
var a20 = a4[8], a21 = a4[9], a22 = a4[10], a23 = a4[11];
var a30 = a4[12], a31 = a4[13], a32 = a4[14], a33 = a4[15];
out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22);
out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));
out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12);
out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));
out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));
out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22);
out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));
out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12);
out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21);
out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));
out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11);
out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));
out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));
out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21);
out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));
out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11);
return out;
}
function determinant2(a4) {
var a00 = a4[0], a01 = a4[1], a02 = a4[2], a03 = a4[3];
var a10 = a4[4], a11 = a4[5], a12 = a4[6], a13 = a4[7];
var a20 = a4[8], a21 = a4[9], a22 = a4[10], a23 = a4[11];
var a30 = a4[12], a31 = a4[13], a32 = a4[14], a33 = a4[15];
var b00 = a00 * a11 - a01 * a10;
var b01 = a00 * a12 - a02 * a10;
var b02 = a00 * a13 - a03 * a10;
var b03 = a01 * a12 - a02 * a11;
var b04 = a01 * a13 - a03 * a11;
var b05 = a02 * a13 - a03 * a12;
var b06 = a20 * a31 - a21 * a30;
var b07 = a20 * a32 - a22 * a30;
var b08 = a20 * a33 - a23 * a30;
var b09 = a21 * a32 - a22 * a31;
var b10 = a21 * a33 - a23 * a31;
var b11 = a22 * a33 - a23 * a32;
return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
}
function multiply2(out, a4, b10) {
var a00 = a4[0], a01 = a4[1], a02 = a4[2], a03 = a4[3];
var a10 = a4[4], a11 = a4[5], a12 = a4[6], a13 = a4[7];
var a20 = a4[8], a21 = a4[9], a22 = a4[10], a23 = a4[11];
var a30 = a4[12], a31 = a4[13], a32 = a4[14], a33 = a4[15];
var b02 = b10[0], b12 = b10[1], b23 = b10[2], b32 = b10[3];
out[0] = b02 * a00 + b12 * a10 + b23 * a20 + b32 * a30;
out[1] = b02 * a01 + b12 * a11 + b23 * a21 + b32 * a31;
out[2] = b02 * a02 + b12 * a12 + b23 * a22 + b32 * a32;
out[3] = b02 * a03 + b12 * a13 + b23 * a23 + b32 * a33;
b02 = b10[4];
b12 = b10[5];
b23 = b10[6];
b32 = b10[7];
out[4] = b02 * a00 + b12 * a10 + b23 * a20 + b32 * a30;
out[5] = b02 * a01 + b12 * a11 + b23 * a21 + b32 * a31;
out[6] = b02 * a02 + b12 * a12 + b23 * a22 + b32 * a32;
out[7] = b02 * a03 + b12 * a13 + b23 * a23 + b32 * a33;
b02 = b10[8];
b12 = b10[9];
b23 = b10[10];
b32 = b10[11];
out[8] = b02 * a00 + b12 * a10 + b23 * a20 + b32 * a30;
out[9] = b02 * a01 + b12 * a11 + b23 * a21 + b32 * a31;
out[10] = b02 * a02 + b12 * a12 + b23 * a22 + b32 * a32;
out[11] = b02 * a03 + b12 * a13 + b23 * a23 + b32 * a33;
b02 = b10[12];
b12 = b10[13];
b23 = b10[14];
b32 = b10[15];
out[12] = b02 * a00 + b12 * a10 + b23 * a20 + b32 * a30;
out[13] = b02 * a01 + b12 * a11 + b23 * a21 + b32 * a31;
out[14] = b02 * a02 + b12 * a12 + b23 * a22 + b32 * a32;
out[15] = b02 * a03 + b12 * a13 + b23 * a23 + b32 * a33;
return out;
}
function translate2(out, a4, v3) {
var x6 = v3[0], y5 = v3[1], z3 = v3[2];
var a00, a01, a02, a03;
var a10, a11, a12, a13;
var a20, a21, a22, a23;
if (a4 === out) {
out[12] = a4[0] * x6 + a4[4] * y5 + a4[8] * z3 + a4[12];
out[13] = a4[1] * x6 + a4[5] * y5 + a4[9] * z3 + a4[13];
out[14] = a4[2] * x6 + a4[6] * y5 + a4[10] * z3 + a4[14];
out[15] = a4[3] * x6 + a4[7] * y5 + a4[11] * z3 + a4[15];
} else {
a00 = a4[0];
a01 = a4[1];
a02 = a4[2];
a03 = a4[3];
a10 = a4[4];
a11 = a4[5];
a12 = a4[6];
a13 = a4[7];
a20 = a4[8];
a21 = a4[9];
a22 = a4[10];
a23 = a4[11];
out[0] = a00;
out[1] = a01;
out[2] = a02;
out[3] = a03;
out[4] = a10;
out[5] = a11;
out[6] = a12;
out[7] = a13;
out[8] = a20;
out[9] = a21;
out[10] = a22;
out[11] = a23;
out[12] = a00 * x6 + a10 * y5 + a20 * z3 + a4[12];
out[13] = a01 * x6 + a11 * y5 + a21 * z3 + a4[13];
out[14] = a02 * x6 + a12 * y5 + a22 * z3 + a4[14];
out[15] = a03 * x6 + a13 * y5 + a23 * z3 + a4[15];
}
return out;
}
function scale2(out, a4, v3) {
var x6 = v3[0], y5 = v3[1], z3 = v3[2];
out[0] = a4[0] * x6;
out[1] = a4[1] * x6;
out[2] = a4[2] * x6;
out[3] = a4[3] * x6;
out[4] = a4[4] * y5;
out[5] = a4[5] * y5;
out[6] = a4[6] * y5;
out[7] = a4[7] * y5;
out[8] = a4[8] * z3;
out[9] = a4[9] * z3;
out[10] = a4[10] * z3;
out[11] = a4[11] * z3;
out[12] = a4[12];
out[13] = a4[13];
out[14] = a4[14];
out[15] = a4[15];
return out;
}
function rotate2(out, a4, rad, axis22) {
var x6 = axis22[0], y5 = axis22[1], z3 = axis22[2];
var len5 = Math.hypot(x6, y5, z3);
var s4, c5, t4;
var a00, a01, a02, a03;
var a10, a11, a12, a13;
var a20, a21, a22, a23;
var b00, b01, b02;
var b10, b11, b12;
var b20, b21, b222;
if (len5 < EPSILON) {
return null;
}
len5 = 1 / len5;
x6 *= len5;
y5 *= len5;
z3 *= len5;
s4 = Math.sin(rad);
c5 = Math.cos(rad);
t4 = 1 - c5;
a00 = a4[0];
a01 = a4[1];
a02 = a4[2];
a03 = a4[3];
a10 = a4[4];
a11 = a4[5];
a12 = a4[6];
a13 = a4[7];
a20 = a4[8];
a21 = a4[9];
a22 = a4[10];
a23 = a4[11];
b00 = x6 * x6 * t4 + c5;
b01 = y5 * x6 * t4 + z3 * s4;
b02 = z3 * x6 * t4 - y5 * s4;
b10 = x6 * y5 * t4 - z3 * s4;
b11 = y5 * y5 * t4 + c5;
b12 = z3 * y5 * t4 + x6 * s4;
b20 = x6 * z3 * t4 + y5 * s4;
b21 = y5 * z3 * t4 - x6 * s4;
b222 = z3 * z3 * t4 + c5;
out[0] = a00 * b00 + a10 * b01 + a20 * b02;
out[1] = a01 * b00 + a11 * b01 + a21 * b02;
out[2] = a02 * b00 + a12 * b01 + a22 * b02;
out[3] = a03 * b00 + a13 * b01 + a23 * b02;
out[4] = a00 * b10 + a10 * b11 + a20 * b12;
out[5] = a01 * b10 + a11 * b11 + a21 * b12;
out[6] = a02 * b10 + a12 * b11 + a22 * b12;
out[7] = a03 * b10 + a13 * b11 + a23 * b12;
out[8] = a00 * b20 + a10 * b21 + a20 * b222;
out[9] = a01 * b20 + a11 * b21 + a21 * b222;
out[10] = a02 * b20 + a12 * b21 + a22 * b222;
out[11] = a03 * b20 + a13 * b21 + a23 * b222;
if (a4 !== out) {
out[12] = a4[12];
out[13] = a4[13];
out[14] = a4[14];
out[15] = a4[15];
}
return out;
}
function rotateX(out, a4, rad) {
var s4 = Math.sin(rad);
var c5 = Math.cos(rad);
var a10 = a4[4];
var a11 = a4[5];
var a12 = a4[6];
var a13 = a4[7];
var a20 = a4[8];
var a21 = a4[9];
var a22 = a4[10];
var a23 = a4[11];
if (a4 !== out) {
out[0] = a4[0];
out[1] = a4[1];
out[2] = a4[2];
out[3] = a4[3];
out[12] = a4[12];
out[13] = a4[13];
out[14] = a4[14];
out[15] = a4[15];
}
out[4] = a10 * c5 + a20 * s4;
out[5] = a11 * c5 + a21 * s4;
out[6] = a12 * c5 + a22 * s4;
out[7] = a13 * c5 + a23 * s4;
out[8] = a20 * c5 - a10 * s4;
out[9] = a21 * c5 - a11 * s4;
out[10] = a22 * c5 - a12 * s4;
out[11] = a23 * c5 - a13 * s4;
return out;
}
function rotateY(out, a4, rad) {
var s4 = Math.sin(rad);
var c5 = Math.cos(rad);
var a00 = a4[0];
var a01 = a4[1];
var a02 = a4[2];
var a03 = a4[3];
var a20 = a4[8];
var a21 = a4[9];
var a22 = a4[10];
var a23 = a4[11];
if (a4 !== out) {
out[4] = a4[4];
out[5] = a4[5];
out[6] = a4[6];
out[7] = a4[7];
out[12] = a4[12];
out[13] = a4[13];
out[14] = a4[14];
out[15] = a4[15];
}
out[0] = a00 * c5 - a20 * s4;
out[1] = a01 * c5 - a21 * s4;
out[2] = a02 * c5 - a22 * s4;
out[3] = a03 * c5 - a23 * s4;
out[8] = a00 * s4 + a20 * c5;
out[9] = a01 * s4 + a21 * c5;
out[10] = a02 * s4 + a22 * c5;
out[11] = a03 * s4 + a23 * c5;
return out;
}
function rotateZ(out, a4, rad) {
var s4 = Math.sin(rad);
var c5 = Math.cos(rad);
var a00 = a4[0];
var a01 = a4[1];
var a02 = a4[2];
var a03 = a4[3];
var a10 = a4[4];
var a11 = a4[5];
var a12 = a4[6];
var a13 = a4[7];
if (a4 !== out) {
out[8] = a4[8];
out[9] = a4[9];
out[10] = a4[10];
out[11] = a4[11];
out[12] = a4[12];
out[13] = a4[13];
out[14] = a4[14];
out[15] = a4[15];
}
out[0] = a00 * c5 + a10 * s4;
out[1] = a01 * c5 + a11 * s4;
out[2] = a02 * c5 + a12 * s4;
out[3] = a03 * c5 + a13 * s4;
out[4] = a10 * c5 - a00 * s4;
out[5] = a11 * c5 - a01 * s4;
out[6] = a12 * c5 - a02 * s4;
out[7] = a13 * c5 - a03 * s4;
return out;
}
function fromTranslation2(out, v3) {
out[0] = 1;
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = 0;
out[5] = 1;
out[6] = 0;
out[7] = 0;
out[8] = 0;
out[9] = 0;
out[10] = 1;
out[11] = 0;
out[12] = v3[0];
out[13] = v3[1];
out[14] = v3[2];
out[15] = 1;
return out;
}
function fromScaling2(out, v3) {
out[0] = v3[0];
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = 0;
out[5] = v3[1];
out[6] = 0;
out[7] = 0;
out[8] = 0;
out[9] = 0;
out[10] = v3[2];
out[11] = 0;
out[12] = 0;
out[13] = 0;
out[14] = 0;
out[15] = 1;
return out;
}
function fromRotation2(out, rad, axis22) {
var x6 = axis22[0], y5 = axis22[1], z3 = axis22[2];
var len5 = Math.hypot(x6, y5, z3);
var s4, c5, t4;
if (len5 < EPSILON) {
return null;
}
len5 = 1 / len5;
x6 *= len5;
y5 *= len5;
z3 *= len5;
s4 = Math.sin(rad);
c5 = Math.cos(rad);
t4 = 1 - c5;
out[0] = x6 * x6 * t4 + c5;
out[1] = y5 * x6 * t4 + z3 * s4;
out[2] = z3 * x6 * t4 - y5 * s4;
out[3] = 0;
out[4] = x6 * y5 * t4 - z3 * s4;
out[5] = y5 * y5 * t4 + c5;
out[6] = z3 * y5 * t4 + x6 * s4;
out[7] = 0;
out[8] = x6 * z3 * t4 + y5 * s4;
out[9] = y5 * z3 * t4 - x6 * s4;
out[10] = z3 * z3 * t4 + c5;
out[11] = 0;
out[12] = 0;
out[13] = 0;
out[14] = 0;
out[15] = 1;
return out;
}
function fromXRotation(out, rad) {
var s4 = Math.sin(rad);
var c5 = Math.cos(rad);
out[0] = 1;
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = 0;
out[5] = c5;
out[6] = s4;
out[7] = 0;
out[8] = 0;
out[9] = -s4;
out[10] = c5;
out[11] = 0;
out[12] = 0;
out[13] = 0;
out[14] = 0;
out[15] = 1;
return out;
}
function fromYRotation(out, rad) {
var s4 = Math.sin(rad);
var c5 = Math.cos(rad);
out[0] = c5;
out[1] = 0;
out[2] = -s4;
out[3] = 0;
out[4] = 0;
out[5] = 1;
out[6] = 0;
out[7] = 0;
out[8] = s4;
out[9] = 0;
out[10] = c5;
out[11] = 0;
out[12] = 0;
out[13] = 0;
out[14] = 0;
out[15] = 1;
return out;
}
function fromZRotation(out, rad) {
var s4 = Math.sin(rad);
var c5 = Math.cos(rad);
out[0] = c5;
out[1] = s4;
out[2] = 0;
out[3] = 0;
out[4] = -s4;
out[5] = c5;
out[6] = 0;
out[7] = 0;
out[8] = 0;
out[9] = 0;
out[10] = 1;
out[11] = 0;
out[12] = 0;
out[13] = 0;
out[14] = 0;
out[15] = 1;
return out;
}
function fromRotationTranslation(out, q4, v3) {
var x6 = q4[0], y5 = q4[1], z3 = q4[2], w4 = q4[3];
var x22 = x6 + x6;
var y22 = y5 + y5;
var z22 = z3 + z3;
var xx = x6 * x22;
var xy = x6 * y22;
var xz = x6 * z22;
var yy = y5 * y22;
var yz = y5 * z22;
var zz = z3 * z22;
var wx = w4 * x22;
var wy = w4 * y22;
var wz = w4 * z22;
out[0] = 1 - (yy + zz);
out[1] = xy + wz;
out[2] = xz - wy;
out[3] = 0;
out[4] = xy - wz;
out[5] = 1 - (xx + zz);
out[6] = yz + wx;
out[7] = 0;
out[8] = xz + wy;
out[9] = yz - wx;
out[10] = 1 - (xx + yy);
out[11] = 0;
out[12] = v3[0];
out[13] = v3[1];
out[14] = v3[2];
out[15] = 1;
return out;
}
function fromQuat2(out, a4) {
var translation = new ARRAY_TYPE(3);
var bx = -a4[0], by = -a4[1], bz = -a4[2], bw = a4[3], ax = a4[4], ay = a4[5], az = a4[6], aw = a4[7];
var magnitude = bx * bx + by * by + bz * bz + bw * bw;
if (magnitude > 0) {
translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude;
translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude;
translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude;
} else {
translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;
translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;
translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;
}
fromRotationTranslation(out, a4, translation);
return out;
}
function getTranslation(out, mat) {
out[0] = mat[12];
out[1] = mat[13];
out[2] = mat[14];
return out;
}
function getScaling(out, mat) {
var m11 = mat[0];
var m12 = mat[1];
var m13 = mat[2];
var m21 = mat[4];
var m22 = mat[5];
var m23 = mat[6];
var m31 = mat[8];
var m32 = mat[9];
var m33 = mat[10];
out[0] = Math.hypot(m11, m12, m13);
out[1] = Math.hypot(m21, m22, m23);
out[2] = Math.hypot(m31, m32, m33);
return out;
}
function getRotation(out, mat) {
var scaling = new ARRAY_TYPE(3);
getScaling(scaling, mat);
var is1 = 1 / scaling[0];
var is2 = 1 / scaling[1];
var is3 = 1 / scaling[2];
var sm11 = mat[0] * is1;
var sm12 = mat[1] * is2;
var sm13 = mat[2] * is3;
var sm21 = mat[4] * is1;
var sm22 = mat[5] * is2;
var sm23 = mat[6] * is3;
var sm31 = mat[8] * is1;
var sm32 = mat[9] * is2;
var sm33 = mat[10] * is3;
var trace = sm11 + sm22 + sm33;
var S3 = 0;
if (trace > 0) {
S3 = Math.sqrt(trace + 1) * 2;
out[3] = 0.25 * S3;
out[0] = (sm23 - sm32) / S3;
out[1] = (sm31 - sm13) / S3;
out[2] = (sm12 - sm21) / S3;
} else if (sm11 > sm22 && sm11 > sm33) {
S3 = Math.sqrt(1 + sm11 - sm22 - sm33) * 2;
out[3] = (sm23 - sm32) / S3;
out[0] = 0.25 * S3;
out[1] = (sm12 + sm21) / S3;
out[2] = (sm31 + sm13) / S3;
} else if (sm22 > sm33) {
S3 = Math.sqrt(1 + sm22 - sm11 - sm33) * 2;
out[3] = (sm31 - sm13) / S3;
out[0] = (sm12 + sm21) / S3;
out[1] = 0.25 * S3;
out[2] = (sm23 + sm32) / S3;
} else {
S3 = Math.sqrt(1 + sm33 - sm11 - sm22) * 2;
out[3] = (sm12 - sm21) / S3;
out[0] = (sm31 + sm13) / S3;
out[1] = (sm23 + sm32) / S3;
out[2] = 0.25 * S3;
}
return out;
}
function fromRotationTranslationScale(out, q4, v3, s4) {
var x6 = q4[0], y5 = q4[1], z3 = q4[2], w4 = q4[3];
var x22 = x6 + x6;
var y22 = y5 + y5;
var z22 = z3 + z3;
var xx = x6 * x22;
var xy = x6 * y22;
var xz = x6 * z22;
var yy = y5 * y22;
var yz = y5 * z22;
var zz = z3 * z22;
var wx = w4 * x22;
var wy = w4 * y22;
var wz = w4 * z22;
var sx = s4[0];
var sy = s4[1];
var sz = s4[2];
out[0] = (1 - (yy + zz)) * sx;
out[1] = (xy + wz) * sx;
out[2] = (xz - wy) * sx;
out[3] = 0;
out[4] = (xy - wz) * sy;
out[5] = (1 - (xx + zz)) * sy;
out[6] = (yz + wx) * sy;
out[7] = 0;
out[8] = (xz + wy) * sz;
out[9] = (yz - wx) * sz;
out[10] = (1 - (xx + yy)) * sz;
out[11] = 0;
out[12] = v3[0];
out[13] = v3[1];
out[14] = v3[2];
out[15] = 1;
return out;
}
function fromRotationTranslationScaleOrigin(out, q4, v3, s4, o3) {
var x6 = q4[0], y5 = q4[1], z3 = q4[2], w4 = q4[3];
var x22 = x6 + x6;
var y22 = y5 + y5;
var z22 = z3 + z3;
var xx = x6 * x22;
var xy = x6 * y22;
var xz = x6 * z22;
var yy = y5 * y22;
var yz = y5 * z22;
var zz = z3 * z22;
var wx = w4 * x22;
var wy = w4 * y22;
var wz = w4 * z22;
var sx = s4[0];
var sy = s4[1];
var sz = s4[2];
var ox = o3[0];
var oy = o3[1];
var oz = o3[2];
var out0 = (1 - (yy + zz)) * sx;
var out1 = (xy + wz) * sx;
var out2 = (xz - wy) * sx;
var out4 = (xy - wz) * sy;
var out5 = (1 - (xx + zz)) * sy;
var out6 = (yz + wx) * sy;
var out8 = (xz + wy) * sz;
var out9 = (yz - wx) * sz;
var out10 = (1 - (xx + yy)) * sz;
out[0] = out0;
out[1] = out1;
out[2] = out2;
out[3] = 0;
out[4] = out4;
out[5] = out5;
out[6] = out6;
out[7] = 0;
out[8] = out8;
out[9] = out9;
out[10] = out10;
out[11] = 0;
out[12] = v3[0] + ox - (out0 * ox + out4 * oy + out8 * oz);
out[13] = v3[1] + oy - (out1 * ox + out5 * oy + out9 * oz);
out[14] = v3[2] + oz - (out2 * ox + out6 * oy + out10 * oz);
out[15] = 1;
return out;
}
function fromQuat3(out, q4) {
var x6 = q4[0], y5 = q4[1], z3 = q4[2], w4 = q4[3];
var x22 = x6 + x6;
var y22 = y5 + y5;
var z22 = z3 + z3;
var xx = x6 * x22;
var yx = y5 * x22;
var yy = y5 * y22;
var zx = z3 * x22;
var zy = z3 * y22;
var zz = z3 * z22;
var wx = w4 * x22;
var wy = w4 * y22;
var wz = w4 * z22;
out[0] = 1 - yy - zz;
out[1] = yx + wz;
out[2] = zx - wy;
out[3] = 0;
out[4] = yx - wz;
out[5] = 1 - xx - zz;
out[6] = zy + wx;
out[7] = 0;
out[8] = zx + wy;
out[9] = zy - wx;
out[10] = 1 - xx - yy;
out[11] = 0;
out[12] = 0;
out[13] = 0;
out[14] = 0;
out[15] = 1;
return out;
}
function frustum(out, left2, right2, bottom, top, near2, far) {
var rl = 1 / (right2 - left2);
var tb = 1 / (top - bottom);
var nf = 1 / (near2 - far);
out[0] = near2 * 2 * rl;
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = 0;
out[5] = near2 * 2 * tb;
out[6] = 0;
out[7] = 0;
out[8] = (right2 + left2) * rl;
out[9] = (top + bottom) * tb;
out[10] = (far + near2) * nf;
out[11] = -1;
out[12] = 0;
out[13] = 0;
out[14] = far * near2 * 2 * nf;
out[15] = 0;
return out;
}
function perspectiveNO(out, fovy, aspect, near2, far) {
var f3 = 1 / Math.tan(fovy / 2), nf;
out[0] = f3 / aspect;
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = 0;
out[5] = f3;
out[6] = 0;
out[7] = 0;
out[8] = 0;
out[9] = 0;
out[11] = -1;
out[12] = 0;
out[13] = 0;
out[15] = 0;
if (far != null && far !== Infinity) {
nf = 1 / (near2 - far);
out[10] = (far + near2) * nf;
out[14] = 2 * far * near2 * nf;
} else {
out[10] = -1;
out[14] = -2 * near2;
}
return out;
}
var perspective = perspectiveNO;
function perspectiveZO(out, fovy, aspect, near2, far) {
var f3 = 1 / Math.tan(fovy / 2), nf;
out[0] = f3 / aspect;
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = 0;
out[5] = f3;
out[6] = 0;
out[7] = 0;
out[8] = 0;
out[9] = 0;
out[11] = -1;
out[12] = 0;
out[13] = 0;
out[15] = 0;
if (far != null && far !== Infinity) {
nf = 1 / (near2 - far);
out[10] = far * nf;
out[14] = far * near2 * nf;
} else {
out[10] = -1;
out[14] = -near2;
}
return out;
}
function perspectiveFromFieldOfView(out, fov, near2, far) {
var upTan = Math.tan(fov.upDegrees * Math.PI / 180);
var downTan = Math.tan(fov.downDegrees * Math.PI / 180);
var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180);
var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180);
var xScale = 2 / (leftTan + rightTan);
var yScale = 2 / (upTan + downTan);
out[0] = xScale;
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = 0;
out[5] = yScale;
out[6] = 0;
out[7] = 0;
out[8] = -((leftTan - rightTan) * xScale * 0.5);
out[9] = (upTan - downTan) * yScale * 0.5;
out[10] = far / (near2 - far);
out[11] = -1;
out[12] = 0;
out[13] = 0;
out[14] = far * near2 / (near2 - far);
out[15] = 0;
return out;
}
function orthoNO(out, left2, right2, bottom, top, near2, far) {
var lr = 1 / (left2 - right2);
var bt = 1 / (bottom - top);
var nf = 1 / (near2 - far);
out[0] = -2 * lr;
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = 0;
out[5] = -2 * bt;
out[6] = 0;
out[7] = 0;
out[8] = 0;
out[9] = 0;
out[10] = 2 * nf;
out[11] = 0;
out[12] = (left2 + right2) * lr;
out[13] = (top + bottom) * bt;
out[14] = (far + near2) * nf;
out[15] = 1;
return out;
}
var ortho = orthoNO;
function orthoZO(out, left2, right2, bottom, top, near2, far) {
var lr = 1 / (left2 - right2);
var bt = 1 / (bottom - top);
var nf = 1 / (near2 - far);
out[0] = -2 * lr;
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = 0;
out[5] = -2 * bt;
out[6] = 0;
out[7] = 0;
out[8] = 0;
out[9] = 0;
out[10] = nf;
out[11] = 0;
out[12] = (left2 + right2) * lr;
out[13] = (top + bottom) * bt;
out[14] = near2 * nf;
out[15] = 1;
return out;
}
function lookAt(out, eye, center2, up) {
var x0, x1, x22, y0, y1, y22, z0, z1, z22, len5;
var eyex = eye[0];
var eyey = eye[1];
var eyez = eye[2];
var upx = up[0];
var upy = up[1];
var upz = up[2];
var centerx = center2[0];
var centery = center2[1];
var centerz = center2[2];
if (Math.abs(eyex - centerx) < EPSILON && Math.abs(eyey - centery) < EPSILON && Math.abs(eyez - centerz) < EPSILON) {
return identity3(out);
}
z0 = eyex - centerx;
z1 = eyey - centery;
z22 = eyez - centerz;
len5 = 1 / Math.hypot(z0, z1, z22);
z0 *= len5;
z1 *= len5;
z22 *= len5;
x0 = upy * z22 - upz * z1;
x1 = upz * z0 - upx * z22;
x22 = upx * z1 - upy * z0;
len5 = Math.hypot(x0, x1, x22);
if (!len5) {
x0 = 0;
x1 = 0;
x22 = 0;
} else {
len5 = 1 / len5;
x0 *= len5;
x1 *= len5;
x22 *= len5;
}
y0 = z1 * x22 - z22 * x1;
y1 = z22 * x0 - z0 * x22;
y22 = z0 * x1 - z1 * x0;
len5 = Math.hypot(y0, y1, y22);
if (!len5) {
y0 = 0;
y1 = 0;
y22 = 0;
} else {
len5 = 1 / len5;
y0 *= len5;
y1 *= len5;
y22 *= len5;
}
out[0] = x0;
out[1] = y0;
out[2] = z0;
out[3] = 0;
out[4] = x1;
out[5] = y1;
out[6] = z1;
out[7] = 0;
out[8] = x22;
out[9] = y22;
out[10] = z22;
out[11] = 0;
out[12] = -(x0 * eyex + x1 * eyey + x22 * eyez);
out[13] = -(y0 * eyex + y1 * eyey + y22 * eyez);
out[14] = -(z0 * eyex + z1 * eyey + z22 * eyez);
out[15] = 1;
return out;
}
function targetTo(out, eye, target, up) {
var eyex = eye[0], eyey = eye[1], eyez = eye[2], upx = up[0], upy = up[1], upz = up[2];
var z0 = eyex - target[0], z1 = eyey - target[1], z22 = eyez - target[2];
var len5 = z0 * z0 + z1 * z1 + z22 * z22;
if (len5 > 0) {
len5 = 1 / Math.sqrt(len5);
z0 *= len5;
z1 *= len5;
z22 *= len5;
}
var x0 = upy * z22 - upz * z1, x1 = upz * z0 - upx * z22, x22 = upx * z1 - upy * z0;
len5 = x0 * x0 + x1 * x1 + x22 * x22;
if (len5 > 0) {
len5 = 1 / Math.sqrt(len5);
x0 *= len5;
x1 *= len5;
x22 *= len5;
}
out[0] = x0;
out[1] = x1;
out[2] = x22;
out[3] = 0;
out[4] = z1 * x22 - z22 * x1;
out[5] = z22 * x0 - z0 * x22;
out[6] = z0 * x1 - z1 * x0;
out[7] = 0;
out[8] = z0;
out[9] = z1;
out[10] = z22;
out[11] = 0;
out[12] = eyex;
out[13] = eyey;
out[14] = eyez;
out[15] = 1;
return out;
}
function str3(a4) {
return "mat4(" + a4[0] + ", " + a4[1] + ", " + a4[2] + ", " + a4[3] + ", " + a4[4] + ", " + a4[5] + ", " + a4[6] + ", " + a4[7] + ", " + a4[8] + ", " + a4[9] + ", " + a4[10] + ", " + a4[11] + ", " + a4[12] + ", " + a4[13] + ", " + a4[14] + ", " + a4[15] + ")";
}
function frob2(a4) {
return Math.hypot(a4[0], a4[1], a4[2], a4[3], a4[4], a4[5], a4[6], a4[7], a4[8], a4[9], a4[10], a4[11], a4[12], a4[13], a4[14], a4[15]);
}
function add2(out, a4, b10) {
out[0] = a4[0] + b10[0];
out[1] = a4[1] + b10[1];
out[2] = a4[2] + b10[2];
out[3] = a4[3] + b10[3];
out[4] = a4[4] + b10[4];
out[5] = a4[5] + b10[5];
out[6] = a4[6] + b10[6];
out[7] = a4[7] + b10[7];
out[8] = a4[8] + b10[8];
out[9] = a4[9] + b10[9];
out[10] = a4[10] + b10[10];
out[11] = a4[11] + b10[11];
out[12] = a4[12] + b10[12];
out[13] = a4[13] + b10[13];
out[14] = a4[14] + b10[14];
out[15] = a4[15] + b10[15];
return out;
}
function subtract2(out, a4, b10) {
out[0] = a4[0] - b10[0];
out[1] = a4[1] - b10[1];
out[2] = a4[2] - b10[2];
out[3] = a4[3] - b10[3];
out[4] = a4[4] - b10[4];
out[5] = a4[5] - b10[5];
out[6] = a4[6] - b10[6];
out[7] = a4[7] - b10[7];
out[8] = a4[8] - b10[8];
out[9] = a4[9] - b10[9];
out[10] = a4[10] - b10[10];
out[11] = a4[11] - b10[11];
out[12] = a4[12] - b10[12];
out[13] = a4[13] - b10[13];
out[14] = a4[14] - b10[14];
out[15] = a4[15] - b10[15];
return out;
}
function multiplyScalar2(out, a4, b10) {
out[0] = a4[0] * b10;
out[1] = a4[1] * b10;
out[2] = a4[2] * b10;
out[3] = a4[3] * b10;
out[4] = a4[4] * b10;
out[5] = a4[5] * b10;
out[6] = a4[6] * b10;
out[7] = a4[7] * b10;
out[8] = a4[8] * b10;
out[9] = a4[9] * b10;
out[10] = a4[10] * b10;
out[11] = a4[11] * b10;
out[12] = a4[12] * b10;
out[13] = a4[13] * b10;
out[14] = a4[14] * b10;
out[15] = a4[15] * b10;
return out;
}
function multiplyScalarAndAdd2(out, a4, b10, scale12) {
out[0] = a4[0] + b10[0] * scale12;
out[1] = a4[1] + b10[1] * scale12;
out[2] = a4[2] + b10[2] * scale12;
out[3] = a4[3] + b10[3] * scale12;
out[4] = a4[4] + b10[4] * scale12;
out[5] = a4[5] + b10[5] * scale12;
out[6] = a4[6] + b10[6] * scale12;
out[7] = a4[7] + b10[7] * scale12;
out[8] = a4[8] + b10[8] * scale12;
out[9] = a4[9] + b10[9] * scale12;
out[10] = a4[10] + b10[10] * scale12;
out[11] = a4[11] + b10[11] * scale12;
out[12] = a4[12] + b10[12] * scale12;
out[13] = a4[13] + b10[13] * scale12;
out[14] = a4[14] + b10[14] * scale12;
out[15] = a4[15] + b10[15] * scale12;
return out;
}
function exactEquals2(a4, b10) {
return a4[0] === b10[0] && a4[1] === b10[1] && a4[2] === b10[2] && a4[3] === b10[3] && a4[4] === b10[4] && a4[5] === b10[5] && a4[6] === b10[6] && a4[7] === b10[7] && a4[8] === b10[8] && a4[9] === b10[9] && a4[10] === b10[10] && a4[11] === b10[11] && a4[12] === b10[12] && a4[13] === b10[13] && a4[14] === b10[14] && a4[15] === b10[15];
}
function equals2(a4, b10) {
var a0 = a4[0], a1 = a4[1], a22 = a4[2], a32 = a4[3];
var a42 = a4[4], a5 = a4[5], a6 = a4[6], a7 = a4[7];
var a8 = a4[8], a9 = a4[9], a10 = a4[10], a11 = a4[11];
var a12 = a4[12], a13 = a4[13], a14 = a4[14], a15 = a4[15];
var b02 = b10[0], b12 = b10[1], b23 = b10[2], b32 = b10[3];
var b42 = b10[4], b52 = b10[5], b62 = b10[6], b72 = b10[7];
var b82 = b10[8], b92 = b10[9], b102 = b10[10], b11 = b10[11];
var b122 = b10[12], b13 = b10[13], b14 = b10[14], b15 = b10[15];
return Math.abs(a0 - b02) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b02)) && Math.abs(a1 - b12) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b12)) && Math.abs(a22 - b23) <= EPSILON * Math.max(1, Math.abs(a22), Math.abs(b23)) && Math.abs(a32 - b32) <= EPSILON * Math.max(1, Math.abs(a32), Math.abs(b32)) && Math.abs(a42 - b42) <= EPSILON * Math.max(1, Math.abs(a42), Math.abs(b42)) && Math.abs(a5 - b52) <= EPSILON * Math.max(1, Math.abs(a5), Math.abs(b52)) && Math.abs(a6 - b62) <= EPSILON * Math.max(1, Math.abs(a6), Math.abs(b62)) && Math.abs(a7 - b72) <= EPSILON * Math.max(1, Math.abs(a7), Math.abs(b72)) && Math.abs(a8 - b82) <= EPSILON * Math.max(1, Math.abs(a8), Math.abs(b82)) && Math.abs(a9 - b92) <= EPSILON * Math.max(1, Math.abs(a9), Math.abs(b92)) && Math.abs(a10 - b102) <= EPSILON * Math.max(1, Math.abs(a10), Math.abs(b102)) && Math.abs(a11 - b11) <= EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b122) <= EPSILON * Math.max(1, Math.abs(a12), Math.abs(b122)) && Math.abs(a13 - b13) <= EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15));
}
var mul2 = multiply2;
var sub2 = subtract2;
// node_modules/gl-matrix/esm/quat.js
var quat_exports = {};
__export(quat_exports, {
add: () => add5,
calculateW: () => calculateW,
clone: () => clone6,
conjugate: () => conjugate,
copy: () => copy5,
create: () => create5,
dot: () => dot3,
equals: () => equals5,
exactEquals: () => exactEquals5,
exp: () => exp,
fromEuler: () => fromEuler,
fromMat3: () => fromMat3,
fromValues: () => fromValues5,
getAngle: () => getAngle,
getAxisAngle: () => getAxisAngle,
identity: () => identity4,
invert: () => invert3,
len: () => len3,
length: () => length3,
lerp: () => lerp3,
ln: () => ln2,
mul: () => mul5,
multiply: () => multiply5,
normalize: () => normalize3,
pow: () => pow,
random: () => random3,
rotateX: () => rotateX3,
rotateY: () => rotateY3,
rotateZ: () => rotateZ3,
rotationTo: () => rotationTo,
scale: () => scale5,
set: () => set6,
setAxes: () => setAxes,
setAxisAngle: () => setAxisAngle,
slerp: () => slerp,
sqlerp: () => sqlerp,
sqrLen: () => sqrLen3,
squaredLength: () => squaredLength3,
str: () => str6
});
// node_modules/gl-matrix/esm/vec3.js
var vec3_exports = {};
__export(vec3_exports, {
add: () => add3,
angle: () => angle,
bezier: () => bezier,
ceil: () => ceil,
clone: () => clone4,
copy: () => copy3,
create: () => create3,
cross: () => cross,
dist: () => dist,
distance: () => distance,
div: () => div,
divide: () => divide,
dot: () => dot,
equals: () => equals3,
exactEquals: () => exactEquals3,
floor: () => floor,
forEach: () => forEach,
fromValues: () => fromValues3,
hermite: () => hermite,
inverse: () => inverse,
len: () => len,
length: () => length,
lerp: () => lerp,
max: () => max,
min: () => min,
mul: () => mul3,
multiply: () => multiply3,
negate: () => negate,
normalize: () => normalize,
random: () => random,
rotateX: () => rotateX2,
rotateY: () => rotateY2,
rotateZ: () => rotateZ2,
round: () => round,
scale: () => scale3,
scaleAndAdd: () => scaleAndAdd,
set: () => set4,
sqrDist: () => sqrDist,
sqrLen: () => sqrLen,
squaredDistance: () => squaredDistance,
squaredLength: () => squaredLength,
str: () => str4,
sub: () => sub3,
subtract: () => subtract3,
transformMat3: () => transformMat3,
transformMat4: () => transformMat4,
transformQuat: () => transformQuat,
zero: () => zero
});
function create3() {
var out = new ARRAY_TYPE(3);
if (ARRAY_TYPE != Float32Array) {
out[0] = 0;
out[1] = 0;
out[2] = 0;
}
return out;
}
function clone4(a4) {
var out = new ARRAY_TYPE(3);
out[0] = a4[0];
out[1] = a4[1];
out[2] = a4[2];
return out;
}
function length(a4) {
var x6 = a4[0];
var y5 = a4[1];
var z3 = a4[2];
return Math.hypot(x6, y5, z3);
}
function fromValues3(x6, y5, z3) {
var out = new ARRAY_TYPE(3);
out[0] = x6;
out[1] = y5;
out[2] = z3;
return out;
}
function copy3(out, a4) {
out[0] = a4[0];
out[1] = a4[1];
out[2] = a4[2];
return out;
}
function set4(out, x6, y5, z3) {
out[0] = x6;
out[1] = y5;
out[2] = z3;
return out;
}
function add3(out, a4, b10) {
out[0] = a4[0] + b10[0];
out[1] = a4[1] + b10[1];
out[2] = a4[2] + b10[2];
return out;
}
function subtract3(out, a4, b10) {
out[0] = a4[0] - b10[0];
out[1] = a4[1] - b10[1];
out[2] = a4[2] - b10[2];
return out;
}
function multiply3(out, a4, b10) {
out[0] = a4[0] * b10[0];
out[1] = a4[1] * b10[1];
out[2] = a4[2] * b10[2];
return out;
}
function divide(out, a4, b10) {
out[0] = a4[0] / b10[0];
out[1] = a4[1] / b10[1];
out[2] = a4[2] / b10[2];
return out;
}
function ceil(out, a4) {
out[0] = Math.ceil(a4[0]);
out[1] = Math.ceil(a4[1]);
out[2] = Math.ceil(a4[2]);
return out;
}
function floor(out, a4) {
out[0] = Math.floor(a4[0]);
out[1] = Math.floor(a4[1]);
out[2] = Math.floor(a4[2]);
return out;
}
function min(out, a4, b10) {
out[0] = Math.min(a4[0], b10[0]);
out[1] = Math.min(a4[1], b10[1]);
out[2] = Math.min(a4[2], b10[2]);
return out;
}
function max(out, a4, b10) {
out[0] = Math.max(a4[0], b10[0]);
out[1] = Math.max(a4[1], b10[1]);
out[2] = Math.max(a4[2], b10[2]);
return out;
}
function round(out, a4) {
out[0] = Math.round(a4[0]);
out[1] = Math.round(a4[1]);
out[2] = Math.round(a4[2]);
return out;
}
function scale3(out, a4, b10) {
out[0] = a4[0] * b10;
out[1] = a4[1] * b10;
out[2] = a4[2] * b10;
return out;
}
function scaleAndAdd(out, a4, b10, scale12) {
out[0] = a4[0] + b10[0] * scale12;
out[1] = a4[1] + b10[1] * scale12;
out[2] = a4[2] + b10[2] * scale12;
return out;
}
function distance(a4, b10) {
var x6 = b10[0] - a4[0];
var y5 = b10[1] - a4[1];
var z3 = b10[2] - a4[2];
return Math.hypot(x6, y5, z3);
}
function squaredDistance(a4, b10) {
var x6 = b10[0] - a4[0];
var y5 = b10[1] - a4[1];
var z3 = b10[2] - a4[2];
return x6 * x6 + y5 * y5 + z3 * z3;
}
function squaredLength(a4) {
var x6 = a4[0];
var y5 = a4[1];
var z3 = a4[2];
return x6 * x6 + y5 * y5 + z3 * z3;
}
function negate(out, a4) {
out[0] = -a4[0];
out[1] = -a4[1];
out[2] = -a4[2];
return out;
}
function inverse(out, a4) {
out[0] = 1 / a4[0];
out[1] = 1 / a4[1];
out[2] = 1 / a4[2];
return out;
}
function normalize(out, a4) {
var x6 = a4[0];
var y5 = a4[1];
var z3 = a4[2];
var len5 = x6 * x6 + y5 * y5 + z3 * z3;
if (len5 > 0) {
len5 = 1 / Math.sqrt(len5);
}
out[0] = a4[0] * len5;
out[1] = a4[1] * len5;
out[2] = a4[2] * len5;
return out;
}
function dot(a4, b10) {
return a4[0] * b10[0] + a4[1] * b10[1] + a4[2] * b10[2];
}
function cross(out, a4, b10) {
var ax = a4[0], ay = a4[1], az = a4[2];
var bx = b10[0], by = b10[1], bz = b10[2];
out[0] = ay * bz - az * by;
out[1] = az * bx - ax * bz;
out[2] = ax * by - ay * bx;
return out;
}
function lerp(out, a4, b10, t4) {
var ax = a4[0];
var ay = a4[1];
var az = a4[2];
out[0] = ax + t4 * (b10[0] - ax);
out[1] = ay + t4 * (b10[1] - ay);
out[2] = az + t4 * (b10[2] - az);
return out;
}
function hermite(out, a4, b10, c5, d3, t4) {
var factorTimes2 = t4 * t4;
var factor1 = factorTimes2 * (2 * t4 - 3) + 1;
var factor2 = factorTimes2 * (t4 - 2) + t4;
var factor3 = factorTimes2 * (t4 - 1);
var factor4 = factorTimes2 * (3 - 2 * t4);
out[0] = a4[0] * factor1 + b10[0] * factor2 + c5[0] * factor3 + d3[0] * factor4;
out[1] = a4[1] * factor1 + b10[1] * factor2 + c5[1] * factor3 + d3[1] * factor4;
out[2] = a4[2] * factor1 + b10[2] * factor2 + c5[2] * factor3 + d3[2] * factor4;
return out;
}
function bezier(out, a4, b10, c5, d3, t4) {
var inverseFactor = 1 - t4;
var inverseFactorTimesTwo = inverseFactor * inverseFactor;
var factorTimes2 = t4 * t4;
var factor1 = inverseFactorTimesTwo * inverseFactor;
var factor2 = 3 * t4 * inverseFactorTimesTwo;
var factor3 = 3 * factorTimes2 * inverseFactor;
var factor4 = factorTimes2 * t4;
out[0] = a4[0] * factor1 + b10[0] * factor2 + c5[0] * factor3 + d3[0] * factor4;
out[1] = a4[1] * factor1 + b10[1] * factor2 + c5[1] * factor3 + d3[1] * factor4;
out[2] = a4[2] * factor1 + b10[2] * factor2 + c5[2] * factor3 + d3[2] * factor4;
return out;
}
function random(out, scale12) {
scale12 = scale12 || 1;
var r4 = RANDOM() * 2 * Math.PI;
var z3 = RANDOM() * 2 - 1;
var zScale = Math.sqrt(1 - z3 * z3) * scale12;
out[0] = Math.cos(r4) * zScale;
out[1] = Math.sin(r4) * zScale;
out[2] = z3 * scale12;
return out;
}
function transformMat4(out, a4, m4) {
var x6 = a4[0], y5 = a4[1], z3 = a4[2];
var w4 = m4[3] * x6 + m4[7] * y5 + m4[11] * z3 + m4[15];
w4 = w4 || 1;
out[0] = (m4[0] * x6 + m4[4] * y5 + m4[8] * z3 + m4[12]) / w4;
out[1] = (m4[1] * x6 + m4[5] * y5 + m4[9] * z3 + m4[13]) / w4;
out[2] = (m4[2] * x6 + m4[6] * y5 + m4[10] * z3 + m4[14]) / w4;
return out;
}
function transformMat3(out, a4, m4) {
var x6 = a4[0], y5 = a4[1], z3 = a4[2];
out[0] = x6 * m4[0] + y5 * m4[3] + z3 * m4[6];
out[1] = x6 * m4[1] + y5 * m4[4] + z3 * m4[7];
out[2] = x6 * m4[2] + y5 * m4[5] + z3 * m4[8];
return out;
}
function transformQuat(out, a4, q4) {
var qx = q4[0], qy = q4[1], qz = q4[2], qw = q4[3];
var x6 = a4[0], y5 = a4[1], z3 = a4[2];
var uvx = qy * z3 - qz * y5, uvy = qz * x6 - qx * z3, uvz = qx * y5 - qy * x6;
var uuvx = qy * uvz - qz * uvy, uuvy = qz * uvx - qx * uvz, uuvz = qx * uvy - qy * uvx;
var w22 = qw * 2;
uvx *= w22;
uvy *= w22;
uvz *= w22;
uuvx *= 2;
uuvy *= 2;
uuvz *= 2;
out[0] = x6 + uvx + uuvx;
out[1] = y5 + uvy + uuvy;
out[2] = z3 + uvz + uuvz;
return out;
}
function rotateX2(out, a4, b10, rad) {
var p4 = [], r4 = [];
p4[0] = a4[0] - b10[0];
p4[1] = a4[1] - b10[1];
p4[2] = a4[2] - b10[2];
r4[0] = p4[0];
r4[1] = p4[1] * Math.cos(rad) - p4[2] * Math.sin(rad);
r4[2] = p4[1] * Math.sin(rad) + p4[2] * Math.cos(rad);
out[0] = r4[0] + b10[0];
out[1] = r4[1] + b10[1];
out[2] = r4[2] + b10[2];
return out;
}
function rotateY2(out, a4, b10, rad) {
var p4 = [], r4 = [];
p4[0] = a4[0] - b10[0];
p4[1] = a4[1] - b10[1];
p4[2] = a4[2] - b10[2];
r4[0] = p4[2] * Math.sin(rad) + p4[0] * Math.cos(rad);
r4[1] = p4[1];
r4[2] = p4[2] * Math.cos(rad) - p4[0] * Math.sin(rad);
out[0] = r4[0] + b10[0];
out[1] = r4[1] + b10[1];
out[2] = r4[2] + b10[2];
return out;
}
function rotateZ2(out, a4, b10, rad) {
var p4 = [], r4 = [];
p4[0] = a4[0] - b10[0];
p4[1] = a4[1] - b10[1];
p4[2] = a4[2] - b10[2];
r4[0] = p4[0] * Math.cos(rad) - p4[1] * Math.sin(rad);
r4[1] = p4[0] * Math.sin(rad) + p4[1] * Math.cos(rad);
r4[2] = p4[2];
out[0] = r4[0] + b10[0];
out[1] = r4[1] + b10[1];
out[2] = r4[2] + b10[2];
return out;
}
function angle(a4, b10) {
var ax = a4[0], ay = a4[1], az = a4[2], bx = b10[0], by = b10[1], bz = b10[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && dot(a4, b10) / mag;
return Math.acos(Math.min(Math.max(cosine, -1), 1));
}
function zero(out) {
out[0] = 0;
out[1] = 0;
out[2] = 0;
return out;
}
function str4(a4) {
return "vec3(" + a4[0] + ", " + a4[1] + ", " + a4[2] + ")";
}
function exactEquals3(a4, b10) {
return a4[0] === b10[0] && a4[1] === b10[1] && a4[2] === b10[2];
}
function equals3(a4, b10) {
var a0 = a4[0], a1 = a4[1], a22 = a4[2];
var b02 = b10[0], b12 = b10[1], b23 = b10[2];
return Math.abs(a0 - b02) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b02)) && Math.abs(a1 - b12) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b12)) && Math.abs(a22 - b23) <= EPSILON * Math.max(1, Math.abs(a22), Math.abs(b23));
}
var sub3 = subtract3;
var mul3 = multiply3;
var div = divide;
var dist = distance;
var sqrDist = squaredDistance;
var len = length;
var sqrLen = squaredLength;
var forEach = function() {
var vec = create3();
return function(a4, stride, offset, count2, fn2, arg) {
var i4, l4;
if (!stride) {
stride = 3;
}
if (!offset) {
offset = 0;
}
if (count2) {
l4 = Math.min(count2 * stride + offset, a4.length);
} else {
l4 = a4.length;
}
for (i4 = offset; i4 < l4; i4 += stride) {
vec[0] = a4[i4];
vec[1] = a4[i4 + 1];
vec[2] = a4[i4 + 2];
fn2(vec, vec, arg);
a4[i4] = vec[0];
a4[i4 + 1] = vec[1];
a4[i4 + 2] = vec[2];
}
return a4;
};
}();
// node_modules/gl-matrix/esm/vec4.js
var vec4_exports = {};
__export(vec4_exports, {
add: () => add4,
ceil: () => ceil2,
clone: () => clone5,
copy: () => copy4,
create: () => create4,
cross: () => cross2,
dist: () => dist2,
distance: () => distance2,
div: () => div2,
divide: () => divide2,
dot: () => dot2,
equals: () => equals4,
exactEquals: () => exactEquals4,
floor: () => floor2,
forEach: () => forEach2,
fromValues: () => fromValues4,
inverse: () => inverse2,
len: () => len2,
length: () => length2,
lerp: () => lerp2,
max: () => max2,
min: () => min2,
mul: () => mul4,
multiply: () => multiply4,
negate: () => negate2,
normalize: () => normalize2,
random: () => random2,
round: () => round2,
scale: () => scale4,
scaleAndAdd: () => scaleAndAdd2,
set: () => set5,
sqrDist: () => sqrDist2,
sqrLen: () => sqrLen2,
squaredDistance: () => squaredDistance2,
squaredLength: () => squaredLength2,
str: () => str5,
sub: () => sub4,
subtract: () => subtract4,
transformMat4: () => transformMat42,
transformQuat: () => transformQuat2,
zero: () => zero2
});
function create4() {
var out = new ARRAY_TYPE(4);
if (ARRAY_TYPE != Float32Array) {
out[0] = 0;
out[1] = 0;
out[2] = 0;
out[3] = 0;
}
return out;
}
function clone5(a4) {
var out = new ARRAY_TYPE(4);
out[0] = a4[0];
out[1] = a4[1];
out[2] = a4[2];
out[3] = a4[3];
return out;
}
function fromValues4(x6, y5, z3, w4) {
var out = new ARRAY_TYPE(4);
out[0] = x6;
out[1] = y5;
out[2] = z3;
out[3] = w4;
return out;
}
function copy4(out, a4) {
out[0] = a4[0];
out[1] = a4[1];
out[2] = a4[2];
out[3] = a4[3];
return out;
}
function set5(out, x6, y5, z3, w4) {
out[0] = x6;
out[1] = y5;
out[2] = z3;
out[3] = w4;
return out;
}
function add4(out, a4, b10) {
out[0] = a4[0] + b10[0];
out[1] = a4[1] + b10[1];
out[2] = a4[2] + b10[2];
out[3] = a4[3] + b10[3];
return out;
}
function subtract4(out, a4, b10) {
out[0] = a4[0] - b10[0];
out[1] = a4[1] - b10[1];
out[2] = a4[2] - b10[2];
out[3] = a4[3] - b10[3];
return out;
}
function multiply4(out, a4, b10) {
out[0] = a4[0] * b10[0];
out[1] = a4[1] * b10[1];
out[2] = a4[2] * b10[2];
out[3] = a4[3] * b10[3];
return out;
}
function divide2(out, a4, b10) {
out[0] = a4[0] / b10[0];
out[1] = a4[1] / b10[1];
out[2] = a4[2] / b10[2];
out[3] = a4[3] / b10[3];
return out;
}
function ceil2(out, a4) {
out[0] = Math.ceil(a4[0]);
out[1] = Math.ceil(a4[1]);
out[2] = Math.ceil(a4[2]);
out[3] = Math.ceil(a4[3]);
return out;
}
function floor2(out, a4) {
out[0] = Math.floor(a4[0]);
out[1] = Math.floor(a4[1]);
out[2] = Math.floor(a4[2]);
out[3] = Math.floor(a4[3]);
return out;
}
function min2(out, a4, b10) {
out[0] = Math.min(a4[0], b10[0]);
out[1] = Math.min(a4[1], b10[1]);
out[2] = Math.min(a4[2], b10[2]);
out[3] = Math.min(a4[3], b10[3]);
return out;
}
function max2(out, a4, b10) {
out[0] = Math.max(a4[0], b10[0]);
out[1] = Math.max(a4[1], b10[1]);
out[2] = Math.max(a4[2], b10[2]);
out[3] = Math.max(a4[3], b10[3]);
return out;
}
function round2(out, a4) {
out[0] = Math.round(a4[0]);
out[1] = Math.round(a4[1]);
out[2] = Math.round(a4[2]);
out[3] = Math.round(a4[3]);
return out;
}
function scale4(out, a4, b10) {
out[0] = a4[0] * b10;
out[1] = a4[1] * b10;
out[2] = a4[2] * b10;
out[3] = a4[3] * b10;
return out;
}
function scaleAndAdd2(out, a4, b10, scale12) {
out[0] = a4[0] + b10[0] * scale12;
out[1] = a4[1] + b10[1] * scale12;
out[2] = a4[2] + b10[2] * scale12;
out[3] = a4[3] + b10[3] * scale12;
return out;
}
function distance2(a4, b10) {
var x6 = b10[0] - a4[0];
var y5 = b10[1] - a4[1];
var z3 = b10[2] - a4[2];
var w4 = b10[3] - a4[3];
return Math.hypot(x6, y5, z3, w4);
}
function squaredDistance2(a4, b10) {
var x6 = b10[0] - a4[0];
var y5 = b10[1] - a4[1];
var z3 = b10[2] - a4[2];
var w4 = b10[3] - a4[3];
return x6 * x6 + y5 * y5 + z3 * z3 + w4 * w4;
}
function length2(a4) {
var x6 = a4[0];
var y5 = a4[1];
var z3 = a4[2];
var w4 = a4[3];
return Math.hypot(x6, y5, z3, w4);
}
function squaredLength2(a4) {
var x6 = a4[0];
var y5 = a4[1];
var z3 = a4[2];
var w4 = a4[3];
return x6 * x6 + y5 * y5 + z3 * z3 + w4 * w4;
}
function negate2(out, a4) {
out[0] = -a4[0];
out[1] = -a4[1];
out[2] = -a4[2];
out[3] = -a4[3];
return out;
}
function inverse2(out, a4) {
out[0] = 1 / a4[0];
out[1] = 1 / a4[1];
out[2] = 1 / a4[2];
out[3] = 1 / a4[3];
return out;
}
function normalize2(out, a4) {
var x6 = a4[0];
var y5 = a4[1];
var z3 = a4[2];
var w4 = a4[3];
var len5 = x6 * x6 + y5 * y5 + z3 * z3 + w4 * w4;
if (len5 > 0) {
len5 = 1 / Math.sqrt(len5);
}
out[0] = x6 * len5;
out[1] = y5 * len5;
out[2] = z3 * len5;
out[3] = w4 * len5;
return out;
}
function dot2(a4, b10) {
return a4[0] * b10[0] + a4[1] * b10[1] + a4[2] * b10[2] + a4[3] * b10[3];
}
function cross2(out, u3, v3, w4) {
var A4 = v3[0] * w4[1] - v3[1] * w4[0], B3 = v3[0] * w4[2] - v3[2] * w4[0], C3 = v3[0] * w4[3] - v3[3] * w4[0], D3 = v3[1] * w4[2] - v3[2] * w4[1], E2 = v3[1] * w4[3] - v3[3] * w4[1], F3 = v3[2] * w4[3] - v3[3] * w4[2];
var G2 = u3[0];
var H3 = u3[1];
var I3 = u3[2];
var J2 = u3[3];
out[0] = H3 * F3 - I3 * E2 + J2 * D3;
out[1] = -(G2 * F3) + I3 * C3 - J2 * B3;
out[2] = G2 * E2 - H3 * C3 + J2 * A4;
out[3] = -(G2 * D3) + H3 * B3 - I3 * A4;
return out;
}
function lerp2(out, a4, b10, t4) {
var ax = a4[0];
var ay = a4[1];
var az = a4[2];
var aw = a4[3];
out[0] = ax + t4 * (b10[0] - ax);
out[1] = ay + t4 * (b10[1] - ay);
out[2] = az + t4 * (b10[2] - az);
out[3] = aw + t4 * (b10[3] - aw);
return out;
}
function random2(out, scale12) {
scale12 = scale12 || 1;
var v1, v22, v3, v4;
var s1, s22;
do {
v1 = RANDOM() * 2 - 1;
v22 = RANDOM() * 2 - 1;
s1 = v1 * v1 + v22 * v22;
} while (s1 >= 1);
do {
v3 = RANDOM() * 2 - 1;
v4 = RANDOM() * 2 - 1;
s22 = v3 * v3 + v4 * v4;
} while (s22 >= 1);
var d3 = Math.sqrt((1 - s1) / s22);
out[0] = scale12 * v1;
out[1] = scale12 * v22;
out[2] = scale12 * v3 * d3;
out[3] = scale12 * v4 * d3;
return out;
}
function transformMat42(out, a4, m4) {
var x6 = a4[0], y5 = a4[1], z3 = a4[2], w4 = a4[3];
out[0] = m4[0] * x6 + m4[4] * y5 + m4[8] * z3 + m4[12] * w4;
out[1] = m4[1] * x6 + m4[5] * y5 + m4[9] * z3 + m4[13] * w4;
out[2] = m4[2] * x6 + m4[6] * y5 + m4[10] * z3 + m4[14] * w4;
out[3] = m4[3] * x6 + m4[7] * y5 + m4[11] * z3 + m4[15] * w4;
return out;
}
function transformQuat2(out, a4, q4) {
var x6 = a4[0], y5 = a4[1], z3 = a4[2];
var qx = q4[0], qy = q4[1], qz = q4[2], qw = q4[3];
var ix = qw * x6 + qy * z3 - qz * y5;
var iy = qw * y5 + qz * x6 - qx * z3;
var iz = qw * z3 + qx * y5 - qy * x6;
var iw = -qx * x6 - qy * y5 - qz * z3;
out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;
out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;
out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
out[3] = a4[3];
return out;
}
function zero2(out) {
out[0] = 0;
out[1] = 0;
out[2] = 0;
out[3] = 0;
return out;
}
function str5(a4) {
return "vec4(" + a4[0] + ", " + a4[1] + ", " + a4[2] + ", " + a4[3] + ")";
}
function exactEquals4(a4, b10) {
return a4[0] === b10[0] && a4[1] === b10[1] && a4[2] === b10[2] && a4[3] === b10[3];
}
function equals4(a4, b10) {
var a0 = a4[0], a1 = a4[1], a22 = a4[2], a32 = a4[3];
var b02 = b10[0], b12 = b10[1], b23 = b10[2], b32 = b10[3];
return Math.abs(a0 - b02) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b02)) && Math.abs(a1 - b12) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b12)) && Math.abs(a22 - b23) <= EPSILON * Math.max(1, Math.abs(a22), Math.abs(b23)) && Math.abs(a32 - b32) <= EPSILON * Math.max(1, Math.abs(a32), Math.abs(b32));
}
var sub4 = subtract4;
var mul4 = multiply4;
var div2 = divide2;
var dist2 = distance2;
var sqrDist2 = squaredDistance2;
var len2 = length2;
var sqrLen2 = squaredLength2;
var forEach2 = function() {
var vec = create4();
return function(a4, stride, offset, count2, fn2, arg) {
var i4, l4;
if (!stride) {
stride = 4;
}
if (!offset) {
offset = 0;
}
if (count2) {
l4 = Math.min(count2 * stride + offset, a4.length);
} else {
l4 = a4.length;
}
for (i4 = offset; i4 < l4; i4 += stride) {
vec[0] = a4[i4];
vec[1] = a4[i4 + 1];
vec[2] = a4[i4 + 2];
vec[3] = a4[i4 + 3];
fn2(vec, vec, arg);
a4[i4] = vec[0];
a4[i4 + 1] = vec[1];
a4[i4 + 2] = vec[2];
a4[i4 + 3] = vec[3];
}
return a4;
};
}();
// node_modules/gl-matrix/esm/quat.js
function create5() {
var out = new ARRAY_TYPE(4);
if (ARRAY_TYPE != Float32Array) {
out[0] = 0;
out[1] = 0;
out[2] = 0;
}
out[3] = 1;
return out;
}
function identity4(out) {
out[0] = 0;
out[1] = 0;
out[2] = 0;
out[3] = 1;
return out;
}
function setAxisAngle(out, axis22, rad) {
rad = rad * 0.5;
var s4 = Math.sin(rad);
out[0] = s4 * axis22[0];
out[1] = s4 * axis22[1];
out[2] = s4 * axis22[2];
out[3] = Math.cos(rad);
return out;
}
function getAxisAngle(out_axis, q4) {
var rad = Math.acos(q4[3]) * 2;
var s4 = Math.sin(rad / 2);
if (s4 > EPSILON) {
out_axis[0] = q4[0] / s4;
out_axis[1] = q4[1] / s4;
out_axis[2] = q4[2] / s4;
} else {
out_axis[0] = 1;
out_axis[1] = 0;
out_axis[2] = 0;
}
return rad;
}
function getAngle(a4, b10) {
var dotproduct = dot3(a4, b10);
return Math.acos(2 * dotproduct * dotproduct - 1);
}
function multiply5(out, a4, b10) {
var ax = a4[0], ay = a4[1], az = a4[2], aw = a4[3];
var bx = b10[0], by = b10[1], bz = b10[2], bw = b10[3];
out[0] = ax * bw + aw * bx + ay * bz - az * by;
out[1] = ay * bw + aw * by + az * bx - ax * bz;
out[2] = az * bw + aw * bz + ax * by - ay * bx;
out[3] = aw * bw - ax * bx - ay * by - az * bz;
return out;
}
function rotateX3(out, a4, rad) {
rad *= 0.5;
var ax = a4[0], ay = a4[1], az = a4[2], aw = a4[3];
var bx = Math.sin(rad), bw = Math.cos(rad);
out[0] = ax * bw + aw * bx;
out[1] = ay * bw + az * bx;
out[2] = az * bw - ay * bx;
out[3] = aw * bw - ax * bx;
return out;
}
function rotateY3(out, a4, rad) {
rad *= 0.5;
var ax = a4[0], ay = a4[1], az = a4[2], aw = a4[3];
var by = Math.sin(rad), bw = Math.cos(rad);
out[0] = ax * bw - az * by;
out[1] = ay * bw + aw * by;
out[2] = az * bw + ax * by;
out[3] = aw * bw - ay * by;
return out;
}
function rotateZ3(out, a4, rad) {
rad *= 0.5;
var ax = a4[0], ay = a4[1], az = a4[2], aw = a4[3];
var bz = Math.sin(rad), bw = Math.cos(rad);
out[0] = ax * bw + ay * bz;
out[1] = ay * bw - ax * bz;
out[2] = az * bw + aw * bz;
out[3] = aw * bw - az * bz;
return out;
}
function calculateW(out, a4) {
var x6 = a4[0], y5 = a4[1], z3 = a4[2];
out[0] = x6;
out[1] = y5;
out[2] = z3;
out[3] = Math.sqrt(Math.abs(1 - x6 * x6 - y5 * y5 - z3 * z3));
return out;
}
function exp(out, a4) {
var x6 = a4[0], y5 = a4[1], z3 = a4[2], w4 = a4[3];
var r4 = Math.sqrt(x6 * x6 + y5 * y5 + z3 * z3);
var et = Math.exp(w4);
var s4 = r4 > 0 ? et * Math.sin(r4) / r4 : 0;
out[0] = x6 * s4;
out[1] = y5 * s4;
out[2] = z3 * s4;
out[3] = et * Math.cos(r4);
return out;
}
function ln2(out, a4) {
var x6 = a4[0], y5 = a4[1], z3 = a4[2], w4 = a4[3];
var r4 = Math.sqrt(x6 * x6 + y5 * y5 + z3 * z3);
var t4 = r4 > 0 ? Math.atan2(r4, w4) / r4 : 0;
out[0] = x6 * t4;
out[1] = y5 * t4;
out[2] = z3 * t4;
out[3] = 0.5 * Math.log(x6 * x6 + y5 * y5 + z3 * z3 + w4 * w4);
return out;
}
function pow(out, a4, b10) {
ln2(out, a4);
scale5(out, out, b10);
exp(out, out);
return out;
}
function slerp(out, a4, b10, t4) {
var ax = a4[0], ay = a4[1], az = a4[2], aw = a4[3];
var bx = b10[0], by = b10[1], bz = b10[2], bw = b10[3];
var omega, cosom, sinom, scale0, scale1;
cosom = ax * bx + ay * by + az * bz + aw * bw;
if (cosom < 0) {
cosom = -cosom;
bx = -bx;
by = -by;
bz = -bz;
bw = -bw;
}
if (1 - cosom > EPSILON) {
omega = Math.acos(cosom);
sinom = Math.sin(omega);
scale0 = Math.sin((1 - t4) * omega) / sinom;
scale1 = Math.sin(t4 * omega) / sinom;
} else {
scale0 = 1 - t4;
scale1 = t4;
}
out[0] = scale0 * ax + scale1 * bx;
out[1] = scale0 * ay + scale1 * by;
out[2] = scale0 * az + scale1 * bz;
out[3] = scale0 * aw + scale1 * bw;
return out;
}
function random3(out) {
var u1 = RANDOM();
var u22 = RANDOM();
var u3 = RANDOM();
var sqrt1MinusU1 = Math.sqrt(1 - u1);
var sqrtU1 = Math.sqrt(u1);
out[0] = sqrt1MinusU1 * Math.sin(2 * Math.PI * u22);
out[1] = sqrt1MinusU1 * Math.cos(2 * Math.PI * u22);
out[2] = sqrtU1 * Math.sin(2 * Math.PI * u3);
out[3] = sqrtU1 * Math.cos(2 * Math.PI * u3);
return out;
}
function invert3(out, a4) {
var a0 = a4[0], a1 = a4[1], a22 = a4[2], a32 = a4[3];
var dot7 = a0 * a0 + a1 * a1 + a22 * a22 + a32 * a32;
var invDot = dot7 ? 1 / dot7 : 0;
out[0] = -a0 * invDot;
out[1] = -a1 * invDot;
out[2] = -a22 * invDot;
out[3] = a32 * invDot;
return out;
}
function conjugate(out, a4) {
out[0] = -a4[0];
out[1] = -a4[1];
out[2] = -a4[2];
out[3] = a4[3];
return out;
}
function fromMat3(out, m4) {
var fTrace = m4[0] + m4[4] + m4[8];
var fRoot;
if (fTrace > 0) {
fRoot = Math.sqrt(fTrace + 1);
out[3] = 0.5 * fRoot;
fRoot = 0.5 / fRoot;
out[0] = (m4[5] - m4[7]) * fRoot;
out[1] = (m4[6] - m4[2]) * fRoot;
out[2] = (m4[1] - m4[3]) * fRoot;
} else {
var i4 = 0;
if (m4[4] > m4[0])
i4 = 1;
if (m4[8] > m4[i4 * 3 + i4])
i4 = 2;
var j4 = (i4 + 1) % 3;
var k4 = (i4 + 2) % 3;
fRoot = Math.sqrt(m4[i4 * 3 + i4] - m4[j4 * 3 + j4] - m4[k4 * 3 + k4] + 1);
out[i4] = 0.5 * fRoot;
fRoot = 0.5 / fRoot;
out[3] = (m4[j4 * 3 + k4] - m4[k4 * 3 + j4]) * fRoot;
out[j4] = (m4[j4 * 3 + i4] + m4[i4 * 3 + j4]) * fRoot;
out[k4] = (m4[k4 * 3 + i4] + m4[i4 * 3 + k4]) * fRoot;
}
return out;
}
function fromEuler(out, x6, y5, z3) {
var halfToRad = 0.5 * Math.PI / 180;
x6 *= halfToRad;
y5 *= halfToRad;
z3 *= halfToRad;
var sx = Math.sin(x6);
var cx = Math.cos(x6);
var sy = Math.sin(y5);
var cy = Math.cos(y5);
var sz = Math.sin(z3);
var cz = Math.cos(z3);
out[0] = sx * cy * cz - cx * sy * sz;
out[1] = cx * sy * cz + sx * cy * sz;
out[2] = cx * cy * sz - sx * sy * cz;
out[3] = cx * cy * cz + sx * sy * sz;
return out;
}
function str6(a4) {
return "quat(" + a4[0] + ", " + a4[1] + ", " + a4[2] + ", " + a4[3] + ")";
}
var clone6 = clone5;
var fromValues5 = fromValues4;
var copy5 = copy4;
var set6 = set5;
var add5 = add4;
var mul5 = multiply5;
var scale5 = scale4;
var dot3 = dot2;
var lerp3 = lerp2;
var length3 = length2;
var len3 = length3;
var squaredLength3 = squaredLength2;
var sqrLen3 = squaredLength3;
var normalize3 = normalize2;
var exactEquals5 = exactEquals4;
var equals5 = equals4;
var rotationTo = function() {
var tmpvec3 = create3();
var xUnitVec3 = fromValues3(1, 0, 0);
var yUnitVec3 = fromValues3(0, 1, 0);
return function(out, a4, b10) {
var dot7 = dot(a4, b10);
if (dot7 < -0.999999) {
cross(tmpvec3, xUnitVec3, a4);
if (len(tmpvec3) < 1e-6)
cross(tmpvec3, yUnitVec3, a4);
normalize(tmpvec3, tmpvec3);
setAxisAngle(out, tmpvec3, Math.PI);
return out;
} else if (dot7 > 0.999999) {
out[0] = 0;
out[1] = 0;
out[2] = 0;
out[3] = 1;
return out;
} else {
cross(tmpvec3, a4, b10);
out[0] = tmpvec3[0];
out[1] = tmpvec3[1];
out[2] = tmpvec3[2];
out[3] = 1 + dot7;
return normalize3(out, out);
}
};
}();
var sqlerp = function() {
var temp1 = create5();
var temp2 = create5();
return function(out, a4, b10, c5, d3, t4) {
slerp(temp1, a4, d3, t4);
slerp(temp2, b10, c5, t4);
slerp(out, temp1, temp2, 2 * t4 * (1 - t4));
return out;
};
}();
var setAxes = function() {
var matr = create();
return function(out, view, right2, up) {
matr[0] = right2[0];
matr[3] = right2[1];
matr[6] = right2[2];
matr[1] = up[0];
matr[4] = up[1];
matr[7] = up[2];
matr[2] = -view[0];
matr[5] = -view[1];
matr[8] = -view[2];
return normalize3(out, fromMat3(out, matr));
};
}();
// node_modules/gl-matrix/esm/vec2.js
var vec2_exports = {};
__export(vec2_exports, {
add: () => add6,
angle: () => angle2,
ceil: () => ceil3,
clone: () => clone7,
copy: () => copy6,
create: () => create6,
cross: () => cross3,
dist: () => dist3,
distance: () => distance3,
div: () => div3,
divide: () => divide3,
dot: () => dot4,
equals: () => equals6,
exactEquals: () => exactEquals6,
floor: () => floor3,
forEach: () => forEach3,
fromValues: () => fromValues6,
inverse: () => inverse3,
len: () => len4,
length: () => length4,
lerp: () => lerp4,
max: () => max3,
min: () => min3,
mul: () => mul6,
multiply: () => multiply6,
negate: () => negate3,
normalize: () => normalize4,
random: () => random4,
rotate: () => rotate3,
round: () => round3,
scale: () => scale6,
scaleAndAdd: () => scaleAndAdd3,
set: () => set7,
sqrDist: () => sqrDist3,
sqrLen: () => sqrLen4,
squaredDistance: () => squaredDistance3,
squaredLength: () => squaredLength4,
str: () => str7,
sub: () => sub5,
subtract: () => subtract5,
transformMat2: () => transformMat2,
transformMat2d: () => transformMat2d,
transformMat3: () => transformMat32,
transformMat4: () => transformMat43,
zero: () => zero3
});
function create6() {
var out = new ARRAY_TYPE(2);
if (ARRAY_TYPE != Float32Array) {
out[0] = 0;
out[1] = 0;
}
return out;
}
function clone7(a4) {
var out = new ARRAY_TYPE(2);
out[0] = a4[0];
out[1] = a4[1];
return out;
}
function fromValues6(x6, y5) {
var out = new ARRAY_TYPE(2);
out[0] = x6;
out[1] = y5;
return out;
}
function copy6(out, a4) {
out[0] = a4[0];
out[1] = a4[1];
return out;
}
function set7(out, x6, y5) {
out[0] = x6;
out[1] = y5;
return out;
}
function add6(out, a4, b10) {
out[0] = a4[0] + b10[0];
out[1] = a4[1] + b10[1];
return out;
}
function subtract5(out, a4, b10) {
out[0] = a4[0] - b10[0];
out[1] = a4[1] - b10[1];
return out;
}
function multiply6(out, a4, b10) {
out[0] = a4[0] * b10[0];
out[1] = a4[1] * b10[1];
return out;
}
function divide3(out, a4, b10) {
out[0] = a4[0] / b10[0];
out[1] = a4[1] / b10[1];
return out;
}
function ceil3(out, a4) {
out[0] = Math.ceil(a4[0]);
out[1] = Math.ceil(a4[1]);
return out;
}
function floor3(out, a4) {
out[0] = Math.floor(a4[0]);
out[1] = Math.floor(a4[1]);
return out;
}
function min3(out, a4, b10) {
out[0] = Math.min(a4[0], b10[0]);
out[1] = Math.min(a4[1], b10[1]);
return out;
}
function max3(out, a4, b10) {
out[0] = Math.max(a4[0], b10[0]);
out[1] = Math.max(a4[1], b10[1]);
return out;
}
function round3(out, a4) {
out[0] = Math.round(a4[0]);
out[1] = Math.round(a4[1]);
return out;
}
function scale6(out, a4, b10) {
out[0] = a4[0] * b10;
out[1] = a4[1] * b10;
return out;
}
function scaleAndAdd3(out, a4, b10, scale12) {
out[0] = a4[0] + b10[0] * scale12;
out[1] = a4[1] + b10[1] * scale12;
return out;
}
function distance3(a4, b10) {
var x6 = b10[0] - a4[0], y5 = b10[1] - a4[1];
return Math.hypot(x6, y5);
}
function squaredDistance3(a4, b10) {
var x6 = b10[0] - a4[0], y5 = b10[1] - a4[1];
return x6 * x6 + y5 * y5;
}
function length4(a4) {
var x6 = a4[0], y5 = a4[1];
return Math.hypot(x6, y5);
}
function squaredLength4(a4) {
var x6 = a4[0], y5 = a4[1];
return x6 * x6 + y5 * y5;
}
function negate3(out, a4) {
out[0] = -a4[0];
out[1] = -a4[1];
return out;
}
function inverse3(out, a4) {
out[0] = 1 / a4[0];
out[1] = 1 / a4[1];
return out;
}
function normalize4(out, a4) {
var x6 = a4[0], y5 = a4[1];
var len5 = x6 * x6 + y5 * y5;
if (len5 > 0) {
len5 = 1 / Math.sqrt(len5);
}
out[0] = a4[0] * len5;
out[1] = a4[1] * len5;
return out;
}
function dot4(a4, b10) {
return a4[0] * b10[0] + a4[1] * b10[1];
}
function cross3(out, a4, b10) {
var z3 = a4[0] * b10[1] - a4[1] * b10[0];
out[0] = out[1] = 0;
out[2] = z3;
return out;
}
function lerp4(out, a4, b10, t4) {
var ax = a4[0], ay = a4[1];
out[0] = ax + t4 * (b10[0] - ax);
out[1] = ay + t4 * (b10[1] - ay);
return out;
}
function random4(out, scale12) {
scale12 = scale12 || 1;
var r4 = RANDOM() * 2 * Math.PI;
out[0] = Math.cos(r4) * scale12;
out[1] = Math.sin(r4) * scale12;
return out;
}
function transformMat2(out, a4, m4) {
var x6 = a4[0], y5 = a4[1];
out[0] = m4[0] * x6 + m4[2] * y5;
out[1] = m4[1] * x6 + m4[3] * y5;
return out;
}
function transformMat2d(out, a4, m4) {
var x6 = a4[0], y5 = a4[1];
out[0] = m4[0] * x6 + m4[2] * y5 + m4[4];
out[1] = m4[1] * x6 + m4[3] * y5 + m4[5];
return out;
}
function transformMat32(out, a4, m4) {
var x6 = a4[0], y5 = a4[1];
out[0] = m4[0] * x6 + m4[3] * y5 + m4[6];
out[1] = m4[1] * x6 + m4[4] * y5 + m4[7];
return out;
}
function transformMat43(out, a4, m4) {
var x6 = a4[0];
var y5 = a4[1];
out[0] = m4[0] * x6 + m4[4] * y5 + m4[12];
out[1] = m4[1] * x6 + m4[5] * y5 + m4[13];
return out;
}
function rotate3(out, a4, b10, rad) {
var p0 = a4[0] - b10[0], p1 = a4[1] - b10[1], sinC = Math.sin(rad), cosC = Math.cos(rad);
out[0] = p0 * cosC - p1 * sinC + b10[0];
out[1] = p0 * sinC + p1 * cosC + b10[1];
return out;
}
function angle2(a4, b10) {
var x1 = a4[0], y1 = a4[1], x22 = b10[0], y22 = b10[1], mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x22 * x22 + y22 * y22), cosine = mag && (x1 * x22 + y1 * y22) / mag;
return Math.acos(Math.min(Math.max(cosine, -1), 1));
}
function zero3(out) {
out[0] = 0;
out[1] = 0;
return out;
}
function str7(a4) {
return "vec2(" + a4[0] + ", " + a4[1] + ")";
}
function exactEquals6(a4, b10) {
return a4[0] === b10[0] && a4[1] === b10[1];
}
function equals6(a4, b10) {
var a0 = a4[0], a1 = a4[1];
var b02 = b10[0], b12 = b10[1];
return Math.abs(a0 - b02) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b02)) && Math.abs(a1 - b12) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b12));
}
var len4 = length4;
var sub5 = subtract5;
var mul6 = multiply6;
var div3 = divide3;
var dist3 = distance3;
var sqrDist3 = squaredDistance3;
var sqrLen4 = squaredLength4;
var forEach3 = function() {
var vec = create6();
return function(a4, stride, offset, count2, fn2, arg) {
var i4, l4;
if (!stride) {
stride = 2;
}
if (!offset) {
offset = 0;
}
if (count2) {
l4 = Math.min(count2 * stride + offset, a4.length);
} else {
l4 = a4.length;
}
for (i4 = offset; i4 < l4; i4 += stride) {
vec[0] = a4[i4];
vec[1] = a4[i4 + 1];
fn2(vec, vec, arg);
a4[i4] = vec[0];
a4[i4 + 1] = vec[1];
}
return a4;
};
}();
// node_modules/@antv/matrix-util/esm/ext.js
var ext_exports = {};
__export(ext_exports, {
angleTo: () => angleTo,
direction: () => direction,
leftRotate: () => leftRotate,
leftScale: () => leftScale,
leftTranslate: () => leftTranslate,
transform: () => transform,
vertical: () => vertical
});
function leftTranslate(out, a4, v3) {
var transMat = [0, 0, 0, 0, 0, 0, 0, 0, 0];
mat3_exports.fromTranslation(transMat, v3);
return mat3_exports.multiply(out, transMat, a4);
}
function leftRotate(out, a4, rad) {
var rotateMat = [0, 0, 0, 0, 0, 0, 0, 0, 0];
mat3_exports.fromRotation(rotateMat, rad);
return mat3_exports.multiply(out, rotateMat, a4);
}
function leftScale(out, a4, v3) {
var scaleMat = [0, 0, 0, 0, 0, 0, 0, 0, 0];
mat3_exports.fromScaling(scaleMat, v3);
return mat3_exports.multiply(out, scaleMat, a4);
}
function leftMultiply(out, a4, a1) {
return mat3_exports.multiply(out, a1, a4);
}
function transform(m4, actions) {
var matrix = m4 ? [].concat(m4) : [1, 0, 0, 0, 1, 0, 0, 0, 1];
for (var i4 = 0, len5 = actions.length; i4 < len5; i4++) {
var action = actions[i4];
switch (action[0]) {
case "t":
leftTranslate(matrix, matrix, [action[1], action[2]]);
break;
case "s":
leftScale(matrix, matrix, [action[1], action[2]]);
break;
case "r":
leftRotate(matrix, matrix, action[1]);
break;
case "m":
leftMultiply(matrix, matrix, action[1]);
break;
default:
break;
}
}
return matrix;
}
function direction(v1, v22) {
return v1[0] * v22[1] - v22[0] * v1[1];
}
function angleTo(v1, v22, direct) {
var ang = vec2_exports.angle(v1, v22);
var angleLargeThanPI = direction(v1, v22) >= 0;
if (direct) {
if (angleLargeThanPI) {
return Math.PI * 2 - ang;
}
return ang;
}
if (angleLargeThanPI) {
return ang;
}
return Math.PI * 2 - ang;
}
function vertical(out, v3, flag) {
if (flag) {
out[0] = v3[1];
out[1] = -1 * v3[0];
} else {
out[0] = -1 * v3[1];
out[1] = v3[0];
}
return out;
}
// node_modules/@antv/g-base/esm/util/matrix.js
function multiplyMatrix(a4, b10) {
var out = [];
var a00 = a4[0];
var a01 = a4[1];
var a02 = a4[2];
var a10 = a4[3];
var a11 = a4[4];
var a12 = a4[5];
var a20 = a4[6];
var a21 = a4[7];
var a22 = a4[8];
var b00 = b10[0];
var b01 = b10[1];
var b02 = b10[2];
var b102 = b10[3];
var b11 = b10[4];
var b12 = b10[5];
var b20 = b10[6];
var b21 = b10[7];
var b222 = b10[8];
out[0] = b00 * a00 + b01 * a10 + b02 * a20;
out[1] = b00 * a01 + b01 * a11 + b02 * a21;
out[2] = b00 * a02 + b01 * a12 + b02 * a22;
out[3] = b102 * a00 + b11 * a10 + b12 * a20;
out[4] = b102 * a01 + b11 * a11 + b12 * a21;
out[5] = b102 * a02 + b11 * a12 + b12 * a22;
out[6] = b20 * a00 + b21 * a10 + b222 * a20;
out[7] = b20 * a01 + b21 * a11 + b222 * a21;
out[8] = b20 * a02 + b21 * a12 + b222 * a22;
return out;
}
function multiplyVec2(m4, v3) {
var out = [];
var x6 = v3[0];
var y5 = v3[1];
out[0] = m4[0] * x6 + m4[3] * y5 + m4[6];
out[1] = m4[1] * x6 + m4[4] * y5 + m4[7];
return out;
}
function invert4(a4) {
var out = [];
var a00 = a4[0];
var a01 = a4[1];
var a02 = a4[2];
var a10 = a4[3];
var a11 = a4[4];
var a12 = a4[5];
var a20 = a4[6];
var a21 = a4[7];
var a22 = a4[8];
var b01 = a22 * a11 - a12 * a21;
var b11 = -a22 * a10 + a12 * a20;
var b21 = a21 * a10 - a11 * a20;
var det = a00 * b01 + a01 * b11 + a02 * b21;
if (!det) {
return null;
}
det = 1 / det;
out[0] = b01 * det;
out[1] = (-a22 * a01 + a02 * a21) * det;
out[2] = (a12 * a01 - a02 * a11) * det;
out[3] = b11 * det;
out[4] = (a22 * a00 - a02 * a20) * det;
out[5] = (-a12 * a00 + a02 * a10) * det;
out[6] = b21 * det;
out[7] = (-a21 * a00 + a01 * a20) * det;
out[8] = (a11 * a00 - a01 * a10) * det;
return out;
}
// node_modules/@antv/g-base/esm/abstract/element.js
var transform2 = ext_exports.transform;
var MATRIX = "matrix";
var CLONE_CFGS = ["zIndex", "capture", "visible", "type"];
var RESERVED_PORPS = ["repeat"];
var DELEGATION_SPLIT = ":";
var WILDCARD2 = "*";
function _cloneArrayAttr(arr) {
var result = [];
for (var i4 = 0; i4 < arr.length; i4++) {
if (is_array_default(arr[i4])) {
result.push([].concat(arr[i4]));
} else {
result.push(arr[i4]);
}
}
return result;
}
function getFormatFromAttrs(toAttrs, shape) {
var fromAttrs = {};
var attrs = shape.attrs;
for (var k4 in toAttrs) {
fromAttrs[k4] = attrs[k4];
}
return fromAttrs;
}
function getFormatToAttrs(props, shape) {
var toAttrs = {};
var attrs = shape.attr();
each_default(props, function(v3, k4) {
if (RESERVED_PORPS.indexOf(k4) === -1 && !is_equal_default(attrs[k4], v3)) {
toAttrs[k4] = v3;
}
});
return toAttrs;
}
function checkExistedAttrs(animations, animation7) {
if (animation7.onFrame) {
return animations;
}
var startTime = animation7.startTime, delay = animation7.delay, duration = animation7.duration;
var hasOwnProperty4 = Object.prototype.hasOwnProperty;
each_default(animations, function(item) {
if (startTime + delay < item.startTime + item.delay + item.duration && duration > item.delay) {
each_default(animation7.toAttrs, function(v3, k4) {
if (hasOwnProperty4.call(item.toAttrs, k4)) {
delete item.toAttrs[k4];
delete item.fromAttrs[k4];
}
});
}
});
return animations;
}
var Element2 = function(_super) {
__extends(Element4, _super);
function Element4(cfg) {
var _this = _super.call(this, cfg) || this;
_this.attrs = {};
var attrs = _this.getDefaultAttrs();
mix(attrs, cfg.attrs);
_this.attrs = attrs;
_this.initAttrs(attrs);
_this.initAnimate();
return _this;
}
Element4.prototype.getDefaultCfg = function() {
return {
visible: true,
capture: true,
zIndex: 0
};
};
Element4.prototype.getDefaultAttrs = function() {
return {
matrix: this.getDefaultMatrix(),
opacity: 1
};
};
Element4.prototype.onCanvasChange = function(changeType) {
};
Element4.prototype.initAttrs = function(attrs) {
};
Element4.prototype.initAnimate = function() {
this.set("animable", true);
this.set("animating", false);
};
Element4.prototype.isGroup = function() {
return false;
};
Element4.prototype.getParent = function() {
return this.get("parent");
};
Element4.prototype.getCanvas = function() {
return this.get("canvas");
};
Element4.prototype.attr = function() {
var _a6;
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var name = args[0], value2 = args[1];
if (!name)
return this.attrs;
if (is_object_default(name)) {
for (var k4 in name) {
this.setAttr(k4, name[k4]);
}
this.afterAttrsChange(name);
return this;
}
if (args.length === 2) {
this.setAttr(name, value2);
this.afterAttrsChange((_a6 = {}, _a6[name] = value2, _a6));
return this;
}
return this.attrs[name];
};
Element4.prototype.isClipped = function(refX, refY) {
var clip = this.getClip();
return clip && !clip.isHit(refX, refY);
};
Element4.prototype.setAttr = function(name, value2) {
var originValue = this.attrs[name];
if (originValue !== value2) {
this.attrs[name] = value2;
this.onAttrChange(name, value2, originValue);
}
};
Element4.prototype.onAttrChange = function(name, value2, originValue) {
if (name === "matrix") {
this.set("totalMatrix", null);
}
};
Element4.prototype.afterAttrsChange = function(targetAttrs) {
if (this.cfg.isClipShape) {
var applyTo = this.cfg.applyTo;
if (applyTo) {
applyTo.onCanvasChange("clip");
}
} else {
this.onCanvasChange("attr");
}
};
Element4.prototype.show = function() {
this.set("visible", true);
this.onCanvasChange("show");
return this;
};
Element4.prototype.hide = function() {
this.set("visible", false);
this.onCanvasChange("hide");
return this;
};
Element4.prototype.setZIndex = function(zIndex) {
this.set("zIndex", zIndex);
var parent = this.getParent();
if (parent) {
parent.sort();
}
return this;
};
Element4.prototype.toFront = function() {
var parent = this.getParent();
if (!parent) {
return;
}
var children = parent.getChildren();
var el = this.get("el");
var index2 = children.indexOf(this);
children.splice(index2, 1);
children.push(this);
this.onCanvasChange("zIndex");
};
Element4.prototype.toBack = function() {
var parent = this.getParent();
if (!parent) {
return;
}
var children = parent.getChildren();
var el = this.get("el");
var index2 = children.indexOf(this);
children.splice(index2, 1);
children.unshift(this);
this.onCanvasChange("zIndex");
};
Element4.prototype.remove = function(destroy) {
if (destroy === void 0) {
destroy = true;
}
var parent = this.getParent();
if (parent) {
removeFromArray(parent.getChildren(), this);
if (!parent.get("clearing")) {
this.onCanvasChange("remove");
}
} else {
this.onCanvasChange("remove");
}
if (destroy) {
this.destroy();
}
};
Element4.prototype.resetMatrix = function() {
this.attr(MATRIX, this.getDefaultMatrix());
this.onCanvasChange("matrix");
};
Element4.prototype.getMatrix = function() {
return this.attr(MATRIX);
};
Element4.prototype.setMatrix = function(m4) {
this.attr(MATRIX, m4);
this.onCanvasChange("matrix");
};
Element4.prototype.getTotalMatrix = function() {
var totalMatrix = this.cfg.totalMatrix;
if (!totalMatrix) {
var currentMatrix = this.attr("matrix");
var parentMatrix = this.cfg.parentMatrix;
if (parentMatrix && currentMatrix) {
totalMatrix = multiplyMatrix(parentMatrix, currentMatrix);
} else {
totalMatrix = currentMatrix || parentMatrix;
}
this.set("totalMatrix", totalMatrix);
}
return totalMatrix;
};
Element4.prototype.applyMatrix = function(matrix) {
var currentMatrix = this.attr("matrix");
var totalMatrix = null;
if (matrix && currentMatrix) {
totalMatrix = multiplyMatrix(matrix, currentMatrix);
} else {
totalMatrix = currentMatrix || matrix;
}
this.set("totalMatrix", totalMatrix);
this.set("parentMatrix", matrix);
};
Element4.prototype.getDefaultMatrix = function() {
return null;
};
Element4.prototype.applyToMatrix = function(v3) {
var matrix = this.attr("matrix");
if (matrix) {
return multiplyVec2(matrix, v3);
}
return v3;
};
Element4.prototype.invertFromMatrix = function(v3) {
var matrix = this.attr("matrix");
if (matrix) {
var invertMatrix3 = invert4(matrix);
if (invertMatrix3) {
return multiplyVec2(invertMatrix3, v3);
}
}
return v3;
};
Element4.prototype.setClip = function(clipCfg) {
var canvas = this.getCanvas();
var clipShape = null;
if (clipCfg) {
var ShapeBase4 = this.getShapeBase();
var shapeType = upper_first_default(clipCfg.type);
var Cons = ShapeBase4[shapeType];
if (Cons) {
clipShape = new Cons({
type: clipCfg.type,
isClipShape: true,
applyTo: this,
attrs: clipCfg.attrs,
canvas
});
}
}
this.set("clipShape", clipShape);
this.onCanvasChange("clip");
return clipShape;
};
Element4.prototype.getClip = function() {
var clipShape = this.cfg.clipShape;
if (!clipShape) {
return null;
}
return clipShape;
};
Element4.prototype.clone = function() {
var _this = this;
var originAttrs = this.attrs;
var attrs = {};
each_default(originAttrs, function(i4, k4) {
if (is_array_default(originAttrs[k4])) {
attrs[k4] = _cloneArrayAttr(originAttrs[k4]);
} else {
attrs[k4] = originAttrs[k4];
}
});
var cons = this.constructor;
var clone10 = new cons({ attrs });
each_default(CLONE_CFGS, function(cfgName) {
clone10.set(cfgName, _this.get(cfgName));
});
return clone10;
};
Element4.prototype.destroy = function() {
var destroyed = this.destroyed;
if (destroyed) {
return;
}
this.attrs = {};
_super.prototype.destroy.call(this);
};
Element4.prototype.isAnimatePaused = function() {
return this.get("_pause").isPaused;
};
Element4.prototype.animate = function() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (!this.get("timeline") && !this.get("canvas")) {
return;
}
this.set("animating", true);
var timeline = this.get("timeline");
if (!timeline) {
timeline = this.get("canvas").get("timeline");
this.set("timeline", timeline);
}
var animations = this.get("animations") || [];
if (!timeline.timer) {
timeline.initTimer();
}
var toAttrs = args[0], duration = args[1], _a6 = args[2], easing = _a6 === void 0 ? "easeLinear" : _a6, _b = args[3], callback = _b === void 0 ? noop_default : _b, _c = args[4], delay = _c === void 0 ? 0 : _c;
var onFrame;
var repeat2;
var pauseCallback;
var resumeCallback;
var animateCfg;
if (is_function_default(toAttrs)) {
onFrame = toAttrs;
toAttrs = {};
} else if (is_object_default(toAttrs) && toAttrs.onFrame) {
onFrame = toAttrs.onFrame;
repeat2 = toAttrs.repeat;
}
if (is_object_default(duration)) {
animateCfg = duration;
duration = animateCfg.duration;
easing = animateCfg.easing || "easeLinear";
delay = animateCfg.delay || 0;
repeat2 = animateCfg.repeat || repeat2 || false;
callback = animateCfg.callback || noop_default;
pauseCallback = animateCfg.pauseCallback || noop_default;
resumeCallback = animateCfg.resumeCallback || noop_default;
} else {
if (is_number_default(callback)) {
delay = callback;
callback = null;
}
if (is_function_default(easing)) {
callback = easing;
easing = "easeLinear";
} else {
easing = easing || "easeLinear";
}
}
var formatToAttrs = getFormatToAttrs(toAttrs, this);
var animation7 = {
fromAttrs: getFormatFromAttrs(formatToAttrs, this),
toAttrs: formatToAttrs,
duration,
easing,
repeat: repeat2,
callback,
pauseCallback,
resumeCallback,
delay,
startTime: timeline.getTime(),
id: unique_id_default(),
onFrame,
pathFormatted: false
};
if (animations.length > 0) {
animations = checkExistedAttrs(animations, animation7);
} else {
timeline.addAnimator(this);
}
animations.push(animation7);
this.set("animations", animations);
this.set("_pause", { isPaused: false });
};
Element4.prototype.stopAnimate = function(toEnd) {
var _this = this;
if (toEnd === void 0) {
toEnd = true;
}
var animations = this.get("animations");
each_default(animations, function(animation7) {
if (toEnd) {
if (animation7.onFrame) {
_this.attr(animation7.onFrame(1));
} else {
_this.attr(animation7.toAttrs);
}
}
if (animation7.callback) {
animation7.callback();
}
});
this.set("animating", false);
this.set("animations", []);
};
Element4.prototype.pauseAnimate = function() {
var timeline = this.get("timeline");
var animations = this.get("animations");
var pauseTime = timeline.getTime();
each_default(animations, function(animation7) {
animation7._paused = true;
animation7._pauseTime = pauseTime;
if (animation7.pauseCallback) {
animation7.pauseCallback();
}
});
this.set("_pause", {
isPaused: true,
pauseTime
});
return this;
};
Element4.prototype.resumeAnimate = function() {
var timeline = this.get("timeline");
var current = timeline.getTime();
var animations = this.get("animations");
var pauseTime = this.get("_pause").pauseTime;
each_default(animations, function(animation7) {
animation7.startTime = animation7.startTime + (current - pauseTime);
animation7._paused = false;
animation7._pauseTime = null;
if (animation7.resumeCallback) {
animation7.resumeCallback();
}
});
this.set("_pause", {
isPaused: false
});
this.set("animations", animations);
return this;
};
Element4.prototype.emitDelegation = function(type2, eventObj) {
var _this = this;
var paths = eventObj.propagationPath;
var events = this.getEvents();
var relativeShape;
if (type2 === "mouseenter") {
relativeShape = eventObj.fromShape;
} else if (type2 === "mouseleave") {
relativeShape = eventObj.toShape;
}
var _loop_1 = function(i5) {
var element = paths[i5];
var name_1 = element.get("name");
if (name_1) {
if ((element.isGroup() || element.isCanvas && element.isCanvas()) && relativeShape && isParent(element, relativeShape)) {
return "break";
}
if (is_array_default(name_1)) {
each_default(name_1, function(subName) {
_this.emitDelegateEvent(element, subName, eventObj);
});
} else {
this_1.emitDelegateEvent(element, name_1, eventObj);
}
}
};
var this_1 = this;
for (var i4 = 0; i4 < paths.length; i4++) {
var state_1 = _loop_1(i4);
if (state_1 === "break")
break;
}
};
Element4.prototype.emitDelegateEvent = function(element, name, eventObj) {
var events = this.getEvents();
var eventName = name + DELEGATION_SPLIT + eventObj.type;
if (events[eventName] || events[WILDCARD2]) {
eventObj.name = eventName;
eventObj.currentTarget = element;
eventObj.delegateTarget = this;
eventObj.delegateObject = element.get("delegateObject");
this.emit(eventName, eventObj);
}
};
Element4.prototype.translate = function(translateX, translateY) {
if (translateX === void 0) {
translateX = 0;
}
if (translateY === void 0) {
translateY = 0;
}
var matrix = this.getMatrix();
var newMatrix = transform2(matrix, [["t", translateX, translateY]]);
this.setMatrix(newMatrix);
return this;
};
Element4.prototype.move = function(targetX, targetY) {
var x6 = this.attr("x") || 0;
var y5 = this.attr("y") || 0;
this.translate(targetX - x6, targetY - y5);
return this;
};
Element4.prototype.moveTo = function(targetX, targetY) {
return this.move(targetX, targetY);
};
Element4.prototype.scale = function(ratioX, ratioY) {
var matrix = this.getMatrix();
var newMatrix = transform2(matrix, [["s", ratioX, ratioY || ratioX]]);
this.setMatrix(newMatrix);
return this;
};
Element4.prototype.rotate = function(radian) {
var matrix = this.getMatrix();
var newMatrix = transform2(matrix, [["r", radian]]);
this.setMatrix(newMatrix);
return this;
};
Element4.prototype.rotateAtStart = function(rotate8) {
var _a6 = this.attr(), x6 = _a6.x, y5 = _a6.y;
var matrix = this.getMatrix();
var newMatrix = transform2(matrix, [
["t", -x6, -y5],
["r", rotate8],
["t", x6, y5]
]);
this.setMatrix(newMatrix);
return this;
};
Element4.prototype.rotateAtPoint = function(x6, y5, rotate8) {
var matrix = this.getMatrix();
var newMatrix = transform2(matrix, [
["t", -x6, -y5],
["r", rotate8],
["t", x6, y5]
]);
this.setMatrix(newMatrix);
return this;
};
return Element4;
}(base_default2);
var element_default = Element2;
// node_modules/@antv/g-base/esm/abstract/container.js
var SHAPE_MAP = {};
var INDEX = "_INDEX";
function setCanvas(element, canvas) {
element.set("canvas", canvas);
if (element.isGroup()) {
var children = element.get("children");
if (children.length) {
children.forEach(function(child) {
setCanvas(child, canvas);
});
}
}
}
function setTimeline(element, timeline) {
element.set("timeline", timeline);
if (element.isGroup()) {
var children = element.get("children");
if (children.length) {
children.forEach(function(child) {
setTimeline(child, timeline);
});
}
}
}
function removeChild(container2, element, destroy) {
if (destroy === void 0) {
destroy = true;
}
if (destroy) {
element.destroy();
} else {
element.set("parent", null);
element.set("canvas", null);
}
removeFromArray(container2.getChildren(), element);
}
function getComparer(compare4) {
return function(left2, right2) {
var result = compare4(left2, right2);
return result === 0 ? left2[INDEX] - right2[INDEX] : result;
};
}
var Container = function(_super) {
__extends(Container3, _super);
function Container3() {
return _super !== null && _super.apply(this, arguments) || this;
}
Container3.prototype.isCanvas = function() {
return false;
};
Container3.prototype.getBBox = function() {
var minX = Infinity;
var maxX = -Infinity;
var minY = Infinity;
var maxY2 = -Infinity;
var xArr = [];
var yArr = [];
var children = this.getChildren().filter(function(child) {
return child.get("visible") && (!child.isGroup() || child.isGroup() && child.getChildren().length > 0);
});
if (children.length > 0) {
each_default(children, function(child) {
var box3 = child.getBBox();
xArr.push(box3.minX, box3.maxX);
yArr.push(box3.minY, box3.maxY);
});
minX = min_default(xArr);
maxX = max_default(xArr);
minY = min_default(yArr);
maxY2 = max_default(yArr);
} else {
minX = 0;
maxX = 0;
minY = 0;
maxY2 = 0;
}
var box2 = {
x: minX,
y: minY,
minX,
minY,
maxX,
maxY: maxY2,
width: maxX - minX,
height: maxY2 - minY
};
return box2;
};
Container3.prototype.getCanvasBBox = function() {
var minX = Infinity;
var maxX = -Infinity;
var minY = Infinity;
var maxY2 = -Infinity;
var xArr = [];
var yArr = [];
var children = this.getChildren().filter(function(child) {
return child.get("visible") && (!child.isGroup() || child.isGroup() && child.getChildren().length > 0);
});
if (children.length > 0) {
each_default(children, function(child) {
var box3 = child.getCanvasBBox();
xArr.push(box3.minX, box3.maxX);
yArr.push(box3.minY, box3.maxY);
});
minX = min_default(xArr);
maxX = max_default(xArr);
minY = min_default(yArr);
maxY2 = max_default(yArr);
} else {
minX = 0;
maxX = 0;
minY = 0;
maxY2 = 0;
}
var box2 = {
x: minX,
y: minY,
minX,
minY,
maxX,
maxY: maxY2,
width: maxX - minX,
height: maxY2 - minY
};
return box2;
};
Container3.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
cfg["children"] = [];
return cfg;
};
Container3.prototype.onAttrChange = function(name, value2, originValue) {
_super.prototype.onAttrChange.call(this, name, value2, originValue);
if (name === "matrix") {
var totalMatrix = this.getTotalMatrix();
this._applyChildrenMarix(totalMatrix);
}
};
Container3.prototype.applyMatrix = function(matrix) {
var preTotalMatrix = this.getTotalMatrix();
_super.prototype.applyMatrix.call(this, matrix);
var totalMatrix = this.getTotalMatrix();
if (totalMatrix === preTotalMatrix) {
return;
}
this._applyChildrenMarix(totalMatrix);
};
Container3.prototype._applyChildrenMarix = function(totalMatrix) {
var children = this.getChildren();
each_default(children, function(child) {
child.applyMatrix(totalMatrix);
});
};
Container3.prototype.addShape = function() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var type2 = args[0];
var cfg = args[1];
if (is_object_default(type2)) {
cfg = type2;
} else {
cfg["type"] = type2;
}
var shapeType = SHAPE_MAP[cfg.type];
if (!shapeType) {
shapeType = upper_first_default(cfg.type);
SHAPE_MAP[cfg.type] = shapeType;
}
var ShapeBase4 = this.getShapeBase();
var shape = new ShapeBase4[shapeType](cfg);
this.add(shape);
return shape;
};
Container3.prototype.addGroup = function() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var groupClass = args[0], cfg = args[1];
var group2;
if (is_function_default(groupClass)) {
if (cfg) {
group2 = new groupClass(cfg);
} else {
group2 = new groupClass({
parent: this
});
}
} else {
var tmpCfg = groupClass || {};
var TmpGroupClass = this.getGroupBase();
group2 = new TmpGroupClass(tmpCfg);
}
this.add(group2);
return group2;
};
Container3.prototype.getCanvas = function() {
var canvas;
if (this.isCanvas()) {
canvas = this;
} else {
canvas = this.get("canvas");
}
return canvas;
};
Container3.prototype.getShape = function(x6, y5, ev) {
if (!isAllowCapture(this)) {
return null;
}
var children = this.getChildren();
var shape;
if (!this.isCanvas()) {
var v3 = [x6, y5, 1];
v3 = this.invertFromMatrix(v3);
if (!this.isClipped(v3[0], v3[1])) {
shape = this._findShape(children, v3[0], v3[1], ev);
}
} else {
shape = this._findShape(children, x6, y5, ev);
}
return shape;
};
Container3.prototype._findShape = function(children, x6, y5, ev) {
var shape = null;
for (var i4 = children.length - 1; i4 >= 0; i4--) {
var child = children[i4];
if (isAllowCapture(child)) {
if (child.isGroup()) {
shape = child.getShape(x6, y5, ev);
} else if (child.isHit(x6, y5)) {
shape = child;
}
}
if (shape) {
break;
}
}
return shape;
};
Container3.prototype.add = function(element) {
var canvas = this.getCanvas();
var children = this.getChildren();
var timeline = this.get("timeline");
var preParent = element.getParent();
if (preParent) {
removeChild(preParent, element, false);
}
element.set("parent", this);
if (canvas) {
setCanvas(element, canvas);
}
if (timeline) {
setTimeline(element, timeline);
}
children.push(element);
element.onCanvasChange("add");
this._applyElementMatrix(element);
};
Container3.prototype._applyElementMatrix = function(element) {
var totalMatrix = this.getTotalMatrix();
if (totalMatrix) {
element.applyMatrix(totalMatrix);
}
};
Container3.prototype.getChildren = function() {
return this.get("children");
};
Container3.prototype.sort = function() {
var children = this.getChildren();
each_default(children, function(child, index2) {
child[INDEX] = index2;
return child;
});
children.sort(getComparer(function(obj1, obj2) {
return obj1.get("zIndex") - obj2.get("zIndex");
}));
this.onCanvasChange("sort");
};
Container3.prototype.clear = function() {
this.set("clearing", true);
if (this.destroyed) {
return;
}
var children = this.getChildren();
for (var i4 = children.length - 1; i4 >= 0; i4--) {
children[i4].destroy();
}
this.set("children", []);
this.onCanvasChange("clear");
this.set("clearing", false);
};
Container3.prototype.destroy = function() {
if (this.get("destroyed")) {
return;
}
this.clear();
_super.prototype.destroy.call(this);
};
Container3.prototype.getFirst = function() {
return this.getChildByIndex(0);
};
Container3.prototype.getLast = function() {
var children = this.getChildren();
return this.getChildByIndex(children.length - 1);
};
Container3.prototype.getChildByIndex = function(index2) {
var children = this.getChildren();
return children[index2];
};
Container3.prototype.getCount = function() {
var children = this.getChildren();
return children.length;
};
Container3.prototype.contain = function(element) {
var children = this.getChildren();
return children.indexOf(element) > -1;
};
Container3.prototype.removeChild = function(element, destroy) {
if (destroy === void 0) {
destroy = true;
}
if (this.contain(element)) {
element.remove(destroy);
}
};
Container3.prototype.findAll = function(fn2) {
var rst = [];
var children = this.getChildren();
each_default(children, function(element) {
if (fn2(element)) {
rst.push(element);
}
if (element.isGroup()) {
rst = rst.concat(element.findAll(fn2));
}
});
return rst;
};
Container3.prototype.find = function(fn2) {
var rst = null;
var children = this.getChildren();
each_default(children, function(element) {
if (fn2(element)) {
rst = element;
} else if (element.isGroup()) {
rst = element.find(fn2);
}
if (rst) {
return false;
}
});
return rst;
};
Container3.prototype.findById = function(id) {
return this.find(function(element) {
return element.get("id") === id;
});
};
Container3.prototype.findByClassName = function(className) {
return this.find(function(element) {
return element.get("className") === className;
});
};
Container3.prototype.findAllByName = function(name) {
return this.findAll(function(element) {
return element.get("name") === name;
});
};
return Container3;
}(element_default);
var container_default = Container;
// node_modules/d3-timer/src/timer.js
var frame = 0;
var timeout = 0;
var interval = 0;
var pokeDelay = 1e3;
var taskHead;
var taskTail;
var clockLast = 0;
var clockNow = 0;
var clockSkew = 0;
var clock = typeof performance === "object" && performance.now ? performance : Date;
var setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f3) {
setTimeout(f3, 17);
};
function now() {
return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
}
function clearNow() {
clockNow = 0;
}
function Timer() {
this._call = this._time = this._next = null;
}
Timer.prototype = timer.prototype = {
constructor: Timer,
restart: function(callback, delay, time2) {
if (typeof callback !== "function")
throw new TypeError("callback is not a function");
time2 = (time2 == null ? now() : +time2) + (delay == null ? 0 : +delay);
if (!this._next && taskTail !== this) {
if (taskTail)
taskTail._next = this;
else
taskHead = this;
taskTail = this;
}
this._call = callback;
this._time = time2;
sleep();
},
stop: function() {
if (this._call) {
this._call = null;
this._time = Infinity;
sleep();
}
}
};
function timer(callback, delay, time2) {
var t4 = new Timer();
t4.restart(callback, delay, time2);
return t4;
}
function timerFlush() {
now();
++frame;
var t4 = taskHead, e4;
while (t4) {
if ((e4 = clockNow - t4._time) >= 0)
t4._call.call(null, e4);
t4 = t4._next;
}
--frame;
}
function wake() {
clockNow = (clockLast = clock.now()) + clockSkew;
frame = timeout = 0;
try {
timerFlush();
} finally {
frame = 0;
nap();
clockNow = 0;
}
}
function poke() {
var now2 = clock.now(), delay = now2 - clockLast;
if (delay > pokeDelay)
clockSkew -= delay, clockLast = now2;
}
function nap() {
var t0, t1 = taskHead, t22, time2 = Infinity;
while (t1) {
if (t1._call) {
if (time2 > t1._time)
time2 = t1._time;
t0 = t1, t1 = t1._next;
} else {
t22 = t1._next, t1._next = null;
t1 = t0 ? t0._next = t22 : taskHead = t22;
}
}
taskTail = t0;
sleep(time2);
}
function sleep(time2) {
if (frame)
return;
if (timeout)
timeout = clearTimeout(timeout);
var delay = time2 - clockNow;
if (delay > 24) {
if (time2 < Infinity)
timeout = setTimeout(wake, time2 - clock.now() - clockSkew);
if (interval)
interval = clearInterval(interval);
} else {
if (!interval)
clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
frame = 1, setFrame(wake);
}
}
// node_modules/d3-ease/src/index.js
var src_exports = {};
__export(src_exports, {
easeBack: () => backInOut,
easeBackIn: () => backIn,
easeBackInOut: () => backInOut,
easeBackOut: () => backOut,
easeBounce: () => bounceOut,
easeBounceIn: () => bounceIn,
easeBounceInOut: () => bounceInOut,
easeBounceOut: () => bounceOut,
easeCircle: () => circleInOut,
easeCircleIn: () => circleIn,
easeCircleInOut: () => circleInOut,
easeCircleOut: () => circleOut,
easeCubic: () => cubicInOut,
easeCubicIn: () => cubicIn,
easeCubicInOut: () => cubicInOut,
easeCubicOut: () => cubicOut,
easeElastic: () => elasticOut,
easeElasticIn: () => elasticIn,
easeElasticInOut: () => elasticInOut,
easeElasticOut: () => elasticOut,
easeExp: () => expInOut,
easeExpIn: () => expIn,
easeExpInOut: () => expInOut,
easeExpOut: () => expOut,
easeLinear: () => linear,
easePoly: () => polyInOut,
easePolyIn: () => polyIn,
easePolyInOut: () => polyInOut,
easePolyOut: () => polyOut,
easeQuad: () => quadInOut,
easeQuadIn: () => quadIn,
easeQuadInOut: () => quadInOut,
easeQuadOut: () => quadOut,
easeSin: () => sinInOut,
easeSinIn: () => sinIn,
easeSinInOut: () => sinInOut,
easeSinOut: () => sinOut
});
// node_modules/d3-ease/src/linear.js
function linear(t4) {
return +t4;
}
// node_modules/d3-ease/src/quad.js
function quadIn(t4) {
return t4 * t4;
}
function quadOut(t4) {
return t4 * (2 - t4);
}
function quadInOut(t4) {
return ((t4 *= 2) <= 1 ? t4 * t4 : --t4 * (2 - t4) + 1) / 2;
}
// node_modules/d3-ease/src/cubic.js
function cubicIn(t4) {
return t4 * t4 * t4;
}
function cubicOut(t4) {
return --t4 * t4 * t4 + 1;
}
function cubicInOut(t4) {
return ((t4 *= 2) <= 1 ? t4 * t4 * t4 : (t4 -= 2) * t4 * t4 + 2) / 2;
}
// node_modules/d3-ease/src/poly.js
var exponent = 3;
var polyIn = function custom(e4) {
e4 = +e4;
function polyIn2(t4) {
return Math.pow(t4, e4);
}
polyIn2.exponent = custom;
return polyIn2;
}(exponent);
var polyOut = function custom2(e4) {
e4 = +e4;
function polyOut2(t4) {
return 1 - Math.pow(1 - t4, e4);
}
polyOut2.exponent = custom2;
return polyOut2;
}(exponent);
var polyInOut = function custom3(e4) {
e4 = +e4;
function polyInOut2(t4) {
return ((t4 *= 2) <= 1 ? Math.pow(t4, e4) : 2 - Math.pow(2 - t4, e4)) / 2;
}
polyInOut2.exponent = custom3;
return polyInOut2;
}(exponent);
// node_modules/d3-ease/src/sin.js
var pi = Math.PI;
var halfPi = pi / 2;
function sinIn(t4) {
return +t4 === 1 ? 1 : 1 - Math.cos(t4 * halfPi);
}
function sinOut(t4) {
return Math.sin(t4 * halfPi);
}
function sinInOut(t4) {
return (1 - Math.cos(pi * t4)) / 2;
}
// node_modules/d3-ease/src/math.js
function tpmt(x6) {
return (Math.pow(2, -10 * x6) - 9765625e-10) * 1.0009775171065494;
}
// node_modules/d3-ease/src/exp.js
function expIn(t4) {
return tpmt(1 - +t4);
}
function expOut(t4) {
return 1 - tpmt(t4);
}
function expInOut(t4) {
return ((t4 *= 2) <= 1 ? tpmt(1 - t4) : 2 - tpmt(t4 - 1)) / 2;
}
// node_modules/d3-ease/src/circle.js
function circleIn(t4) {
return 1 - Math.sqrt(1 - t4 * t4);
}
function circleOut(t4) {
return Math.sqrt(1 - --t4 * t4);
}
function circleInOut(t4) {
return ((t4 *= 2) <= 1 ? 1 - Math.sqrt(1 - t4 * t4) : Math.sqrt(1 - (t4 -= 2) * t4) + 1) / 2;
}
// node_modules/d3-ease/src/bounce.js
var b1 = 4 / 11;
var b22 = 6 / 11;
var b3 = 8 / 11;
var b4 = 3 / 4;
var b5 = 9 / 11;
var b6 = 10 / 11;
var b7 = 15 / 16;
var b8 = 21 / 22;
var b9 = 63 / 64;
var b0 = 1 / b1 / b1;
function bounceIn(t4) {
return 1 - bounceOut(1 - t4);
}
function bounceOut(t4) {
return (t4 = +t4) < b1 ? b0 * t4 * t4 : t4 < b3 ? b0 * (t4 -= b22) * t4 + b4 : t4 < b6 ? b0 * (t4 -= b5) * t4 + b7 : b0 * (t4 -= b8) * t4 + b9;
}
function bounceInOut(t4) {
return ((t4 *= 2) <= 1 ? 1 - bounceOut(1 - t4) : bounceOut(t4 - 1) + 1) / 2;
}
// node_modules/d3-ease/src/back.js
var overshoot = 1.70158;
var backIn = function custom4(s4) {
s4 = +s4;
function backIn2(t4) {
return (t4 = +t4) * t4 * (s4 * (t4 - 1) + t4);
}
backIn2.overshoot = custom4;
return backIn2;
}(overshoot);
var backOut = function custom5(s4) {
s4 = +s4;
function backOut2(t4) {
return --t4 * t4 * ((t4 + 1) * s4 + t4) + 1;
}
backOut2.overshoot = custom5;
return backOut2;
}(overshoot);
var backInOut = function custom6(s4) {
s4 = +s4;
function backInOut2(t4) {
return ((t4 *= 2) < 1 ? t4 * t4 * ((s4 + 1) * t4 - s4) : (t4 -= 2) * t4 * ((s4 + 1) * t4 + s4) + 2) / 2;
}
backInOut2.overshoot = custom6;
return backInOut2;
}(overshoot);
// node_modules/d3-ease/src/elastic.js
var tau = 2 * Math.PI;
var amplitude = 1;
var period = 0.3;
var elasticIn = function custom7(a4, p4) {
var s4 = Math.asin(1 / (a4 = Math.max(1, a4))) * (p4 /= tau);
function elasticIn2(t4) {
return a4 * tpmt(- --t4) * Math.sin((s4 - t4) / p4);
}
elasticIn2.amplitude = function(a5) {
return custom7(a5, p4 * tau);
};
elasticIn2.period = function(p5) {
return custom7(a4, p5);
};
return elasticIn2;
}(amplitude, period);
var elasticOut = function custom8(a4, p4) {
var s4 = Math.asin(1 / (a4 = Math.max(1, a4))) * (p4 /= tau);
function elasticOut2(t4) {
return 1 - a4 * tpmt(t4 = +t4) * Math.sin((t4 + s4) / p4);
}
elasticOut2.amplitude = function(a5) {
return custom8(a5, p4 * tau);
};
elasticOut2.period = function(p5) {
return custom8(a4, p5);
};
return elasticOut2;
}(amplitude, period);
var elasticInOut = function custom9(a4, p4) {
var s4 = Math.asin(1 / (a4 = Math.max(1, a4))) * (p4 /= tau);
function elasticInOut2(t4) {
return ((t4 = t4 * 2 - 1) < 0 ? a4 * tpmt(-t4) * Math.sin((s4 - t4) / p4) : 2 - a4 * tpmt(t4) * Math.sin((s4 + t4) / p4)) / 2;
}
elasticInOut2.amplitude = function(a5) {
return custom9(a5, p4 * tau);
};
elasticInOut2.period = function(p5) {
return custom9(a4, p5);
};
return elasticInOut2;
}(amplitude, period);
// node_modules/d3-color/src/define.js
function define_default(constructor, factory, prototype) {
constructor.prototype = factory.prototype = prototype;
prototype.constructor = constructor;
}
function extend3(parent, definition) {
var prototype = Object.create(parent.prototype);
for (var key in definition)
prototype[key] = definition[key];
return prototype;
}
// node_modules/d3-color/src/color.js
function Color() {
}
var darker = 0.7;
var brighter = 1 / darker;
var reI = "\\s*([+-]?\\d+)\\s*";
var reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*";
var reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
var reHex = /^#([0-9a-f]{3,8})$/;
var reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$");
var reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$");
var reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$");
var reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$");
var reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$");
var reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");
var named = {
aliceblue: 15792383,
antiquewhite: 16444375,
aqua: 65535,
aquamarine: 8388564,
azure: 15794175,
beige: 16119260,
bisque: 16770244,
black: 0,
blanchedalmond: 16772045,
blue: 255,
blueviolet: 9055202,
brown: 10824234,
burlywood: 14596231,
cadetblue: 6266528,
chartreuse: 8388352,
chocolate: 13789470,
coral: 16744272,
cornflowerblue: 6591981,
cornsilk: 16775388,
crimson: 14423100,
cyan: 65535,
darkblue: 139,
darkcyan: 35723,
darkgoldenrod: 12092939,
darkgray: 11119017,
darkgreen: 25600,
darkgrey: 11119017,
darkkhaki: 12433259,
darkmagenta: 9109643,
darkolivegreen: 5597999,
darkorange: 16747520,
darkorchid: 10040012,
darkred: 9109504,
darksalmon: 15308410,
darkseagreen: 9419919,
darkslateblue: 4734347,
darkslategray: 3100495,
darkslategrey: 3100495,
darkturquoise: 52945,
darkviolet: 9699539,
deeppink: 16716947,
deepskyblue: 49151,
dimgray: 6908265,
dimgrey: 6908265,
dodgerblue: 2003199,
firebrick: 11674146,
floralwhite: 16775920,
forestgreen: 2263842,
fuchsia: 16711935,
gainsboro: 14474460,
ghostwhite: 16316671,
gold: 16766720,
goldenrod: 14329120,
gray: 8421504,
green: 32768,
greenyellow: 11403055,
grey: 8421504,
honeydew: 15794160,
hotpink: 16738740,
indianred: 13458524,
indigo: 4915330,
ivory: 16777200,
khaki: 15787660,
lavender: 15132410,
lavenderblush: 16773365,
lawngreen: 8190976,
lemonchiffon: 16775885,
lightblue: 11393254,
lightcoral: 15761536,
lightcyan: 14745599,
lightgoldenrodyellow: 16448210,
lightgray: 13882323,
lightgreen: 9498256,
lightgrey: 13882323,
lightpink: 16758465,
lightsalmon: 16752762,
lightseagreen: 2142890,
lightskyblue: 8900346,
lightslategray: 7833753,
lightslategrey: 7833753,
lightsteelblue: 11584734,
lightyellow: 16777184,
lime: 65280,
limegreen: 3329330,
linen: 16445670,
magenta: 16711935,
maroon: 8388608,
mediumaquamarine: 6737322,
mediumblue: 205,
mediumorchid: 12211667,
mediumpurple: 9662683,
mediumseagreen: 3978097,
mediumslateblue: 8087790,
mediumspringgreen: 64154,
mediumturquoise: 4772300,
mediumvioletred: 13047173,
midnightblue: 1644912,
mintcream: 16121850,
mistyrose: 16770273,
moccasin: 16770229,
navajowhite: 16768685,
navy: 128,
oldlace: 16643558,
olive: 8421376,
olivedrab: 7048739,
orange: 16753920,
orangered: 16729344,
orchid: 14315734,
palegoldenrod: 15657130,
palegreen: 10025880,
paleturquoise: 11529966,
palevioletred: 14381203,
papayawhip: 16773077,
peachpuff: 16767673,
peru: 13468991,
pink: 16761035,
plum: 14524637,
powderblue: 11591910,
purple: 8388736,
rebeccapurple: 6697881,
red: 16711680,
rosybrown: 12357519,
royalblue: 4286945,
saddlebrown: 9127187,
salmon: 16416882,
sandybrown: 16032864,
seagreen: 3050327,
seashell: 16774638,
sienna: 10506797,
silver: 12632256,
skyblue: 8900331,
slateblue: 6970061,
slategray: 7372944,
slategrey: 7372944,
snow: 16775930,
springgreen: 65407,
steelblue: 4620980,
tan: 13808780,
teal: 32896,
thistle: 14204888,
tomato: 16737095,
turquoise: 4251856,
violet: 15631086,
wheat: 16113331,
white: 16777215,
whitesmoke: 16119285,
yellow: 16776960,
yellowgreen: 10145074
};
define_default(Color, color, {
copy: function(channels) {
return Object.assign(new this.constructor(), this, channels);
},
displayable: function() {
return this.rgb().displayable();
},
hex: color_formatHex,
formatHex: color_formatHex,
formatHsl: color_formatHsl,
formatRgb: color_formatRgb,
toString: color_formatRgb
});
function color_formatHex() {
return this.rgb().formatHex();
}
function color_formatHsl() {
return hslConvert(this).formatHsl();
}
function color_formatRgb() {
return this.rgb().formatRgb();
}
function color(format2) {
var m4, l4;
format2 = (format2 + "").trim().toLowerCase();
return (m4 = reHex.exec(format2)) ? (l4 = m4[1].length, m4 = parseInt(m4[1], 16), l4 === 6 ? rgbn(m4) : l4 === 3 ? new Rgb(m4 >> 8 & 15 | m4 >> 4 & 240, m4 >> 4 & 15 | m4 & 240, (m4 & 15) << 4 | m4 & 15, 1) : l4 === 8 ? rgba(m4 >> 24 & 255, m4 >> 16 & 255, m4 >> 8 & 255, (m4 & 255) / 255) : l4 === 4 ? rgba(m4 >> 12 & 15 | m4 >> 8 & 240, m4 >> 8 & 15 | m4 >> 4 & 240, m4 >> 4 & 15 | m4 & 240, ((m4 & 15) << 4 | m4 & 15) / 255) : null) : (m4 = reRgbInteger.exec(format2)) ? new Rgb(m4[1], m4[2], m4[3], 1) : (m4 = reRgbPercent.exec(format2)) ? new Rgb(m4[1] * 255 / 100, m4[2] * 255 / 100, m4[3] * 255 / 100, 1) : (m4 = reRgbaInteger.exec(format2)) ? rgba(m4[1], m4[2], m4[3], m4[4]) : (m4 = reRgbaPercent.exec(format2)) ? rgba(m4[1] * 255 / 100, m4[2] * 255 / 100, m4[3] * 255 / 100, m4[4]) : (m4 = reHslPercent.exec(format2)) ? hsla(m4[1], m4[2] / 100, m4[3] / 100, 1) : (m4 = reHslaPercent.exec(format2)) ? hsla(m4[1], m4[2] / 100, m4[3] / 100, m4[4]) : named.hasOwnProperty(format2) ? rgbn(named[format2]) : format2 === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
}
function rgbn(n3) {
return new Rgb(n3 >> 16 & 255, n3 >> 8 & 255, n3 & 255, 1);
}
function rgba(r4, g4, b10, a4) {
if (a4 <= 0)
r4 = g4 = b10 = NaN;
return new Rgb(r4, g4, b10, a4);
}
function rgbConvert(o3) {
if (!(o3 instanceof Color))
o3 = color(o3);
if (!o3)
return new Rgb();
o3 = o3.rgb();
return new Rgb(o3.r, o3.g, o3.b, o3.opacity);
}
function rgb(r4, g4, b10, opacity) {
return arguments.length === 1 ? rgbConvert(r4) : new Rgb(r4, g4, b10, opacity == null ? 1 : opacity);
}
function Rgb(r4, g4, b10, opacity) {
this.r = +r4;
this.g = +g4;
this.b = +b10;
this.opacity = +opacity;
}
define_default(Rgb, rgb, extend3(Color, {
brighter: function(k4) {
k4 = k4 == null ? brighter : Math.pow(brighter, k4);
return new Rgb(this.r * k4, this.g * k4, this.b * k4, this.opacity);
},
darker: function(k4) {
k4 = k4 == null ? darker : Math.pow(darker, k4);
return new Rgb(this.r * k4, this.g * k4, this.b * k4, this.opacity);
},
rgb: function() {
return this;
},
displayable: function() {
return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1);
},
hex: rgb_formatHex,
formatHex: rgb_formatHex,
formatRgb: rgb_formatRgb,
toString: rgb_formatRgb
}));
function rgb_formatHex() {
return "#" + hex(this.r) + hex(this.g) + hex(this.b);
}
function rgb_formatRgb() {
var a4 = this.opacity;
a4 = isNaN(a4) ? 1 : Math.max(0, Math.min(1, a4));
return (a4 === 1 ? "rgb(" : "rgba(") + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.b) || 0)) + (a4 === 1 ? ")" : ", " + a4 + ")");
}
function hex(value2) {
value2 = Math.max(0, Math.min(255, Math.round(value2) || 0));
return (value2 < 16 ? "0" : "") + value2.toString(16);
}
function hsla(h3, s4, l4, a4) {
if (a4 <= 0)
h3 = s4 = l4 = NaN;
else if (l4 <= 0 || l4 >= 1)
h3 = s4 = NaN;
else if (s4 <= 0)
h3 = NaN;
return new Hsl(h3, s4, l4, a4);
}
function hslConvert(o3) {
if (o3 instanceof Hsl)
return new Hsl(o3.h, o3.s, o3.l, o3.opacity);
if (!(o3 instanceof Color))
o3 = color(o3);
if (!o3)
return new Hsl();
if (o3 instanceof Hsl)
return o3;
o3 = o3.rgb();
var r4 = o3.r / 255, g4 = o3.g / 255, b10 = o3.b / 255, min7 = Math.min(r4, g4, b10), max8 = Math.max(r4, g4, b10), h3 = NaN, s4 = max8 - min7, l4 = (max8 + min7) / 2;
if (s4) {
if (r4 === max8)
h3 = (g4 - b10) / s4 + (g4 < b10) * 6;
else if (g4 === max8)
h3 = (b10 - r4) / s4 + 2;
else
h3 = (r4 - g4) / s4 + 4;
s4 /= l4 < 0.5 ? max8 + min7 : 2 - max8 - min7;
h3 *= 60;
} else {
s4 = l4 > 0 && l4 < 1 ? 0 : h3;
}
return new Hsl(h3, s4, l4, o3.opacity);
}
function hsl(h3, s4, l4, opacity) {
return arguments.length === 1 ? hslConvert(h3) : new Hsl(h3, s4, l4, opacity == null ? 1 : opacity);
}
function Hsl(h3, s4, l4, opacity) {
this.h = +h3;
this.s = +s4;
this.l = +l4;
this.opacity = +opacity;
}
define_default(Hsl, hsl, extend3(Color, {
brighter: function(k4) {
k4 = k4 == null ? brighter : Math.pow(brighter, k4);
return new Hsl(this.h, this.s, this.l * k4, this.opacity);
},
darker: function(k4) {
k4 = k4 == null ? darker : Math.pow(darker, k4);
return new Hsl(this.h, this.s, this.l * k4, this.opacity);
},
rgb: function() {
var h3 = this.h % 360 + (this.h < 0) * 360, s4 = isNaN(h3) || isNaN(this.s) ? 0 : this.s, l4 = this.l, m22 = l4 + (l4 < 0.5 ? l4 : 1 - l4) * s4, m1 = 2 * l4 - m22;
return new Rgb(hsl2rgb(h3 >= 240 ? h3 - 240 : h3 + 120, m1, m22), hsl2rgb(h3, m1, m22), hsl2rgb(h3 < 120 ? h3 + 240 : h3 - 120, m1, m22), this.opacity);
},
displayable: function() {
return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
},
formatHsl: function() {
var a4 = this.opacity;
a4 = isNaN(a4) ? 1 : Math.max(0, Math.min(1, a4));
return (a4 === 1 ? "hsl(" : "hsla(") + (this.h || 0) + ", " + (this.s || 0) * 100 + "%, " + (this.l || 0) * 100 + "%" + (a4 === 1 ? ")" : ", " + a4 + ")");
}
}));
function hsl2rgb(h3, m1, m22) {
return (h3 < 60 ? m1 + (m22 - m1) * h3 / 60 : h3 < 180 ? m22 : h3 < 240 ? m1 + (m22 - m1) * (240 - h3) / 60 : m1) * 255;
}
// node_modules/d3-interpolate/src/basis.js
function basis(t1, v0, v1, v22, v3) {
var t22 = t1 * t1, t32 = t22 * t1;
return ((1 - 3 * t1 + 3 * t22 - t32) * v0 + (4 - 6 * t22 + 3 * t32) * v1 + (1 + 3 * t1 + 3 * t22 - 3 * t32) * v22 + t32 * v3) / 6;
}
function basis_default(values2) {
var n3 = values2.length - 1;
return function(t4) {
var i4 = t4 <= 0 ? t4 = 0 : t4 >= 1 ? (t4 = 1, n3 - 1) : Math.floor(t4 * n3), v1 = values2[i4], v22 = values2[i4 + 1], v0 = i4 > 0 ? values2[i4 - 1] : 2 * v1 - v22, v3 = i4 < n3 - 1 ? values2[i4 + 2] : 2 * v22 - v1;
return basis((t4 - i4 / n3) * n3, v0, v1, v22, v3);
};
}
// node_modules/d3-interpolate/src/basisClosed.js
function basisClosed_default(values2) {
var n3 = values2.length;
return function(t4) {
var i4 = Math.floor(((t4 %= 1) < 0 ? ++t4 : t4) * n3), v0 = values2[(i4 + n3 - 1) % n3], v1 = values2[i4 % n3], v22 = values2[(i4 + 1) % n3], v3 = values2[(i4 + 2) % n3];
return basis((t4 - i4 / n3) * n3, v0, v1, v22, v3);
};
}
// node_modules/d3-interpolate/src/constant.js
function constant_default(x6) {
return function() {
return x6;
};
}
// node_modules/d3-interpolate/src/color.js
function linear2(a4, d3) {
return function(t4) {
return a4 + t4 * d3;
};
}
function exponential(a4, b10, y5) {
return a4 = Math.pow(a4, y5), b10 = Math.pow(b10, y5) - a4, y5 = 1 / y5, function(t4) {
return Math.pow(a4 + t4 * b10, y5);
};
}
function gamma(y5) {
return (y5 = +y5) === 1 ? nogamma : function(a4, b10) {
return b10 - a4 ? exponential(a4, b10, y5) : constant_default(isNaN(a4) ? b10 : a4);
};
}
function nogamma(a4, b10) {
var d3 = b10 - a4;
return d3 ? linear2(a4, d3) : constant_default(isNaN(a4) ? b10 : a4);
}
// node_modules/d3-interpolate/src/rgb.js
var rgb_default = function rgbGamma(y5) {
var color4 = gamma(y5);
function rgb2(start, end2) {
var r4 = color4((start = rgb(start)).r, (end2 = rgb(end2)).r), g4 = color4(start.g, end2.g), b10 = color4(start.b, end2.b), opacity = nogamma(start.opacity, end2.opacity);
return function(t4) {
start.r = r4(t4);
start.g = g4(t4);
start.b = b10(t4);
start.opacity = opacity(t4);
return start + "";
};
}
rgb2.gamma = rgbGamma;
return rgb2;
}(1);
function rgbSpline(spline) {
return function(colors) {
var n3 = colors.length, r4 = new Array(n3), g4 = new Array(n3), b10 = new Array(n3), i4, color4;
for (i4 = 0; i4 < n3; ++i4) {
color4 = rgb(colors[i4]);
r4[i4] = color4.r || 0;
g4[i4] = color4.g || 0;
b10[i4] = color4.b || 0;
}
r4 = spline(r4);
g4 = spline(g4);
b10 = spline(b10);
color4.opacity = 1;
return function(t4) {
color4.r = r4(t4);
color4.g = g4(t4);
color4.b = b10(t4);
return color4 + "";
};
};
}
var rgbBasis = rgbSpline(basis_default);
var rgbBasisClosed = rgbSpline(basisClosed_default);
// node_modules/d3-interpolate/src/numberArray.js
function numberArray_default(a4, b10) {
if (!b10)
b10 = [];
var n3 = a4 ? Math.min(b10.length, a4.length) : 0, c5 = b10.slice(), i4;
return function(t4) {
for (i4 = 0; i4 < n3; ++i4)
c5[i4] = a4[i4] * (1 - t4) + b10[i4] * t4;
return c5;
};
}
function isNumberArray(x6) {
return ArrayBuffer.isView(x6) && !(x6 instanceof DataView);
}
// node_modules/d3-interpolate/src/array.js
function array_default(a4, b10) {
return (isNumberArray(b10) ? numberArray_default : genericArray)(a4, b10);
}
function genericArray(a4, b10) {
var nb = b10 ? b10.length : 0, na = a4 ? Math.min(nb, a4.length) : 0, x6 = new Array(na), c5 = new Array(nb), i4;
for (i4 = 0; i4 < na; ++i4)
x6[i4] = value_default(a4[i4], b10[i4]);
for (; i4 < nb; ++i4)
c5[i4] = b10[i4];
return function(t4) {
for (i4 = 0; i4 < na; ++i4)
c5[i4] = x6[i4](t4);
return c5;
};
}
// node_modules/d3-interpolate/src/date.js
function date_default(a4, b10) {
var d3 = new Date();
return a4 = +a4, b10 = +b10, function(t4) {
return d3.setTime(a4 * (1 - t4) + b10 * t4), d3;
};
}
// node_modules/d3-interpolate/src/number.js
function number_default(a4, b10) {
return a4 = +a4, b10 = +b10, function(t4) {
return a4 * (1 - t4) + b10 * t4;
};
}
// node_modules/d3-interpolate/src/object.js
function object_default(a4, b10) {
var i4 = {}, c5 = {}, k4;
if (a4 === null || typeof a4 !== "object")
a4 = {};
if (b10 === null || typeof b10 !== "object")
b10 = {};
for (k4 in b10) {
if (k4 in a4) {
i4[k4] = value_default(a4[k4], b10[k4]);
} else {
c5[k4] = b10[k4];
}
}
return function(t4) {
for (k4 in i4)
c5[k4] = i4[k4](t4);
return c5;
};
}
// node_modules/d3-interpolate/src/string.js
var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
var reB = new RegExp(reA.source, "g");
function zero4(b10) {
return function() {
return b10;
};
}
function one(b10) {
return function(t4) {
return b10(t4) + "";
};
}
function string_default(a4, b10) {
var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i4 = -1, s4 = [], q4 = [];
a4 = a4 + "", b10 = b10 + "";
while ((am = reA.exec(a4)) && (bm = reB.exec(b10))) {
if ((bs = bm.index) > bi) {
bs = b10.slice(bi, bs);
if (s4[i4])
s4[i4] += bs;
else
s4[++i4] = bs;
}
if ((am = am[0]) === (bm = bm[0])) {
if (s4[i4])
s4[i4] += bm;
else
s4[++i4] = bm;
} else {
s4[++i4] = null;
q4.push({ i: i4, x: number_default(am, bm) });
}
bi = reB.lastIndex;
}
if (bi < b10.length) {
bs = b10.slice(bi);
if (s4[i4])
s4[i4] += bs;
else
s4[++i4] = bs;
}
return s4.length < 2 ? q4[0] ? one(q4[0].x) : zero4(b10) : (b10 = q4.length, function(t4) {
for (var i5 = 0, o3; i5 < b10; ++i5)
s4[(o3 = q4[i5]).i] = o3.x(t4);
return s4.join("");
});
}
// node_modules/d3-interpolate/src/value.js
function value_default(a4, b10) {
var t4 = typeof b10, c5;
return b10 == null || t4 === "boolean" ? constant_default(b10) : (t4 === "number" ? number_default : t4 === "string" ? (c5 = color(b10)) ? (b10 = c5, rgb_default) : string_default : b10 instanceof color ? rgb_default : b10 instanceof Date ? date_default : isNumberArray(b10) ? numberArray_default : Array.isArray(b10) ? genericArray : typeof b10.valueOf !== "function" && typeof b10.toString !== "function" || isNaN(b10) ? object_default : number_default)(a4, b10);
}
// node_modules/@antv/g-base/esm/util/color.js
var isColorProp = function(prop) {
return ["fill", "stroke", "fillStyle", "strokeStyle"].includes(prop);
};
var isGradientColor = function(val) {
return /^[r,R,L,l]{1}[\s]*\(/.test(val);
};
// node_modules/@antv/g-base/esm/animate/timeline.js
var IDENTITY_MATRIX = [1, 0, 0, 0, 1, 0, 0, 0, 1];
function _update(shape, animation7, ratio) {
var cProps = {};
var fromAttrs = animation7.fromAttrs, toAttrs = animation7.toAttrs;
if (shape.destroyed) {
return;
}
var interf;
for (var k4 in toAttrs) {
if (!is_equal_default(fromAttrs[k4], toAttrs[k4])) {
if (k4 === "path") {
var toPath = toAttrs[k4];
var fromPath = fromAttrs[k4];
if (toPath.length > fromPath.length) {
toPath = parsePathString(toAttrs[k4]);
fromPath = parsePathString(fromAttrs[k4]);
fromPath = fillPathByDiff(fromPath, toPath);
fromPath = formatPath(fromPath, toPath);
animation7.fromAttrs.path = fromPath;
animation7.toAttrs.path = toPath;
} else if (!animation7.pathFormatted) {
toPath = parsePathString(toAttrs[k4]);
fromPath = parsePathString(fromAttrs[k4]);
fromPath = formatPath(fromPath, toPath);
animation7.fromAttrs.path = fromPath;
animation7.toAttrs.path = toPath;
animation7.pathFormatted = true;
}
cProps[k4] = [];
for (var i4 = 0; i4 < toPath.length; i4++) {
var toPathPoint = toPath[i4];
var fromPathPoint = fromPath[i4];
var cPathPoint = [];
for (var j4 = 0; j4 < toPathPoint.length; j4++) {
if (is_number_default(toPathPoint[j4]) && fromPathPoint && is_number_default(fromPathPoint[j4])) {
interf = value_default(fromPathPoint[j4], toPathPoint[j4]);
cPathPoint.push(interf(ratio));
} else {
cPathPoint.push(toPathPoint[j4]);
}
}
cProps[k4].push(cPathPoint);
}
} else if (k4 === "matrix") {
var matrixFn = array_default(fromAttrs[k4] || IDENTITY_MATRIX, toAttrs[k4] || IDENTITY_MATRIX);
var currentMatrix = matrixFn(ratio);
cProps[k4] = currentMatrix;
} else if (isColorProp(k4) && isGradientColor(toAttrs[k4])) {
cProps[k4] = toAttrs[k4];
} else if (!is_function_default(toAttrs[k4])) {
interf = value_default(fromAttrs[k4], toAttrs[k4]);
cProps[k4] = interf(ratio);
}
}
}
shape.attr(cProps);
}
function update(shape, animation7, elapsed) {
var startTime = animation7.startTime, delay = animation7.delay;
if (elapsed < startTime + delay || animation7._paused) {
return false;
}
var ratio;
var duration = animation7.duration;
var easing = animation7.easing;
elapsed = elapsed - startTime - animation7.delay;
if (animation7.repeat) {
ratio = elapsed % duration / duration;
ratio = src_exports[easing](ratio);
} else {
ratio = elapsed / duration;
if (ratio < 1) {
ratio = src_exports[easing](ratio);
} else {
if (animation7.onFrame) {
shape.attr(animation7.onFrame(1));
} else {
shape.attr(animation7.toAttrs);
}
return true;
}
}
if (animation7.onFrame) {
var attrs = animation7.onFrame(ratio);
shape.attr(attrs);
} else {
_update(shape, animation7, ratio);
}
return false;
}
var Timeline = function() {
function Timeline2(canvas) {
this.animators = [];
this.current = 0;
this.timer = null;
this.canvas = canvas;
}
Timeline2.prototype.initTimer = function() {
var _this = this;
var isFinished = false;
var shape;
var animations;
var animation7;
this.timer = timer(function(elapsed) {
_this.current = elapsed;
if (_this.animators.length > 0) {
for (var i4 = _this.animators.length - 1; i4 >= 0; i4--) {
shape = _this.animators[i4];
if (shape.destroyed) {
_this.removeAnimator(i4);
continue;
}
if (!shape.isAnimatePaused()) {
animations = shape.get("animations");
for (var j4 = animations.length - 1; j4 >= 0; j4--) {
animation7 = animations[j4];
isFinished = update(shape, animation7, elapsed);
if (isFinished) {
animations.splice(j4, 1);
isFinished = false;
if (animation7.callback) {
animation7.callback();
}
}
}
}
if (animations.length === 0) {
_this.removeAnimator(i4);
}
}
var autoDraw = _this.canvas.get("autoDraw");
if (!autoDraw) {
_this.canvas.draw();
}
}
});
};
Timeline2.prototype.addAnimator = function(shape) {
this.animators.push(shape);
};
Timeline2.prototype.removeAnimator = function(index2) {
this.animators.splice(index2, 1);
};
Timeline2.prototype.isAnimating = function() {
return !!this.animators.length;
};
Timeline2.prototype.stop = function() {
if (this.timer) {
this.timer.stop();
}
};
Timeline2.prototype.stopAllAnimations = function(toEnd) {
if (toEnd === void 0) {
toEnd = true;
}
this.animators.forEach(function(animator) {
animator.stopAnimate(toEnd);
});
this.animators = [];
this.canvas.draw();
};
Timeline2.prototype.getTime = function() {
return this.current;
};
return Timeline2;
}();
var timeline_default = Timeline;
// node_modules/@antv/g-base/esm/event/event-contoller.js
var CLICK_OFFSET = 40;
var LEFT_BTN_CODE = 0;
var EVENTS = [
"mousedown",
"mouseup",
"dblclick",
"mouseout",
"mouseover",
"mousemove",
"mouseleave",
"mouseenter",
"touchstart",
"touchmove",
"touchend",
"dragenter",
"dragover",
"dragleave",
"drop",
"contextmenu",
"mousewheel"
];
function emitTargetEvent(target, type2, eventObj) {
eventObj.name = type2;
eventObj.target = target;
eventObj.currentTarget = target;
eventObj.delegateTarget = target;
target.emit(type2, eventObj);
}
function bubbleEvent(container2, type2, eventObj) {
if (eventObj.bubbles) {
var relativeShape = void 0;
var isOverEvent = false;
if (type2 === "mouseenter") {
relativeShape = eventObj.fromShape;
isOverEvent = true;
} else if (type2 === "mouseleave") {
isOverEvent = true;
relativeShape = eventObj.toShape;
}
if (container2.isCanvas() && isOverEvent) {
return;
}
if (relativeShape && isParent(container2, relativeShape)) {
eventObj.bubbles = false;
return;
}
eventObj.name = type2;
eventObj.currentTarget = container2;
eventObj.delegateTarget = container2;
container2.emit(type2, eventObj);
}
}
var EventController = function() {
function EventController4(cfg) {
var _this = this;
this.draggingShape = null;
this.dragging = false;
this.currentShape = null;
this.mousedownShape = null;
this.mousedownPoint = null;
this._eventCallback = function(ev) {
var type2 = ev.type;
_this._triggerEvent(type2, ev);
};
this._onDocumentMove = function(ev) {
var canvas = _this.canvas;
var el = canvas.get("el");
if (el !== ev.target) {
if (_this.dragging || _this.currentShape) {
var pointInfo = _this._getPointInfo(ev);
if (_this.dragging) {
_this._emitEvent("drag", ev, pointInfo, _this.draggingShape);
}
}
}
};
this._onDocumentMouseUp = function(ev) {
var canvas = _this.canvas;
var el = canvas.get("el");
if (el !== ev.target) {
if (_this.dragging) {
var pointInfo = _this._getPointInfo(ev);
if (_this.draggingShape) {
_this._emitEvent("drop", ev, pointInfo, null);
}
_this._emitEvent("dragend", ev, pointInfo, _this.draggingShape);
_this._afterDrag(_this.draggingShape, pointInfo, ev);
}
}
};
this.canvas = cfg.canvas;
}
EventController4.prototype.init = function() {
this._bindEvents();
};
EventController4.prototype._bindEvents = function() {
var _this = this;
var el = this.canvas.get("el");
each_default(EVENTS, function(eventName) {
el.addEventListener(eventName, _this._eventCallback);
});
if (document) {
document.addEventListener("mousemove", this._onDocumentMove);
document.addEventListener("mouseup", this._onDocumentMouseUp);
}
};
EventController4.prototype._clearEvents = function() {
var _this = this;
var el = this.canvas.get("el");
each_default(EVENTS, function(eventName) {
el.removeEventListener(eventName, _this._eventCallback);
});
if (document) {
document.removeEventListener("mousemove", this._onDocumentMove);
document.removeEventListener("mouseup", this._onDocumentMouseUp);
}
};
EventController4.prototype._getEventObj = function(type2, event, point2, target, fromShape, toShape) {
var eventObj = new graph_event_default(type2, event);
eventObj.fromShape = fromShape;
eventObj.toShape = toShape;
eventObj.x = point2.x;
eventObj.y = point2.y;
eventObj.clientX = point2.clientX;
eventObj.clientY = point2.clientY;
eventObj.propagationPath.push(target);
return eventObj;
};
EventController4.prototype._getShape = function(point2, ev) {
return this.canvas.getShape(point2.x, point2.y, ev);
};
EventController4.prototype._getPointInfo = function(ev) {
var canvas = this.canvas;
var clientPoint = canvas.getClientByEvent(ev);
var point2 = canvas.getPointByEvent(ev);
return {
x: point2.x,
y: point2.y,
clientX: clientPoint.x,
clientY: clientPoint.y
};
};
EventController4.prototype._triggerEvent = function(type2, ev) {
var pointInfo = this._getPointInfo(ev);
var shape = this._getShape(pointInfo, ev);
var method = this["_on" + type2];
var leaveCanvas = false;
if (method) {
method.call(this, pointInfo, shape, ev);
} else {
var preShape = this.currentShape;
if (type2 === "mouseenter" || type2 === "dragenter" || type2 === "mouseover") {
this._emitEvent(type2, ev, pointInfo, null, null, shape);
if (shape) {
this._emitEvent(type2, ev, pointInfo, shape, null, shape);
}
if (type2 === "mouseenter" && this.draggingShape) {
this._emitEvent("dragenter", ev, pointInfo, null);
}
} else if (type2 === "mouseleave" || type2 === "dragleave" || type2 === "mouseout") {
leaveCanvas = true;
if (preShape) {
this._emitEvent(type2, ev, pointInfo, preShape, preShape, null);
}
this._emitEvent(type2, ev, pointInfo, null, preShape, null);
if (type2 === "mouseleave" && this.draggingShape) {
this._emitEvent("dragleave", ev, pointInfo, null);
}
} else {
this._emitEvent(type2, ev, pointInfo, shape, null, null);
}
}
if (!leaveCanvas) {
this.currentShape = shape;
}
if (shape && !shape.get("destroyed")) {
var canvas = this.canvas;
var el = canvas.get("el");
el.style.cursor = shape.attr("cursor") || canvas.get("cursor");
}
};
EventController4.prototype._onmousedown = function(pointInfo, shape, event) {
if (event.button === LEFT_BTN_CODE) {
this.mousedownShape = shape;
this.mousedownPoint = pointInfo;
this.mousedownTimeStamp = event.timeStamp;
}
this._emitEvent("mousedown", event, pointInfo, shape, null, null);
};
EventController4.prototype._emitMouseoverEvents = function(event, pointInfo, fromShape, toShape) {
var el = this.canvas.get("el");
if (fromShape !== toShape) {
if (fromShape) {
this._emitEvent("mouseout", event, pointInfo, fromShape, fromShape, toShape);
this._emitEvent("mouseleave", event, pointInfo, fromShape, fromShape, toShape);
if (!toShape || toShape.get("destroyed")) {
el.style.cursor = this.canvas.get("cursor");
}
}
if (toShape) {
this._emitEvent("mouseover", event, pointInfo, toShape, fromShape, toShape);
this._emitEvent("mouseenter", event, pointInfo, toShape, fromShape, toShape);
}
}
};
EventController4.prototype._emitDragoverEvents = function(event, pointInfo, fromShape, toShape, isCanvasEmit) {
if (toShape) {
if (toShape !== fromShape) {
if (fromShape) {
this._emitEvent("dragleave", event, pointInfo, fromShape, fromShape, toShape);
}
this._emitEvent("dragenter", event, pointInfo, toShape, fromShape, toShape);
}
if (!isCanvasEmit) {
this._emitEvent("dragover", event, pointInfo, toShape);
}
} else if (fromShape) {
this._emitEvent("dragleave", event, pointInfo, fromShape, fromShape, toShape);
}
if (isCanvasEmit) {
this._emitEvent("dragover", event, pointInfo, toShape);
}
};
EventController4.prototype._afterDrag = function(draggingShape, pointInfo, event) {
if (draggingShape) {
draggingShape.set("capture", true);
this.draggingShape = null;
}
this.dragging = false;
var shape = this._getShape(pointInfo, event);
if (shape !== draggingShape) {
this._emitMouseoverEvents(event, pointInfo, draggingShape, shape);
}
this.currentShape = shape;
};
EventController4.prototype._onmouseup = function(pointInfo, shape, event) {
if (event.button === LEFT_BTN_CODE) {
var draggingShape = this.draggingShape;
if (this.dragging) {
if (draggingShape) {
this._emitEvent("drop", event, pointInfo, shape);
}
this._emitEvent("dragend", event, pointInfo, draggingShape);
this._afterDrag(draggingShape, pointInfo, event);
} else {
this._emitEvent("mouseup", event, pointInfo, shape);
if (shape === this.mousedownShape) {
this._emitEvent("click", event, pointInfo, shape);
}
this.mousedownShape = null;
this.mousedownPoint = null;
}
}
};
EventController4.prototype._ondragover = function(pointInfo, shape, event) {
event.preventDefault();
var preShape = this.currentShape;
this._emitDragoverEvents(event, pointInfo, preShape, shape, true);
};
EventController4.prototype._onmousemove = function(pointInfo, shape, event) {
var canvas = this.canvas;
var preShape = this.currentShape;
var draggingShape = this.draggingShape;
if (this.dragging) {
if (draggingShape) {
this._emitDragoverEvents(event, pointInfo, preShape, shape, false);
}
this._emitEvent("drag", event, pointInfo, draggingShape);
} else {
var mousedownPoint = this.mousedownPoint;
if (mousedownPoint) {
var mousedownShape = this.mousedownShape;
var now2 = event.timeStamp;
var timeWindow = now2 - this.mousedownTimeStamp;
var dx = mousedownPoint.clientX - pointInfo.clientX;
var dy = mousedownPoint.clientY - pointInfo.clientY;
var dist4 = dx * dx + dy * dy;
if (timeWindow > 120 || dist4 > CLICK_OFFSET) {
if (mousedownShape && mousedownShape.get("draggable")) {
draggingShape = this.mousedownShape;
draggingShape.set("capture", false);
this.draggingShape = draggingShape;
this.dragging = true;
this._emitEvent("dragstart", event, pointInfo, draggingShape);
this.mousedownShape = null;
this.mousedownPoint = null;
} else if (!mousedownShape && canvas.get("draggable")) {
this.dragging = true;
this._emitEvent("dragstart", event, pointInfo, null);
this.mousedownShape = null;
this.mousedownPoint = null;
} else {
this._emitMouseoverEvents(event, pointInfo, preShape, shape);
this._emitEvent("mousemove", event, pointInfo, shape);
}
} else {
this._emitMouseoverEvents(event, pointInfo, preShape, shape);
this._emitEvent("mousemove", event, pointInfo, shape);
}
} else {
this._emitMouseoverEvents(event, pointInfo, preShape, shape);
this._emitEvent("mousemove", event, pointInfo, shape);
}
}
};
EventController4.prototype._emitEvent = function(type2, event, pointInfo, shape, fromShape, toShape) {
var eventObj = this._getEventObj(type2, event, pointInfo, shape, fromShape, toShape);
if (shape) {
eventObj.shape = shape;
emitTargetEvent(shape, type2, eventObj);
var parent_1 = shape.getParent();
while (parent_1) {
parent_1.emitDelegation(type2, eventObj);
if (!eventObj.propagationStopped) {
bubbleEvent(parent_1, type2, eventObj);
}
eventObj.propagationPath.push(parent_1);
parent_1 = parent_1.getParent();
}
} else {
var canvas = this.canvas;
emitTargetEvent(canvas, type2, eventObj);
}
};
EventController4.prototype.destroy = function() {
this._clearEvents();
this.canvas = null;
this.currentShape = null;
this.draggingShape = null;
this.mousedownPoint = null;
this.mousedownShape = null;
this.mousedownTimeStamp = null;
};
return EventController4;
}();
var event_contoller_default = EventController;
// node_modules/@antv/g-base/esm/abstract/canvas.js
var PX_SUFFIX = "px";
var browser = detect();
var isFirefox = browser && browser.name === "firefox";
var Canvas = function(_super) {
__extends(Canvas4, _super);
function Canvas4(cfg) {
var _this = _super.call(this, cfg) || this;
_this.initContainer();
_this.initDom();
_this.initEvents();
_this.initTimeline();
return _this;
}
Canvas4.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
cfg["cursor"] = "default";
cfg["supportCSSTransform"] = false;
return cfg;
};
Canvas4.prototype.initContainer = function() {
var container2 = this.get("container");
if (is_string_default(container2)) {
container2 = document.getElementById(container2);
this.set("container", container2);
}
};
Canvas4.prototype.initDom = function() {
var el = this.createDom();
this.set("el", el);
var container2 = this.get("container");
container2.appendChild(el);
this.setDOMSize(this.get("width"), this.get("height"));
};
Canvas4.prototype.initEvents = function() {
var eventController = new event_contoller_default({
canvas: this
});
eventController.init();
this.set("eventController", eventController);
};
Canvas4.prototype.initTimeline = function() {
var timeline = new timeline_default(this);
this.set("timeline", timeline);
};
Canvas4.prototype.setDOMSize = function(width2, height) {
var el = this.get("el");
if (isBrowser) {
el.style.width = width2 + PX_SUFFIX;
el.style.height = height + PX_SUFFIX;
}
};
Canvas4.prototype.changeSize = function(width2, height) {
this.setDOMSize(width2, height);
this.set("width", width2);
this.set("height", height);
this.onCanvasChange("changeSize");
};
Canvas4.prototype.getRenderer = function() {
return this.get("renderer");
};
Canvas4.prototype.getCursor = function() {
return this.get("cursor");
};
Canvas4.prototype.setCursor = function(cursor) {
this.set("cursor", cursor);
var el = this.get("el");
if (isBrowser && el) {
el.style.cursor = cursor;
}
};
Canvas4.prototype.getPointByEvent = function(ev) {
var supportCSSTransform = this.get("supportCSSTransform");
if (supportCSSTransform) {
if (isFirefox && !is_nil_default(ev.layerX) && ev.layerX !== ev.offsetX) {
return {
x: ev.layerX,
y: ev.layerY
};
}
if (!is_nil_default(ev.offsetX)) {
return {
x: ev.offsetX,
y: ev.offsetY
};
}
}
var _a6 = this.getClientByEvent(ev), clientX = _a6.x, clientY = _a6.y;
return this.getPointByClient(clientX, clientY);
};
Canvas4.prototype.getClientByEvent = function(ev) {
var clientInfo = ev;
if (ev.touches) {
if (ev.type === "touchend") {
clientInfo = ev.changedTouches[0];
} else {
clientInfo = ev.touches[0];
}
}
return {
x: clientInfo.clientX,
y: clientInfo.clientY
};
};
Canvas4.prototype.getPointByClient = function(clientX, clientY) {
var el = this.get("el");
var bbox = el.getBoundingClientRect();
return {
x: clientX - bbox.left,
y: clientY - bbox.top
};
};
Canvas4.prototype.getClientByPoint = function(x6, y5) {
var el = this.get("el");
var bbox = el.getBoundingClientRect();
return {
x: x6 + bbox.left,
y: y5 + bbox.top
};
};
Canvas4.prototype.draw = function() {
};
Canvas4.prototype.removeDom = function() {
var el = this.get("el");
el.parentNode.removeChild(el);
};
Canvas4.prototype.clearEvents = function() {
var eventController = this.get("eventController");
eventController.destroy();
};
Canvas4.prototype.isCanvas = function() {
return true;
};
Canvas4.prototype.getParent = function() {
return null;
};
Canvas4.prototype.destroy = function() {
var timeline = this.get("timeline");
if (this.get("destroyed")) {
return;
}
this.clear();
if (timeline) {
timeline.stop();
}
this.clearEvents();
this.removeDom();
_super.prototype.destroy.call(this);
};
return Canvas4;
}(container_default);
var canvas_default = Canvas;
// node_modules/@antv/g-base/esm/abstract/group.js
var AbstractGroup = function(_super) {
__extends(AbstractGroup2, _super);
function AbstractGroup2() {
return _super !== null && _super.apply(this, arguments) || this;
}
AbstractGroup2.prototype.isGroup = function() {
return true;
};
AbstractGroup2.prototype.isEntityGroup = function() {
return false;
};
AbstractGroup2.prototype.clone = function() {
var clone10 = _super.prototype.clone.call(this);
var children = this.getChildren();
for (var i4 = 0; i4 < children.length; i4++) {
var child = children[i4];
clone10.add(child.clone());
}
return clone10;
};
return AbstractGroup2;
}(container_default);
var group_default2 = AbstractGroup;
// node_modules/@antv/g-base/esm/abstract/shape.js
var AbstractShape = function(_super) {
__extends(AbstractShape2, _super);
function AbstractShape2(cfg) {
return _super.call(this, cfg) || this;
}
AbstractShape2.prototype._isInBBox = function(refX, refY) {
var bbox = this.getBBox();
return bbox.minX <= refX && bbox.maxX >= refX && bbox.minY <= refY && bbox.maxY >= refY;
};
AbstractShape2.prototype.afterAttrsChange = function(targetAttrs) {
_super.prototype.afterAttrsChange.call(this, targetAttrs);
this.clearCacheBBox();
};
AbstractShape2.prototype.getBBox = function() {
var bbox = this.cfg.bbox;
if (!bbox) {
bbox = this.calculateBBox();
this.set("bbox", bbox);
}
return bbox;
};
AbstractShape2.prototype.getCanvasBBox = function() {
var canvasBBox = this.cfg.canvasBBox;
if (!canvasBBox) {
canvasBBox = this.calculateCanvasBBox();
this.set("canvasBBox", canvasBBox);
}
return canvasBBox;
};
AbstractShape2.prototype.applyMatrix = function(matrix) {
_super.prototype.applyMatrix.call(this, matrix);
this.set("canvasBBox", null);
};
AbstractShape2.prototype.calculateCanvasBBox = function() {
var bbox = this.getBBox();
var totalMatrix = this.getTotalMatrix();
var minX = bbox.minX, minY = bbox.minY, maxX = bbox.maxX, maxY2 = bbox.maxY;
if (totalMatrix) {
var topLeft = multiplyVec2(totalMatrix, [bbox.minX, bbox.minY]);
var topRight = multiplyVec2(totalMatrix, [bbox.maxX, bbox.minY]);
var bottomLeft = multiplyVec2(totalMatrix, [bbox.minX, bbox.maxY]);
var bottomRight = multiplyVec2(totalMatrix, [bbox.maxX, bbox.maxY]);
minX = Math.min(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]);
maxX = Math.max(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]);
minY = Math.min(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1]);
maxY2 = Math.max(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1]);
}
var attrs = this.attrs;
if (attrs.shadowColor) {
var _a6 = attrs.shadowBlur, shadowBlur = _a6 === void 0 ? 0 : _a6, _b = attrs.shadowOffsetX, shadowOffsetX = _b === void 0 ? 0 : _b, _c = attrs.shadowOffsetY, shadowOffsetY = _c === void 0 ? 0 : _c;
var shadowLeft = minX - shadowBlur + shadowOffsetX;
var shadowRight = maxX + shadowBlur + shadowOffsetX;
var shadowTop = minY - shadowBlur + shadowOffsetY;
var shadowBottom = maxY2 + shadowBlur + shadowOffsetY;
minX = Math.min(minX, shadowLeft);
maxX = Math.max(maxX, shadowRight);
minY = Math.min(minY, shadowTop);
maxY2 = Math.max(maxY2, shadowBottom);
}
return {
x: minX,
y: minY,
minX,
minY,
maxX,
maxY: maxY2,
width: maxX - minX,
height: maxY2 - minY
};
};
AbstractShape2.prototype.clearCacheBBox = function() {
this.set("bbox", null);
this.set("canvasBBox", null);
};
AbstractShape2.prototype.isClipShape = function() {
return this.get("isClipShape");
};
AbstractShape2.prototype.isInShape = function(refX, refY) {
return false;
};
AbstractShape2.prototype.isOnlyHitBox = function() {
return false;
};
AbstractShape2.prototype.isHit = function(x6, y5) {
var startArrowShape = this.get("startArrowShape");
var endArrowShape = this.get("endArrowShape");
var vec = [x6, y5, 1];
vec = this.invertFromMatrix(vec);
var refX = vec[0], refY = vec[1];
var inBBox = this._isInBBox(refX, refY);
if (this.isOnlyHitBox()) {
return inBBox;
}
if (inBBox && !this.isClipped(refX, refY)) {
if (this.isInShape(refX, refY)) {
return true;
}
if (startArrowShape && startArrowShape.isHit(refX, refY)) {
return true;
}
if (endArrowShape && endArrowShape.isHit(refX, refY)) {
return true;
}
}
return false;
};
return AbstractShape2;
}(element_default);
var shape_default = AbstractShape;
// node_modules/@antv/g-base/esm/bbox/register.js
var cache = new Map();
function register(type2, method) {
cache.set(type2, method);
}
function getMethod(type2) {
return cache.get(type2);
}
// node_modules/@antv/g-base/esm/bbox/rect.js
function rect_default(shape) {
var attrs = shape.attr();
var x6 = attrs.x, y5 = attrs.y, width2 = attrs.width, height = attrs.height;
return {
x: x6,
y: y5,
width: width2,
height
};
}
// node_modules/@antv/g-base/esm/bbox/circle.js
function circle_default(shape) {
var _a6 = shape.attr(), x6 = _a6.x, y5 = _a6.y, r4 = _a6.r;
return {
x: x6 - r4,
y: y5 - r4,
width: r4 * 2,
height: r4 * 2
};
}
// node_modules/@antv/g-math/esm/util.js
var util_exports = {};
__export(util_exports, {
distance: () => distance4,
getBBoxByArray: () => getBBoxByArray,
getBBoxRange: () => getBBoxRange,
isNumberEqual: () => isNumberEqual2,
piMod: () => piMod
});
function minNum(array) {
return Math.min.apply(null, array);
}
function maxNum(array) {
return Math.max.apply(null, array);
}
function distance4(x1, y1, x22, y22) {
var dx = x1 - x22;
var dy = y1 - y22;
return Math.sqrt(dx * dx + dy * dy);
}
function isNumberEqual2(v1, v22) {
return Math.abs(v1 - v22) < 1e-3;
}
function getBBoxByArray(xArr, yArr) {
var minX = minNum(xArr);
var minY = minNum(yArr);
var maxX = maxNum(xArr);
var maxY2 = maxNum(yArr);
return {
x: minX,
y: minY,
width: maxX - minX,
height: maxY2 - minY
};
}
function getBBoxRange(x1, y1, x22, y22) {
return {
minX: minNum([x1, x22]),
maxX: maxNum([x1, x22]),
minY: minNum([y1, y22]),
maxY: maxNum([y1, y22])
};
}
function piMod(angle3) {
return (angle3 + Math.PI * 2) % (Math.PI * 2);
}
// node_modules/@antv/g-math/esm/line.js
var line_default = {
box: function(x1, y1, x22, y22) {
return getBBoxByArray([x1, x22], [y1, y22]);
},
length: function(x1, y1, x22, y22) {
return distance4(x1, y1, x22, y22);
},
pointAt: function(x1, y1, x22, y22, t4) {
return {
x: (1 - t4) * x1 + t4 * x22,
y: (1 - t4) * y1 + t4 * y22
};
},
pointDistance: function(x1, y1, x22, y22, x6, y5) {
var cross6 = (x22 - x1) * (x6 - x1) + (y22 - y1) * (y5 - y1);
if (cross6 < 0) {
return distance4(x1, y1, x6, y5);
}
var lengthSquare = (x22 - x1) * (x22 - x1) + (y22 - y1) * (y22 - y1);
if (cross6 > lengthSquare) {
return distance4(x22, y22, x6, y5);
}
return this.pointToLine(x1, y1, x22, y22, x6, y5);
},
pointToLine: function(x1, y1, x22, y22, x6, y5) {
var d3 = [x22 - x1, y22 - y1];
if (exactEquals6(d3, [0, 0])) {
return Math.sqrt((x6 - x1) * (x6 - x1) + (y5 - y1) * (y5 - y1));
}
var u3 = [-d3[1], d3[0]];
normalize4(u3, u3);
var a4 = [x6 - x1, y5 - y1];
return Math.abs(dot4(a4, u3));
},
tangentAngle: function(x1, y1, x22, y22) {
return Math.atan2(y22 - y1, x22 - x1);
}
};
// node_modules/@antv/g-math/esm/bezier.js
var EPSILON2 = 1e-4;
function nearestPoint(xArr, yArr, x6, y5, tCallback, length5) {
var t4;
var d3 = Infinity;
var v0 = [x6, y5];
var segNum = 20;
if (length5 && length5 > 200) {
segNum = length5 / 10;
}
var increaseRate = 1 / segNum;
var interval3 = increaseRate / 10;
for (var i4 = 0; i4 <= segNum; i4++) {
var _t = i4 * increaseRate;
var v1 = [tCallback.apply(null, xArr.concat([_t])), tCallback.apply(null, yArr.concat([_t]))];
var d1 = distance4(v0[0], v0[1], v1[0], v1[1]);
if (d1 < d3) {
t4 = _t;
d3 = d1;
}
}
if (t4 === 0) {
return {
x: xArr[0],
y: yArr[0]
};
}
if (t4 === 1) {
var count2 = xArr.length;
return {
x: xArr[count2 - 1],
y: yArr[count2 - 1]
};
}
d3 = Infinity;
for (var i4 = 0; i4 < 32; i4++) {
if (interval3 < EPSILON2) {
break;
}
var prev = t4 - interval3;
var next = t4 + interval3;
var v1 = [tCallback.apply(null, xArr.concat([prev])), tCallback.apply(null, yArr.concat([prev]))];
var d1 = distance4(v0[0], v0[1], v1[0], v1[1]);
if (prev >= 0 && d1 < d3) {
t4 = prev;
d3 = d1;
} else {
var v22 = [tCallback.apply(null, xArr.concat([next])), tCallback.apply(null, yArr.concat([next]))];
var d22 = distance4(v0[0], v0[1], v22[0], v22[1]);
if (next <= 1 && d22 < d3) {
t4 = next;
d3 = d22;
} else {
interval3 *= 0.5;
}
}
}
return {
x: tCallback.apply(null, xArr.concat([t4])),
y: tCallback.apply(null, yArr.concat([t4]))
};
}
function snapLength(xArr, yArr) {
var totalLength = 0;
var count2 = xArr.length;
for (var i4 = 0; i4 < count2; i4++) {
var x6 = xArr[i4];
var y5 = yArr[i4];
var nextX = xArr[(i4 + 1) % count2];
var nextY = yArr[(i4 + 1) % count2];
totalLength += distance4(x6, y5, nextX, nextY);
}
return totalLength / 2;
}
// node_modules/@antv/g-math/esm/quadratic.js
function quadraticAt(p0, p1, p22, t4) {
var onet = 1 - t4;
return onet * onet * p0 + 2 * t4 * onet * p1 + t4 * t4 * p22;
}
function extrema(p0, p1, p22) {
var a4 = p0 + p22 - 2 * p1;
if (isNumberEqual2(a4, 0)) {
return [0.5];
}
var rst = (p0 - p1) / a4;
if (rst <= 1 && rst >= 0) {
return [rst];
}
return [];
}
function derivativeAt(p0, p1, p22, t4) {
return 2 * (1 - t4) * (p1 - p0) + 2 * t4 * (p22 - p1);
}
function divideQuadratic(x1, y1, x22, y22, x32, y32, t4) {
var xt = quadraticAt(x1, x22, x32, t4);
var yt = quadraticAt(y1, y22, y32, t4);
var controlPoint1 = line_default.pointAt(x1, y1, x22, y22, t4);
var controlPoint2 = line_default.pointAt(x22, y22, x32, y32, t4);
return [
[x1, y1, controlPoint1.x, controlPoint1.y, xt, yt],
[xt, yt, controlPoint2.x, controlPoint2.y, x32, y32]
];
}
function quadraticLength(x1, y1, x22, y22, x32, y32, iterationCount) {
if (iterationCount === 0) {
return (distance4(x1, y1, x22, y22) + distance4(x22, y22, x32, y32) + distance4(x1, y1, x32, y32)) / 2;
}
var quadratics = divideQuadratic(x1, y1, x22, y22, x32, y32, 0.5);
var left2 = quadratics[0];
var right2 = quadratics[1];
left2.push(iterationCount - 1);
right2.push(iterationCount - 1);
return quadraticLength.apply(null, left2) + quadraticLength.apply(null, right2);
}
var quadratic_default = {
box: function(x1, y1, x22, y22, x32, y32) {
var xExtrema2 = extrema(x1, x22, x32)[0];
var yExtrema2 = extrema(y1, y22, y32)[0];
var xArr = [x1, x32];
var yArr = [y1, y32];
if (xExtrema2 !== void 0) {
xArr.push(quadraticAt(x1, x22, x32, xExtrema2));
}
if (yExtrema2 !== void 0) {
yArr.push(quadraticAt(y1, y22, y32, yExtrema2));
}
return getBBoxByArray(xArr, yArr);
},
length: function(x1, y1, x22, y22, x32, y32) {
return quadraticLength(x1, y1, x22, y22, x32, y32, 3);
},
nearestPoint: function(x1, y1, x22, y22, x32, y32, x0, y0) {
return nearestPoint([x1, x22, x32], [y1, y22, y32], x0, y0, quadraticAt);
},
pointDistance: function(x1, y1, x22, y22, x32, y32, x0, y0) {
var point2 = this.nearestPoint(x1, y1, x22, y22, x32, y32, x0, y0);
return distance4(point2.x, point2.y, x0, y0);
},
interpolationAt: quadraticAt,
pointAt: function(x1, y1, x22, y22, x32, y32, t4) {
return {
x: quadraticAt(x1, x22, x32, t4),
y: quadraticAt(y1, y22, y32, t4)
};
},
divide: function(x1, y1, x22, y22, x32, y32, t4) {
return divideQuadratic(x1, y1, x22, y22, x32, y32, t4);
},
tangentAngle: function(x1, y1, x22, y22, x32, y32, t4) {
var dx = derivativeAt(x1, x22, x32, t4);
var dy = derivativeAt(y1, y22, y32, t4);
var angle3 = Math.atan2(dy, dx);
return piMod(angle3);
}
};
// node_modules/@antv/g-math/esm/cubic.js
function cubicAt(p0, p1, p22, p32, t4) {
var onet = 1 - t4;
return onet * onet * onet * p0 + 3 * p1 * t4 * onet * onet + 3 * p22 * t4 * t4 * onet + p32 * t4 * t4 * t4;
}
function derivativeAt2(p0, p1, p22, p32, t4) {
var onet = 1 - t4;
return 3 * (onet * onet * (p1 - p0) + 2 * onet * t4 * (p22 - p1) + t4 * t4 * (p32 - p22));
}
function extrema2(p0, p1, p22, p32) {
var a4 = -3 * p0 + 9 * p1 - 9 * p22 + 3 * p32;
var b10 = 6 * p0 - 12 * p1 + 6 * p22;
var c5 = 3 * p1 - 3 * p0;
var extremas = [];
var t1;
var t22;
var discSqrt;
if (isNumberEqual2(a4, 0)) {
if (!isNumberEqual2(b10, 0)) {
t1 = -c5 / b10;
if (t1 >= 0 && t1 <= 1) {
extremas.push(t1);
}
}
} else {
var disc = b10 * b10 - 4 * a4 * c5;
if (isNumberEqual2(disc, 0)) {
extremas.push(-b10 / (2 * a4));
} else if (disc > 0) {
discSqrt = Math.sqrt(disc);
t1 = (-b10 + discSqrt) / (2 * a4);
t22 = (-b10 - discSqrt) / (2 * a4);
if (t1 >= 0 && t1 <= 1) {
extremas.push(t1);
}
if (t22 >= 0 && t22 <= 1) {
extremas.push(t22);
}
}
}
return extremas;
}
function divideCubic(x1, y1, x22, y22, x32, y32, x42, y42, t4) {
var xt = cubicAt(x1, x22, x32, x42, t4);
var yt = cubicAt(y1, y22, y32, y42, t4);
var c1 = line_default.pointAt(x1, y1, x22, y22, t4);
var c22 = line_default.pointAt(x22, y22, x32, y32, t4);
var c32 = line_default.pointAt(x32, y32, x42, y42, t4);
var c12 = line_default.pointAt(c1.x, c1.y, c22.x, c22.y, t4);
var c23 = line_default.pointAt(c22.x, c22.y, c32.x, c32.y, t4);
return [
[x1, y1, c1.x, c1.y, c12.x, c12.y, xt, yt],
[xt, yt, c23.x, c23.y, c32.x, c32.y, x42, y42]
];
}
function cubicLength(x1, y1, x22, y22, x32, y32, x42, y42, iterationCount) {
if (iterationCount === 0) {
return snapLength([x1, x22, x32, x42], [y1, y22, y32, y42]);
}
var cubics = divideCubic(x1, y1, x22, y22, x32, y32, x42, y42, 0.5);
var left2 = cubics[0];
var right2 = cubics[1];
left2.push(iterationCount - 1);
right2.push(iterationCount - 1);
return cubicLength.apply(null, left2) + cubicLength.apply(null, right2);
}
var cubic_default = {
extrema: extrema2,
box: function(x1, y1, x22, y22, x32, y32, x42, y42) {
var xArr = [x1, x42];
var yArr = [y1, y42];
var xExtrema2 = extrema2(x1, x22, x32, x42);
var yExtrema2 = extrema2(y1, y22, y32, y42);
for (var i4 = 0; i4 < xExtrema2.length; i4++) {
xArr.push(cubicAt(x1, x22, x32, x42, xExtrema2[i4]));
}
for (var i4 = 0; i4 < yExtrema2.length; i4++) {
yArr.push(cubicAt(y1, y22, y32, y42, yExtrema2[i4]));
}
return getBBoxByArray(xArr, yArr);
},
length: function(x1, y1, x22, y22, x32, y32, x42, y42) {
return cubicLength(x1, y1, x22, y22, x32, y32, x42, y42, 3);
},
nearestPoint: function(x1, y1, x22, y22, x32, y32, x42, y42, x0, y0, length5) {
return nearestPoint([x1, x22, x32, x42], [y1, y22, y32, y42], x0, y0, cubicAt, length5);
},
pointDistance: function(x1, y1, x22, y22, x32, y32, x42, y42, x0, y0, length5) {
var point2 = this.nearestPoint(x1, y1, x22, y22, x32, y32, x42, y42, x0, y0, length5);
return distance4(point2.x, point2.y, x0, y0);
},
interpolationAt: cubicAt,
pointAt: function(x1, y1, x22, y22, x32, y32, x42, y42, t4) {
return {
x: cubicAt(x1, x22, x32, x42, t4),
y: cubicAt(y1, y22, y32, y42, t4)
};
},
divide: function(x1, y1, x22, y22, x32, y32, x42, y42, t4) {
return divideCubic(x1, y1, x22, y22, x32, y32, x42, y42, t4);
},
tangentAngle: function(x1, y1, x22, y22, x32, y32, x42, y42, t4) {
var dx = derivativeAt2(x1, x22, x32, x42, t4);
var dy = derivativeAt2(y1, y22, y32, y42, t4);
return piMod(Math.atan2(dy, dx));
}
};
// node_modules/@antv/g-math/esm/ellipse.js
function copysign(v1, v22) {
var absv = Math.abs(v1);
return v22 > 0 ? absv : absv * -1;
}
var ellipse_default = {
box: function(x6, y5, rx, ry) {
return {
x: x6 - rx,
y: y5 - ry,
width: rx * 2,
height: ry * 2
};
},
length: function(x6, y5, rx, ry) {
return Math.PI * (3 * (rx + ry) - Math.sqrt((3 * rx + ry) * (rx + 3 * ry)));
},
nearestPoint: function(x6, y5, rx, ry, x0, y0) {
var a4 = rx;
var b10 = ry;
if (a4 === 0 || b10 === 0) {
return {
x: x6,
y: y5
};
}
var relativeX = x0 - x6;
var relativeY = y0 - y5;
var px = Math.abs(relativeX);
var py = Math.abs(relativeY);
var squareA = a4 * a4;
var squareB = b10 * b10;
var t4 = Math.PI / 4;
var nearestX;
var nearestY;
for (var i4 = 0; i4 < 4; i4++) {
nearestX = a4 * Math.cos(t4);
nearestY = b10 * Math.sin(t4);
var ex = (squareA - squareB) * Math.pow(Math.cos(t4), 3) / a4;
var ey = (squareB - squareA) * Math.pow(Math.sin(t4), 3) / b10;
var rx1 = nearestX - ex;
var ry1 = nearestY - ey;
var qx = px - ex;
var qy = py - ey;
var r4 = Math.hypot(ry1, rx1);
var q4 = Math.hypot(qy, qx);
var delta_c = r4 * Math.asin((rx1 * qy - ry1 * qx) / (r4 * q4));
var delta_t = delta_c / Math.sqrt(squareA + squareB - nearestX * nearestX - nearestY * nearestY);
t4 += delta_t;
t4 = Math.min(Math.PI / 2, Math.max(0, t4));
}
return {
x: x6 + copysign(nearestX, relativeX),
y: y5 + copysign(nearestY, relativeY)
};
},
pointDistance: function(x6, y5, rx, ry, x0, y0) {
var nearestPoint2 = this.nearestPoint(x6, y5, rx, ry, x0, y0);
return distance4(nearestPoint2.x, nearestPoint2.y, x0, y0);
},
pointAt: function(x6, y5, rx, ry, t4) {
var angle3 = 2 * Math.PI * t4;
return {
x: x6 + rx * Math.cos(angle3),
y: y5 + ry * Math.sin(angle3)
};
},
tangentAngle: function(x6, y5, rx, ry, t4) {
var angle3 = 2 * Math.PI * t4;
var tangentAngle = Math.atan2(ry * Math.cos(angle3), -rx * Math.sin(angle3));
return piMod(tangentAngle);
}
};
// node_modules/@antv/g-math/esm/arc.js
function derivativeXAt(cx, cy, rx, ry, xRotation, startAngle, endAngle, angle3) {
return -1 * rx * Math.cos(xRotation) * Math.sin(angle3) - ry * Math.sin(xRotation) * Math.cos(angle3);
}
function derivativeYAt(cx, cy, rx, ry, xRotation, startAngle, endAngle, angle3) {
return -1 * rx * Math.sin(xRotation) * Math.sin(angle3) + ry * Math.cos(xRotation) * Math.cos(angle3);
}
function xExtrema(rx, ry, xRotation) {
return Math.atan(-ry / rx * Math.tan(xRotation));
}
function yExtrema(rx, ry, xRotation) {
return Math.atan(ry / (rx * Math.tan(xRotation)));
}
function xAt(cx, cy, rx, ry, xRotation, angle3) {
return rx * Math.cos(xRotation) * Math.cos(angle3) - ry * Math.sin(xRotation) * Math.sin(angle3) + cx;
}
function yAt(cx, cy, rx, ry, xRotation, angle3) {
return rx * Math.sin(xRotation) * Math.cos(angle3) + ry * Math.cos(xRotation) * Math.sin(angle3) + cy;
}
function getAngle2(rx, ry, x0, y0) {
var angle3 = Math.atan2(y0 * rx, x0 * ry);
return (angle3 + Math.PI * 2) % (Math.PI * 2);
}
function getPoint(rx, ry, angle3) {
return {
x: rx * Math.cos(angle3),
y: ry * Math.sin(angle3)
};
}
function rotate4(x6, y5, angle3) {
var cos3 = Math.cos(angle3);
var sin3 = Math.sin(angle3);
return [x6 * cos3 - y5 * sin3, x6 * sin3 + y5 * cos3];
}
var arc_default = {
box: function(cx, cy, rx, ry, xRotation, startAngle, endAngle) {
var xDim = xExtrema(rx, ry, xRotation);
var minX = Infinity;
var maxX = -Infinity;
var xs = [startAngle, endAngle];
for (var i4 = -Math.PI * 2; i4 <= Math.PI * 2; i4 += Math.PI) {
var xAngle = xDim + i4;
if (startAngle < endAngle) {
if (startAngle < xAngle && xAngle < endAngle) {
xs.push(xAngle);
}
} else {
if (endAngle < xAngle && xAngle < startAngle) {
xs.push(xAngle);
}
}
}
for (var i4 = 0; i4 < xs.length; i4++) {
var x6 = xAt(cx, cy, rx, ry, xRotation, xs[i4]);
if (x6 < minX) {
minX = x6;
}
if (x6 > maxX) {
maxX = x6;
}
}
var yDim = yExtrema(rx, ry, xRotation);
var minY = Infinity;
var maxY2 = -Infinity;
var ys = [startAngle, endAngle];
for (var i4 = -Math.PI * 2; i4 <= Math.PI * 2; i4 += Math.PI) {
var yAngle = yDim + i4;
if (startAngle < endAngle) {
if (startAngle < yAngle && yAngle < endAngle) {
ys.push(yAngle);
}
} else {
if (endAngle < yAngle && yAngle < startAngle) {
ys.push(yAngle);
}
}
}
for (var i4 = 0; i4 < ys.length; i4++) {
var y5 = yAt(cx, cy, rx, ry, xRotation, ys[i4]);
if (y5 < minY) {
minY = y5;
}
if (y5 > maxY2) {
maxY2 = y5;
}
}
return {
x: minX,
y: minY,
width: maxX - minX,
height: maxY2 - minY
};
},
length: function(cx, cy, rx, ry, xRotation, startAngle, endAngle) {
},
nearestPoint: function(cx, cy, rx, ry, xRotation, startAngle, endAngle, x0, y0) {
var relativeVector = rotate4(x0 - cx, y0 - cy, -xRotation);
var x1 = relativeVector[0], y1 = relativeVector[1];
var relativePoint = ellipse_default.nearestPoint(0, 0, rx, ry, x1, y1);
var angle3 = getAngle2(rx, ry, relativePoint.x, relativePoint.y);
if (angle3 < startAngle) {
relativePoint = getPoint(rx, ry, startAngle);
} else if (angle3 > endAngle) {
relativePoint = getPoint(rx, ry, endAngle);
}
var vector = rotate4(relativePoint.x, relativePoint.y, xRotation);
return {
x: vector[0] + cx,
y: vector[1] + cy
};
},
pointDistance: function(cx, cy, rx, ry, xRotation, startAngle, endAngle, x0, y0) {
var nearestPoint2 = this.nearestPoint(cx, cy, rx, ry, x0, y0);
return distance4(nearestPoint2.x, nearestPoint2.y, x0, y0);
},
pointAt: function(cx, cy, rx, ry, xRotation, startAngle, endAngle, t4) {
var angle3 = (endAngle - startAngle) * t4 + startAngle;
return {
x: xAt(cx, cy, rx, ry, xRotation, angle3),
y: yAt(cx, cy, rx, ry, xRotation, angle3)
};
},
tangentAngle: function(cx, cy, rx, ry, xRotation, startAngle, endAngle, t4) {
var angle3 = (endAngle - startAngle) * t4 + startAngle;
var dx = derivativeXAt(cx, cy, rx, ry, xRotation, startAngle, endAngle, angle3);
var dy = derivativeYAt(cx, cy, rx, ry, xRotation, startAngle, endAngle, angle3);
return piMod(Math.atan2(dy, dx));
}
};
// node_modules/@antv/g-math/esm/segments.js
function analyzePoints(points) {
var totalLength = 0;
var segments = [];
for (var i4 = 0; i4 < points.length - 1; i4++) {
var from = points[i4];
var to = points[i4 + 1];
var length_1 = distance4(from[0], from[1], to[0], to[1]);
var seg = {
from,
to,
length: length_1
};
segments.push(seg);
totalLength += length_1;
}
return { segments, totalLength };
}
function lengthOfSegment(points) {
if (points.length < 2) {
return 0;
}
var totalLength = 0;
for (var i4 = 0; i4 < points.length - 1; i4++) {
var from = points[i4];
var to = points[i4 + 1];
totalLength += distance4(from[0], from[1], to[0], to[1]);
}
return totalLength;
}
function pointAtSegments(points, t4) {
if (t4 > 1 || t4 < 0 || points.length < 2) {
return null;
}
var _a6 = analyzePoints(points), segments = _a6.segments, totalLength = _a6.totalLength;
if (totalLength === 0) {
return {
x: points[0][0],
y: points[0][1]
};
}
var startRatio = 0;
var point2 = null;
for (var i4 = 0; i4 < segments.length; i4++) {
var seg = segments[i4];
var from = seg.from, to = seg.to;
var currentRatio = seg.length / totalLength;
if (t4 >= startRatio && t4 <= startRatio + currentRatio) {
var localRatio = (t4 - startRatio) / currentRatio;
point2 = line_default.pointAt(from[0], from[1], to[0], to[1], localRatio);
break;
}
startRatio += currentRatio;
}
return point2;
}
function angleAtSegments(points, t4) {
if (t4 > 1 || t4 < 0 || points.length < 2) {
return 0;
}
var _a6 = analyzePoints(points), segments = _a6.segments, totalLength = _a6.totalLength;
var startRatio = 0;
var angle3 = 0;
for (var i4 = 0; i4 < segments.length; i4++) {
var seg = segments[i4];
var from = seg.from, to = seg.to;
var currentRatio = seg.length / totalLength;
if (t4 >= startRatio && t4 <= startRatio + currentRatio) {
angle3 = Math.atan2(to[1] - from[1], to[0] - from[0]);
break;
}
startRatio += currentRatio;
}
return angle3;
}
function distanceAtSegment(points, x6, y5) {
var minDistance = Infinity;
for (var i4 = 0; i4 < points.length - 1; i4++) {
var point2 = points[i4];
var nextPoint = points[i4 + 1];
var distance_1 = line_default.pointDistance(point2[0], point2[1], nextPoint[0], nextPoint[1], x6, y5);
if (distance_1 < minDistance) {
minDistance = distance_1;
}
}
return minDistance;
}
// node_modules/@antv/g-math/esm/polyline.js
var polyline_default = {
box: function(points) {
var xArr = [];
var yArr = [];
for (var i4 = 0; i4 < points.length; i4++) {
var point2 = points[i4];
xArr.push(point2[0]);
yArr.push(point2[1]);
}
return getBBoxByArray(xArr, yArr);
},
length: function(points) {
return lengthOfSegment(points);
},
pointAt: function(points, t4) {
return pointAtSegments(points, t4);
},
pointDistance: function(points, x6, y5) {
return distanceAtSegment(points, x6, y5);
},
tangentAngle: function(points, t4) {
return angleAtSegments(points, t4);
}
};
// node_modules/@antv/g-base/esm/bbox/util.js
function mergeBBox(bbox1, bbox2) {
if (!bbox1 || !bbox2) {
return bbox1 || bbox2;
}
return {
minX: Math.min(bbox1.minX, bbox2.minX),
minY: Math.min(bbox1.minY, bbox2.minY),
maxX: Math.max(bbox1.maxX, bbox2.maxX),
maxY: Math.max(bbox1.maxY, bbox2.maxY)
};
}
function mergeArrowBBox(shape, bbox) {
var startArrowShape = shape.get("startArrowShape");
var endArrowShape = shape.get("endArrowShape");
var startArrowBBox = null;
var endArrowBBox = null;
if (startArrowShape) {
startArrowBBox = startArrowShape.getCanvasBBox();
bbox = mergeBBox(bbox, startArrowBBox);
}
if (endArrowShape) {
endArrowBBox = endArrowShape.getCanvasBBox();
bbox = mergeBBox(bbox, endArrowBBox);
}
return bbox;
}
// node_modules/@antv/g-base/esm/bbox/polyline.js
function polyline_default2(shape) {
var attrs = shape.attr();
var points = attrs.points;
var xArr = [];
var yArr = [];
for (var i4 = 0; i4 < points.length; i4++) {
var point2 = points[i4];
xArr.push(point2[0]);
yArr.push(point2[1]);
}
var _a6 = util_exports.getBBoxByArray(xArr, yArr), x6 = _a6.x, y5 = _a6.y, width2 = _a6.width, height = _a6.height;
var bbox = {
minX: x6,
minY: y5,
maxX: x6 + width2,
maxY: y5 + height
};
bbox = mergeArrowBBox(shape, bbox);
return {
x: bbox.minX,
y: bbox.minY,
width: bbox.maxX - bbox.minX,
height: bbox.maxY - bbox.minY
};
}
// node_modules/@antv/g-base/esm/bbox/polygon.js
function polygon_default2(shape) {
var attrs = shape.attr();
var points = attrs.points;
var xArr = [];
var yArr = [];
for (var i4 = 0; i4 < points.length; i4++) {
var point2 = points[i4];
xArr.push(point2[0]);
yArr.push(point2[1]);
}
return util_exports.getBBoxByArray(xArr, yArr);
}
// node_modules/@antv/g-base/esm/util/offscreen.js
var offScreenCtx = null;
function getOffScreenContext() {
if (!offScreenCtx) {
var canvas = document.createElement("canvas");
canvas.width = 1;
canvas.height = 1;
offScreenCtx = canvas.getContext("2d");
}
return offScreenCtx;
}
// node_modules/@antv/g-base/esm/util/text.js
function getTextHeight(text, fontSize, lineHeight) {
var lineCount = 1;
if (is_string_default(text)) {
lineCount = text.split("\n").length;
}
if (lineCount > 1) {
var spaceingY = getLineSpaceing(fontSize, lineHeight);
return fontSize * lineCount + spaceingY * (lineCount - 1);
}
return fontSize;
}
function getLineSpaceing(fontSize, lineHeight) {
return lineHeight ? lineHeight - fontSize : fontSize * 0.14;
}
function getTextWidth(text, font) {
var context = getOffScreenContext();
var width2 = 0;
if (is_nil_default(text) || text === "") {
return width2;
}
context.save();
context.font = font;
if (is_string_default(text) && text.includes("\n")) {
var textArr = text.split("\n");
each_default(textArr, function(subText) {
var measureWidth = context.measureText(subText).width;
if (width2 < measureWidth) {
width2 = measureWidth;
}
});
} else {
width2 = context.measureText(text).width;
}
context.restore();
return width2;
}
function assembleFont(attrs) {
var fontSize = attrs.fontSize, fontFamily = attrs.fontFamily, fontWeight = attrs.fontWeight, fontStyle = attrs.fontStyle, fontVariant = attrs.fontVariant;
return [fontStyle, fontVariant, fontWeight, fontSize + "px", fontFamily].join(" ").trim();
}
// node_modules/@antv/g-base/esm/bbox/text.js
function text_default(shape) {
var attrs = shape.attr();
var x6 = attrs.x, y5 = attrs.y, text = attrs.text, fontSize = attrs.fontSize, lineHeight = attrs.lineHeight;
var font = attrs.font;
if (!font) {
font = assembleFont(attrs);
}
var width2 = getTextWidth(text, font);
var bbox;
if (!width2) {
bbox = {
x: x6,
y: y5,
width: 0,
height: 0
};
} else {
var textAlign = attrs.textAlign, textBaseline = attrs.textBaseline;
var height = getTextHeight(text, fontSize, lineHeight);
var point2 = {
x: x6,
y: y5 - height
};
if (textAlign) {
if (textAlign === "end" || textAlign === "right") {
point2.x -= width2;
} else if (textAlign === "center") {
point2.x -= width2 / 2;
}
}
if (textBaseline) {
if (textBaseline === "top") {
point2.y += height;
} else if (textBaseline === "middle") {
point2.y += height / 2;
}
}
bbox = {
x: point2.x,
y: point2.y,
width: width2,
height
};
}
return bbox;
}
// node_modules/@antv/path-util/esm/parse-path.js
var regexTags = /[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/ig;
var regexDot = /[^\s\,]+/ig;
function parsePath(p4) {
var path = p4 || [];
if (is_array_default(path)) {
return path;
}
if (is_string_default(path)) {
path = path.match(regexTags);
each_default(path, function(item, index2) {
item = item.match(regexDot);
if (item[0].length > 1) {
var tag = item[0].charAt(0);
item.splice(1, 0, item[0].substr(1));
item[0] = tag;
}
each_default(item, function(sub6, i4) {
if (!isNaN(sub6)) {
item[i4] = +sub6;
}
});
path[index2] = item;
});
return path;
}
}
var parse_path_default = parsePath;
// node_modules/@antv/path-util/esm/catmull-rom-2-bezier.js
function smoothBezier(points, smooth, isLoop, constraint) {
var cps = [];
var hasConstraint = !!constraint;
var prevPoint;
var nextPoint;
var min7;
var max8;
var nextCp0;
var cp1;
var cp0;
if (hasConstraint) {
min7 = constraint[0], max8 = constraint[1];
for (var i4 = 0, l4 = points.length; i4 < l4; i4 += 1) {
var point2 = points[i4];
min7 = vec2_exports.min([0, 0], min7, point2);
max8 = vec2_exports.max([0, 0], max8, point2);
}
}
for (var i4 = 0, len5 = points.length; i4 < len5; i4 += 1) {
var point2 = points[i4];
if (i4 === 0 && !isLoop) {
cp0 = point2;
} else if (i4 === len5 - 1 && !isLoop) {
cp1 = point2;
cps.push(cp0);
cps.push(cp1);
} else {
var prevIdx = [i4 ? i4 - 1 : len5 - 1, i4 - 1][isLoop ? 0 : 1];
prevPoint = points[prevIdx];
nextPoint = points[isLoop ? (i4 + 1) % len5 : i4 + 1];
var v3 = [0, 0];
v3 = vec2_exports.sub(v3, nextPoint, prevPoint);
v3 = vec2_exports.scale(v3, v3, smooth);
var d0 = vec2_exports.distance(point2, prevPoint);
var d1 = vec2_exports.distance(point2, nextPoint);
var sum = d0 + d1;
if (sum !== 0) {
d0 /= sum;
d1 /= sum;
}
var v1 = vec2_exports.scale([0, 0], v3, -d0);
var v22 = vec2_exports.scale([0, 0], v3, d1);
cp1 = vec2_exports.add([0, 0], point2, v1);
nextCp0 = vec2_exports.add([0, 0], point2, v22);
nextCp0 = vec2_exports.min([0, 0], nextCp0, vec2_exports.max([0, 0], nextPoint, point2));
nextCp0 = vec2_exports.max([0, 0], nextCp0, vec2_exports.min([0, 0], nextPoint, point2));
v1 = vec2_exports.sub([0, 0], nextCp0, point2);
v1 = vec2_exports.scale([0, 0], v1, -d0 / d1);
cp1 = vec2_exports.add([0, 0], point2, v1);
cp1 = vec2_exports.min([0, 0], cp1, vec2_exports.max([0, 0], prevPoint, point2));
cp1 = vec2_exports.max([0, 0], cp1, vec2_exports.min([0, 0], prevPoint, point2));
v22 = vec2_exports.sub([0, 0], point2, cp1);
v22 = vec2_exports.scale([0, 0], v22, d1 / d0);
nextCp0 = vec2_exports.add([0, 0], point2, v22);
if (hasConstraint) {
cp1 = vec2_exports.max([0, 0], cp1, min7);
cp1 = vec2_exports.min([0, 0], cp1, max8);
nextCp0 = vec2_exports.max([0, 0], nextCp0, min7);
nextCp0 = vec2_exports.min([0, 0], nextCp0, max8);
}
cps.push(cp0);
cps.push(cp1);
cp0 = nextCp0;
}
}
if (isLoop) {
cps.push(cps.shift());
}
return cps;
}
function catmullRom2Bezier(crp, z3, constraint) {
if (z3 === void 0) {
z3 = false;
}
if (constraint === void 0) {
constraint = [
[0, 0],
[1, 1]
];
}
var isLoop = !!z3;
var pointList = [];
for (var i4 = 0, l4 = crp.length; i4 < l4; i4 += 2) {
pointList.push([crp[i4], crp[i4 + 1]]);
}
var controlPointList = smoothBezier(pointList, 0.4, isLoop, constraint);
var len5 = pointList.length;
var d1 = [];
var cp1;
var cp2;
var p4;
for (var i4 = 0; i4 < len5 - 1; i4 += 1) {
cp1 = controlPointList[i4 * 2];
cp2 = controlPointList[i4 * 2 + 1];
p4 = pointList[i4 + 1];
d1.push(["C", cp1[0], cp1[1], cp2[0], cp2[1], p4[0], p4[1]]);
}
if (isLoop) {
cp1 = controlPointList[len5];
cp2 = controlPointList[len5 + 1];
p4 = pointList[0];
d1.push(["C", cp1[0], cp1[1], cp2[0], cp2[1], p4[0], p4[1]]);
}
return d1;
}
var catmull_rom_2_bezier_default = catmullRom2Bezier;
// node_modules/@antv/path-util/esm/parse-path-string.js
var SPACES2 = " \n\v\f\r \xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029";
var PATH_COMMAND2 = new RegExp("([a-z])[" + SPACES2 + ",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[" + SPACES2 + "]*,?[" + SPACES2 + "]*)+)", "ig");
var PATH_VALUES2 = new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[" + SPACES2 + "]*,?[" + SPACES2 + "]*", "ig");
function parsePathString2(pathString) {
if (!pathString) {
return null;
}
if (is_array_default(pathString)) {
return pathString;
}
var paramCounts = {
a: 7,
c: 6,
o: 2,
h: 1,
l: 2,
m: 2,
r: 4,
q: 4,
s: 4,
t: 2,
v: 1,
u: 3,
z: 0
};
var data3 = [];
String(pathString).replace(PATH_COMMAND2, function(a4, b10, c5) {
var params = [];
var name = b10.toLowerCase();
c5.replace(PATH_VALUES2, function(a5, b11) {
b11 && params.push(+b11);
});
if (name === "m" && params.length > 2) {
data3.push([b10].concat(params.splice(0, 2)));
name = "l";
b10 = b10 === "m" ? "l" : "L";
}
if (name === "o" && params.length === 1) {
data3.push([b10, params[0]]);
}
if (name === "r") {
data3.push([b10].concat(params));
} else {
while (params.length >= paramCounts[name]) {
data3.push([b10].concat(params.splice(0, paramCounts[name])));
if (!paramCounts[name]) {
break;
}
}
}
return "";
});
return data3;
}
// node_modules/@antv/path-util/esm/path-2-absolute.js
var REGEX_MD = /[a-z]/;
function toSymmetry(p4, c5) {
return [
c5[0] + (c5[0] - p4[0]),
c5[1] + (c5[1] - p4[1])
];
}
function pathToAbsolute2(pathString) {
var pathArray = parsePathString2(pathString);
if (!pathArray || !pathArray.length) {
return [
["M", 0, 0]
];
}
var needProcess = false;
for (var i4 = 0; i4 < pathArray.length; i4++) {
var cmd = pathArray[i4][0];
if (REGEX_MD.test(cmd) || ["V", "H", "T", "S"].indexOf(cmd) >= 0) {
needProcess = true;
break;
}
}
if (!needProcess) {
return pathArray;
}
var res = [];
var x6 = 0;
var y5 = 0;
var mx = 0;
var my = 0;
var start = 0;
var pa0;
var dots;
var first = pathArray[0];
if (first[0] === "M" || first[0] === "m") {
x6 = +first[1];
y5 = +first[2];
mx = x6;
my = y5;
start++;
res[0] = ["M", x6, y5];
}
for (var i4 = start, ii = pathArray.length; i4 < ii; i4++) {
var pa = pathArray[i4];
var preParams = res[i4 - 1];
var r4 = [];
var cmd = pa[0];
var upCmd = cmd.toUpperCase();
if (cmd !== upCmd) {
r4[0] = upCmd;
switch (upCmd) {
case "A":
r4[1] = pa[1];
r4[2] = pa[2];
r4[3] = pa[3];
r4[4] = pa[4];
r4[5] = pa[5];
r4[6] = +pa[6] + x6;
r4[7] = +pa[7] + y5;
break;
case "V":
r4[1] = +pa[1] + y5;
break;
case "H":
r4[1] = +pa[1] + x6;
break;
case "M":
mx = +pa[1] + x6;
my = +pa[2] + y5;
r4[1] = mx;
r4[2] = my;
break;
default:
for (var j4 = 1, jj = pa.length; j4 < jj; j4++) {
r4[j4] = +pa[j4] + (j4 % 2 ? x6 : y5);
}
}
} else {
r4 = pathArray[i4];
}
switch (upCmd) {
case "Z":
x6 = +mx;
y5 = +my;
break;
case "H":
x6 = r4[1];
r4 = ["L", x6, y5];
break;
case "V":
y5 = r4[1];
r4 = ["L", x6, y5];
break;
case "T":
x6 = r4[1];
y5 = r4[2];
var symetricT = toSymmetry([preParams[1], preParams[2]], [preParams[3], preParams[4]]);
r4 = ["Q", symetricT[0], symetricT[1], x6, y5];
break;
case "S":
x6 = r4[r4.length - 2];
y5 = r4[r4.length - 1];
var length_1 = preParams.length;
var symetricS = toSymmetry([preParams[length_1 - 4], preParams[length_1 - 3]], [preParams[length_1 - 2], preParams[length_1 - 1]]);
r4 = ["C", symetricS[0], symetricS[1], r4[1], r4[2], x6, y5];
break;
case "M":
mx = r4[r4.length - 2];
my = r4[r4.length - 1];
break;
default:
x6 = r4[r4.length - 2];
y5 = r4[r4.length - 1];
}
res.push(r4);
}
return res;
}
// node_modules/@antv/path-util/esm/process/arc-2-cubic.js
var TAU = Math.PI * 2;
// node_modules/@antv/path-util/esm/get-arc-params.js
function vMag(v3) {
return Math.sqrt(v3[0] * v3[0] + v3[1] * v3[1]);
}
function vRatio(u3, v3) {
return vMag(u3) * vMag(v3) ? (u3[0] * v3[0] + u3[1] * v3[1]) / (vMag(u3) * vMag(v3)) : 1;
}
function vAngle(u3, v3) {
return (u3[0] * v3[1] < u3[1] * v3[0] ? -1 : 1) * Math.acos(vRatio(u3, v3));
}
function isSamePoint(point1, point2) {
return point1[0] === point2[0] && point1[1] === point2[1];
}
function getArcParams(startPoint, params) {
var rx = params[1];
var ry = params[2];
var xRotation = mod_default(to_radian_default(params[3]), Math.PI * 2);
var arcFlag = params[4];
var sweepFlag = params[5];
var x1 = startPoint[0];
var y1 = startPoint[1];
var x22 = params[6];
var y22 = params[7];
var xp = Math.cos(xRotation) * (x1 - x22) / 2 + Math.sin(xRotation) * (y1 - y22) / 2;
var yp = -1 * Math.sin(xRotation) * (x1 - x22) / 2 + Math.cos(xRotation) * (y1 - y22) / 2;
var lambda = xp * xp / (rx * rx) + yp * yp / (ry * ry);
if (lambda > 1) {
rx *= Math.sqrt(lambda);
ry *= Math.sqrt(lambda);
}
var diff2 = rx * rx * (yp * yp) + ry * ry * (xp * xp);
var f3 = diff2 ? Math.sqrt((rx * rx * (ry * ry) - diff2) / diff2) : 1;
if (arcFlag === sweepFlag) {
f3 *= -1;
}
if (isNaN(f3)) {
f3 = 0;
}
var cxp = ry ? f3 * rx * yp / ry : 0;
var cyp = rx ? f3 * -ry * xp / rx : 0;
var cx = (x1 + x22) / 2 + Math.cos(xRotation) * cxp - Math.sin(xRotation) * cyp;
var cy = (y1 + y22) / 2 + Math.sin(xRotation) * cxp + Math.cos(xRotation) * cyp;
var u3 = [(xp - cxp) / rx, (yp - cyp) / ry];
var v3 = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry];
var theta = vAngle([1, 0], u3);
var dTheta = vAngle(u3, v3);
if (vRatio(u3, v3) <= -1) {
dTheta = Math.PI;
}
if (vRatio(u3, v3) >= 1) {
dTheta = 0;
}
if (sweepFlag === 0 && dTheta > 0) {
dTheta = dTheta - 2 * Math.PI;
}
if (sweepFlag === 1 && dTheta < 0) {
dTheta = dTheta + 2 * Math.PI;
}
return {
cx,
cy,
rx: isSamePoint(startPoint, [x22, y22]) ? 0 : rx,
ry: isSamePoint(startPoint, [x22, y22]) ? 0 : ry,
startAngle: theta,
endAngle: theta + dTheta,
xRotation,
arcFlag,
sweepFlag
};
}
// node_modules/@antv/path-util/esm/path-2-segments.js
function toSymmetry2(point2, center2) {
return [center2[0] + (center2[0] - point2[0]), center2[1] + (center2[1] - point2[1])];
}
function getSegments(path) {
path = parse_path_default(path);
var segments = [];
var currentPoint = null;
var nextParams = null;
var startMovePoint = null;
var lastStartMovePointIndex = 0;
var count2 = path.length;
for (var i4 = 0; i4 < count2; i4++) {
var params = path[i4];
nextParams = path[i4 + 1];
var command = params[0];
var segment = {
command,
prePoint: currentPoint,
params,
startTangent: null,
endTangent: null
};
switch (command) {
case "M":
startMovePoint = [params[1], params[2]];
lastStartMovePointIndex = i4;
break;
case "A":
var arcParams = getArcParams(currentPoint, params);
segment["arcParams"] = arcParams;
break;
default:
break;
}
if (command === "Z") {
currentPoint = startMovePoint;
nextParams = path[lastStartMovePointIndex + 1];
} else {
var len5 = params.length;
currentPoint = [params[len5 - 2], params[len5 - 1]];
}
if (nextParams && nextParams[0] === "Z") {
nextParams = path[lastStartMovePointIndex];
if (segments[lastStartMovePointIndex]) {
segments[lastStartMovePointIndex].prePoint = currentPoint;
}
}
segment["currentPoint"] = currentPoint;
if (segments[lastStartMovePointIndex] && isSamePoint(currentPoint, segments[lastStartMovePointIndex].currentPoint)) {
segments[lastStartMovePointIndex].prePoint = segment.prePoint;
}
var nextPoint = nextParams ? [nextParams[nextParams.length - 2], nextParams[nextParams.length - 1]] : null;
segment["nextPoint"] = nextPoint;
var prePoint = segment.prePoint;
if (["L", "H", "V"].includes(command)) {
segment.startTangent = [prePoint[0] - currentPoint[0], prePoint[1] - currentPoint[1]];
segment.endTangent = [currentPoint[0] - prePoint[0], currentPoint[1] - prePoint[1]];
} else if (command === "Q") {
var cp = [params[1], params[2]];
segment.startTangent = [prePoint[0] - cp[0], prePoint[1] - cp[1]];
segment.endTangent = [currentPoint[0] - cp[0], currentPoint[1] - cp[1]];
} else if (command === "T") {
var preSegment = segments[i4 - 1];
var cp = toSymmetry2(preSegment.currentPoint, prePoint);
if (preSegment.command === "Q") {
segment.command = "Q";
segment.startTangent = [prePoint[0] - cp[0], prePoint[1] - cp[1]];
segment.endTangent = [currentPoint[0] - cp[0], currentPoint[1] - cp[1]];
} else {
segment.command = "TL";
segment.startTangent = [prePoint[0] - currentPoint[0], prePoint[1] - currentPoint[1]];
segment.endTangent = [currentPoint[0] - prePoint[0], currentPoint[1] - prePoint[1]];
}
} else if (command === "C") {
var cp1 = [params[1], params[2]];
var cp2 = [params[3], params[4]];
segment.startTangent = [prePoint[0] - cp1[0], prePoint[1] - cp1[1]];
segment.endTangent = [currentPoint[0] - cp2[0], currentPoint[1] - cp2[1]];
if (segment.startTangent[0] === 0 && segment.startTangent[1] === 0) {
segment.startTangent = [cp1[0] - cp2[0], cp1[1] - cp2[1]];
}
if (segment.endTangent[0] === 0 && segment.endTangent[1] === 0) {
segment.endTangent = [cp2[0] - cp1[0], cp2[1] - cp1[1]];
}
} else if (command === "S") {
var preSegment = segments[i4 - 1];
var cp1 = toSymmetry2(preSegment.currentPoint, prePoint);
var cp2 = [params[1], params[2]];
if (preSegment.command === "C") {
segment.command = "C";
segment.startTangent = [prePoint[0] - cp1[0], prePoint[1] - cp1[1]];
segment.endTangent = [currentPoint[0] - cp2[0], currentPoint[1] - cp2[1]];
} else {
segment.command = "SQ";
segment.startTangent = [prePoint[0] - cp2[0], prePoint[1] - cp2[1]];
segment.endTangent = [currentPoint[0] - cp2[0], currentPoint[1] - cp2[1]];
}
} else if (command === "A") {
var d3 = 1e-3;
var _a6 = segment["arcParams"] || {}, _b = _a6.cx, cx = _b === void 0 ? 0 : _b, _c = _a6.cy, cy = _c === void 0 ? 0 : _c, _d = _a6.rx, rx = _d === void 0 ? 0 : _d, _e = _a6.ry, ry = _e === void 0 ? 0 : _e, _f = _a6.sweepFlag, sweepFlag = _f === void 0 ? 0 : _f, _g = _a6.startAngle, startAngle = _g === void 0 ? 0 : _g, _h = _a6.endAngle, endAngle = _h === void 0 ? 0 : _h;
if (sweepFlag === 0) {
d3 *= -1;
}
var dx1 = rx * Math.cos(startAngle - d3) + cx;
var dy1 = ry * Math.sin(startAngle - d3) + cy;
segment.startTangent = [dx1 - startMovePoint[0], dy1 - startMovePoint[1]];
var dx2 = rx * Math.cos(startAngle + endAngle + d3) + cx;
var dy2 = ry * Math.sin(startAngle + endAngle - d3) + cy;
segment.endTangent = [prePoint[0] - dx2, prePoint[1] - dy2];
}
segments.push(segment);
}
return segments;
}
// node_modules/@antv/path-util/esm/get-line-intersect.js
var isBetween = function(value2, min7, max8) {
return value2 >= min7 && value2 <= max8;
};
function getLineIntersect(p0, p1, p22, p32) {
var tolerance3 = 1e-3;
var E2 = {
x: p22.x - p0.x,
y: p22.y - p0.y
};
var D0 = {
x: p1.x - p0.x,
y: p1.y - p0.y
};
var D1 = {
x: p32.x - p22.x,
y: p32.y - p22.y
};
var kross = D0.x * D1.y - D0.y * D1.x;
var sqrKross = kross * kross;
var sqrLen0 = D0.x * D0.x + D0.y * D0.y;
var sqrLen1 = D1.x * D1.x + D1.y * D1.y;
var point2 = null;
if (sqrKross > tolerance3 * sqrLen0 * sqrLen1) {
var s4 = (E2.x * D1.y - E2.y * D1.x) / kross;
var t4 = (E2.x * D0.y - E2.y * D0.x) / kross;
if (isBetween(s4, 0, 1) && isBetween(t4, 0, 1)) {
point2 = {
x: p0.x + s4 * D0.x,
y: p0.y + s4 * D0.y
};
}
}
return point2;
}
// node_modules/@antv/path-util/esm/point-in-polygon.js
var tolerance = 1e-6;
function dcmp(x6) {
if (Math.abs(x6) < tolerance) {
return 0;
}
return x6 < 0 ? -1 : 1;
}
function onSegment(p1, p22, q4) {
if ((q4[0] - p1[0]) * (p22[1] - p1[1]) === (p22[0] - p1[0]) * (q4[1] - p1[1]) && Math.min(p1[0], p22[0]) <= q4[0] && q4[0] <= Math.max(p1[0], p22[0]) && Math.min(p1[1], p22[1]) <= q4[1] && q4[1] <= Math.max(p1[1], p22[1])) {
return true;
}
return false;
}
function isInPolygon(points, x6, y5) {
var isHit = false;
var n3 = points.length;
if (n3 <= 2) {
return false;
}
for (var i4 = 0; i4 < n3; i4++) {
var p1 = points[i4];
var p22 = points[(i4 + 1) % n3];
if (onSegment(p1, p22, [x6, y5])) {
return true;
}
if (dcmp(p1[1] - y5) > 0 !== dcmp(p22[1] - y5) > 0 && dcmp(x6 - (y5 - p1[1]) * (p1[0] - p22[0]) / (p1[1] - p22[1]) - p1[0]) < 0) {
isHit = !isHit;
}
}
return isHit;
}
// node_modules/@antv/path-util/esm/is-polygons-intersect.js
function parseToLines(points) {
var lines = [];
var count2 = points.length;
for (var i4 = 0; i4 < count2 - 1; i4++) {
var point2 = points[i4];
var next = points[i4 + 1];
lines.push({
from: {
x: point2[0],
y: point2[1]
},
to: {
x: next[0],
y: next[1]
}
});
}
if (lines.length > 1) {
var first = points[0];
var last2 = points[count2 - 1];
lines.push({
from: {
x: last2[0],
y: last2[1]
},
to: {
x: first[0],
y: first[1]
}
});
}
return lines;
}
function lineIntersectPolygon(lines, line2) {
var isIntersect2 = false;
each_default(lines, function(l4) {
if (getLineIntersect(l4.from, l4.to, line2.from, line2.to)) {
isIntersect2 = true;
return false;
}
});
return isIntersect2;
}
function getBBox(points) {
var xArr = points.map(function(p4) {
return p4[0];
});
var yArr = points.map(function(p4) {
return p4[1];
});
return {
minX: Math.min.apply(null, xArr),
maxX: Math.max.apply(null, xArr),
minY: Math.min.apply(null, yArr),
maxY: Math.max.apply(null, yArr)
};
}
function intersectBBox(box1, box2) {
return !(box2.minX > box1.maxX || box2.maxX < box1.minX || box2.minY > box1.maxY || box2.maxY < box1.minY);
}
function isPolygonsIntersect(points1, points2) {
if (points1.length < 2 || points2.length < 2) {
return false;
}
var bbox1 = getBBox(points1);
var bbox2 = getBBox(points2);
if (!intersectBBox(bbox1, bbox2)) {
return false;
}
var isIn = false;
each_default(points2, function(point2) {
if (isInPolygon(points1, point2[0], point2[1])) {
isIn = true;
return false;
}
});
if (isIn) {
return true;
}
each_default(points1, function(point2) {
if (isInPolygon(points2, point2[0], point2[1])) {
isIn = true;
return false;
}
});
if (isIn) {
return true;
}
var lines1 = parseToLines(points1);
var lines2 = parseToLines(points2);
var isIntersect2 = false;
each_default(lines2, function(line2) {
if (lineIntersectPolygon(lines1, line2)) {
isIntersect2 = true;
return false;
}
});
return isIntersect2;
}
// node_modules/@antv/g-base/esm/bbox/path.js
function getPathBox(segments, lineWidth) {
var xArr = [];
var yArr = [];
var segmentsWithAngle = [];
for (var i4 = 0; i4 < segments.length; i4++) {
var segment = segments[i4];
var currentPoint = segment.currentPoint, params = segment.params, prePoint = segment.prePoint;
var box2 = void 0;
switch (segment.command) {
case "Q":
box2 = quadratic_default.box(prePoint[0], prePoint[1], params[1], params[2], params[3], params[4]);
break;
case "C":
box2 = cubic_default.box(prePoint[0], prePoint[1], params[1], params[2], params[3], params[4], params[5], params[6]);
break;
case "A":
var arcParams = segment.arcParams;
box2 = arc_default.box(arcParams.cx, arcParams.cy, arcParams.rx, arcParams.ry, arcParams.xRotation, arcParams.startAngle, arcParams.endAngle);
break;
default:
xArr.push(currentPoint[0]);
yArr.push(currentPoint[1]);
break;
}
if (box2) {
segment.box = box2;
xArr.push(box2.x, box2.x + box2.width);
yArr.push(box2.y, box2.y + box2.height);
}
if (lineWidth && (segment.command === "L" || segment.command === "M") && segment.prePoint && segment.nextPoint) {
segmentsWithAngle.push(segment);
}
}
xArr = xArr.filter(function(item) {
return !Number.isNaN(item);
});
yArr = yArr.filter(function(item) {
return !Number.isNaN(item);
});
var minX = min_default(xArr);
var minY = min_default(yArr);
var maxX = max_default(xArr);
var maxY2 = max_default(yArr);
if (segmentsWithAngle.length === 0) {
return {
x: minX,
y: minY,
width: maxX - minX,
height: maxY2 - minY
};
}
for (var i4 = 0; i4 < segmentsWithAngle.length; i4++) {
var segment = segmentsWithAngle[i4];
var currentPoint = segment.currentPoint;
var extra = void 0;
if (currentPoint[0] === minX) {
extra = getExtraFromSegmentWithAngle(segment, lineWidth);
minX = minX - extra.xExtra;
} else if (currentPoint[0] === maxX) {
extra = getExtraFromSegmentWithAngle(segment, lineWidth);
maxX = maxX + extra.xExtra;
}
if (currentPoint[1] === minY) {
extra = getExtraFromSegmentWithAngle(segment, lineWidth);
minY = minY - extra.yExtra;
} else if (currentPoint[1] === maxY2) {
extra = getExtraFromSegmentWithAngle(segment, lineWidth);
maxY2 = maxY2 + extra.yExtra;
}
}
return {
x: minX,
y: minY,
width: maxX - minX,
height: maxY2 - minY
};
}
function getExtraFromSegmentWithAngle(segment, lineWidth) {
var prePoint = segment.prePoint, currentPoint = segment.currentPoint, nextPoint = segment.nextPoint;
var currentAndPre = Math.pow(currentPoint[0] - prePoint[0], 2) + Math.pow(currentPoint[1] - prePoint[1], 2);
var currentAndNext = Math.pow(currentPoint[0] - nextPoint[0], 2) + Math.pow(currentPoint[1] - nextPoint[1], 2);
var preAndNext = Math.pow(prePoint[0] - nextPoint[0], 2) + Math.pow(prePoint[1] - nextPoint[1], 2);
var currentAngle = Math.acos((currentAndPre + currentAndNext - preAndNext) / (2 * Math.sqrt(currentAndPre) * Math.sqrt(currentAndNext)));
if (!currentAngle || Math.sin(currentAngle) === 0 || isNumberEqual(currentAngle, 0)) {
return {
xExtra: 0,
yExtra: 0
};
}
var xAngle = Math.abs(Math.atan2(nextPoint[1] - currentPoint[1], nextPoint[0] - currentPoint[0]));
var yAngle = Math.abs(Math.atan2(nextPoint[0] - currentPoint[0], nextPoint[1] - currentPoint[1]));
xAngle = xAngle > Math.PI / 2 ? Math.PI - xAngle : xAngle;
yAngle = yAngle > Math.PI / 2 ? Math.PI - yAngle : yAngle;
var extra = {
xExtra: Math.cos(currentAngle / 2 - xAngle) * (lineWidth / 2 * (1 / Math.sin(currentAngle / 2))) - lineWidth / 2 || 0,
yExtra: Math.cos(yAngle - currentAngle / 2) * (lineWidth / 2 * (1 / Math.sin(currentAngle / 2))) - lineWidth / 2 || 0
};
return extra;
}
function path_default(shape) {
var attrs = shape.attr();
var path = attrs.path, stroke = attrs.stroke;
var lineWidth = stroke ? attrs.lineWidth : 0;
var segments = shape.get("segments") || getSegments(path);
var _a6 = getPathBox(segments, lineWidth), x6 = _a6.x, y5 = _a6.y, width2 = _a6.width, height = _a6.height;
var bbox = {
minX: x6,
minY: y5,
maxX: x6 + width2,
maxY: y5 + height
};
bbox = mergeArrowBBox(shape, bbox);
return {
x: bbox.minX,
y: bbox.minY,
width: bbox.maxX - bbox.minX,
height: bbox.maxY - bbox.minY
};
}
// node_modules/@antv/g-base/esm/bbox/line.js
function line_default2(shape) {
var attrs = shape.attr();
var x1 = attrs.x1, y1 = attrs.y1, x22 = attrs.x2, y22 = attrs.y2;
var minX = Math.min(x1, x22);
var maxX = Math.max(x1, x22);
var minY = Math.min(y1, y22);
var maxY2 = Math.max(y1, y22);
var bbox = {
minX,
maxX,
minY,
maxY: maxY2
};
bbox = mergeArrowBBox(shape, bbox);
return {
x: bbox.minX,
y: bbox.minY,
width: bbox.maxX - bbox.minX,
height: bbox.maxY - bbox.minY
};
}
// node_modules/@antv/g-base/esm/bbox/ellipse.js
function ellipse_default2(shape) {
var attrs = shape.attr();
var x6 = attrs.x, y5 = attrs.y, rx = attrs.rx, ry = attrs.ry;
return {
x: x6 - rx,
y: y5 - ry,
width: rx * 2,
height: ry * 2
};
}
// node_modules/@antv/g-base/esm/bbox/index.js
register("rect", rect_default);
register("image", rect_default);
register("circle", circle_default);
register("marker", circle_default);
register("polyline", polyline_default2);
register("polygon", polygon_default2);
register("text", text_default);
register("path", path_default);
register("line", line_default2);
register("ellipse", ellipse_default2);
// node_modules/@antv/adjust/esm/constant.js
var DEFAULT_Y = 0;
var MARGIN_RATIO = 1 / 2;
var DODGE_RATIO = 1 / 2;
var GAP = 0.05;
// node_modules/@antv/adjust/esm/adjusts/adjust.js
var Adjust = function() {
function Adjust2(cfg) {
var xField = cfg.xField, yField = cfg.yField, _a6 = cfg.adjustNames, adjustNames = _a6 === void 0 ? ["x", "y"] : _a6;
this.adjustNames = adjustNames;
this.xField = xField;
this.yField = yField;
}
Adjust2.prototype.isAdjust = function(dim) {
return this.adjustNames.indexOf(dim) >= 0;
};
Adjust2.prototype.getAdjustRange = function(dim, dimValue, values2) {
var yField = this.yField;
var index2 = values2.indexOf(dimValue);
var length5 = values2.length;
var pre;
var next;
if (!yField && this.isAdjust("y")) {
pre = 0;
next = 1;
} else if (length5 > 1) {
pre = values2[index2 === 0 ? 0 : index2 - 1];
next = values2[index2 === length5 - 1 ? length5 - 1 : index2 + 1];
if (index2 !== 0) {
pre += (dimValue - pre) / 2;
} else {
pre -= (next - dimValue) / 2;
}
if (index2 !== length5 - 1) {
next -= (next - dimValue) / 2;
} else {
next += (dimValue - values2[length5 - 2]) / 2;
}
} else {
pre = dimValue === 0 ? 0 : dimValue - 0.5;
next = dimValue === 0 ? 1 : dimValue + 0.5;
}
return {
pre,
next
};
};
Adjust2.prototype.adjustData = function(groupedDataArray, mergedData) {
var _this = this;
var dimValuesMap = this.getDimValues(mergedData);
each_default(groupedDataArray, function(dataArray, index2) {
each_default(dimValuesMap, function(values2, dim) {
_this.adjustDim(dim, values2, dataArray, index2);
});
});
};
Adjust2.prototype.groupData = function(data3, dim) {
each_default(data3, function(record) {
if (record[dim] === void 0) {
record[dim] = DEFAULT_Y;
}
});
return group_by_default(data3, dim);
};
Adjust2.prototype.adjustDim = function(dim, values2, data3, index2) {
};
Adjust2.prototype.getDimValues = function(mergedData) {
var _a6 = this, xField = _a6.xField, yField = _a6.yField;
var dimValuesMap = {};
var dims = [];
if (xField && this.isAdjust("x")) {
dims.push(xField);
}
if (yField && this.isAdjust("y")) {
dims.push(yField);
}
dims.forEach(function(dim2) {
dimValuesMap[dim2] = values_of_key_default(mergedData, dim2).sort(function(v1, v22) {
return v1 - v22;
});
});
if (!yField && this.isAdjust("y")) {
var dim = "y";
dimValuesMap[dim] = [DEFAULT_Y, 1];
}
return dimValuesMap;
};
return Adjust2;
}();
var adjust_default = Adjust;
// node_modules/@antv/adjust/esm/factory.js
var ADJUST_MAP = {};
var getAdjust = function(type2) {
return ADJUST_MAP[type2.toLowerCase()];
};
var registerAdjust = function(type2, ctor) {
if (getAdjust(type2)) {
throw new Error("Adjust type '" + type2 + "' existed.");
}
ADJUST_MAP[type2.toLowerCase()] = ctor;
};
// node_modules/@antv/adjust/node_modules/tslib/modules/index.js
var import_tslib10 = __toModule(require_tslib2());
var {
__extends: __extends2,
__assign: __assign2,
__rest: __rest2,
__decorate: __decorate2,
__param: __param2,
__metadata: __metadata2,
__awaiter: __awaiter2,
__generator: __generator2,
__exportStar: __exportStar2,
__createBinding: __createBinding2,
__values: __values2,
__read: __read2,
__spread: __spread2,
__spreadArrays: __spreadArrays2,
__await: __await2,
__asyncGenerator: __asyncGenerator2,
__asyncDelegator: __asyncDelegator2,
__asyncValues: __asyncValues2,
__makeTemplateObject: __makeTemplateObject2,
__importStar: __importStar2,
__importDefault: __importDefault2,
__classPrivateFieldGet: __classPrivateFieldGet2,
__classPrivateFieldSet: __classPrivateFieldSet2
} = import_tslib10.default;
// node_modules/@antv/adjust/esm/adjusts/dodge.js
var Dodge = function(_super) {
__extends2(Dodge2, _super);
function Dodge2(cfg) {
var _this = _super.call(this, cfg) || this;
_this.cacheMap = {};
_this.adjustDataArray = [];
_this.mergeData = [];
var _a6 = cfg.marginRatio, marginRatio = _a6 === void 0 ? MARGIN_RATIO : _a6, _b = cfg.dodgeRatio, dodgeRatio = _b === void 0 ? DODGE_RATIO : _b, dodgeBy = cfg.dodgeBy, intervalPadding = cfg.intervalPadding, dodgePadding = cfg.dodgePadding, xDimensionLength = cfg.xDimensionLength, groupNum = cfg.groupNum, defaultSize = cfg.defaultSize, maxColumnWidth = cfg.maxColumnWidth, minColumnWidth = cfg.minColumnWidth, columnWidthRatio = cfg.columnWidthRatio;
_this.marginRatio = marginRatio;
_this.dodgeRatio = dodgeRatio;
_this.dodgeBy = dodgeBy;
_this.intervalPadding = intervalPadding;
_this.dodgePadding = dodgePadding;
_this.xDimensionLegenth = xDimensionLength;
_this.groupNum = groupNum;
_this.defaultSize = defaultSize;
_this.maxColumnWidth = maxColumnWidth;
_this.minColumnWidth = minColumnWidth;
_this.columnWidthRatio = columnWidthRatio;
return _this;
}
Dodge2.prototype.process = function(groupDataArray) {
var groupedDataArray = clone_default(groupDataArray);
var mergeData = flatten_default(groupedDataArray);
var dodgeBy = this.dodgeBy;
var adjustDataArray = dodgeBy ? group_default(mergeData, dodgeBy) : groupedDataArray;
this.cacheMap = {};
this.adjustDataArray = adjustDataArray;
this.mergeData = mergeData;
this.adjustData(adjustDataArray, mergeData);
this.adjustDataArray = [];
this.mergeData = [];
return groupedDataArray;
};
Dodge2.prototype.adjustDim = function(dim, values2, data3, frameIndex) {
var _this = this;
var map6 = this.getDistribution(dim);
var groupData = this.groupData(data3, dim);
each_default(groupData, function(group2, key) {
var range;
if (values2.length === 1) {
range = {
pre: values2[0] - 1,
next: values2[0] + 1
};
} else {
range = _this.getAdjustRange(dim, parseFloat(key), values2);
}
each_default(group2, function(d3) {
var value2 = d3[dim];
var valueArr = map6[value2];
var valIndex = valueArr.indexOf(frameIndex);
d3[dim] = _this.getDodgeOffset(range, valIndex, valueArr.length);
});
});
return [];
};
Dodge2.prototype.getDodgeOffset = function(range, idx, len5) {
var _a6 = this, dodgeRatio = _a6.dodgeRatio, marginRatio = _a6.marginRatio, intervalPadding = _a6.intervalPadding, dodgePadding = _a6.dodgePadding;
var pre = range.pre, next = range.next;
var tickLength = next - pre;
var position2;
if (!is_nil_default(intervalPadding) && is_nil_default(dodgePadding) && intervalPadding >= 0) {
var offset = this.getIntervalOnlyOffset(len5, idx);
position2 = pre + offset;
} else if (!is_nil_default(dodgePadding) && is_nil_default(intervalPadding) && dodgePadding >= 0) {
var offset = this.getDodgeOnlyOffset(len5, idx);
position2 = pre + offset;
} else if (!is_nil_default(intervalPadding) && !is_nil_default(dodgePadding) && intervalPadding >= 0 && dodgePadding >= 0) {
var offset = this.getIntervalAndDodgeOffset(len5, idx);
position2 = pre + offset;
} else {
var width2 = tickLength * dodgeRatio / len5;
var margin = marginRatio * width2;
var offset = 1 / 2 * (tickLength - len5 * width2 - (len5 - 1) * margin) + ((idx + 1) * width2 + idx * margin) - 1 / 2 * width2 - 1 / 2 * tickLength;
position2 = (pre + next) / 2 + offset;
}
return position2;
};
Dodge2.prototype.getIntervalOnlyOffset = function(len5, idx) {
var _a6 = this, defaultSize = _a6.defaultSize, intervalPadding = _a6.intervalPadding, xDimensionLegenth = _a6.xDimensionLegenth, groupNum = _a6.groupNum, dodgeRatio = _a6.dodgeRatio, maxColumnWidth = _a6.maxColumnWidth, minColumnWidth = _a6.minColumnWidth, columnWidthRatio = _a6.columnWidthRatio;
var normalizedIntervalPadding = intervalPadding / xDimensionLegenth;
var normalizedDodgePadding = (1 - (groupNum - 1) * normalizedIntervalPadding) / groupNum * dodgeRatio / (len5 - 1);
var geomWidth = ((1 - normalizedIntervalPadding * (groupNum - 1)) / groupNum - normalizedDodgePadding * (len5 - 1)) / len5;
geomWidth = !is_nil_default(columnWidthRatio) ? 1 / groupNum / len5 * columnWidthRatio : geomWidth;
if (!is_nil_default(maxColumnWidth)) {
var normalizedMaxWidht = maxColumnWidth / xDimensionLegenth;
geomWidth = Math.min(geomWidth, normalizedMaxWidht);
}
if (!is_nil_default(minColumnWidth)) {
var normalizedMinWidht = minColumnWidth / xDimensionLegenth;
geomWidth = Math.max(geomWidth, normalizedMinWidht);
}
geomWidth = defaultSize ? defaultSize / xDimensionLegenth : geomWidth;
normalizedDodgePadding = ((1 - (groupNum - 1) * normalizedIntervalPadding) / groupNum - len5 * geomWidth) / (len5 - 1);
var offset = ((1 / 2 + idx) * geomWidth + idx * normalizedDodgePadding + 1 / 2 * normalizedIntervalPadding) * groupNum - normalizedIntervalPadding / 2;
return offset;
};
Dodge2.prototype.getDodgeOnlyOffset = function(len5, idx) {
var _a6 = this, defaultSize = _a6.defaultSize, dodgePadding = _a6.dodgePadding, xDimensionLegenth = _a6.xDimensionLegenth, groupNum = _a6.groupNum, marginRatio = _a6.marginRatio, maxColumnWidth = _a6.maxColumnWidth, minColumnWidth = _a6.minColumnWidth, columnWidthRatio = _a6.columnWidthRatio;
var normalizedDodgePadding = dodgePadding / xDimensionLegenth;
var normalizedIntervalPadding = 1 * marginRatio / (groupNum - 1);
var geomWidth = ((1 - normalizedIntervalPadding * (groupNum - 1)) / groupNum - normalizedDodgePadding * (len5 - 1)) / len5;
geomWidth = columnWidthRatio ? 1 / groupNum / len5 * columnWidthRatio : geomWidth;
if (!is_nil_default(maxColumnWidth)) {
var normalizedMaxWidht = maxColumnWidth / xDimensionLegenth;
geomWidth = Math.min(geomWidth, normalizedMaxWidht);
}
if (!is_nil_default(minColumnWidth)) {
var normalizedMinWidht = minColumnWidth / xDimensionLegenth;
geomWidth = Math.max(geomWidth, normalizedMinWidht);
}
geomWidth = defaultSize ? defaultSize / xDimensionLegenth : geomWidth;
normalizedIntervalPadding = (1 - (geomWidth * len5 + normalizedDodgePadding * (len5 - 1)) * groupNum) / (groupNum - 1);
var offset = ((1 / 2 + idx) * geomWidth + idx * normalizedDodgePadding + 1 / 2 * normalizedIntervalPadding) * groupNum - normalizedIntervalPadding / 2;
return offset;
};
Dodge2.prototype.getIntervalAndDodgeOffset = function(len5, idx) {
var _a6 = this, intervalPadding = _a6.intervalPadding, dodgePadding = _a6.dodgePadding, xDimensionLegenth = _a6.xDimensionLegenth, groupNum = _a6.groupNum;
var normalizedIntervalPadding = intervalPadding / xDimensionLegenth;
var normalizedDodgePadding = dodgePadding / xDimensionLegenth;
var geomWidth = ((1 - normalizedIntervalPadding * (groupNum - 1)) / groupNum - normalizedDodgePadding * (len5 - 1)) / len5;
var offset = ((1 / 2 + idx) * geomWidth + idx * normalizedDodgePadding + 1 / 2 * normalizedIntervalPadding) * groupNum - normalizedIntervalPadding / 2;
return offset;
};
Dodge2.prototype.getDistribution = function(dim) {
var groupedDataArray = this.adjustDataArray;
var cacheMap = this.cacheMap;
var map6 = cacheMap[dim];
if (!map6) {
map6 = {};
each_default(groupedDataArray, function(data3, index2) {
var values2 = values_of_key_default(data3, dim);
if (!values2.length) {
values2.push(0);
}
each_default(values2, function(val) {
if (!map6[val]) {
map6[val] = [];
}
map6[val].push(index2);
});
});
cacheMap[dim] = map6;
}
return map6;
};
return Dodge2;
}(adjust_default);
var dodge_default = Dodge;
// node_modules/@antv/adjust/esm/adjusts/jitter.js
function randomNumber(min7, max8) {
return (max8 - min7) * Math.random() + min7;
}
var Jitter = function(_super) {
__extends2(Jitter2, _super);
function Jitter2() {
return _super !== null && _super.apply(this, arguments) || this;
}
Jitter2.prototype.process = function(groupDataArray) {
var groupedDataArray = clone_default(groupDataArray);
var mergeData = flatten_default(groupedDataArray);
this.adjustData(groupedDataArray, mergeData);
return groupedDataArray;
};
Jitter2.prototype.adjustDim = function(dim, values2, dataArray) {
var _this = this;
var groupDataArray = this.groupData(dataArray, dim);
return each_default(groupDataArray, function(data3, dimValue) {
return _this.adjustGroup(data3, dim, parseFloat(dimValue), values2);
});
};
Jitter2.prototype.getAdjustOffset = function(range) {
var pre = range.pre, next = range.next;
var margin = (next - pre) * GAP;
return randomNumber(pre + margin, next - margin);
};
Jitter2.prototype.adjustGroup = function(group2, dim, dimValue, values2) {
var _this = this;
var range = this.getAdjustRange(dim, dimValue, values2);
each_default(group2, function(data3) {
data3[dim] = _this.getAdjustOffset(range);
});
return group2;
};
return Jitter2;
}(adjust_default);
var jitter_default = Jitter;
// node_modules/@antv/adjust/esm/adjusts/stack.js
var Cache = cache_default;
var Stack = function(_super) {
__extends2(Stack3, _super);
function Stack3(cfg) {
var _this = _super.call(this, cfg) || this;
var _a6 = cfg.adjustNames, adjustNames = _a6 === void 0 ? ["y"] : _a6, _b = cfg.height, height = _b === void 0 ? NaN : _b, _c = cfg.size, size2 = _c === void 0 ? 10 : _c, _d = cfg.reverseOrder, reverseOrder = _d === void 0 ? false : _d;
_this.adjustNames = adjustNames;
_this.height = height;
_this.size = size2;
_this.reverseOrder = reverseOrder;
return _this;
}
Stack3.prototype.process = function(groupDataArray) {
var _a6 = this, yField = _a6.yField, reverseOrder = _a6.reverseOrder;
var d3 = yField ? this.processStack(groupDataArray) : this.processOneDimStack(groupDataArray);
return reverseOrder ? this.reverse(d3) : d3;
};
Stack3.prototype.reverse = function(groupedDataArray) {
return groupedDataArray.slice(0).reverse();
};
Stack3.prototype.processStack = function(groupDataArray) {
var _a6 = this, xField = _a6.xField, yField = _a6.yField, reverseOrder = _a6.reverseOrder;
var groupedDataArray = reverseOrder ? this.reverse(groupDataArray) : groupDataArray;
var positive = new Cache();
var negative = new Cache();
return groupedDataArray.map(function(dataArray) {
return dataArray.map(function(data3) {
var _a7;
var x6 = get_default(data3, xField, 0);
var y5 = get_default(data3, [yField]);
var xKey = x6.toString();
y5 = is_array_default(y5) ? y5[1] : y5;
if (!is_nil_default(y5)) {
var cache3 = y5 >= 0 ? positive : negative;
if (!cache3.has(xKey)) {
cache3.set(xKey, 0);
}
var xValue = cache3.get(xKey);
var newXValue = y5 + xValue;
cache3.set(xKey, newXValue);
return __assign2(__assign2({}, data3), (_a7 = {}, _a7[yField] = [xValue, newXValue], _a7));
}
return data3;
});
});
};
Stack3.prototype.processOneDimStack = function(groupDataArray) {
var _this = this;
var _a6 = this, xField = _a6.xField, height = _a6.height, reverseOrder = _a6.reverseOrder;
var yField = "y";
var groupedDataArray = reverseOrder ? this.reverse(groupDataArray) : groupDataArray;
var cache3 = new Cache();
return groupedDataArray.map(function(dataArray) {
return dataArray.map(function(data3) {
var _a7;
var size2 = _this.size;
var xValue = data3[xField];
var stackHeight = size2 * 2 / height;
if (!cache3.has(xValue)) {
cache3.set(xValue, stackHeight / 2);
}
var stackValue = cache3.get(xValue);
cache3.set(xValue, stackValue + stackHeight);
return __assign2(__assign2({}, data3), (_a7 = {}, _a7[yField] = stackValue, _a7));
});
});
};
return Stack3;
}(adjust_default);
var stack_default = Stack;
// node_modules/@antv/adjust/esm/adjusts/symmetric.js
var Symmetric = function(_super) {
__extends2(Symmetric2, _super);
function Symmetric2() {
return _super !== null && _super.apply(this, arguments) || this;
}
Symmetric2.prototype.process = function(groupDataArray) {
var mergeData = flatten_default(groupDataArray);
var _a6 = this, xField = _a6.xField, yField = _a6.yField;
var cache3 = this.getXValuesMaxMap(mergeData);
var max8 = Math.max.apply(Math, Object.keys(cache3).map(function(key) {
return cache3[key];
}));
return map_default(groupDataArray, function(dataArray) {
return map_default(dataArray, function(data3) {
var _a7, _b;
var yValue = data3[yField];
var xValue = data3[xField];
if (is_array_default(yValue)) {
var off_1 = (max8 - cache3[xValue]) / 2;
return __assign2(__assign2({}, data3), (_a7 = {}, _a7[yField] = map_default(yValue, function(y5) {
return off_1 + y5;
}), _a7));
}
var offset = (max8 - yValue) / 2;
return __assign2(__assign2({}, data3), (_b = {}, _b[yField] = [offset, yValue + offset], _b));
});
});
};
Symmetric2.prototype.getXValuesMaxMap = function(mergeData) {
var _this = this;
var _a6 = this, xField = _a6.xField, yField = _a6.yField;
var groupDataArray = group_by_default(mergeData, function(data3) {
return data3[xField];
});
return map_values_default(groupDataArray, function(dataArray) {
return _this.getDimMaxValue(dataArray, yField);
});
};
Symmetric2.prototype.getDimMaxValue = function(mergeData, dim) {
var dimValues = map_default(mergeData, function(data3) {
return get_default(data3, dim, []);
});
var flattenValues = flatten_default(dimValues);
return Math.max.apply(Math, flattenValues);
};
return Symmetric2;
}(adjust_default);
var symmetric_default = Symmetric;
// node_modules/@antv/adjust/esm/index.js
registerAdjust("Dodge", dodge_default);
registerAdjust("Jitter", jitter_default);
registerAdjust("Stack", stack_default);
registerAdjust("Symmetric", symmetric_default);
// node_modules/@antv/attr/esm/attributes/base.js
var toScaleString = function(scale12, value2) {
if (is_string_default(value2)) {
return value2;
}
return scale12.invert(scale12.scale(value2));
};
var Attribute = function() {
function Attribute2(cfg) {
this.names = [];
this.scales = [];
this.linear = false;
this.values = [];
this.callback = function() {
return [];
};
this._parseCfg(cfg);
}
Attribute2.prototype.mapping = function() {
var _this = this;
var params = [];
for (var _i = 0; _i < arguments.length; _i++) {
params[_i] = arguments[_i];
}
var values2 = params.map(function(param, idx) {
return _this._toOriginParam(param, _this.scales[idx]);
});
return this.callback.apply(this, values2);
};
Attribute2.prototype.getLinearValue = function(percent2) {
var steps = this.values.length - 1;
var step = Math.floor(steps * percent2);
var leftPercent = steps * percent2 - step;
var start = this.values[step];
var end2 = step === steps ? start : this.values[step + 1];
return start + (end2 - start) * leftPercent;
};
Attribute2.prototype.getNames = function() {
var scales = this.scales;
var names = this.names;
var length5 = Math.min(scales.length, names.length);
var rst = [];
for (var i4 = 0; i4 < length5; i4 += 1) {
rst.push(names[i4]);
}
return rst;
};
Attribute2.prototype.getFields = function() {
return this.scales.map(function(scale12) {
return scale12.field;
});
};
Attribute2.prototype.getScale = function(name) {
return this.scales[this.names.indexOf(name)];
};
Attribute2.prototype.defaultCallback = function() {
var _this = this;
var params = [];
for (var _i = 0; _i < arguments.length; _i++) {
params[_i] = arguments[_i];
}
if (params.length === 0) {
return this.values;
}
return params.map(function(param, idx) {
var scale12 = _this.scales[idx];
return scale12.type === "identity" ? scale12.values[0] : _this._getAttributeValue(scale12, param);
});
};
Attribute2.prototype._parseCfg = function(cfg) {
var _this = this;
var _a6 = cfg.type, type2 = _a6 === void 0 ? "base" : _a6, _b = cfg.names, names = _b === void 0 ? [] : _b, _c = cfg.scales, scales = _c === void 0 ? [] : _c, _d = cfg.values, values2 = _d === void 0 ? [] : _d, callback = cfg.callback;
this.type = type2;
this.scales = scales;
this.values = values2;
this.names = names;
this.callback = function() {
var params = [];
for (var _i = 0; _i < arguments.length; _i++) {
params[_i] = arguments[_i];
}
if (callback) {
var ret = callback.apply(void 0, params);
if (!is_nil_default(ret)) {
return [ret];
}
}
return _this.defaultCallback.apply(_this, params);
};
};
Attribute2.prototype._getAttributeValue = function(scale12, value2) {
if (scale12.isCategory && !this.linear) {
var idx = scale12.translate(value2);
return this.values[idx % this.values.length];
}
var percent2 = scale12.scale(value2);
return this.getLinearValue(percent2);
};
Attribute2.prototype._toOriginParam = function(param, scale12) {
return !scale12.isLinear ? is_array_default(param) ? param.map(function(p4) {
return toScaleString(scale12, p4);
}) : toScaleString(scale12, param) : param;
};
return Attribute2;
}();
var base_default3 = Attribute;
// node_modules/@antv/attr/node_modules/tslib/modules/index.js
var import_tslib15 = __toModule(require_tslib3());
var {
__extends: __extends3,
__assign: __assign3,
__rest: __rest3,
__decorate: __decorate3,
__param: __param3,
__metadata: __metadata3,
__awaiter: __awaiter3,
__generator: __generator3,
__exportStar: __exportStar3,
__createBinding: __createBinding3,
__values: __values3,
__read: __read3,
__spread: __spread3,
__spreadArrays: __spreadArrays3,
__await: __await3,
__asyncGenerator: __asyncGenerator3,
__asyncDelegator: __asyncDelegator3,
__asyncValues: __asyncValues3,
__makeTemplateObject: __makeTemplateObject3,
__importStar: __importStar3,
__importDefault: __importDefault3,
__classPrivateFieldGet: __classPrivateFieldGet3,
__classPrivateFieldSet: __classPrivateFieldSet3
} = import_tslib15.default;
// node_modules/@antv/color-util/esm/index.js
var RGB_REG = /rgba?\(([\s.,0-9]+)\)/;
var regexLG = /^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i;
var regexRG = /^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i;
var regexColorStop = /[\d.]+:(#[^\s]+|[^\)]+\))/gi;
var isGradientColor2 = function(val) {
return /^[r,R,L,l]{1}[\s]*\(/.test(val);
};
var createTmp = function() {
var i4 = document.createElement("i");
i4.title = "Web Colour Picker";
i4.style.display = "none";
document.body.appendChild(i4);
return i4;
};
var getValue = function(start, end2, percent2, index2) {
return start[index2] + (end2[index2] - start[index2]) * percent2;
};
function arr2rgb(arr) {
return "#" + toHex(arr[0]) + toHex(arr[1]) + toHex(arr[2]);
}
var rgb2arr = function(str8) {
return [
parseInt(str8.substr(1, 2), 16),
parseInt(str8.substr(3, 2), 16),
parseInt(str8.substr(5, 2), 16)
];
};
var toHex = function(value2) {
var x16Value = Math.round(value2).toString(16);
return x16Value.length === 1 ? "0" + x16Value : x16Value;
};
var calColor = function(points, percent2) {
var fixedPercent = isNaN(Number(percent2)) || percent2 < 0 ? 0 : percent2 > 1 ? 1 : Number(percent2);
var steps = points.length - 1;
var step = Math.floor(steps * fixedPercent);
var left2 = steps * fixedPercent - step;
var start = points[step];
var end2 = step === steps ? start : points[step + 1];
return arr2rgb([
getValue(start, end2, left2, 0),
getValue(start, end2, left2, 1),
getValue(start, end2, left2, 2)
]);
};
var iEl;
var toRGB = function(color4) {
if (color4[0] === "#" && color4.length === 7) {
return color4;
}
if (!iEl) {
iEl = createTmp();
}
iEl.style.color = color4;
var rst = document.defaultView.getComputedStyle(iEl, "").getPropertyValue("color");
var matches = RGB_REG.exec(rst);
var cArray = matches[1].split(/\s*,\s*/).map(function(s4) {
return Number(s4);
});
rst = arr2rgb(cArray);
return rst;
};
var gradient = function(colors) {
var colorArray = is_string_default(colors) ? colors.split("-") : colors;
var points = map_default(colorArray, function(color4) {
return rgb2arr(color4.indexOf("#") === -1 ? toRGB(color4) : color4);
});
return function(percent2) {
return calColor(points, percent2);
};
};
var toCSSGradient = function(gradientColor) {
if (isGradientColor2(gradientColor)) {
var cssColor_1;
var steps = void 0;
if (gradientColor[0] === "l") {
var arr = regexLG.exec(gradientColor);
var angle3 = +arr[1] + 90;
steps = arr[2];
cssColor_1 = "linear-gradient(" + angle3 + "deg, ";
} else if (gradientColor[0] === "r") {
cssColor_1 = "radial-gradient(";
var arr = regexRG.exec(gradientColor);
steps = arr[4];
}
var colorStops_1 = steps.match(regexColorStop);
each_default(colorStops_1, function(item, index2) {
var itemArr = item.split(":");
cssColor_1 += itemArr[1] + " " + itemArr[0] * 100 + "%";
if (index2 !== colorStops_1.length - 1) {
cssColor_1 += ", ";
}
});
cssColor_1 += ")";
return cssColor_1;
}
return gradientColor;
};
var esm_default2 = {
rgb2arr,
gradient,
toRGB: memoize_default(toRGB),
toCSSGradient
};
// node_modules/@antv/attr/esm/attributes/color.js
var Color2 = function(_super) {
__extends3(Color3, _super);
function Color3(cfg) {
var _this = _super.call(this, cfg) || this;
_this.type = "color";
_this.names = ["color"];
if (is_string_default(_this.values)) {
_this.linear = true;
}
_this.gradient = esm_default2.gradient(_this.values);
return _this;
}
Color3.prototype.getLinearValue = function(percent2) {
return this.gradient(percent2);
};
return Color3;
}(base_default3);
var color_default = Color2;
// node_modules/@antv/attr/esm/attributes/opacity.js
var Opacity = function(_super) {
__extends3(Opacity2, _super);
function Opacity2(cfg) {
var _this = _super.call(this, cfg) || this;
_this.type = "opacity";
_this.names = ["opacity"];
return _this;
}
return Opacity2;
}(base_default3);
var opacity_default = Opacity;
// node_modules/@antv/attr/esm/attributes/position.js
var Position = function(_super) {
__extends3(Position2, _super);
function Position2(cfg) {
var _this = _super.call(this, cfg) || this;
_this.names = ["x", "y"];
_this.type = "position";
return _this;
}
Position2.prototype.mapping = function(x6, y5) {
var _a6 = this.scales, scaleX = _a6[0], scaleY = _a6[1];
if (is_nil_default(x6) || is_nil_default(y5)) {
return [];
}
return [
is_array_default(x6) ? x6.map(function(xi) {
return scaleX.scale(xi);
}) : scaleX.scale(x6),
is_array_default(y5) ? y5.map(function(yi) {
return scaleY.scale(yi);
}) : scaleY.scale(y5)
];
};
return Position2;
}(base_default3);
var position_default = Position;
// node_modules/@antv/attr/esm/attributes/shape.js
var Shape = function(_super) {
__extends3(Shape3, _super);
function Shape3(cfg) {
var _this = _super.call(this, cfg) || this;
_this.type = "shape";
_this.names = ["shape"];
return _this;
}
Shape3.prototype.getLinearValue = function(percent2) {
var idx = Math.round((this.values.length - 1) * percent2);
return this.values[idx];
};
return Shape3;
}(base_default3);
var shape_default2 = Shape;
// node_modules/@antv/attr/esm/attributes/size.js
var Size = function(_super) {
__extends3(Size2, _super);
function Size2(cfg) {
var _this = _super.call(this, cfg) || this;
_this.type = "size";
_this.names = ["size"];
return _this;
}
return Size2;
}(base_default3);
var size_default = Size;
// node_modules/@antv/scale/esm/tick-method/register.js
var methodCache = {};
function getTickMethod(key) {
return methodCache[key];
}
function registerTickMethod(key, method) {
methodCache[key] = method;
}
// node_modules/@antv/scale/esm/base.js
var Scale = function() {
function Scale2(cfg) {
this.type = "base";
this.isCategory = false;
this.isLinear = false;
this.isContinuous = false;
this.isIdentity = false;
this.values = [];
this.range = [0, 1];
this.ticks = [];
this.__cfg__ = cfg;
this.initCfg();
this.init();
}
Scale2.prototype.translate = function(v3) {
return v3;
};
Scale2.prototype.change = function(cfg) {
mix(this.__cfg__, cfg);
this.init();
};
Scale2.prototype.clone = function() {
return this.constructor(this.__cfg__);
};
Scale2.prototype.getTicks = function() {
var _this = this;
return map_default(this.ticks, function(tick, idx) {
if (is_object_default(tick)) {
return tick;
}
return {
text: _this.getText(tick, idx),
tickValue: tick,
value: _this.scale(tick)
};
});
};
Scale2.prototype.getText = function(value2, key) {
var formatter = this.formatter;
var res = formatter ? formatter(value2, key) : value2;
if (is_nil_default(res) || !is_function_default(res.toString)) {
return "";
}
return res.toString();
};
Scale2.prototype.getConfig = function(key) {
return this.__cfg__[key];
};
Scale2.prototype.init = function() {
mix(this, this.__cfg__);
this.setDomain();
if (is_empty_default(this.getConfig("ticks"))) {
this.ticks = this.calculateTicks();
}
};
Scale2.prototype.initCfg = function() {
};
Scale2.prototype.setDomain = function() {
};
Scale2.prototype.calculateTicks = function() {
var tickMethod = this.tickMethod;
var ticks = [];
if (is_string_default(tickMethod)) {
var method = getTickMethod(tickMethod);
if (!method) {
throw new Error("There is no method to to calculate ticks!");
}
ticks = method(this);
} else if (is_function_default(tickMethod)) {
ticks = tickMethod(this);
}
return ticks;
};
Scale2.prototype.rangeMin = function() {
return this.range[0];
};
Scale2.prototype.rangeMax = function() {
return this.range[1];
};
Scale2.prototype.calcPercent = function(value2, min7, max8) {
if (is_number_default(value2)) {
return (value2 - min7) / (max8 - min7);
}
return NaN;
};
Scale2.prototype.calcValue = function(percent2, min7, max8) {
return min7 + percent2 * (max8 - min7);
};
return Scale2;
}();
var base_default4 = Scale;
// node_modules/@antv/scale/esm/category/base.js
var Category = function(_super) {
__extends(Category3, _super);
function Category3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "cat";
_this.isCategory = true;
return _this;
}
Category3.prototype.buildIndexMap = function() {
if (!this.translateIndexMap) {
this.translateIndexMap = new Map();
for (var i4 = 0; i4 < this.values.length; i4++) {
this.translateIndexMap.set(this.values[i4], i4);
}
}
};
Category3.prototype.translate = function(value2) {
this.buildIndexMap();
var idx = this.translateIndexMap.get(value2);
if (idx === void 0) {
idx = is_number_default(value2) ? value2 : NaN;
}
return idx;
};
Category3.prototype.scale = function(value2) {
var order2 = this.translate(value2);
var percent2 = this.calcPercent(order2, this.min, this.max);
return this.calcValue(percent2, this.rangeMin(), this.rangeMax());
};
Category3.prototype.invert = function(scaledValue) {
var domainRange = this.max - this.min;
var percent2 = this.calcPercent(scaledValue, this.rangeMin(), this.rangeMax());
var idx = Math.round(domainRange * percent2) + this.min;
if (idx < this.min || idx > this.max) {
return NaN;
}
return this.values[idx];
};
Category3.prototype.getText = function(value2) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var v3 = value2;
if (is_number_default(value2) && !this.values.includes(value2)) {
v3 = this.values[v3];
}
return _super.prototype.getText.apply(this, __spreadArray([v3], args, false));
};
Category3.prototype.initCfg = function() {
this.tickMethod = "cat";
};
Category3.prototype.setDomain = function() {
if (is_nil_default(this.getConfig("min"))) {
this.min = 0;
}
if (is_nil_default(this.getConfig("max"))) {
var size2 = this.values.length;
this.max = size2 > 1 ? size2 - 1 : size2;
}
if (this.translateIndexMap) {
this.translateIndexMap = void 0;
}
};
return Category3;
}(base_default4);
var base_default5 = Category;
// node_modules/fecha/lib/fecha.js
var fecha_exports = {};
__export(fecha_exports, {
assign: () => assign,
default: () => fecha_default,
defaultI18n: () => defaultI18n,
format: () => format,
parse: () => parse,
setGlobalDateI18n: () => setGlobalDateI18n,
setGlobalDateMasks: () => setGlobalDateMasks
});
var token = /d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
var twoDigitsOptional = "[1-9]\\d?";
var twoDigits = "\\d\\d";
var threeDigits = "\\d{3}";
var fourDigits = "\\d{4}";
var word = "[^\\s]+";
var literal = /\[([^]*?)\]/gm;
function shorten(arr, sLen) {
var newArr = [];
for (var i4 = 0, len5 = arr.length; i4 < len5; i4++) {
newArr.push(arr[i4].substr(0, sLen));
}
return newArr;
}
var monthUpdate = function(arrName) {
return function(v3, i18n) {
var lowerCaseArr = i18n[arrName].map(function(v4) {
return v4.toLowerCase();
});
var index2 = lowerCaseArr.indexOf(v3.toLowerCase());
if (index2 > -1) {
return index2;
}
return null;
};
};
function assign(origObj) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
for (var _a6 = 0, args_1 = args; _a6 < args_1.length; _a6++) {
var obj = args_1[_a6];
for (var key in obj) {
origObj[key] = obj[key];
}
}
return origObj;
}
var dayNames = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
];
var monthNames = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
];
var monthNamesShort = shorten(monthNames, 3);
var dayNamesShort = shorten(dayNames, 3);
var defaultI18n = {
dayNamesShort,
dayNames,
monthNamesShort,
monthNames,
amPm: ["am", "pm"],
DoFn: function(dayOfMonth) {
return dayOfMonth + ["th", "st", "nd", "rd"][dayOfMonth % 10 > 3 ? 0 : (dayOfMonth - dayOfMonth % 10 !== 10 ? 1 : 0) * dayOfMonth % 10];
}
};
var globalI18n = assign({}, defaultI18n);
var setGlobalDateI18n = function(i18n) {
return globalI18n = assign(globalI18n, i18n);
};
var regexEscape = function(str8) {
return str8.replace(/[|\\{()[^$+*?.-]/g, "\\$&");
};
var pad = function(val, len5) {
if (len5 === void 0) {
len5 = 2;
}
val = String(val);
while (val.length < len5) {
val = "0" + val;
}
return val;
};
var formatFlags = {
D: function(dateObj) {
return String(dateObj.getDate());
},
DD: function(dateObj) {
return pad(dateObj.getDate());
},
Do: function(dateObj, i18n) {
return i18n.DoFn(dateObj.getDate());
},
d: function(dateObj) {
return String(dateObj.getDay());
},
dd: function(dateObj) {
return pad(dateObj.getDay());
},
ddd: function(dateObj, i18n) {
return i18n.dayNamesShort[dateObj.getDay()];
},
dddd: function(dateObj, i18n) {
return i18n.dayNames[dateObj.getDay()];
},
M: function(dateObj) {
return String(dateObj.getMonth() + 1);
},
MM: function(dateObj) {
return pad(dateObj.getMonth() + 1);
},
MMM: function(dateObj, i18n) {
return i18n.monthNamesShort[dateObj.getMonth()];
},
MMMM: function(dateObj, i18n) {
return i18n.monthNames[dateObj.getMonth()];
},
YY: function(dateObj) {
return pad(String(dateObj.getFullYear()), 4).substr(2);
},
YYYY: function(dateObj) {
return pad(dateObj.getFullYear(), 4);
},
h: function(dateObj) {
return String(dateObj.getHours() % 12 || 12);
},
hh: function(dateObj) {
return pad(dateObj.getHours() % 12 || 12);
},
H: function(dateObj) {
return String(dateObj.getHours());
},
HH: function(dateObj) {
return pad(dateObj.getHours());
},
m: function(dateObj) {
return String(dateObj.getMinutes());
},
mm: function(dateObj) {
return pad(dateObj.getMinutes());
},
s: function(dateObj) {
return String(dateObj.getSeconds());
},
ss: function(dateObj) {
return pad(dateObj.getSeconds());
},
S: function(dateObj) {
return String(Math.round(dateObj.getMilliseconds() / 100));
},
SS: function(dateObj) {
return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
},
SSS: function(dateObj) {
return pad(dateObj.getMilliseconds(), 3);
},
a: function(dateObj, i18n) {
return dateObj.getHours() < 12 ? i18n.amPm[0] : i18n.amPm[1];
},
A: function(dateObj, i18n) {
return dateObj.getHours() < 12 ? i18n.amPm[0].toUpperCase() : i18n.amPm[1].toUpperCase();
},
ZZ: function(dateObj) {
var offset = dateObj.getTimezoneOffset();
return (offset > 0 ? "-" : "+") + pad(Math.floor(Math.abs(offset) / 60) * 100 + Math.abs(offset) % 60, 4);
},
Z: function(dateObj) {
var offset = dateObj.getTimezoneOffset();
return (offset > 0 ? "-" : "+") + pad(Math.floor(Math.abs(offset) / 60), 2) + ":" + pad(Math.abs(offset) % 60, 2);
}
};
var monthParse = function(v3) {
return +v3 - 1;
};
var emptyDigits = [null, twoDigitsOptional];
var emptyWord = [null, word];
var amPm = [
"isPm",
word,
function(v3, i18n) {
var val = v3.toLowerCase();
if (val === i18n.amPm[0]) {
return 0;
} else if (val === i18n.amPm[1]) {
return 1;
}
return null;
}
];
var timezoneOffset = [
"timezoneOffset",
"[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",
function(v3) {
var parts = (v3 + "").match(/([+-]|\d\d)/gi);
if (parts) {
var minutes = +parts[1] * 60 + parseInt(parts[2], 10);
return parts[0] === "+" ? minutes : -minutes;
}
return 0;
}
];
var parseFlags = {
D: ["day", twoDigitsOptional],
DD: ["day", twoDigits],
Do: ["day", twoDigitsOptional + word, function(v3) {
return parseInt(v3, 10);
}],
M: ["month", twoDigitsOptional, monthParse],
MM: ["month", twoDigits, monthParse],
YY: [
"year",
twoDigits,
function(v3) {
var now2 = new Date();
var cent = +("" + now2.getFullYear()).substr(0, 2);
return +("" + (+v3 > 68 ? cent - 1 : cent) + v3);
}
],
h: ["hour", twoDigitsOptional, void 0, "isPm"],
hh: ["hour", twoDigits, void 0, "isPm"],
H: ["hour", twoDigitsOptional],
HH: ["hour", twoDigits],
m: ["minute", twoDigitsOptional],
mm: ["minute", twoDigits],
s: ["second", twoDigitsOptional],
ss: ["second", twoDigits],
YYYY: ["year", fourDigits],
S: ["millisecond", "\\d", function(v3) {
return +v3 * 100;
}],
SS: ["millisecond", twoDigits, function(v3) {
return +v3 * 10;
}],
SSS: ["millisecond", threeDigits],
d: emptyDigits,
dd: emptyDigits,
ddd: emptyWord,
dddd: emptyWord,
MMM: ["month", word, monthUpdate("monthNamesShort")],
MMMM: ["month", word, monthUpdate("monthNames")],
a: amPm,
A: amPm,
ZZ: timezoneOffset,
Z: timezoneOffset
};
var globalMasks = {
default: "ddd MMM DD YYYY HH:mm:ss",
shortDate: "M/D/YY",
mediumDate: "MMM D, YYYY",
longDate: "MMMM D, YYYY",
fullDate: "dddd, MMMM D, YYYY",
isoDate: "YYYY-MM-DD",
isoDateTime: "YYYY-MM-DDTHH:mm:ssZ",
shortTime: "HH:mm",
mediumTime: "HH:mm:ss",
longTime: "HH:mm:ss.SSS"
};
var setGlobalDateMasks = function(masks) {
return assign(globalMasks, masks);
};
var format = function(dateObj, mask, i18n) {
if (mask === void 0) {
mask = globalMasks["default"];
}
if (i18n === void 0) {
i18n = {};
}
if (typeof dateObj === "number") {
dateObj = new Date(dateObj);
}
if (Object.prototype.toString.call(dateObj) !== "[object Date]" || isNaN(dateObj.getTime())) {
throw new Error("Invalid Date pass to format");
}
mask = globalMasks[mask] || mask;
var literals = [];
mask = mask.replace(literal, function($0, $1) {
literals.push($1);
return "@@@";
});
var combinedI18nSettings = assign(assign({}, globalI18n), i18n);
mask = mask.replace(token, function($0) {
return formatFlags[$0](dateObj, combinedI18nSettings);
});
return mask.replace(/@@@/g, function() {
return literals.shift();
});
};
function parse(dateStr, format2, i18n) {
if (i18n === void 0) {
i18n = {};
}
if (typeof format2 !== "string") {
throw new Error("Invalid format in fecha parse");
}
format2 = globalMasks[format2] || format2;
if (dateStr.length > 1e3) {
return null;
}
var today = new Date();
var dateInfo = {
year: today.getFullYear(),
month: 0,
day: 1,
hour: 0,
minute: 0,
second: 0,
millisecond: 0,
isPm: null,
timezoneOffset: null
};
var parseInfo = [];
var literals = [];
var newFormat = format2.replace(literal, function($0, $1) {
literals.push(regexEscape($1));
return "@@@";
});
var specifiedFields = {};
var requiredFields = {};
newFormat = regexEscape(newFormat).replace(token, function($0) {
var info = parseFlags[$0];
var field7 = info[0], regex = info[1], requiredField = info[3];
if (specifiedFields[field7]) {
throw new Error("Invalid format. " + field7 + " specified twice in format");
}
specifiedFields[field7] = true;
if (requiredField) {
requiredFields[requiredField] = true;
}
parseInfo.push(info);
return "(" + regex + ")";
});
Object.keys(requiredFields).forEach(function(field7) {
if (!specifiedFields[field7]) {
throw new Error("Invalid format. " + field7 + " is required in specified format");
}
});
newFormat = newFormat.replace(/@@@/g, function() {
return literals.shift();
});
var matches = dateStr.match(new RegExp(newFormat, "i"));
if (!matches) {
return null;
}
var combinedI18nSettings = assign(assign({}, globalI18n), i18n);
for (var i4 = 1; i4 < matches.length; i4++) {
var _a6 = parseInfo[i4 - 1], field6 = _a6[0], parser = _a6[2];
var value2 = parser ? parser(matches[i4], combinedI18nSettings) : +matches[i4];
if (value2 == null) {
return null;
}
dateInfo[field6] = value2;
}
if (dateInfo.isPm === 1 && dateInfo.hour != null && +dateInfo.hour !== 12) {
dateInfo.hour = +dateInfo.hour + 12;
} else if (dateInfo.isPm === 0 && +dateInfo.hour === 12) {
dateInfo.hour = 0;
}
var dateWithoutTZ = new Date(dateInfo.year, dateInfo.month, dateInfo.day, dateInfo.hour, dateInfo.minute, dateInfo.second, dateInfo.millisecond);
var validateFields = [
["month", "getMonth"],
["day", "getDate"],
["hour", "getHours"],
["minute", "getMinutes"],
["second", "getSeconds"]
];
for (var i4 = 0, len5 = validateFields.length; i4 < len5; i4++) {
if (specifiedFields[validateFields[i4][0]] && dateInfo[validateFields[i4][0]] !== dateWithoutTZ[validateFields[i4][1]]()) {
return null;
}
}
if (dateInfo.timezoneOffset == null) {
return dateWithoutTZ;
}
return new Date(Date.UTC(dateInfo.year, dateInfo.month, dateInfo.day, dateInfo.hour, dateInfo.minute - dateInfo.timezoneOffset, dateInfo.second, dateInfo.millisecond));
}
var fecha = {
format,
parse,
defaultI18n,
setGlobalDateI18n,
setGlobalDateMasks
};
var fecha_default = fecha;
// node_modules/@antv/scale/esm/util/bisector.js
function bisector_default(getter) {
return function(a4, x6, _lo, _hi) {
var lo = is_nil_default(_lo) ? 0 : _lo;
var hi = is_nil_default(_hi) ? a4.length : _hi;
while (lo < hi) {
var mid2 = lo + hi >>> 1;
if (getter(a4[mid2]) > x6) {
hi = mid2;
} else {
lo = mid2 + 1;
}
}
return lo;
};
}
// node_modules/@antv/scale/esm/util/time.js
var FORMAT_METHOD = "format";
function timeFormat(time2, mask) {
var method = fecha_exports[FORMAT_METHOD] || fecha_default[FORMAT_METHOD];
return method(time2, mask);
}
function toTimeStamp(value2) {
if (is_string_default(value2)) {
if (value2.indexOf("T") > 0) {
value2 = new Date(value2).getTime();
} else {
value2 = new Date(value2.replace(/-/gi, "/")).getTime();
}
}
if (is_date_default(value2)) {
value2 = value2.getTime();
}
return value2;
}
var SECOND = 1e3;
var MINUTE = 60 * SECOND;
var HOUR = 60 * MINUTE;
var DAY = 24 * HOUR;
var MONTH = DAY * 31;
var YEAR = DAY * 365;
var intervals = [
["HH:mm:ss", SECOND],
["HH:mm:ss", SECOND * 10],
["HH:mm:ss", SECOND * 30],
["HH:mm", MINUTE],
["HH:mm", MINUTE * 10],
["HH:mm", MINUTE * 30],
["HH", HOUR],
["HH", HOUR * 6],
["HH", HOUR * 12],
["YYYY-MM-DD", DAY],
["YYYY-MM-DD", DAY * 4],
["YYYY-WW", DAY * 7],
["YYYY-MM", MONTH],
["YYYY-MM", MONTH * 4],
["YYYY-MM", MONTH * 6],
["YYYY", DAY * 380]
];
function getTickInterval(min7, max8, tickCount) {
var target = (max8 - min7) / tickCount;
var idx = bisector_default(function(o3) {
return o3[1];
})(intervals, target) - 1;
var interval3 = intervals[idx];
if (idx < 0) {
interval3 = intervals[0];
} else if (idx >= intervals.length) {
interval3 = last(intervals);
}
return interval3;
}
// node_modules/@antv/scale/esm/category/time.js
var TimeCat = function(_super) {
__extends(TimeCat2, _super);
function TimeCat2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "timeCat";
return _this;
}
TimeCat2.prototype.translate = function(value2) {
value2 = toTimeStamp(value2);
var index2 = this.values.indexOf(value2);
if (index2 === -1) {
if (is_number_default(value2) && value2 < this.values.length) {
index2 = value2;
} else {
index2 = NaN;
}
}
return index2;
};
TimeCat2.prototype.getText = function(value2, tickIndex) {
var index2 = this.translate(value2);
if (index2 > -1) {
var result = this.values[index2];
var formatter = this.formatter;
result = formatter ? formatter(result, tickIndex) : timeFormat(result, this.mask);
return result;
}
return value2;
};
TimeCat2.prototype.initCfg = function() {
this.tickMethod = "time-cat";
this.mask = "YYYY-MM-DD";
this.tickCount = 7;
};
TimeCat2.prototype.setDomain = function() {
var values2 = this.values;
each_default(values2, function(v3, i4) {
values2[i4] = toTimeStamp(v3);
});
values2.sort(function(v1, v22) {
return v1 - v22;
});
_super.prototype.setDomain.call(this);
};
return TimeCat2;
}(base_default5);
var time_default = TimeCat;
// node_modules/@antv/scale/esm/continuous/base.js
var Continuous = function(_super) {
__extends(Continuous2, _super);
function Continuous2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.isContinuous = true;
return _this;
}
Continuous2.prototype.scale = function(value2) {
if (is_nil_default(value2)) {
return NaN;
}
var rangeMin = this.rangeMin();
var rangeMax = this.rangeMax();
var max8 = this.max;
var min7 = this.min;
if (max8 === min7) {
return rangeMin;
}
var percent2 = this.getScalePercent(value2);
return rangeMin + percent2 * (rangeMax - rangeMin);
};
Continuous2.prototype.init = function() {
_super.prototype.init.call(this);
var ticks = this.ticks;
var firstTick = head(ticks);
var lastTick = last(ticks);
if (firstTick < this.min) {
this.min = firstTick;
}
if (lastTick > this.max) {
this.max = lastTick;
}
if (!is_nil_default(this.minLimit)) {
this.min = firstTick;
}
if (!is_nil_default(this.maxLimit)) {
this.max = lastTick;
}
};
Continuous2.prototype.setDomain = function() {
var _a6 = get_range_default(this.values), min7 = _a6.min, max8 = _a6.max;
if (is_nil_default(this.min)) {
this.min = min7;
}
if (is_nil_default(this.max)) {
this.max = max8;
}
if (this.min > this.max) {
this.min = min7;
this.max = max8;
}
};
Continuous2.prototype.calculateTicks = function() {
var _this = this;
var ticks = _super.prototype.calculateTicks.call(this);
if (!this.nice) {
ticks = filter_default(ticks, function(tick) {
return tick >= _this.min && tick <= _this.max;
});
}
return ticks;
};
Continuous2.prototype.getScalePercent = function(value2) {
var max8 = this.max;
var min7 = this.min;
return (value2 - min7) / (max8 - min7);
};
Continuous2.prototype.getInvertPercent = function(value2) {
return (value2 - this.rangeMin()) / (this.rangeMax() - this.rangeMin());
};
return Continuous2;
}(base_default4);
var base_default6 = Continuous;
// node_modules/@antv/scale/esm/continuous/linear.js
var Linear = function(_super) {
__extends(Linear2, _super);
function Linear2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "linear";
_this.isLinear = true;
return _this;
}
Linear2.prototype.invert = function(value2) {
var percent2 = this.getInvertPercent(value2);
return this.min + percent2 * (this.max - this.min);
};
Linear2.prototype.initCfg = function() {
this.tickMethod = "wilkinson-extended";
this.nice = false;
};
return Linear2;
}(base_default6);
var linear_default = Linear;
// node_modules/@antv/scale/esm/util/math.js
function calBase(a4, b10) {
var e4 = Math.E;
var value2;
if (b10 >= 0) {
value2 = Math.pow(e4, Math.log(b10) / a4);
} else {
value2 = Math.pow(e4, Math.log(-b10) / a4) * -1;
}
return value2;
}
function log(a4, b10) {
if (a4 === 1) {
return 1;
}
return Math.log(b10) / Math.log(a4);
}
function getLogPositiveMin(values2, base, max8) {
if (is_nil_default(max8)) {
max8 = Math.max.apply(null, values2);
}
var positiveMin = max8;
each_default(values2, function(value2) {
if (value2 > 0 && value2 < positiveMin) {
positiveMin = value2;
}
});
if (positiveMin === max8) {
positiveMin = max8 / base;
}
if (positiveMin > 1) {
positiveMin = 1;
}
return positiveMin;
}
// node_modules/@antv/scale/esm/continuous/log.js
var Log = function(_super) {
__extends(Log2, _super);
function Log2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "log";
return _this;
}
Log2.prototype.invert = function(value2) {
var base = this.base;
var max8 = log(base, this.max);
var rangeMin = this.rangeMin();
var range = this.rangeMax() - rangeMin;
var min7;
var positiveMin = this.positiveMin;
if (positiveMin) {
if (value2 === 0) {
return 0;
}
min7 = log(base, positiveMin / base);
var appendPercent = 1 / (max8 - min7) * range;
if (value2 < appendPercent) {
return value2 / appendPercent * positiveMin;
}
} else {
min7 = log(base, this.min);
}
var percent2 = (value2 - rangeMin) / range;
var tmp = percent2 * (max8 - min7) + min7;
return Math.pow(base, tmp);
};
Log2.prototype.initCfg = function() {
this.tickMethod = "log";
this.base = 10;
this.tickCount = 6;
this.nice = true;
};
Log2.prototype.setDomain = function() {
_super.prototype.setDomain.call(this);
var min7 = this.min;
if (min7 < 0) {
throw new Error("When you use log scale, the minimum value must be greater than zero!");
}
if (min7 === 0) {
this.positiveMin = getLogPositiveMin(this.values, this.base, this.max);
}
};
Log2.prototype.getScalePercent = function(value2) {
var max8 = this.max;
var min7 = this.min;
if (max8 === min7) {
return 0;
}
if (value2 <= 0) {
return 0;
}
var base = this.base;
var positiveMin = this.positiveMin;
if (positiveMin) {
min7 = positiveMin * 1 / base;
}
var percent2;
if (value2 < positiveMin) {
percent2 = value2 / positiveMin / (log(base, max8) - log(base, min7));
} else {
percent2 = (log(base, value2) - log(base, min7)) / (log(base, max8) - log(base, min7));
}
return percent2;
};
return Log2;
}(base_default6);
var log_default = Log;
// node_modules/@antv/scale/esm/continuous/pow.js
var Pow = function(_super) {
__extends(Pow2, _super);
function Pow2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "pow";
return _this;
}
Pow2.prototype.invert = function(value2) {
var percent2 = this.getInvertPercent(value2);
var exponent2 = this.exponent;
var max8 = calBase(exponent2, this.max);
var min7 = calBase(exponent2, this.min);
var tmp = percent2 * (max8 - min7) + min7;
var factor = tmp >= 0 ? 1 : -1;
return Math.pow(tmp, exponent2) * factor;
};
Pow2.prototype.initCfg = function() {
this.tickMethod = "pow";
this.exponent = 2;
this.tickCount = 5;
this.nice = true;
};
Pow2.prototype.getScalePercent = function(value2) {
var max8 = this.max;
var min7 = this.min;
if (max8 === min7) {
return 0;
}
var exponent2 = this.exponent;
var percent2 = (calBase(exponent2, value2) - calBase(exponent2, min7)) / (calBase(exponent2, max8) - calBase(exponent2, min7));
return percent2;
};
return Pow2;
}(base_default6);
var pow_default = Pow;
// node_modules/@antv/scale/esm/continuous/time.js
var Time = function(_super) {
__extends(Time2, _super);
function Time2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "time";
return _this;
}
Time2.prototype.getText = function(value2, index2) {
var numberValue = this.translate(value2);
var formatter = this.formatter;
return formatter ? formatter(numberValue, index2) : timeFormat(numberValue, this.mask);
};
Time2.prototype.scale = function(value2) {
var v3 = value2;
if (is_string_default(v3) || is_date_default(v3)) {
v3 = this.translate(v3);
}
return _super.prototype.scale.call(this, v3);
};
Time2.prototype.translate = function(v3) {
return toTimeStamp(v3);
};
Time2.prototype.initCfg = function() {
this.tickMethod = "time-pretty";
this.mask = "YYYY-MM-DD";
this.tickCount = 7;
this.nice = false;
};
Time2.prototype.setDomain = function() {
var values2 = this.values;
var minConfig = this.getConfig("min");
var maxConfig = this.getConfig("max");
if (!is_nil_default(minConfig) || !is_number_default(minConfig)) {
this.min = this.translate(this.min);
}
if (!is_nil_default(maxConfig) || !is_number_default(maxConfig)) {
this.max = this.translate(this.max);
}
if (values2 && values2.length) {
var timeStamps_1 = [];
var min_1 = Infinity;
var secondMin_1 = min_1;
var max_1 = 0;
each_default(values2, function(v3) {
var timeStamp = toTimeStamp(v3);
if (isNaN(timeStamp)) {
throw new TypeError("Invalid Time: " + v3 + " in time scale!");
}
if (min_1 > timeStamp) {
secondMin_1 = min_1;
min_1 = timeStamp;
} else if (secondMin_1 > timeStamp) {
secondMin_1 = timeStamp;
}
if (max_1 < timeStamp) {
max_1 = timeStamp;
}
timeStamps_1.push(timeStamp);
});
if (values2.length > 1) {
this.minTickInterval = secondMin_1 - min_1;
}
if (is_nil_default(minConfig)) {
this.min = min_1;
}
if (is_nil_default(maxConfig)) {
this.max = max_1;
}
}
};
return Time2;
}(linear_default);
var time_default2 = Time;
// node_modules/@antv/scale/esm/continuous/quantize.js
var Quantize = function(_super) {
__extends(Quantize2, _super);
function Quantize2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "quantize";
return _this;
}
Quantize2.prototype.invert = function(value2) {
var ticks = this.ticks;
var length5 = ticks.length;
var percent2 = this.getInvertPercent(value2);
var minIndex = Math.floor(percent2 * (length5 - 1));
if (minIndex >= length5 - 1) {
return last(ticks);
}
if (minIndex < 0) {
return head(ticks);
}
var minTick = ticks[minIndex];
var nextTick = ticks[minIndex + 1];
var minIndexPercent = minIndex / (length5 - 1);
var maxIndexPercent = (minIndex + 1) / (length5 - 1);
return minTick + (percent2 - minIndexPercent) / (maxIndexPercent - minIndexPercent) * (nextTick - minTick);
};
Quantize2.prototype.initCfg = function() {
this.tickMethod = "r-pretty";
this.tickCount = 5;
this.nice = true;
};
Quantize2.prototype.calculateTicks = function() {
var ticks = _super.prototype.calculateTicks.call(this);
if (!this.nice) {
if (last(ticks) !== this.max) {
ticks.push(this.max);
}
if (head(ticks) !== this.min) {
ticks.unshift(this.min);
}
}
return ticks;
};
Quantize2.prototype.getScalePercent = function(value2) {
var ticks = this.ticks;
if (value2 < head(ticks)) {
return 0;
}
if (value2 > last(ticks)) {
return 1;
}
var minIndex = 0;
each_default(ticks, function(tick, index2) {
if (value2 >= tick) {
minIndex = index2;
} else {
return false;
}
});
return minIndex / (ticks.length - 1);
};
return Quantize2;
}(base_default6);
var quantize_default = Quantize;
// node_modules/@antv/scale/esm/continuous/quantile.js
var Quantile = function(_super) {
__extends(Quantile2, _super);
function Quantile2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "quantile";
return _this;
}
Quantile2.prototype.initCfg = function() {
this.tickMethod = "quantile";
this.tickCount = 5;
this.nice = true;
};
return Quantile2;
}(quantize_default);
var quantile_default = Quantile;
// node_modules/@antv/scale/esm/factory.js
var map4 = {};
function getClass(key) {
return map4[key];
}
function registerClass(key, cls) {
if (getClass(key)) {
throw new Error("type '" + key + "' existed.");
}
map4[key] = cls;
}
// node_modules/@antv/scale/esm/identity/index.js
var Identity = function(_super) {
__extends(Identity2, _super);
function Identity2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "identity";
_this.isIdentity = true;
return _this;
}
Identity2.prototype.calculateTicks = function() {
return this.values;
};
Identity2.prototype.scale = function(value2) {
if (this.values[0] !== value2 && is_number_default(value2)) {
return value2;
}
return this.range[0];
};
Identity2.prototype.invert = function(value2) {
var range = this.range;
if (value2 < range[0] || value2 > range[1]) {
return NaN;
}
return this.values[0];
};
return Identity2;
}(base_default4);
var identity_default2 = Identity;
// node_modules/@antv/scale/esm/util/pretty-number.js
function prettyNumber(n3) {
return Math.abs(n3) < 1e-15 ? n3 : parseFloat(n3.toFixed(15));
}
// node_modules/@antv/scale/esm/util/extended.js
var DEFAULT_Q = [1, 5, 2, 2.5, 4, 3];
var eps = Number.EPSILON * 100;
function mod2(n3, m4) {
return (n3 % m4 + m4) % m4;
}
function round4(n3) {
return Math.round(n3 * 1e12) / 1e12;
}
function simplicity(q4, Q2, j4, lmin, lmax, lstep) {
var n3 = size(Q2);
var i4 = index_of_default(Q2, q4);
var v3 = 0;
var m4 = mod2(lmin, lstep);
if ((m4 < eps || lstep - m4 < eps) && lmin <= 0 && lmax >= 0) {
v3 = 1;
}
return 1 - i4 / (n3 - 1) - j4 + v3;
}
function simplicityMax(q4, Q2, j4) {
var n3 = size(Q2);
var i4 = index_of_default(Q2, q4);
var v3 = 1;
return 1 - i4 / (n3 - 1) - j4 + v3;
}
function density(k4, m4, dMin, dMax, lMin, lMax) {
var r4 = (k4 - 1) / (lMax - lMin);
var rt = (m4 - 1) / (Math.max(lMax, dMax) - Math.min(dMin, lMin));
return 2 - Math.max(r4 / rt, rt / r4);
}
function densityMax(k4, m4) {
if (k4 >= m4) {
return 2 - (k4 - 1) / (m4 - 1);
}
return 1;
}
function coverage(dMin, dMax, lMin, lMax) {
var range = dMax - dMin;
return 1 - 0.5 * (Math.pow(dMax - lMax, 2) + Math.pow(dMin - lMin, 2)) / Math.pow(0.1 * range, 2);
}
function coverageMax(dMin, dMax, span) {
var range = dMax - dMin;
if (span > range) {
var half = (span - range) / 2;
return 1 - Math.pow(half, 2) / Math.pow(0.1 * range, 2);
}
return 1;
}
function legibility() {
return 1;
}
function extended(dMin, dMax, n3, onlyLoose, Q2, w4) {
if (n3 === void 0) {
n3 = 5;
}
if (onlyLoose === void 0) {
onlyLoose = true;
}
if (Q2 === void 0) {
Q2 = DEFAULT_Q;
}
if (w4 === void 0) {
w4 = [0.25, 0.2, 0.5, 0.05];
}
var m4 = n3 < 0 ? 0 : Math.round(n3);
if (Number.isNaN(dMin) || Number.isNaN(dMax) || typeof dMin !== "number" || typeof dMax !== "number" || !m4) {
return {
min: 0,
max: 0,
ticks: []
};
}
if (dMax - dMin < 1e-15 || m4 === 1) {
return {
min: dMin,
max: dMax,
ticks: [dMin]
};
}
var best = {
score: -2,
lmin: 0,
lmax: 0,
lstep: 0
};
var j4 = 1;
while (j4 < Infinity) {
for (var i4 = 0; i4 < Q2.length; i4 += 1) {
var q4 = Q2[i4];
var sm = simplicityMax(q4, Q2, j4);
if (w4[0] * sm + w4[1] + w4[2] + w4[3] < best.score) {
j4 = Infinity;
break;
}
var k4 = 2;
while (k4 < Infinity) {
var dm = densityMax(k4, m4);
if (w4[0] * sm + w4[1] + w4[2] * dm + w4[3] < best.score) {
break;
}
var delta = (dMax - dMin) / (k4 + 1) / j4 / q4;
var z3 = Math.ceil(Math.log10(delta));
while (z3 < Infinity) {
var step = j4 * q4 * Math.pow(10, z3);
var cm = coverageMax(dMin, dMax, step * (k4 - 1));
if (w4[0] * sm + w4[1] * cm + w4[2] * dm + w4[3] < best.score) {
break;
}
var minStart = Math.floor(dMax / step) * j4 - (k4 - 1) * j4;
var maxStart = Math.ceil(dMin / step) * j4;
if (minStart <= maxStart) {
var count2 = maxStart - minStart;
for (var i_1 = 0; i_1 <= count2; i_1 += 1) {
var start = minStart + i_1;
var lMin = start * (step / j4);
var lMax = lMin + step * (k4 - 1);
var lStep = step;
var s4 = simplicity(q4, Q2, j4, lMin, lMax, lStep);
var c5 = coverage(dMin, dMax, lMin, lMax);
var g4 = density(k4, m4, dMin, dMax, lMin, lMax);
var l4 = legibility();
var score2 = w4[0] * s4 + w4[1] * c5 + w4[2] * g4 + w4[3] * l4;
if (score2 > best.score && (!onlyLoose || lMin <= dMin && lMax >= dMax)) {
best.lmin = lMin;
best.lmax = lMax;
best.lstep = lStep;
best.score = score2;
}
}
}
z3 += 1;
}
k4 += 1;
}
}
j4 += 1;
}
var lmax = prettyNumber(best.lmax);
var lmin = prettyNumber(best.lmin);
var lstep = prettyNumber(best.lstep);
var tickCount = Math.floor(round4((lmax - lmin) / lstep)) + 1;
var ticks = new Array(tickCount);
ticks[0] = prettyNumber(lmin);
for (var i4 = 1; i4 < tickCount; i4++) {
ticks[i4] = prettyNumber(ticks[i4 - 1] + lstep);
}
return {
min: Math.min(dMin, head(ticks)),
max: Math.max(dMax, last(ticks)),
ticks
};
}
// node_modules/@antv/scale/esm/tick-method/cat.js
function calculateCatTicks(cfg) {
var values2 = cfg.values, tickInterval = cfg.tickInterval, tickCount = cfg.tickCount;
var ticks = values2;
if (is_number_default(tickInterval)) {
return filter_default(ticks, function(__, i4) {
return i4 % tickInterval === 0;
});
}
var min7 = cfg.min, max8 = cfg.max;
if (is_nil_default(min7)) {
min7 = 0;
}
if (is_nil_default(max8)) {
max8 = values2.length - 1;
}
if (is_number_default(tickCount) && tickCount < max8 - min7) {
var ticks_1 = extended(min7, max8, tickCount, false, [1, 2, 5, 3, 4, 7, 6, 8, 9]).ticks;
var valid = filter_default(ticks_1, function(tick) {
return tick >= min7 && tick <= max8;
});
return valid.map(function(index2) {
return values2[index2];
});
}
return values2.slice(min7, max8 + 1);
}
// node_modules/@antv/scale/esm/util/d3-linear.js
function d3Linear(cfg) {
var min7 = cfg.min, max8 = cfg.max, nice = cfg.nice, tickCount = cfg.tickCount;
var linear4 = new D3Linear();
linear4.domain([min7, max8]);
if (nice) {
linear4.nice(tickCount);
}
return linear4.ticks(tickCount);
}
var DEFAULT_COUNT = 5;
var e10 = Math.sqrt(50);
var e5 = Math.sqrt(10);
var e22 = Math.sqrt(2);
var D3Linear = function() {
function D3Linear2() {
this._domain = [0, 1];
}
D3Linear2.prototype.domain = function(domain) {
if (domain) {
this._domain = Array.from(domain, Number);
return this;
}
return this._domain.slice();
};
D3Linear2.prototype.nice = function(count2) {
var _a6, _b;
if (count2 === void 0) {
count2 = DEFAULT_COUNT;
}
var d3 = this._domain.slice();
var i0 = 0;
var i1 = this._domain.length - 1;
var start = this._domain[i0];
var stop = this._domain[i1];
var step;
if (stop < start) {
_a6 = [stop, start], start = _a6[0], stop = _a6[1];
_b = [i1, i0], i0 = _b[0], i1 = _b[1];
}
step = tickIncrement(start, stop, count2);
if (step > 0) {
start = Math.floor(start / step) * step;
stop = Math.ceil(stop / step) * step;
step = tickIncrement(start, stop, count2);
} else if (step < 0) {
start = Math.ceil(start * step) / step;
stop = Math.floor(stop * step) / step;
step = tickIncrement(start, stop, count2);
}
if (step > 0) {
d3[i0] = Math.floor(start / step) * step;
d3[i1] = Math.ceil(stop / step) * step;
this.domain(d3);
} else if (step < 0) {
d3[i0] = Math.ceil(start * step) / step;
d3[i1] = Math.floor(stop * step) / step;
this.domain(d3);
}
return this;
};
D3Linear2.prototype.ticks = function(count2) {
if (count2 === void 0) {
count2 = DEFAULT_COUNT;
}
return d3ArrayTicks(this._domain[0], this._domain[this._domain.length - 1], count2 || DEFAULT_COUNT);
};
return D3Linear2;
}();
function d3ArrayTicks(start, stop, count2) {
var reverse;
var i4 = -1;
var n3;
var ticks;
var step;
stop = +stop, start = +start, count2 = +count2;
if (start === stop && count2 > 0) {
return [start];
}
if (reverse = stop < start) {
n3 = start, start = stop, stop = n3;
}
if ((step = tickIncrement(start, stop, count2)) === 0 || !isFinite(step)) {
return [];
}
if (step > 0) {
start = Math.ceil(start / step);
stop = Math.floor(stop / step);
ticks = new Array(n3 = Math.ceil(stop - start + 1));
while (++i4 < n3) {
ticks[i4] = (start + i4) * step;
}
} else {
start = Math.floor(start * step);
stop = Math.ceil(stop * step);
ticks = new Array(n3 = Math.ceil(start - stop + 1));
while (++i4 < n3) {
ticks[i4] = (start - i4) / step;
}
}
if (reverse) {
ticks.reverse();
}
return ticks;
}
function tickIncrement(start, stop, count2) {
var step = (stop - start) / Math.max(0, count2);
var power = Math.floor(Math.log(step) / Math.LN10);
var error = step / Math.pow(10, power);
return power >= 0 ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e22 ? 2 : 1) * Math.pow(10, power) : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e22 ? 2 : 1);
}
// node_modules/@antv/scale/esm/util/interval.js
function snapMultiple(v3, base, snapType) {
var div4;
if (snapType === "ceil") {
div4 = Math.ceil(v3 / base);
} else if (snapType === "floor") {
div4 = Math.floor(v3 / base);
} else {
div4 = Math.round(v3 / base);
}
return div4 * base;
}
function intervalTicks(min7, max8, interval3) {
var minTick = snapMultiple(min7, interval3, "floor");
var maxTick = snapMultiple(max8, interval3, "ceil");
minTick = fixed_base_default(minTick, interval3);
maxTick = fixed_base_default(maxTick, interval3);
var ticks = [];
for (var i4 = minTick; i4 <= maxTick; i4 = i4 + interval3) {
var tickValue = fixed_base_default(i4, interval3);
ticks.push(tickValue);
}
return {
min: minTick,
max: maxTick,
ticks
};
}
// node_modules/@antv/scale/esm/util/strict-limit.js
function strictLimit(cfg, defaultMin, defaultMax) {
var _a6;
var minLimit = cfg.minLimit, maxLimit = cfg.maxLimit, min7 = cfg.min, max8 = cfg.max, _b = cfg.tickCount, tickCount = _b === void 0 ? 5 : _b;
var tickMin = is_nil_default(minLimit) ? is_nil_default(defaultMin) ? min7 : defaultMin : minLimit;
var tickMax = is_nil_default(maxLimit) ? is_nil_default(defaultMax) ? max8 : defaultMax : maxLimit;
if (tickMin > tickMax) {
_a6 = [tickMin, tickMax], tickMax = _a6[0], tickMin = _a6[1];
}
if (tickCount <= 2) {
return [tickMin, tickMax];
}
var step = (tickMax - tickMin) / (tickCount - 1);
var ticks = [];
for (var i4 = 0; i4 < tickCount; i4++) {
ticks.push(tickMin + step * i4);
}
return ticks;
}
// node_modules/@antv/scale/esm/tick-method/d3-linear.js
function d3LinearTickMethod(cfg) {
var min7 = cfg.min, max8 = cfg.max, tickInterval = cfg.tickInterval, minLimit = cfg.minLimit, maxLimit = cfg.maxLimit;
var ticks = d3Linear(cfg);
if (!is_nil_default(minLimit) || !is_nil_default(maxLimit)) {
return strictLimit(cfg, head(ticks), last(ticks));
}
if (tickInterval) {
return intervalTicks(min7, max8, tickInterval).ticks;
}
return ticks;
}
// node_modules/@antv/scale/esm/tick-method/linear.js
function linear3(cfg) {
var min7 = cfg.min, max8 = cfg.max, tickCount = cfg.tickCount, nice = cfg.nice, tickInterval = cfg.tickInterval, minLimit = cfg.minLimit, maxLimit = cfg.maxLimit;
var ticks = extended(min7, max8, tickCount, nice).ticks;
if (!is_nil_default(minLimit) || !is_nil_default(maxLimit)) {
return strictLimit(cfg, head(ticks), last(ticks));
}
if (tickInterval) {
return intervalTicks(min7, max8, tickInterval).ticks;
}
return ticks;
}
// node_modules/@antv/scale/esm/tick-method/log.js
function calculateLogTicks(cfg) {
var base = cfg.base, tickCount = cfg.tickCount, min7 = cfg.min, max8 = cfg.max, values2 = cfg.values;
var minTick;
var maxTick = log(base, max8);
if (min7 > 0) {
minTick = Math.floor(log(base, min7));
} else {
var positiveMin = getLogPositiveMin(values2, base, max8);
minTick = Math.floor(log(base, positiveMin));
}
var count2 = maxTick - minTick;
var avg2 = Math.ceil(count2 / tickCount);
var ticks = [];
for (var i4 = minTick; i4 < maxTick + avg2; i4 = i4 + avg2) {
ticks.push(Math.pow(base, i4));
}
if (min7 <= 0) {
ticks.unshift(0);
}
return ticks;
}
// node_modules/@antv/scale/esm/util/pretty.js
function pretty(min7, max8, m4) {
if (m4 === void 0) {
m4 = 5;
}
if (min7 === max8) {
return {
max: max8,
min: min7,
ticks: [min7]
};
}
var n3 = m4 < 0 ? 0 : Math.round(m4);
if (n3 === 0)
return { max: max8, min: min7, ticks: [] };
var h3 = 1.5;
var h5 = 0.5 + 1.5 * h3;
var d3 = max8 - min7;
var c5 = d3 / n3;
var base = Math.pow(10, Math.floor(Math.log10(c5)));
var unit = base;
if (2 * base - c5 < h3 * (c5 - unit)) {
unit = 2 * base;
if (5 * base - c5 < h5 * (c5 - unit)) {
unit = 5 * base;
if (10 * base - c5 < h3 * (c5 - unit)) {
unit = 10 * base;
}
}
}
var nu = Math.ceil(max8 / unit);
var ns = Math.floor(min7 / unit);
var hi = Math.max(nu * unit, max8);
var lo = Math.min(ns * unit, min7);
var size2 = Math.floor((hi - lo) / unit) + 1;
var ticks = new Array(size2);
for (var i4 = 0; i4 < size2; i4++) {
ticks[i4] = prettyNumber(lo + i4 * unit);
}
return {
min: lo,
max: hi,
ticks
};
}
// node_modules/@antv/scale/esm/tick-method/pow.js
function calculatePowTicks(cfg) {
var exponent2 = cfg.exponent, tickCount = cfg.tickCount;
var max8 = Math.ceil(calBase(exponent2, cfg.max));
var min7 = Math.floor(calBase(exponent2, cfg.min));
var ticks = pretty(min7, max8, tickCount).ticks;
return ticks.map(function(tick) {
var factor = tick >= 0 ? 1 : -1;
return Math.pow(tick, exponent2) * factor;
});
}
// node_modules/@antv/scale/esm/tick-method/quantile.js
function quantileSorted(x6, p4) {
var idx = x6.length * p4;
if (p4 === 1) {
return x6[x6.length - 1];
} else if (p4 === 0) {
return x6[0];
} else if (idx % 1 !== 0) {
return x6[Math.ceil(idx) - 1];
} else if (x6.length % 2 === 0) {
return (x6[idx - 1] + x6[idx]) / 2;
} else {
return x6[idx];
}
}
function calculateTicks(cfg) {
var tickCount = cfg.tickCount, values2 = cfg.values;
if (!values2 || !values2.length) {
return [];
}
var sorted = values2.slice().sort(function(a4, b10) {
return a4 - b10;
});
var ticks = [];
for (var i4 = 0; i4 < tickCount; i4++) {
var p4 = i4 / (tickCount - 1);
ticks.push(quantileSorted(sorted, p4));
}
return ticks;
}
// node_modules/@antv/scale/esm/tick-method/r-prettry.js
function linearPretty(cfg) {
var min7 = cfg.min, max8 = cfg.max, tickCount = cfg.tickCount, tickInterval = cfg.tickInterval, minLimit = cfg.minLimit, maxLimit = cfg.maxLimit;
var ticks = pretty(min7, max8, tickCount).ticks;
if (!is_nil_default(minLimit) || !is_nil_default(maxLimit)) {
return strictLimit(cfg, head(ticks), last(ticks));
}
if (tickInterval) {
return intervalTicks(min7, max8, tickInterval).ticks;
}
return ticks;
}
// node_modules/@antv/scale/esm/tick-method/time.js
function calculateTimeTicks(cfg) {
var min7 = cfg.min, max8 = cfg.max, minTickInterval = cfg.minTickInterval;
var tickInterval = cfg.tickInterval;
var tickCount = cfg.tickCount;
if (tickInterval) {
tickCount = Math.ceil((max8 - min7) / tickInterval);
} else {
tickInterval = getTickInterval(min7, max8, tickCount)[1];
var count2 = (max8 - min7) / tickInterval;
var ratio = count2 / tickCount;
if (ratio > 1) {
tickInterval = tickInterval * Math.ceil(ratio);
}
if (minTickInterval && tickInterval < minTickInterval) {
tickInterval = minTickInterval;
}
}
var ticks = [];
for (var i4 = min7; i4 < max8 + tickInterval; i4 += tickInterval) {
ticks.push(i4);
}
return ticks;
}
// node_modules/@antv/scale/esm/tick-method/time-cat.js
function calculateTimeCatTicks(cfg) {
var ticks = calculateCatTicks(cfg);
var lastValue = last(cfg.values);
if (lastValue !== last(ticks)) {
ticks.push(lastValue);
}
return ticks;
}
// node_modules/@antv/scale/esm/tick-method/time-pretty.js
function getYear(date) {
return new Date(date).getFullYear();
}
function createYear(year) {
return new Date(year, 0, 1).getTime();
}
function getMonth(date) {
return new Date(date).getMonth();
}
function diffMonth(min7, max8) {
var minYear = getYear(min7);
var maxYear = getYear(max8);
var minMonth = getMonth(min7);
var maxMonth = getMonth(max8);
return (maxYear - minYear) * 12 + (maxMonth - minMonth) % 12;
}
function creatMonth(year, month) {
return new Date(year, month, 1).getTime();
}
function diffDay(min7, max8) {
return Math.ceil((max8 - min7) / DAY);
}
function diffHour(min7, max8) {
return Math.ceil((max8 - min7) / HOUR);
}
function diffMinus(min7, max8) {
return Math.ceil((max8 - min7) / (60 * 1e3));
}
function timePretty(cfg) {
var min7 = cfg.min, max8 = cfg.max, minTickInterval = cfg.minTickInterval, tickCount = cfg.tickCount;
var tickInterval = cfg.tickInterval;
var ticks = [];
if (!tickInterval) {
tickInterval = (max8 - min7) / tickCount;
if (minTickInterval && tickInterval < minTickInterval) {
tickInterval = minTickInterval;
}
}
var minYear = getYear(min7);
if (tickInterval > YEAR) {
var maxYear = getYear(max8);
var yearInterval = Math.ceil(tickInterval / YEAR);
for (var i4 = minYear; i4 <= maxYear + yearInterval; i4 = i4 + yearInterval) {
ticks.push(createYear(i4));
}
} else if (tickInterval > MONTH) {
var monthInterval = Math.ceil(tickInterval / MONTH);
var mmMoth = getMonth(min7);
var dMonths = diffMonth(min7, max8);
for (var i4 = 0; i4 <= dMonths + monthInterval; i4 = i4 + monthInterval) {
ticks.push(creatMonth(minYear, i4 + mmMoth));
}
} else if (tickInterval > DAY) {
var date = new Date(min7);
var year = date.getFullYear();
var month = date.getMonth();
var mday = date.getDate();
var day = Math.ceil(tickInterval / DAY);
var ddays = diffDay(min7, max8);
for (var i4 = 0; i4 < ddays + day; i4 = i4 + day) {
ticks.push(new Date(year, month, mday + i4).getTime());
}
} else if (tickInterval > HOUR) {
var date = new Date(min7);
var year = date.getFullYear();
var month = date.getMonth();
var day = date.getDate();
var hour = date.getHours();
var hours = Math.ceil(tickInterval / HOUR);
var dHours = diffHour(min7, max8);
for (var i4 = 0; i4 <= dHours + hours; i4 = i4 + hours) {
ticks.push(new Date(year, month, day, hour + i4).getTime());
}
} else if (tickInterval > MINUTE) {
var dMinus = diffMinus(min7, max8);
var minutes = Math.ceil(tickInterval / MINUTE);
for (var i4 = 0; i4 <= dMinus + minutes; i4 = i4 + minutes) {
ticks.push(min7 + i4 * MINUTE);
}
} else {
var interval3 = tickInterval;
if (interval3 < SECOND) {
interval3 = SECOND;
}
var minSecond = Math.floor(min7 / SECOND) * SECOND;
var dSeconds = Math.ceil((max8 - min7) / SECOND);
var seconds = Math.ceil(interval3 / SECOND);
for (var i4 = 0; i4 < dSeconds + seconds; i4 = i4 + seconds) {
ticks.push(minSecond + i4 * SECOND);
}
}
if (ticks.length >= 512) {
console.warn("Notice: current ticks length(" + ticks.length + ') >= 512, may cause performance issues, even out of memory. Because of the configure "tickInterval"(in milliseconds, current is ' + tickInterval + ") is too small, increase the value to solve the problem!");
}
return ticks;
}
// node_modules/@antv/scale/esm/tick-method/index.js
registerTickMethod("cat", calculateCatTicks);
registerTickMethod("time-cat", calculateTimeCatTicks);
registerTickMethod("wilkinson-extended", linear3);
registerTickMethod("r-pretty", linearPretty);
registerTickMethod("time", calculateTimeTicks);
registerTickMethod("time-pretty", timePretty);
registerTickMethod("log", calculateLogTicks);
registerTickMethod("pow", calculatePowTicks);
registerTickMethod("quantile", calculateTicks);
registerTickMethod("d3-linear", d3LinearTickMethod);
// node_modules/@antv/scale/esm/index.js
registerClass("cat", base_default5);
registerClass("category", base_default5);
registerClass("identity", identity_default2);
registerClass("linear", linear_default);
registerClass("log", log_default);
registerClass("pow", pow_default);
registerClass("time", time_default2);
registerClass("timeCat", time_default);
registerClass("quantize", quantize_default);
registerClass("quantile", quantile_default);
// node_modules/@antv/attr/esm/factory.js
var ATTRIBUTE_MAP = {};
var getAttribute = function(type2) {
return ATTRIBUTE_MAP[type2.toLowerCase()];
};
var registerAttribute = function(type2, ctor) {
if (getAttribute(type2)) {
throw new Error("Attribute type '" + type2 + "' existed.");
}
ATTRIBUTE_MAP[type2.toLowerCase()] = ctor;
};
// node_modules/@antv/attr/esm/index.js
registerAttribute("Color", color_default);
registerAttribute("Opacity", opacity_default);
registerAttribute("Position", position_default);
registerAttribute("Shape", shape_default2);
registerAttribute("Size", size_default);
// node_modules/@antv/coord/esm/coord/base.js
var Coordinate = function() {
function Coordinate2(cfg) {
this.type = "coordinate";
this.isRect = false;
this.isHelix = false;
this.isPolar = false;
this.isReflectX = false;
this.isReflectY = false;
var start = cfg.start, end2 = cfg.end, _a6 = cfg.matrix, matrix = _a6 === void 0 ? [1, 0, 0, 0, 1, 0, 0, 0, 1] : _a6, _b = cfg.isTransposed, isTransposed = _b === void 0 ? false : _b;
this.start = start;
this.end = end2;
this.matrix = matrix;
this.originalMatrix = __spreadArray([], matrix);
this.isTransposed = isTransposed;
}
Coordinate2.prototype.initial = function() {
this.center = {
x: (this.start.x + this.end.x) / 2,
y: (this.start.y + this.end.y) / 2
};
this.width = Math.abs(this.end.x - this.start.x);
this.height = Math.abs(this.end.y - this.start.y);
};
Coordinate2.prototype.update = function(cfg) {
mix(this, cfg);
this.initial();
};
Coordinate2.prototype.convertDim = function(percent2, dim) {
var _a6;
var _b = this[dim], start = _b.start, end2 = _b.end;
if (this.isReflect(dim)) {
_a6 = [end2, start], start = _a6[0], end2 = _a6[1];
}
return start + percent2 * (end2 - start);
};
Coordinate2.prototype.invertDim = function(value2, dim) {
var _a6;
var _b = this[dim], start = _b.start, end2 = _b.end;
if (this.isReflect(dim)) {
_a6 = [end2, start], start = _a6[0], end2 = _a6[1];
}
return (value2 - start) / (end2 - start);
};
Coordinate2.prototype.applyMatrix = function(x6, y5, tag) {
if (tag === void 0) {
tag = 0;
}
var matrix = this.matrix;
var vector = [x6, y5, tag];
vec3_exports.transformMat3(vector, vector, matrix);
return vector;
};
Coordinate2.prototype.invertMatrix = function(x6, y5, tag) {
if (tag === void 0) {
tag = 0;
}
var matrix = this.matrix;
var inverted = mat3_exports.invert([0, 0, 0, 0, 0, 0, 0, 0, 0], matrix);
var vector = [x6, y5, tag];
if (inverted) {
vec3_exports.transformMat3(vector, vector, inverted);
}
return vector;
};
Coordinate2.prototype.convert = function(point2) {
var _a6 = this.convertPoint(point2), x6 = _a6.x, y5 = _a6.y;
var vector = this.applyMatrix(x6, y5, 1);
return {
x: vector[0],
y: vector[1]
};
};
Coordinate2.prototype.invert = function(point2) {
var vector = this.invertMatrix(point2.x, point2.y, 1);
return this.invertPoint({
x: vector[0],
y: vector[1]
});
};
Coordinate2.prototype.rotate = function(radian) {
var matrix = this.matrix;
var center2 = this.center;
ext_exports.leftTranslate(matrix, matrix, [-center2.x, -center2.y]);
ext_exports.leftRotate(matrix, matrix, radian);
ext_exports.leftTranslate(matrix, matrix, [center2.x, center2.y]);
return this;
};
Coordinate2.prototype.reflect = function(dim) {
if (dim === "x") {
this.isReflectX = !this.isReflectX;
} else {
this.isReflectY = !this.isReflectY;
}
return this;
};
Coordinate2.prototype.scale = function(s1, s22) {
var matrix = this.matrix;
var center2 = this.center;
ext_exports.leftTranslate(matrix, matrix, [-center2.x, -center2.y]);
ext_exports.leftScale(matrix, matrix, [s1, s22]);
ext_exports.leftTranslate(matrix, matrix, [center2.x, center2.y]);
return this;
};
Coordinate2.prototype.translate = function(x6, y5) {
var matrix = this.matrix;
ext_exports.leftTranslate(matrix, matrix, [x6, y5]);
return this;
};
Coordinate2.prototype.transpose = function() {
this.isTransposed = !this.isTransposed;
return this;
};
Coordinate2.prototype.getCenter = function() {
return this.center;
};
Coordinate2.prototype.getWidth = function() {
return this.width;
};
Coordinate2.prototype.getHeight = function() {
return this.height;
};
Coordinate2.prototype.getRadius = function() {
return this.radius;
};
Coordinate2.prototype.isReflect = function(dim) {
return dim === "x" ? this.isReflectX : this.isReflectY;
};
Coordinate2.prototype.resetMatrix = function(matrix) {
this.matrix = matrix ? matrix : __spreadArray([], this.originalMatrix);
};
return Coordinate2;
}();
var base_default7 = Coordinate;
// node_modules/@antv/coord/esm/coord/cartesian.js
var Cartesian = function(_super) {
__extends(Cartesian2, _super);
function Cartesian2(cfg) {
var _this = _super.call(this, cfg) || this;
_this.isRect = true;
_this.type = "cartesian";
_this.initial();
return _this;
}
Cartesian2.prototype.initial = function() {
_super.prototype.initial.call(this);
var start = this.start;
var end2 = this.end;
this.x = {
start: start.x,
end: end2.x
};
this.y = {
start: start.y,
end: end2.y
};
};
Cartesian2.prototype.convertPoint = function(point2) {
var _a6;
var x6 = point2.x, y5 = point2.y;
if (this.isTransposed) {
_a6 = [y5, x6], x6 = _a6[0], y5 = _a6[1];
}
return {
x: this.convertDim(x6, "x"),
y: this.convertDim(y5, "y")
};
};
Cartesian2.prototype.invertPoint = function(point2) {
var _a6;
var x6 = this.invertDim(point2.x, "x");
var y5 = this.invertDim(point2.y, "y");
if (this.isTransposed) {
_a6 = [y5, x6], x6 = _a6[0], y5 = _a6[1];
}
return { x: x6, y: y5 };
};
return Cartesian2;
}(base_default7);
var cartesian_default = Cartesian;
// node_modules/@antv/coord/esm/coord/helix.js
var Helix = function(_super) {
__extends(Helix2, _super);
function Helix2(cfg) {
var _this = _super.call(this, cfg) || this;
_this.isHelix = true;
_this.type = "helix";
var _a6 = cfg.startAngle, startAngle = _a6 === void 0 ? 1.25 * Math.PI : _a6, _b = cfg.endAngle, endAngle = _b === void 0 ? 7.25 * Math.PI : _b, _c = cfg.innerRadius, innerRadius = _c === void 0 ? 0 : _c, radius = cfg.radius;
_this.startAngle = startAngle;
_this.endAngle = endAngle;
_this.innerRadius = innerRadius;
_this.radius = radius;
_this.initial();
return _this;
}
Helix2.prototype.initial = function() {
_super.prototype.initial.call(this);
var index2 = (this.endAngle - this.startAngle) / (2 * Math.PI) + 1;
var maxRadius = Math.min(this.width, this.height) / 2;
if (this.radius && this.radius >= 0 && this.radius <= 1) {
maxRadius = maxRadius * this.radius;
}
this.d = Math.floor(maxRadius * (1 - this.innerRadius) / index2);
this.a = this.d / (Math.PI * 2);
this.x = {
start: this.startAngle,
end: this.endAngle
};
this.y = {
start: this.innerRadius * maxRadius,
end: this.innerRadius * maxRadius + this.d * 0.99
};
};
Helix2.prototype.convertPoint = function(point2) {
var _a6;
var x6 = point2.x, y5 = point2.y;
if (this.isTransposed) {
_a6 = [y5, x6], x6 = _a6[0], y5 = _a6[1];
}
var thi = this.convertDim(x6, "x");
var r4 = this.a * thi;
var newY = this.convertDim(y5, "y");
return {
x: this.center.x + Math.cos(thi) * (r4 + newY),
y: this.center.y + Math.sin(thi) * (r4 + newY)
};
};
Helix2.prototype.invertPoint = function(point2) {
var _a6;
var d3 = this.d + this.y.start;
var v3 = vec2_exports.subtract([0, 0], [point2.x, point2.y], [this.center.x, this.center.y]);
var thi = ext_exports.angleTo(v3, [1, 0], true);
var rMin = thi * this.a;
if (vec2_exports.length(v3) < rMin) {
rMin = vec2_exports.length(v3);
}
var index2 = Math.floor((vec2_exports.length(v3) - rMin) / d3);
thi = 2 * index2 * Math.PI + thi;
var r4 = this.a * thi;
var newY = vec2_exports.length(v3) - r4;
newY = isNumberEqual(newY, 0) ? 0 : newY;
var x6 = this.invertDim(thi, "x");
var y5 = this.invertDim(newY, "y");
x6 = isNumberEqual(x6, 0) ? 0 : x6;
y5 = isNumberEqual(y5, 0) ? 0 : y5;
if (this.isTransposed) {
_a6 = [y5, x6], x6 = _a6[0], y5 = _a6[1];
}
return { x: x6, y: y5 };
};
return Helix2;
}(base_default7);
var helix_default = Helix;
// node_modules/@antv/coord/esm/coord/polar.js
var Polar = function(_super) {
__extends(Polar2, _super);
function Polar2(cfg) {
var _this = _super.call(this, cfg) || this;
_this.isPolar = true;
_this.type = "polar";
var _a6 = cfg.startAngle, startAngle = _a6 === void 0 ? -Math.PI / 2 : _a6, _b = cfg.endAngle, endAngle = _b === void 0 ? Math.PI * 3 / 2 : _b, _c = cfg.innerRadius, innerRadius = _c === void 0 ? 0 : _c, radius = cfg.radius;
_this.startAngle = startAngle;
_this.endAngle = endAngle;
_this.innerRadius = innerRadius;
_this.radius = radius;
_this.initial();
return _this;
}
Polar2.prototype.initial = function() {
_super.prototype.initial.call(this);
while (this.endAngle < this.startAngle) {
this.endAngle += Math.PI * 2;
}
var oneBox = this.getOneBox();
var oneWidth = oneBox.maxX - oneBox.minX;
var oneHeight = oneBox.maxY - oneBox.minY;
var left2 = Math.abs(oneBox.minX) / oneWidth;
var top = Math.abs(oneBox.minY) / oneHeight;
var maxRadius;
if (this.height / oneHeight > this.width / oneWidth) {
maxRadius = this.width / oneWidth;
this.circleCenter = {
x: this.center.x - (0.5 - left2) * this.width,
y: this.center.y - (0.5 - top) * maxRadius * oneHeight
};
} else {
maxRadius = this.height / oneHeight;
this.circleCenter = {
x: this.center.x - (0.5 - left2) * maxRadius * oneWidth,
y: this.center.y - (0.5 - top) * this.height
};
}
this.polarRadius = this.radius;
if (!this.radius) {
this.polarRadius = maxRadius;
} else if (this.radius > 0 && this.radius <= 1) {
this.polarRadius = maxRadius * this.radius;
} else if (this.radius <= 0 || this.radius > maxRadius) {
this.polarRadius = maxRadius;
}
this.x = {
start: this.startAngle,
end: this.endAngle
};
this.y = {
start: this.innerRadius * this.polarRadius,
end: this.polarRadius
};
};
Polar2.prototype.getRadius = function() {
return this.polarRadius;
};
Polar2.prototype.convertPoint = function(point2) {
var _a6;
var center2 = this.getCenter();
var x6 = point2.x, y5 = point2.y;
if (this.isTransposed) {
_a6 = [y5, x6], x6 = _a6[0], y5 = _a6[1];
}
x6 = this.convertDim(x6, "x");
y5 = this.convertDim(y5, "y");
return {
x: center2.x + Math.cos(x6) * y5,
y: center2.y + Math.sin(x6) * y5
};
};
Polar2.prototype.invertPoint = function(point2) {
var _a6;
var center2 = this.getCenter();
var vPoint = [point2.x - center2.x, point2.y - center2.y];
var _b = this, startAngle = _b.startAngle, endAngle = _b.endAngle;
if (this.isReflect("x")) {
_a6 = [endAngle, startAngle], startAngle = _a6[0], endAngle = _a6[1];
}
var m4 = [1, 0, 0, 0, 1, 0, 0, 0, 1];
ext_exports.leftRotate(m4, m4, startAngle);
var vStart3 = [1, 0, 0];
vec3_exports.transformMat3(vStart3, vStart3, m4);
var vStart2 = [vStart3[0], vStart3[1]];
var angle3 = ext_exports.angleTo(vStart2, vPoint, endAngle < startAngle);
if (isNumberEqual(angle3, Math.PI * 2)) {
angle3 = 0;
}
var radius = vec2_exports.length(vPoint);
var xPercent = angle3 / (endAngle - startAngle);
xPercent = endAngle - startAngle > 0 ? xPercent : -xPercent;
var yPercent = this.invertDim(radius, "y");
var rst = { x: 0, y: 0 };
rst.x = this.isTransposed ? yPercent : xPercent;
rst.y = this.isTransposed ? xPercent : yPercent;
return rst;
};
Polar2.prototype.getCenter = function() {
return this.circleCenter;
};
Polar2.prototype.getOneBox = function() {
var startAngle = this.startAngle;
var endAngle = this.endAngle;
if (Math.abs(endAngle - startAngle) >= Math.PI * 2) {
return {
minX: -1,
maxX: 1,
minY: -1,
maxY: 1
};
}
var xs = [0, Math.cos(startAngle), Math.cos(endAngle)];
var ys = [0, Math.sin(startAngle), Math.sin(endAngle)];
for (var i4 = Math.min(startAngle, endAngle); i4 < Math.max(startAngle, endAngle); i4 += Math.PI / 18) {
xs.push(Math.cos(i4));
ys.push(Math.sin(i4));
}
return {
minX: Math.min.apply(Math, xs),
maxX: Math.max.apply(Math, xs),
minY: Math.min.apply(Math, ys),
maxY: Math.max.apply(Math, ys)
};
};
return Polar2;
}(base_default7);
var polar_default = Polar;
// node_modules/@antv/coord/esm/factory.js
var COORDINATE_MAP = {};
var getCoordinate = function(type2) {
return COORDINATE_MAP[type2.toLowerCase()];
};
var registerCoordinate = function(type2, ctor) {
COORDINATE_MAP[type2.toLowerCase()] = ctor;
};
// node_modules/@antv/coord/esm/index.js
registerCoordinate("rect", cartesian_default);
registerCoordinate("cartesian", cartesian_default);
registerCoordinate("polar", polar_default);
registerCoordinate("helix", helix_default);
// node_modules/@antv/component/esm/annotation/index.js
var annotation_exports = {};
__export(annotation_exports, {
Arc: () => arc_default2,
DataMarker: () => data_marker_default,
DataRegion: () => data_region_default,
Html: () => html_default,
Image: () => image_default,
Line: () => line_default3,
Region: () => region_default,
RegionFilter: () => region_filter_default,
Shape: () => shape_default3,
Text: () => text_default2
});
// node_modules/@antv/component/esm/util/event.js
function propagationDelegate(group2, eventName, eventObject) {
var event = new graph_event_default(eventName, eventObject);
event.target = group2;
event.propagationPath.push(group2);
group2.emitDelegation(eventName, event);
var parent = group2.getParent();
while (parent) {
parent.emitDelegation(eventName, event);
event.propagationPath.push(parent);
parent = parent.getParent();
}
}
// node_modules/@antv/component/esm/util/matrix.js
var identityMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
function getMatrixByAngle(point2, angle3, matrix) {
if (matrix === void 0) {
matrix = identityMatrix;
}
if (!angle3) {
return null;
}
var m4 = ext_exports.transform(matrix, [
["t", -point2.x, -point2.y],
["r", angle3],
["t", point2.x, point2.y]
]);
return m4;
}
function getMatrixByTranslate(point2, currentMatrix) {
if (!point2.x && !point2.y) {
return null;
}
return ext_exports.transform(currentMatrix || identityMatrix, [["t", point2.x, point2.y]]);
}
function getAngleByMatrix(matrix) {
var xVector = [1, 0, 0];
var out = [0, 0, 0];
vec3_exports.transformMat3(out, xVector, matrix);
return Math.atan2(out[1], out[0]);
}
function multiplyVec22(matrix, v3) {
var out = [0, 0];
vec2_exports.transformMat3(out, v3, matrix);
return out;
}
function applyMatrix2BBox(matrix, bbox) {
var topLeft = multiplyVec22(matrix, [bbox.minX, bbox.minY]);
var topRight = multiplyVec22(matrix, [bbox.maxX, bbox.minY]);
var bottomLeft = multiplyVec22(matrix, [bbox.minX, bbox.maxY]);
var bottomRight = multiplyVec22(matrix, [bbox.maxX, bbox.maxY]);
var minX = Math.min(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]);
var maxX = Math.max(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]);
var minY = Math.min(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1]);
var maxY2 = Math.max(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1]);
return {
x: minX,
y: minY,
minX,
minY,
maxX,
maxY: maxY2,
width: maxX - minX,
height: maxY2 - minY
};
}
function applyRotate(shape, rotate8, x6, y5) {
if (rotate8) {
var matrix = getMatrixByAngle({ x: x6, y: y5 }, rotate8, shape.getMatrix());
shape.setMatrix(matrix);
}
}
function applyTranslate(shape, x6, y5) {
var translateMatrix = getMatrixByTranslate({ x: x6, y: y5 });
shape.attr("matrix", translateMatrix);
}
// node_modules/@antv/component/esm/util/util.js
function formatPadding(padding3) {
var top = 0;
var left2 = 0;
var right2 = 0;
var bottom = 0;
if (is_number_default(padding3)) {
top = left2 = right2 = bottom = padding3;
} else if (is_array_default(padding3)) {
top = padding3[0];
right2 = !is_nil_default(padding3[1]) ? padding3[1] : padding3[0];
bottom = !is_nil_default(padding3[2]) ? padding3[2] : padding3[0];
left2 = !is_nil_default(padding3[3]) ? padding3[3] : right2;
}
return [top, right2, bottom, left2];
}
function clearDom(container2) {
var children = container2.childNodes;
var length5 = children.length;
for (var i4 = length5 - 1; i4 >= 0; i4--) {
container2.removeChild(children[i4]);
}
}
function hasClass(elements, cName) {
return !!elements.className.match(new RegExp("(\\s|^)" + cName + "(\\s|$)"));
}
function regionToBBox(region) {
var start = region.start, end2 = region.end;
var minX = Math.min(start.x, end2.x);
var minY = Math.min(start.y, end2.y);
var maxX = Math.max(start.x, end2.x);
var maxY2 = Math.max(start.y, end2.y);
return {
x: minX,
y: minY,
minX,
minY,
maxX,
maxY: maxY2,
width: maxX - minX,
height: maxY2 - minY
};
}
function pointsToBBox(points) {
var xs = points.map(function(point2) {
return point2.x;
});
var ys = points.map(function(point2) {
return point2.y;
});
var minX = Math.min.apply(Math, xs);
var minY = Math.min.apply(Math, ys);
var maxX = Math.max.apply(Math, xs);
var maxY2 = Math.max.apply(Math, ys);
return {
x: minX,
y: minY,
minX,
minY,
maxX,
maxY: maxY2,
width: maxX - minX,
height: maxY2 - minY
};
}
function createBBox(x6, y5, width2, height) {
var maxX = x6 + width2;
var maxY2 = y5 + height;
return {
x: x6,
y: y5,
width: width2,
height,
minX: x6,
minY: y5,
maxX: isNaN(maxX) ? 0 : maxX,
maxY: isNaN(maxY2) ? 0 : maxY2
};
}
function getValueByPercent(min7, max8, percent2) {
return (1 - percent2) * min7 + max8 * percent2;
}
function getCirclePoint(center2, radius, angle3) {
return {
x: center2.x + Math.cos(angle3) * radius,
y: center2.y + Math.sin(angle3) * radius
};
}
function distance5(p1, p22) {
var dx = p22.x - p1.x;
var dy = p22.y - p1.y;
return Math.sqrt(dx * dx + dy * dy);
}
var near = function(x6, y5, e4) {
if (e4 === void 0) {
e4 = Math.pow(Number.EPSILON, 0.5);
}
return [x6, y5].includes(Infinity) ? Math.abs(x6) === Math.abs(y5) : Math.abs(x6 - y5) < e4;
};
function intersectBBox2(box1, box2) {
var minX = Math.max(box1.minX, box2.minX);
var minY = Math.max(box1.minY, box2.minY);
var maxX = Math.min(box1.maxX, box2.maxX);
var maxY2 = Math.min(box1.maxY, box2.maxY);
return createBBox(minX, minY, maxX - minX, maxY2 - minY);
}
function getBBoxWithClip(element) {
var clipShape = element.getClip();
var clipBBox = clipShape && clipShape.getBBox();
var bbox;
if (!element.isGroup()) {
bbox = element.getBBox();
} else {
var minX_1 = Infinity;
var maxX_1 = -Infinity;
var minY_1 = Infinity;
var maxY_1 = -Infinity;
var children = element.getChildren();
if (children.length > 0) {
each_default(children, function(child) {
if (child.get("visible")) {
if (child.isGroup() && child.get("children").length === 0) {
return true;
}
var box2 = getBBoxWithClip(child);
var leftTop = child.applyToMatrix([box2.minX, box2.minY, 1]);
var leftBottom = child.applyToMatrix([box2.minX, box2.maxY, 1]);
var rightTop = child.applyToMatrix([box2.maxX, box2.minY, 1]);
var rightBottom = child.applyToMatrix([box2.maxX, box2.maxY, 1]);
var boxMinX = Math.min(leftTop[0], leftBottom[0], rightTop[0], rightBottom[0]);
var boxMaxX = Math.max(leftTop[0], leftBottom[0], rightTop[0], rightBottom[0]);
var boxMinY = Math.min(leftTop[1], leftBottom[1], rightTop[1], rightBottom[1]);
var boxMaxY = Math.max(leftTop[1], leftBottom[1], rightTop[1], rightBottom[1]);
if (boxMinX < minX_1) {
minX_1 = boxMinX;
}
if (boxMaxX > maxX_1) {
maxX_1 = boxMaxX;
}
if (boxMinY < minY_1) {
minY_1 = boxMinY;
}
if (boxMaxY > maxY_1) {
maxY_1 = boxMaxY;
}
}
});
} else {
minX_1 = 0;
maxX_1 = 0;
minY_1 = 0;
maxY_1 = 0;
}
bbox = createBBox(minX_1, minY_1, maxX_1 - minX_1, maxY_1 - minY_1);
}
if (clipBBox) {
return intersectBBox2(bbox, clipBBox);
} else {
return bbox;
}
}
function updateClip(element, newElement) {
if (!element.getClip() && !newElement.getClip()) {
return;
}
var newClipShape = newElement.getClip();
if (!newClipShape) {
element.setClip(null);
return;
}
var clipCfg = {
type: newClipShape.get("type"),
attrs: newClipShape.attr()
};
element.setClip(clipCfg);
}
function toPx(number) {
return number + "px";
}
function getTextPoint(start, end2, position2, offset) {
var lineLength = distance5(start, end2);
var offsetPercent = offset / lineLength;
var percent2 = 0;
if (position2 === "start") {
percent2 = 0 - offsetPercent;
} else if (position2 === "end") {
percent2 = 1 + offsetPercent;
}
return {
x: getValueByPercent(start.x, end2.x, percent2),
y: getValueByPercent(start.y, end2.y, percent2)
};
}
// node_modules/@antv/component/esm/abstract/component.js
var LOCATION_FIELD_MAP = {
none: [],
point: ["x", "y"],
region: ["start", "end"],
points: ["points"],
circle: ["center", "radius", "startAngle", "endAngle"]
};
var Component = function(_super) {
__extends(Component4, _super);
function Component4(cfg) {
var _this = _super.call(this, cfg) || this;
_this.initCfg();
return _this;
}
Component4.prototype.getDefaultCfg = function() {
return {
id: "",
name: "",
type: "",
locationType: "none",
offsetX: 0,
offsetY: 0,
animate: false,
capture: true,
updateAutoRender: false,
animateOption: {
appear: null,
update: {
duration: 400,
easing: "easeQuadInOut"
},
enter: {
duration: 400,
easing: "easeQuadInOut"
},
leave: {
duration: 350,
easing: "easeQuadIn"
}
},
events: null,
defaultCfg: {},
visible: true
};
};
Component4.prototype.clear = function() {
};
Component4.prototype.update = function(cfg) {
var _this = this;
var defaultCfg2 = this.get("defaultCfg") || {};
each_default(cfg, function(value2, name) {
var originCfg = _this.get(name);
var newCfg = value2;
if (originCfg !== value2) {
if (is_object_default(value2) && defaultCfg2[name]) {
newCfg = deep_mix_default({}, defaultCfg2[name], value2);
}
_this.set(name, newCfg);
}
});
this.updateInner(cfg);
this.afterUpdate(cfg);
};
Component4.prototype.updateInner = function(cfg) {
};
Component4.prototype.afterUpdate = function(cfg) {
if (has_key_default(cfg, "visible")) {
if (cfg.visible) {
this.show();
} else {
this.hide();
}
}
if (has_key_default(cfg, "capture")) {
this.setCapture(cfg.capture);
}
};
Component4.prototype.getLayoutBBox = function() {
return this.getBBox();
};
Component4.prototype.getLocationType = function() {
return this.get("locationType");
};
Component4.prototype.getOffset = function() {
return {
offsetX: this.get("offsetX"),
offsetY: this.get("offsetY")
};
};
Component4.prototype.setOffset = function(offsetX, offsetY) {
this.update({
offsetX,
offsetY
});
};
Component4.prototype.setLocation = function(cfg) {
var location = __assign({}, cfg);
this.update(location);
};
Component4.prototype.getLocation = function() {
var _this = this;
var location = {};
var locationType = this.get("locationType");
var fields = LOCATION_FIELD_MAP[locationType];
each_default(fields, function(field6) {
location[field6] = _this.get(field6);
});
return location;
};
Component4.prototype.isList = function() {
return false;
};
Component4.prototype.isSlider = function() {
return false;
};
Component4.prototype.init = function() {
};
Component4.prototype.initCfg = function() {
var _this = this;
var defaultCfg2 = this.get("defaultCfg");
each_default(defaultCfg2, function(value2, name) {
var cfg = _this.get(name);
if (is_object_default(cfg)) {
var newCfg = deep_mix_default({}, value2, cfg);
_this.set(name, newCfg);
}
});
};
return Component4;
}(base_default2);
var component_default = Component;
// node_modules/@antv/component/esm/abstract/group-component.js
var STATUS_UPDATE = "update_status";
var COPY_PROPERTIES = ["visible", "tip", "delegateObject"];
var COPY_PROPERTIES_EXCLUDES = ["container", "group", "shapesMap", "isRegister", "isUpdating", "destroyed"];
var GroupComponent = function(_super) {
__extends(GroupComponent2, _super);
function GroupComponent2() {
return _super !== null && _super.apply(this, arguments) || this;
}
GroupComponent2.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), {
container: null,
shapesMap: {},
group: null,
capture: true,
isRegister: false,
isUpdating: false,
isInit: true
});
};
GroupComponent2.prototype.remove = function() {
this.clear();
var group2 = this.get("group");
group2.remove();
};
GroupComponent2.prototype.clear = function() {
var group2 = this.get("group");
group2.clear();
this.set("shapesMap", {});
this.clearOffScreenCache();
this.set("isInit", true);
};
GroupComponent2.prototype.getChildComponentById = function(id) {
var group2 = this.getElementById(id);
var inst = group2 && group2.get("component");
return inst;
};
GroupComponent2.prototype.getElementById = function(id) {
return this.get("shapesMap")[id];
};
GroupComponent2.prototype.getElementByLocalId = function(localId) {
var id = this.getElementId(localId);
return this.getElementById(id);
};
GroupComponent2.prototype.getElementsByName = function(name) {
var rst = [];
each_default(this.get("shapesMap"), function(elem) {
if (elem.get("name") === name) {
rst.push(elem);
}
});
return rst;
};
GroupComponent2.prototype.getContainer = function() {
return this.get("container");
};
GroupComponent2.prototype.updateInner = function(cfg) {
this.offScreenRender();
if (this.get("updateAutoRender")) {
this.render();
}
};
GroupComponent2.prototype.render = function() {
var offScreenGroup = this.get("offScreenGroup");
if (!offScreenGroup) {
offScreenGroup = this.offScreenRender();
}
var group2 = this.get("group");
this.updateElements(offScreenGroup, group2);
this.deleteElements();
this.applyOffset();
if (!this.get("eventInitted")) {
this.initEvent();
this.set("eventInitted", true);
}
this.set("isInit", false);
};
GroupComponent2.prototype.show = function() {
var group2 = this.get("group");
group2.show();
this.set("visible", true);
};
GroupComponent2.prototype.hide = function() {
var group2 = this.get("group");
group2.hide();
this.set("visible", false);
};
GroupComponent2.prototype.setCapture = function(capture) {
var group2 = this.get("group");
group2.set("capture", capture);
this.set("capture", capture);
};
GroupComponent2.prototype.destroy = function() {
this.removeEvent();
this.remove();
_super.prototype.destroy.call(this);
};
GroupComponent2.prototype.getBBox = function() {
return this.get("group").getCanvasBBox();
};
GroupComponent2.prototype.getLayoutBBox = function() {
var group2 = this.get("group");
var bbox = this.getInnerLayoutBBox();
var matrix = group2.getTotalMatrix();
if (matrix) {
bbox = applyMatrix2BBox(matrix, bbox);
}
return bbox;
};
GroupComponent2.prototype.on = function(evt, callback, once) {
var group2 = this.get("group");
group2.on(evt, callback, once);
return this;
};
GroupComponent2.prototype.off = function(evt, callback) {
var group2 = this.get("group");
group2 && group2.off(evt, callback);
return this;
};
GroupComponent2.prototype.emit = function(eventName, eventObject) {
var group2 = this.get("group");
group2.emit(eventName, eventObject);
};
GroupComponent2.prototype.init = function() {
_super.prototype.init.call(this);
if (!this.get("group")) {
this.initGroup();
}
this.offScreenRender();
};
GroupComponent2.prototype.getInnerLayoutBBox = function() {
return this.get("offScreenBBox") || this.get("group").getBBox();
};
GroupComponent2.prototype.delegateEmit = function(eventName, eventObject) {
var group2 = this.get("group");
eventObject.target = group2;
group2.emit(eventName, eventObject);
propagationDelegate(group2, eventName, eventObject);
};
GroupComponent2.prototype.createOffScreenGroup = function() {
var group2 = this.get("group");
var GroupClass = group2.getGroupBase();
var newGroup = new GroupClass({
delegateObject: this.getDelegateObject()
});
return newGroup;
};
GroupComponent2.prototype.applyOffset = function() {
var offsetX = this.get("offsetX");
var offsetY = this.get("offsetY");
this.moveElementTo(this.get("group"), {
x: offsetX,
y: offsetY
});
};
GroupComponent2.prototype.initGroup = function() {
var container2 = this.get("container");
this.set("group", container2.addGroup({
id: this.get("id"),
name: this.get("name"),
capture: this.get("capture"),
visible: this.get("visible"),
isComponent: true,
component: this,
delegateObject: this.getDelegateObject()
}));
};
GroupComponent2.prototype.offScreenRender = function() {
this.clearOffScreenCache();
var offScreenGroup = this.createOffScreenGroup();
this.renderInner(offScreenGroup);
this.set("offScreenGroup", offScreenGroup);
this.set("offScreenBBox", getBBoxWithClip(offScreenGroup));
return offScreenGroup;
};
GroupComponent2.prototype.addGroup = function(parent, cfg) {
this.appendDelegateObject(parent, cfg);
var group2 = parent.addGroup(cfg);
if (this.get("isRegister")) {
this.registerElement(group2);
}
return group2;
};
GroupComponent2.prototype.addShape = function(parent, cfg) {
this.appendDelegateObject(parent, cfg);
var shape = parent.addShape(cfg);
if (this.get("isRegister")) {
this.registerElement(shape);
}
return shape;
};
GroupComponent2.prototype.addComponent = function(parent, cfg) {
var id = cfg.id, Ctor = cfg.component, restCfg = __rest(cfg, ["id", "component"]);
var inst = new Ctor(__assign(__assign({}, restCfg), { id, container: parent, updateAutoRender: this.get("updateAutoRender") }));
inst.init();
inst.render();
if (this.get("isRegister")) {
this.registerElement(inst.get("group"));
}
return inst;
};
GroupComponent2.prototype.initEvent = function() {
};
GroupComponent2.prototype.removeEvent = function() {
var group2 = this.get("group");
group2.off();
};
GroupComponent2.prototype.getElementId = function(localId) {
var id = this.get("id");
var name = this.get("name");
return id + "-" + name + "-" + localId;
};
GroupComponent2.prototype.registerElement = function(element) {
var id = element.get("id");
this.get("shapesMap")[id] = element;
};
GroupComponent2.prototype.unregisterElement = function(element) {
var id = element.get("id");
delete this.get("shapesMap")[id];
};
GroupComponent2.prototype.moveElementTo = function(element, point2) {
var matrix = getMatrixByTranslate(point2);
element.attr("matrix", matrix);
};
GroupComponent2.prototype.addAnimation = function(elmentName, newElement, animateCfg) {
var originOpacity = newElement.attr("opacity");
if (is_nil_default(originOpacity)) {
originOpacity = 1;
}
newElement.attr("opacity", 0);
newElement.animate({ opacity: originOpacity }, animateCfg);
};
GroupComponent2.prototype.removeAnimation = function(elementName, originElement, animateCfg) {
originElement.animate({ opacity: 0 }, animateCfg);
};
GroupComponent2.prototype.updateAnimation = function(elementName, originElement, newAttrs, animateCfg) {
originElement.animate(newAttrs, animateCfg);
};
GroupComponent2.prototype.updateElements = function(newGroup, originGroup) {
var _this = this;
var animate = this.get("animate");
var animateOption = this.get("animateOption");
var children = newGroup.getChildren().slice(0);
var preElement;
each_default(children, function(element) {
var elementId = element.get("id");
var originElement = _this.getElementById(elementId);
var elementName = element.get("name");
if (originElement) {
if (element.get("isComponent")) {
var childComponent = element.get("component");
var origChildComponent = originElement.get("component");
var newCfg = pick_default(childComponent.cfg, difference_default(keys_default(childComponent.cfg), COPY_PROPERTIES_EXCLUDES));
origChildComponent.update(newCfg);
originElement.set(STATUS_UPDATE, "update");
} else {
var replaceAttrs = _this.getReplaceAttrs(originElement, element);
if (animate && animateOption.update) {
_this.updateAnimation(elementName, originElement, replaceAttrs, animateOption.update);
} else {
originElement.attr(replaceAttrs);
}
if (element.isGroup()) {
_this.updateElements(element, originElement);
}
each_default(COPY_PROPERTIES, function(name) {
originElement.set(name, element.get(name));
});
updateClip(originElement, element);
preElement = originElement;
originElement.set(STATUS_UPDATE, "update");
}
} else {
originGroup.add(element);
var siblings = originGroup.getChildren();
siblings.splice(siblings.length - 1, 1);
if (preElement) {
var index2 = siblings.indexOf(preElement);
siblings.splice(index2 + 1, 0, element);
} else {
siblings.unshift(element);
}
_this.registerElement(element);
element.set(STATUS_UPDATE, "add");
if (element.get("isComponent")) {
var childComponent = element.get("component");
childComponent.set("container", originGroup);
} else if (element.isGroup()) {
_this.registerNewGroup(element);
}
preElement = element;
if (animate) {
var animateCfg = _this.get("isInit") ? animateOption.appear : animateOption.enter;
if (animateCfg) {
_this.addAnimation(elementName, element, animateCfg);
}
}
}
});
};
GroupComponent2.prototype.clearUpdateStatus = function(group2) {
var children = group2.getChildren();
each_default(children, function(el) {
el.set(STATUS_UPDATE, null);
});
};
GroupComponent2.prototype.clearOffScreenCache = function() {
var offScreenGroup = this.get("offScreenGroup");
if (offScreenGroup) {
offScreenGroup.destroy();
}
this.set("offScreenGroup", null);
this.set("offScreenBBox", null);
};
GroupComponent2.prototype.getDelegateObject = function() {
var _a6;
var name = this.get("name");
var delegateObject = (_a6 = {}, _a6[name] = this, _a6.component = this, _a6);
return delegateObject;
};
GroupComponent2.prototype.appendDelegateObject = function(parent, cfg) {
var parentObject = parent.get("delegateObject");
if (!cfg.delegateObject) {
cfg.delegateObject = {};
}
mix(cfg.delegateObject, parentObject);
};
GroupComponent2.prototype.getReplaceAttrs = function(originElement, newElement) {
var originAttrs = originElement.attr();
var newAttrs = newElement.attr();
each_default(originAttrs, function(v3, k4) {
if (newAttrs[k4] === void 0) {
newAttrs[k4] = void 0;
}
});
return newAttrs;
};
GroupComponent2.prototype.registerNewGroup = function(group2) {
var _this = this;
var children = group2.getChildren();
each_default(children, function(element) {
_this.registerElement(element);
element.set(STATUS_UPDATE, "add");
if (element.isGroup()) {
_this.registerNewGroup(element);
}
});
};
GroupComponent2.prototype.deleteElements = function() {
var _this = this;
var shapesMap = this.get("shapesMap");
var deleteArray = [];
each_default(shapesMap, function(element, id) {
if (!element.get(STATUS_UPDATE) || element.destroyed) {
deleteArray.push([id, element]);
} else {
element.set(STATUS_UPDATE, null);
}
});
var animate = this.get("animate");
var animateOption = this.get("animateOption");
each_default(deleteArray, function(item) {
var id = item[0], element = item[1];
if (!element.destroyed) {
var elementName = element.get("name");
if (animate && animateOption.leave) {
var callbackAnimCfg = mix({
callback: function() {
_this.removeElement(element);
}
}, animateOption.leave);
_this.removeAnimation(elementName, element, callbackAnimCfg);
} else {
_this.removeElement(element);
}
}
delete shapesMap[id];
});
};
GroupComponent2.prototype.removeElement = function(element) {
if (element.get("isGroup")) {
var component2 = element.get("component");
if (component2) {
component2.destroy();
}
}
element.remove();
};
return GroupComponent2;
}(component_default);
var group_component_default = GroupComponent;
// node_modules/@antv/component/esm/util/text.js
var ELLIPSIS_CODE = "\u2026";
function strLen(str8) {
var len5 = 0;
for (var i4 = 0; i4 < str8.length; i4++) {
len5 += charAtLength(str8, i4);
}
return len5;
}
function charAtLength(str8, i4) {
if (str8.charCodeAt(i4) > 0 && str8.charCodeAt(i4) < 128) {
return 1;
} else {
return 2;
}
}
function ellipsisString(str8, reseveLength, position2) {
if (position2 === void 0) {
position2 = "tail";
}
var count2 = str8.length;
var rst = "";
if (position2 === "tail") {
for (var i4 = 0, index2 = 0; i4 < reseveLength; ) {
var charLength = charAtLength(str8, index2);
if (i4 + charLength <= reseveLength) {
rst += str8[index2];
i4 += charAtLength(str8, index2);
index2++;
} else {
break;
}
}
rst += ELLIPSIS_CODE;
} else if (position2 === "head") {
for (var i4 = 0, index2 = count2 - 1; i4 < reseveLength; ) {
var charLength = charAtLength(str8, index2);
if (i4 + charLength <= reseveLength) {
rst += str8[index2];
i4 += charAtLength(str8, index2);
index2--;
} else {
break;
}
}
rst = ELLIPSIS_CODE + rst;
} else {
var startStr = "";
var endStr = "";
for (var i4 = 0, startIndex = 0, endIndex = count2 - 1; i4 < reseveLength; ) {
var startCodeLen = charAtLength(str8, startIndex);
var hasAdd = false;
if (startCodeLen + i4 <= reseveLength) {
startStr += str8[startIndex];
startIndex++;
i4 += startCodeLen;
hasAdd = true;
}
var endCodeLen = charAtLength(str8, endIndex);
if (endCodeLen + i4 <= reseveLength) {
endStr = str8[endIndex] + endStr;
i4 += endCodeLen;
endIndex--;
hasAdd = true;
}
if (!hasAdd) {
break;
}
}
rst = startStr + ELLIPSIS_CODE + endStr;
}
return rst;
}
// node_modules/@antv/component/esm/util/label.js
var ELLIPSIS_CODE2 = "\u2026";
var ELLIPSIS_CODE_LENGTH = 2;
var OPTIMIZE_THRESHOLD = 400;
function getMaxLabelWidthOptimized(labels) {
var texts = labels.map(function(label17) {
var text = label17.attr("text");
return is_nil_default(text) ? "" : "" + text;
});
var maxLen = 0;
var maxIdx = 0;
for (var i4 = 0; i4 < texts.length; i4 += 1) {
var len5 = 0;
for (var j4 = 0; j4 <= texts[i4].length; j4 += 1) {
var code = texts[i4].charCodeAt(j4);
if (code >= 19968 && code <= 40869) {
len5 += 2;
} else {
len5 += 1;
}
}
if (len5 > maxLen) {
maxLen = len5;
maxIdx = i4;
}
}
return labels[maxIdx].getBBox().width;
}
function getMaxLabelWidth(labels) {
if (labels.length > OPTIMIZE_THRESHOLD) {
return getMaxLabelWidthOptimized(labels);
}
var max8 = 0;
each_default(labels, function(label17) {
var bbox = label17.getBBox();
var width2 = bbox.width;
if (max8 < width2) {
max8 = width2;
}
});
return max8;
}
function getLabelLength(isVertical2, label17) {
var bbox = label17.getCanvasBBox();
return isVertical2 ? bbox.width : bbox.height;
}
function ellipsisLabel(isVertical2, label17, limitLength, position2) {
var _a6;
if (position2 === void 0) {
position2 = "tail";
}
var text = (_a6 = label17.attr("text")) !== null && _a6 !== void 0 ? _a6 : "";
if (position2 === "tail") {
var font = pick_default(label17.attr(), ["fontSize", "fontFamily", "fontWeight", "fontStyle", "fontVariant"]);
var ellipsisText = get_ellipsis_text_default(text, limitLength, font, "\u2026");
if (text !== ellipsisText) {
label17.attr("text", ellipsisText);
label17.set("tip", text);
return true;
}
label17.set("tip", null);
return false;
}
var labelLength = getLabelLength(isVertical2, label17);
var codeLength = strLen(text);
var ellipsisFlag = false;
if (limitLength < labelLength) {
var reserveLength = Math.floor(limitLength / labelLength * codeLength) - ELLIPSIS_CODE_LENGTH;
var newText = void 0;
if (reserveLength >= 0) {
newText = ellipsisString(text, reserveLength, position2);
} else {
newText = ELLIPSIS_CODE2;
}
if (newText) {
label17.attr("text", newText);
ellipsisFlag = true;
}
}
if (ellipsisFlag) {
label17.set("tip", text);
} else {
label17.set("tip", null);
}
return ellipsisFlag;
}
// node_modules/@antv/component/esm/util/graphic.js
function renderTag(container2, tagCfg) {
var x6 = tagCfg.x, y5 = tagCfg.y, content = tagCfg.content, style = tagCfg.style, id = tagCfg.id, name = tagCfg.name, rotate8 = tagCfg.rotate, maxLength = tagCfg.maxLength, autoEllipsis = tagCfg.autoEllipsis, isVertical2 = tagCfg.isVertical, ellipsisPosition = tagCfg.ellipsisPosition, background = tagCfg.background;
var tagGroup = container2.addGroup({
id: id + "-group",
name: name + "-group",
attrs: {
x: x6,
y: y5
}
});
var text = tagGroup.addShape({
type: "text",
id,
name,
attrs: __assign({ x: 0, y: 0, text: content }, style)
});
var padding3 = formatPadding(get_default(background, "padding", 0));
if (maxLength && autoEllipsis) {
var maxTextLength = maxLength - (padding3[1] + padding3[3]);
ellipsisLabel(!isVertical2, text, maxTextLength, ellipsisPosition);
}
if (background) {
var backgroundStyle = get_default(background, "style", {});
var _a6 = text.getCanvasBBox(), minX = _a6.minX, minY = _a6.minY, width2 = _a6.width, height = _a6.height;
var tagBg = tagGroup.addShape("rect", {
id: id + "-bg",
name: id + "-bg",
attrs: __assign({ x: minX - padding3[3], y: minY - padding3[0], width: width2 + padding3[1] + padding3[3], height: height + padding3[0] + padding3[2] }, backgroundStyle)
});
tagBg.toBack();
}
applyTranslate(tagGroup, x6, y5);
applyRotate(tagGroup, rotate8, x6, y5);
}
// node_modules/@antv/component/esm/util/theme.js
var theme_default = {
fontFamily: '\n BlinkMacSystemFont, "Segoe UI", Roboto,"Helvetica Neue",\n Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",\n SimSun, "sans-serif"',
textColor: "#2C3542",
activeTextColor: "#333333",
uncheckedColor: "#D8D8D8",
lineColor: "#416180",
regionColor: "#CCD7EB",
verticalAxisRotate: -Math.PI / 4,
horizontalAxisRotate: Math.PI / 4
};
// node_modules/@antv/component/esm/annotation/line.js
var LineAnnotation = function(_super) {
__extends(LineAnnotation2, _super);
function LineAnnotation2() {
return _super !== null && _super.apply(this, arguments) || this;
}
LineAnnotation2.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { name: "annotation", type: "line", locationType: "region", start: null, end: null, style: {}, text: null, defaultCfg: {
style: {
fill: theme_default.textColor,
fontSize: 12,
textAlign: "center",
textBaseline: "bottom",
fontFamily: theme_default.fontFamily
},
text: {
position: "center",
autoRotate: true,
content: null,
offsetX: 0,
offsetY: 0,
style: {
stroke: theme_default.lineColor,
lineWidth: 1
}
}
} });
};
LineAnnotation2.prototype.renderInner = function(group2) {
this.renderLine(group2);
if (this.get("text")) {
this.renderLabel(group2);
}
};
LineAnnotation2.prototype.renderLine = function(group2) {
var start = this.get("start");
var end2 = this.get("end");
var style = this.get("style");
this.addShape(group2, {
type: "line",
id: this.getElementId("line"),
name: "annotation-line",
attrs: __assign({ x1: start.x, y1: start.y, x2: end2.x, y2: end2.y }, style)
});
};
LineAnnotation2.prototype.getLabelPoint = function(start, end2, position2) {
var percent2;
if (position2 === "start") {
percent2 = 0;
} else if (position2 === "center") {
percent2 = 0.5;
} else if (is_string_default(position2) && position2.indexOf("%") !== -1) {
percent2 = parseInt(position2, 10) / 100;
} else if (is_number_default(position2)) {
percent2 = position2;
} else {
percent2 = 1;
}
if (percent2 > 1 || percent2 < 0) {
percent2 = 1;
}
return {
x: getValueByPercent(start.x, end2.x, percent2),
y: getValueByPercent(start.y, end2.y, percent2)
};
};
LineAnnotation2.prototype.renderLabel = function(group2) {
var text = this.get("text");
var start = this.get("start");
var end2 = this.get("end");
var position2 = text.position, content = text.content, style = text.style, offsetX = text.offsetX, offsetY = text.offsetY, autoRotate = text.autoRotate, maxLength = text.maxLength, autoEllipsis = text.autoEllipsis, ellipsisPosition = text.ellipsisPosition, background = text.background, _a6 = text.isVertical, isVertical2 = _a6 === void 0 ? false : _a6;
var point2 = this.getLabelPoint(start, end2, position2);
var x6 = point2.x + offsetX;
var y5 = point2.y + offsetY;
var cfg = {
id: this.getElementId("line-text"),
name: "annotation-line-text",
x: x6,
y: y5,
content,
style,
maxLength,
autoEllipsis,
ellipsisPosition,
background,
isVertical: isVertical2
};
if (autoRotate) {
var vector = [end2.x - start.x, end2.y - start.y];
cfg.rotate = Math.atan2(vector[1], vector[0]);
}
renderTag(group2, cfg);
};
return LineAnnotation2;
}(group_component_default);
var line_default3 = LineAnnotation;
// node_modules/@antv/component/esm/annotation/text.js
var TextAnnotation = function(_super) {
__extends(TextAnnotation2, _super);
function TextAnnotation2() {
return _super !== null && _super.apply(this, arguments) || this;
}
TextAnnotation2.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { name: "annotation", type: "text", locationType: "point", x: 0, y: 0, content: "", rotate: null, style: {}, background: null, maxLength: null, autoEllipsis: true, isVertical: false, ellipsisPosition: "tail", defaultCfg: {
style: {
fill: theme_default.textColor,
fontSize: 12,
textAlign: "center",
textBaseline: "middle",
fontFamily: theme_default.fontFamily
}
} });
};
TextAnnotation2.prototype.setLocation = function(location) {
this.set("x", location.x);
this.set("y", location.y);
this.resetLocation();
};
TextAnnotation2.prototype.renderInner = function(group2) {
var _a6 = this.getLocation(), x6 = _a6.x, y5 = _a6.y;
var content = this.get("content");
var style = this.get("style");
var id = this.getElementId("text");
var name = this.get("name") + "-text";
var maxLength = this.get("maxLength");
var autoEllipsis = this.get("autoEllipsis");
var isVertical2 = this.get("isVertical");
var ellipsisPosition = this.get("ellipsisPosition");
var background = this.get("background");
var rotate8 = this.get("rotate");
var cfg = {
id,
name,
x: x6,
y: y5,
content,
style,
maxLength,
autoEllipsis,
isVertical: isVertical2,
ellipsisPosition,
background,
rotate: rotate8
};
renderTag(group2, cfg);
};
TextAnnotation2.prototype.resetLocation = function() {
var textGroup = this.getElementByLocalId("text-group");
if (textGroup) {
var _a6 = this.getLocation(), x6 = _a6.x, y5 = _a6.y;
var rotate8 = this.get("rotate");
applyTranslate(textGroup, x6, y5);
applyRotate(textGroup, rotate8, x6, y5);
}
};
return TextAnnotation2;
}(group_component_default);
var text_default2 = TextAnnotation;
// node_modules/@antv/component/esm/annotation/arc.js
var ArcAnnotation = function(_super) {
__extends(ArcAnnotation2, _super);
function ArcAnnotation2() {
return _super !== null && _super.apply(this, arguments) || this;
}
ArcAnnotation2.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { name: "annotation", type: "arc", locationType: "circle", center: null, radius: 100, startAngle: -Math.PI / 2, endAngle: Math.PI * 3 / 2, style: {
stroke: "#999",
lineWidth: 1
} });
};
ArcAnnotation2.prototype.renderInner = function(group2) {
this.renderArc(group2);
};
ArcAnnotation2.prototype.getArcPath = function() {
var _a6 = this.getLocation(), center2 = _a6.center, radius = _a6.radius, startAngle = _a6.startAngle, endAngle = _a6.endAngle;
var startPoint = getCirclePoint(center2, radius, startAngle);
var endPoint = getCirclePoint(center2, radius, endAngle);
var largeFlag = endAngle - startAngle > Math.PI ? 1 : 0;
var path = [["M", startPoint.x, startPoint.y]];
if (endAngle - startAngle === Math.PI * 2) {
var middlePoint = getCirclePoint(center2, radius, startAngle + Math.PI);
path.push(["A", radius, radius, 0, largeFlag, 1, middlePoint.x, middlePoint.y]);
path.push(["A", radius, radius, 0, largeFlag, 1, endPoint.x, endPoint.y]);
} else {
path.push(["A", radius, radius, 0, largeFlag, 1, endPoint.x, endPoint.y]);
}
return path;
};
ArcAnnotation2.prototype.renderArc = function(group2) {
var path = this.getArcPath();
var style = this.get("style");
this.addShape(group2, {
type: "path",
id: this.getElementId("arc"),
name: "annotation-arc",
attrs: __assign({ path }, style)
});
};
return ArcAnnotation2;
}(group_component_default);
var arc_default2 = ArcAnnotation;
// node_modules/@antv/component/esm/annotation/region.js
var RegionAnnotation = function(_super) {
__extends(RegionAnnotation2, _super);
function RegionAnnotation2() {
return _super !== null && _super.apply(this, arguments) || this;
}
RegionAnnotation2.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { name: "annotation", type: "region", locationType: "region", start: null, end: null, style: {}, defaultCfg: {
style: {
lineWidth: 0,
fill: theme_default.regionColor,
opacity: 0.4
}
} });
};
RegionAnnotation2.prototype.renderInner = function(group2) {
this.renderRegion(group2);
};
RegionAnnotation2.prototype.renderRegion = function(group2) {
var start = this.get("start");
var end2 = this.get("end");
var style = this.get("style");
var bbox = regionToBBox({ start, end: end2 });
this.addShape(group2, {
type: "rect",
id: this.getElementId("region"),
name: "annotation-region",
attrs: __assign({ x: bbox.x, y: bbox.y, width: bbox.width, height: bbox.height }, style)
});
};
return RegionAnnotation2;
}(group_component_default);
var region_default = RegionAnnotation;
// node_modules/@antv/component/esm/annotation/image.js
var ImageAnnotation = function(_super) {
__extends(ImageAnnotation2, _super);
function ImageAnnotation2() {
return _super !== null && _super.apply(this, arguments) || this;
}
ImageAnnotation2.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { name: "annotation", type: "image", locationType: "region", start: null, end: null, src: null, style: {} });
};
ImageAnnotation2.prototype.renderInner = function(group2) {
this.renderImage(group2);
};
ImageAnnotation2.prototype.getImageAttrs = function() {
var start = this.get("start");
var end2 = this.get("end");
var style = this.get("style");
var bbox = regionToBBox({ start, end: end2 });
var src = this.get("src");
return __assign({ x: bbox.x, y: bbox.y, img: src, width: bbox.width, height: bbox.height }, style);
};
ImageAnnotation2.prototype.renderImage = function(group2) {
this.addShape(group2, {
type: "image",
id: this.getElementId("image"),
name: "annotation-image",
attrs: this.getImageAttrs()
});
};
return ImageAnnotation2;
}(group_component_default);
var image_default = ImageAnnotation;
// node_modules/@antv/component/esm/annotation/data-marker.js
var DataMarkerAnnotation = function(_super) {
__extends(DataMarkerAnnotation2, _super);
function DataMarkerAnnotation2() {
return _super !== null && _super.apply(this, arguments) || this;
}
DataMarkerAnnotation2.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { name: "annotation", type: "dataMarker", locationType: "point", x: 0, y: 0, point: {}, line: {}, text: {}, direction: "upward", autoAdjust: true, coordinateBBox: null, defaultCfg: {
point: {
display: true,
style: {
r: 3,
fill: "#FFFFFF",
stroke: "#1890FF",
lineWidth: 2
}
},
line: {
display: true,
length: 20,
style: {
stroke: theme_default.lineColor,
lineWidth: 1
}
},
text: {
content: "",
display: true,
style: {
fill: theme_default.textColor,
opacity: 0.65,
fontSize: 12,
textAlign: "start",
fontFamily: theme_default.fontFamily
}
}
} });
};
DataMarkerAnnotation2.prototype.renderInner = function(group2) {
if (get_default(this.get("line"), "display")) {
this.renderLine(group2);
}
if (get_default(this.get("text"), "display")) {
this.renderText(group2);
}
if (get_default(this.get("point"), "display")) {
this.renderPoint(group2);
}
if (this.get("autoAdjust")) {
this.autoAdjust(group2);
}
};
DataMarkerAnnotation2.prototype.applyOffset = function() {
this.moveElementTo(this.get("group"), {
x: this.get("x") + this.get("offsetX"),
y: this.get("y") + this.get("offsetY")
});
};
DataMarkerAnnotation2.prototype.renderPoint = function(group2) {
var point2 = this.getShapeAttrs().point;
this.addShape(group2, {
type: "circle",
id: this.getElementId("point"),
name: "annotation-point",
attrs: point2
});
};
DataMarkerAnnotation2.prototype.renderLine = function(group2) {
var line2 = this.getShapeAttrs().line;
this.addShape(group2, {
type: "path",
id: this.getElementId("line"),
name: "annotation-line",
attrs: line2
});
};
DataMarkerAnnotation2.prototype.renderText = function(group2) {
var textAttrs = this.getShapeAttrs().text;
var x6 = textAttrs.x, y5 = textAttrs.y, text = textAttrs.text, style = __rest(textAttrs, ["x", "y", "text"]);
var _a6 = this.get("text"), background = _a6.background, maxLength = _a6.maxLength, autoEllipsis = _a6.autoEllipsis, isVertival = _a6.isVertival, ellipsisPosition = _a6.ellipsisPosition;
var tagCfg = {
x: x6,
y: y5,
id: this.getElementId("text"),
name: "annotation-text",
content: text,
style,
background,
maxLength,
autoEllipsis,
isVertival,
ellipsisPosition
};
renderTag(group2, tagCfg);
};
DataMarkerAnnotation2.prototype.autoAdjust = function(group2) {
var direction5 = this.get("direction");
var x6 = this.get("x");
var y5 = this.get("y");
var lineLength = get_default(this.get("line"), "length", 0);
var coordinateBBox = this.get("coordinateBBox");
var _a6 = group2.getBBox(), minX = _a6.minX, maxX = _a6.maxX, minY = _a6.minY, maxY2 = _a6.maxY;
var textGroup = group2.findById(this.getElementId("text-group"));
var textShape = group2.findById(this.getElementId("text"));
var lineShape = group2.findById(this.getElementId("line"));
if (!coordinateBBox) {
return;
}
if (textGroup) {
if (x6 + minX <= coordinateBBox.minX) {
var overflow = coordinateBBox.minX - (x6 + minX);
applyTranslate(textGroup, textGroup.attr("x") + overflow, textGroup.attr("y"));
}
if (x6 + maxX >= coordinateBBox.maxX) {
var overflow = x6 + maxX - coordinateBBox.maxX;
applyTranslate(textGroup, textGroup.attr("x") - overflow, textGroup.attr("y"));
}
}
if (direction5 === "upward" && y5 + minY <= coordinateBBox.minY || direction5 !== "upward" && y5 + maxY2 >= coordinateBBox.maxY) {
var textBaseline = void 0;
var factor = void 0;
if (direction5 === "upward" && y5 + minY <= coordinateBBox.minY) {
textBaseline = "top";
factor = 1;
} else {
textBaseline = "bottom";
factor = -1;
}
textShape.attr("textBaseline", textBaseline);
if (lineShape) {
lineShape.attr("path", [
["M", 0, 0],
["L", 0, lineLength * factor]
]);
}
applyTranslate(textGroup, textGroup.attr("x"), (lineLength + 2) * factor);
}
};
DataMarkerAnnotation2.prototype.getShapeAttrs = function() {
var lineDisplay = get_default(this.get("line"), "display");
var pointStyle = get_default(this.get("point"), "style", {});
var lineStyle = get_default(this.get("line"), "style", {});
var textStyle2 = get_default(this.get("text"), "style", {});
var direction5 = this.get("direction");
var lineLength = lineDisplay ? get_default(this.get("line"), "length", 0) : 0;
var factor = direction5 === "upward" ? -1 : 1;
return {
point: __assign({ x: 0, y: 0 }, pointStyle),
line: __assign({ path: [
["M", 0, 0],
["L", 0, lineLength * factor]
] }, lineStyle),
text: __assign({ x: 0, y: (lineLength + 2) * factor, text: get_default(this.get("text"), "content", ""), textBaseline: direction5 === "upward" ? "bottom" : "top" }, textStyle2)
};
};
return DataMarkerAnnotation2;
}(group_component_default);
var data_marker_default = DataMarkerAnnotation;
// node_modules/@antv/component/esm/annotation/data-region.js
var DataRegionAnnotation = function(_super) {
__extends(DataRegionAnnotation2, _super);
function DataRegionAnnotation2() {
return _super !== null && _super.apply(this, arguments) || this;
}
DataRegionAnnotation2.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { name: "annotation", type: "dataRegion", locationType: "points", points: [], lineLength: 0, region: {}, text: {}, defaultCfg: {
region: {
style: {
lineWidth: 0,
fill: theme_default.regionColor,
opacity: 0.4
}
},
text: {
content: "",
style: {
textAlign: "center",
textBaseline: "bottom",
fontSize: 12,
fill: theme_default.textColor,
fontFamily: theme_default.fontFamily
}
}
} });
};
DataRegionAnnotation2.prototype.renderInner = function(group2) {
var regionStyle = get_default(this.get("region"), "style", {});
var textStyle2 = get_default(this.get("text"), "style", {});
var lineLength = this.get("lineLength") || 0;
var points = this.get("points");
if (!points.length) {
return;
}
var bbox = pointsToBBox(points);
var path = [];
path.push(["M", points[0].x, bbox.minY - lineLength]);
points.forEach(function(point2) {
path.push(["L", point2.x, point2.y]);
});
path.push(["L", points[points.length - 1].x, points[points.length - 1].y - lineLength]);
this.addShape(group2, {
type: "path",
id: this.getElementId("region"),
name: "annotation-region",
attrs: __assign({ path }, regionStyle)
});
var textCfg = __assign({ id: this.getElementId("text"), name: "annotation-text", x: (bbox.minX + bbox.maxX) / 2, y: bbox.minY - lineLength }, this.get("text"));
renderTag(group2, textCfg);
};
return DataRegionAnnotation2;
}(group_component_default);
var data_region_default = DataRegionAnnotation;
// node_modules/@antv/component/esm/annotation/region-filter.js
var RegionFilterAnnotation = function(_super) {
__extends(RegionFilterAnnotation2, _super);
function RegionFilterAnnotation2() {
return _super !== null && _super.apply(this, arguments) || this;
}
RegionFilterAnnotation2.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { name: "annotation", type: "regionFilter", locationType: "region", start: null, end: null, color: null, shape: [] });
};
RegionFilterAnnotation2.prototype.renderInner = function(group2) {
var _this = this;
var start = this.get("start");
var end2 = this.get("end");
var layer = this.addGroup(group2, {
id: this.getElementId("region-filter"),
capture: false
});
each_default(this.get("shapes"), function(shape, shapeIdx) {
var type2 = shape.get("type");
var attrs = clone_default(shape.attr());
_this.adjustShapeAttrs(attrs);
_this.addShape(layer, {
id: _this.getElementId("shape-" + type2 + "-" + shapeIdx),
capture: false,
type: type2,
attrs
});
});
var clipBBox = regionToBBox({ start, end: end2 });
layer.setClip({
type: "rect",
attrs: {
x: clipBBox.minX,
y: clipBBox.minY,
width: clipBBox.width,
height: clipBBox.height
}
});
};
RegionFilterAnnotation2.prototype.adjustShapeAttrs = function(attr) {
var color4 = this.get("color");
if (attr.fill) {
attr.fill = attr.fillStyle = color4;
}
attr.stroke = attr.strokeStyle = color4;
};
return RegionFilterAnnotation2;
}(group_component_default);
var region_filter_default = RegionFilterAnnotation;
// node_modules/@antv/component/esm/annotation/shape.js
var ShapeAnnotation = function(_super) {
__extends(ShapeAnnotation2, _super);
function ShapeAnnotation2() {
return _super !== null && _super.apply(this, arguments) || this;
}
ShapeAnnotation2.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { name: "annotation", type: "shape", draw: noop_default });
};
ShapeAnnotation2.prototype.renderInner = function(group2) {
var render = this.get("render");
if (is_function_default(render)) {
render(group2);
}
};
return ShapeAnnotation2;
}(group_component_default);
var shape_default3 = ShapeAnnotation;
// node_modules/@antv/component/esm/abstract/html-component.js
var HtmlComponent = function(_super) {
__extends(HtmlComponent2, _super);
function HtmlComponent2() {
return _super !== null && _super.apply(this, arguments) || this;
}
HtmlComponent2.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { container: null, containerTpl: "
", updateAutoRender: true, containerClassName: "", parent: null });
};
HtmlComponent2.prototype.getContainer = function() {
return this.get("container");
};
HtmlComponent2.prototype.show = function() {
var container2 = this.get("container");
container2.style.display = "";
this.set("visible", true);
};
HtmlComponent2.prototype.hide = function() {
var container2 = this.get("container");
container2.style.display = "none";
this.set("visible", false);
};
HtmlComponent2.prototype.setCapture = function(capture) {
var container2 = this.getContainer();
var value2 = capture ? "auto" : "none";
container2.style.pointerEvents = value2;
this.set("capture", capture);
};
HtmlComponent2.prototype.getBBox = function() {
var container2 = this.getContainer();
var x6 = parseFloat(container2.style.left) || 0;
var y5 = parseFloat(container2.style.top) || 0;
return createBBox(x6, y5, container2.clientWidth, container2.clientHeight);
};
HtmlComponent2.prototype.clear = function() {
var container2 = this.get("container");
clearDom(container2);
};
HtmlComponent2.prototype.destroy = function() {
this.removeEvent();
this.removeDom();
_super.prototype.destroy.call(this);
};
HtmlComponent2.prototype.init = function() {
_super.prototype.init.call(this);
this.initContainer();
this.initDom();
this.resetStyles();
this.applyStyles();
this.initEvent();
this.initCapture();
this.initVisible();
};
HtmlComponent2.prototype.initCapture = function() {
this.setCapture(this.get("capture"));
};
HtmlComponent2.prototype.initVisible = function() {
if (!this.get("visible")) {
this.hide();
} else {
this.show();
}
};
HtmlComponent2.prototype.initDom = function() {
};
HtmlComponent2.prototype.initContainer = function() {
var container2 = this.get("container");
if (is_nil_default(container2)) {
container2 = this.createDom();
var parent_1 = this.get("parent");
if (is_string_default(parent_1)) {
parent_1 = document.getElementById(parent_1);
this.set("parent", parent_1);
}
parent_1.appendChild(container2);
this.set("container", container2);
} else if (is_string_default(container2)) {
container2 = document.getElementById(container2);
this.set("container", container2);
}
if (!this.get("parent")) {
this.set("parent", container2.parentNode);
}
};
HtmlComponent2.prototype.resetStyles = function() {
var style = this.get("domStyles");
var defaultStyles = this.get("defaultStyles");
if (!style) {
style = defaultStyles;
} else {
style = deep_mix_default({}, defaultStyles, style);
}
this.set("domStyles", style);
};
HtmlComponent2.prototype.applyStyles = function() {
var domStyles = this.get("domStyles");
if (!domStyles) {
return;
}
var container2 = this.getContainer();
this.applyChildrenStyles(container2, domStyles);
var containerClassName = this.get("containerClassName");
if (containerClassName && hasClass(container2, containerClassName)) {
var containerCss = domStyles[containerClassName];
modifyCSS(container2, containerCss);
}
};
HtmlComponent2.prototype.applyChildrenStyles = function(element, styles) {
each_default(styles, function(style, name) {
var elements = element.getElementsByClassName(name);
each_default(elements, function(el) {
modifyCSS(el, style);
});
});
};
HtmlComponent2.prototype.applyStyle = function(cssName, dom) {
var domStyles = this.get("domStyles");
modifyCSS(dom, domStyles[cssName]);
};
HtmlComponent2.prototype.createDom = function() {
var containerTpl = this.get("containerTpl");
return createDom(containerTpl);
};
HtmlComponent2.prototype.initEvent = function() {
};
HtmlComponent2.prototype.removeDom = function() {
var container2 = this.get("container");
container2 && container2.parentNode && container2.parentNode.removeChild(container2);
};
HtmlComponent2.prototype.removeEvent = function() {
};
HtmlComponent2.prototype.updateInner = function(cfg) {
if (has_key_default(cfg, "domStyles")) {
this.resetStyles();
this.applyStyles();
}
this.resetPosition();
};
HtmlComponent2.prototype.resetPosition = function() {
};
;
return HtmlComponent2;
}(component_default);
var html_component_default = HtmlComponent;
// node_modules/@antv/component/esm/annotation/html.js
var HtmlAnnotation = function(_super) {
__extends(HtmlAnnotation2, _super);
function HtmlAnnotation2() {
return _super !== null && _super.apply(this, arguments) || this;
}
HtmlAnnotation2.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { name: "annotation", type: "html", locationType: "point", x: 0, y: 0, containerTpl: '', alignX: "left", alignY: "top", html: "", zIndex: 7 });
};
HtmlAnnotation2.prototype.render = function() {
var container2 = this.getContainer();
var html = this.get("html");
clearDom(container2);
var rst = is_function_default(html) ? html(container2) : html;
if (is_element_default(rst)) {
container2.appendChild(rst);
} else if (is_string_default(rst)) {
container2.appendChild(createDom(rst));
}
this.resetPosition();
};
HtmlAnnotation2.prototype.resetPosition = function() {
var container2 = this.getContainer();
var _a6 = this.getLocation(), x6 = _a6.x, y5 = _a6.y;
var alignX = this.get("alignX");
var alignY = this.get("alignY");
var offsetX = this.get("offsetX");
var offsetY = this.get("offsetY");
var domWidth = getOuterWidth(container2);
var domHeight = getOuterHeight(container2);
var position2 = {
x: x6,
y: y5
};
if (alignX === "middle") {
position2.x -= Math.round(domWidth / 2);
} else if (alignX === "right") {
position2.x -= Math.round(domWidth);
}
if (alignY === "middle") {
position2.y -= Math.round(domHeight / 2);
} else if (alignY === "bottom") {
position2.y -= Math.round(domHeight);
}
if (offsetX) {
position2.x += offsetX;
}
if (offsetY) {
position2.y += offsetY;
}
modifyCSS(container2, {
position: "absolute",
left: position2.x + "px",
top: position2.y + "px",
zIndex: this.get("zIndex")
});
};
return HtmlAnnotation2;
}(html_component_default);
var html_default = HtmlAnnotation;
// node_modules/@antv/component/esm/axis/index.js
var axis_exports = {};
__export(axis_exports, {
Base: () => base_default8,
Circle: () => circle_default2,
Line: () => line_default4
});
// node_modules/@antv/component/esm/util/state.js
function getStatesStyle(item, elementName, stateStyles) {
var styleName = elementName + "Style";
var styles = null;
each_default(stateStyles, function(v3, state2) {
if (item[state2] && v3[styleName]) {
if (!styles) {
styles = {};
}
mix(styles, v3[styleName]);
}
});
return styles;
}
// node_modules/@antv/component/esm/axis/base.js
var AxisBase = function(_super) {
__extends(AxisBase2, _super);
function AxisBase2() {
return _super !== null && _super.apply(this, arguments) || this;
}
AxisBase2.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), {
name: "axis",
ticks: [],
line: {},
tickLine: {},
subTickLine: null,
title: null,
label: {},
verticalFactor: 1,
verticalLimitLength: null,
overlapOrder: ["autoRotate", "autoEllipsis", "autoHide"],
tickStates: {},
optimize: {},
defaultCfg: {
line: {
style: {
lineWidth: 1,
stroke: theme_default.lineColor
}
},
tickLine: {
style: {
lineWidth: 1,
stroke: theme_default.lineColor
},
alignTick: true,
length: 5,
displayWithLabel: true
},
subTickLine: {
style: {
lineWidth: 1,
stroke: theme_default.lineColor
},
count: 4,
length: 2
},
label: {
autoRotate: true,
autoHide: false,
autoEllipsis: false,
style: {
fontSize: 12,
fill: theme_default.textColor,
fontFamily: theme_default.fontFamily,
fontWeight: "normal"
},
offset: 10,
offsetX: 0,
offsetY: 0
},
title: {
autoRotate: true,
spacing: 5,
position: "center",
style: {
fontSize: 12,
fill: theme_default.textColor,
textBaseline: "middle",
fontFamily: theme_default.fontFamily,
textAlign: "center"
}
},
tickStates: {
active: {
labelStyle: {
fontWeight: 500
},
tickLineStyle: {
lineWidth: 2
}
},
inactive: {
labelStyle: {
fill: theme_default.uncheckedColor
}
}
},
optimize: {
enable: true,
threshold: 400
}
},
theme: {}
});
};
AxisBase2.prototype.renderInner = function(group2) {
if (this.get("line")) {
this.drawLine(group2);
}
this.drawTicks(group2);
if (this.get("title")) {
this.drawTitle(group2);
}
};
AxisBase2.prototype.isList = function() {
return true;
};
AxisBase2.prototype.getItems = function() {
return this.get("ticks");
};
AxisBase2.prototype.setItems = function(items) {
this.update({
ticks: items
});
};
AxisBase2.prototype.updateItem = function(item, cfg) {
mix(item, cfg);
this.clear();
this.render();
};
AxisBase2.prototype.clearItems = function() {
var itemGroup = this.getElementByLocalId("label-group");
itemGroup && itemGroup.clear();
};
AxisBase2.prototype.setItemState = function(item, state2, value2) {
item[state2] = value2;
this.updateTickStates(item);
};
AxisBase2.prototype.hasState = function(item, state2) {
return !!item[state2];
};
AxisBase2.prototype.getItemStates = function(item) {
var tickStates = this.get("tickStates");
var rst = [];
each_default(tickStates, function(v3, k4) {
if (item[k4]) {
rst.push(k4);
}
});
return rst;
};
AxisBase2.prototype.clearItemsState = function(state2) {
var _this = this;
var items = this.getItemsByState(state2);
each_default(items, function(item) {
_this.setItemState(item, state2, false);
});
};
AxisBase2.prototype.getItemsByState = function(state2) {
var _this = this;
var items = this.getItems();
return filter_default(items, function(item) {
return _this.hasState(item, state2);
});
};
AxisBase2.prototype.getSidePoint = function(point2, offset) {
var self2 = this;
var vector = self2.getSideVector(offset, point2);
return {
x: point2.x + vector[0],
y: point2.y + vector[1]
};
};
AxisBase2.prototype.getTextAnchor = function(vector) {
var align;
if (isNumberEqual(vector[0], 0)) {
align = "center";
} else if (vector[0] > 0) {
align = "start";
} else if (vector[0] < 0) {
align = "end";
}
return align;
};
AxisBase2.prototype.getTextBaseline = function(vector) {
var base;
if (isNumberEqual(vector[1], 0)) {
base = "middle";
} else if (vector[1] > 0) {
base = "top";
} else if (vector[1] < 0) {
base = "bottom";
}
return base;
};
AxisBase2.prototype.processOverlap = function(labelGroup) {
};
AxisBase2.prototype.drawLine = function(group2) {
var path = this.getLinePath();
var line2 = this.get("line");
this.addShape(group2, {
type: "path",
id: this.getElementId("line"),
name: "axis-line",
attrs: mix({
path
}, line2.style)
});
};
AxisBase2.prototype.getTickLineItems = function(ticks) {
var _this = this;
var tickLineItems = [];
var tickLine = this.get("tickLine");
var alignTick = tickLine.alignTick;
var tickLineLength = tickLine.length;
var tickSegment = 1;
var tickCount = ticks.length;
if (tickCount >= 2) {
tickSegment = ticks[1].value - ticks[0].value;
}
each_default(ticks, function(tick) {
var point2 = tick.point;
if (!alignTick) {
point2 = _this.getTickPoint(tick.value - tickSegment / 2);
}
var endPoint = _this.getSidePoint(point2, tickLineLength);
tickLineItems.push({
startPoint: point2,
tickValue: tick.value,
endPoint,
tickId: tick.id,
id: "tickline-" + tick.id
});
});
return tickLineItems;
};
AxisBase2.prototype.getSubTickLineItems = function(tickLineItems) {
var subTickLineItems = [];
var subTickLine = this.get("subTickLine");
var subCount = subTickLine.count;
var tickLineCount = tickLineItems.length;
if (tickLineCount >= 2) {
for (var i4 = 0; i4 < tickLineCount - 1; i4++) {
var pre = tickLineItems[i4];
var next = tickLineItems[i4 + 1];
for (var j4 = 0; j4 < subCount; j4++) {
var percent2 = (j4 + 1) / (subCount + 1);
var tickValue = (1 - percent2) * pre.tickValue + percent2 * next.tickValue;
var point2 = this.getTickPoint(tickValue);
var endPoint = this.getSidePoint(point2, subTickLine.length);
subTickLineItems.push({
startPoint: point2,
endPoint,
tickValue,
id: "sub-" + pre.id + "-" + j4
});
}
}
}
return subTickLineItems;
};
AxisBase2.prototype.getTickLineAttrs = function(tickItem, type2, index2, tickItems) {
var style = this.get(type2).style;
var item = {
points: [tickItem.startPoint, tickItem.endPoint]
};
var defaultTickLineStyle = get_default(this.get("theme"), ["tickLine", "style"], {});
style = is_function_default(style) ? mix({}, defaultTickLineStyle, style(item, index2, tickItems)) : style;
var startPoint = tickItem.startPoint, endPoint = tickItem.endPoint;
return __assign({ x1: startPoint.x, y1: startPoint.y, x2: endPoint.x, y2: endPoint.y }, style);
};
AxisBase2.prototype.drawTick = function(tickItem, tickLineGroup, type2, index2, tickItems) {
this.addShape(tickLineGroup, {
type: "line",
id: this.getElementId(tickItem.id),
name: "axis-" + type2,
attrs: this.getTickLineAttrs(tickItem, type2, index2, tickItems)
});
};
AxisBase2.prototype.drawTickLines = function(group2) {
var _this = this;
var ticks = this.get("ticks");
var subTickLine = this.get("subTickLine");
var tickLineItems = this.getTickLineItems(ticks);
var tickLineGroup = this.addGroup(group2, {
name: "axis-tickline-group",
id: this.getElementId("tickline-group")
});
var tickCfg = this.get("tickLine");
each_default(tickLineItems, function(item, index2) {
if (tickCfg.displayWithLabel) {
var labelId = _this.getElementId("label-" + item.tickId);
if (group2.findById(labelId)) {
_this.drawTick(item, tickLineGroup, "tickLine", index2, tickLineItems);
}
} else {
_this.drawTick(item, tickLineGroup, "tickLine", index2, tickLineItems);
}
});
if (subTickLine) {
var subTickLineItems_1 = this.getSubTickLineItems(tickLineItems);
each_default(subTickLineItems_1, function(item, index2) {
_this.drawTick(item, tickLineGroup, "subTickLine", index2, subTickLineItems_1);
});
}
};
AxisBase2.prototype.processTicks = function() {
var _this = this;
var ticks = this.get("ticks");
each_default(ticks, function(tick) {
tick.point = _this.getTickPoint(tick.value);
if (is_nil_default(tick.id)) {
tick.id = tick.name;
}
});
};
AxisBase2.prototype.drawTicks = function(group2) {
var _this = this;
this.optimizeTicks();
this.processTicks();
if (this.get("label")) {
this.drawLabels(group2);
}
if (this.get("tickLine")) {
this.drawTickLines(group2);
}
var ticks = this.get("ticks");
each_default(ticks, function(tick) {
_this.applyTickStates(tick, group2);
});
};
AxisBase2.prototype.optimizeTicks = function() {
var optimize = this.get("optimize");
var ticks = this.get("ticks");
if (optimize && optimize.enable && optimize.threshold > 0) {
var len5 = size(ticks);
if (len5 > optimize.threshold) {
var page_1 = Math.ceil(len5 / optimize.threshold);
var optimizedTicks = ticks.filter(function(tick, idx) {
return idx % page_1 === 0;
});
this.set("ticks", optimizedTicks);
this.set("originalTicks", ticks);
}
}
};
AxisBase2.prototype.getLabelAttrs = function(tick, index2, ticks) {
var labelCfg = this.get("label");
var offset = labelCfg.offset, offsetX = labelCfg.offsetX, offsetY = labelCfg.offsetY, rotate8 = labelCfg.rotate, formatter = labelCfg.formatter;
var point2 = this.getSidePoint(tick.point, offset);
var vector = this.getSideVector(offset, point2);
var text = formatter ? formatter(tick.name, tick, index2) : tick.name;
var style = labelCfg.style;
style = is_function_default(style) ? get_default(this.get("theme"), ["label", "style"], {}) : style;
var attrs = mix({
x: point2.x + offsetX,
y: point2.y + offsetY,
text,
textAlign: this.getTextAnchor(vector),
textBaseline: this.getTextBaseline(vector)
}, style);
if (rotate8) {
attrs.matrix = getMatrixByAngle(point2, rotate8);
}
return attrs;
};
AxisBase2.prototype.drawLabels = function(group2) {
var _this = this;
var ticks = this.get("ticks");
var labelGroup = this.addGroup(group2, {
name: "axis-label-group",
id: this.getElementId("label-group")
});
each_default(ticks, function(tick, index2) {
_this.addShape(labelGroup, {
type: "text",
name: "axis-label",
id: _this.getElementId("label-" + tick.id),
attrs: _this.getLabelAttrs(tick, index2, ticks),
delegateObject: {
tick,
item: tick,
index: index2
}
});
});
this.processOverlap(labelGroup);
var labels = labelGroup.getChildren();
var defaultLabelStyle3 = get_default(this.get("theme"), ["label", "style"], {});
var _a6 = this.get("label"), style = _a6.style, formatter = _a6.formatter;
if (is_function_default(style)) {
var afterProcessTicks_1 = labels.map(function(label17) {
return get_default(label17.get("delegateObject"), "tick");
});
each_default(labels, function(label17, index2) {
var tick = label17.get("delegateObject").tick;
var text = formatter ? formatter(tick.name, tick, index2) : tick.name;
var newStyle = mix({}, defaultLabelStyle3, style(text, index2, afterProcessTicks_1));
label17.attr(newStyle);
});
}
};
AxisBase2.prototype.getTitleAttrs = function() {
var titleCfg = this.get("title");
var style = titleCfg.style, position2 = titleCfg.position, offset = titleCfg.offset, _a6 = titleCfg.spacing, spacing = _a6 === void 0 ? 0 : _a6, autoRotate = titleCfg.autoRotate;
var titleHeight = style.fontSize;
var percent2 = 0.5;
if (position2 === "start") {
percent2 = 0;
} else if (position2 === "end") {
percent2 = 1;
}
var point2 = this.getTickPoint(percent2);
var titlePoint = this.getSidePoint(point2, offset || spacing + titleHeight / 2);
var attrs = mix({
x: titlePoint.x,
y: titlePoint.y,
text: titleCfg.text
}, style);
var rotate8 = titleCfg.rotate;
var angle3 = rotate8;
if (is_nil_default(rotate8) && autoRotate) {
var vector = this.getAxisVector(point2);
var v1 = [1, 0];
angle3 = ext_exports.angleTo(vector, v1, true);
}
if (angle3) {
var matrix = getMatrixByAngle(titlePoint, angle3);
attrs.matrix = matrix;
}
return attrs;
};
AxisBase2.prototype.drawTitle = function(group2) {
this.addShape(group2, {
type: "text",
id: this.getElementId("title"),
name: "axis-title",
attrs: this.getTitleAttrs()
});
};
AxisBase2.prototype.applyTickStates = function(tick, group2) {
var states = this.getItemStates(tick);
if (states.length) {
var tickStates = this.get("tickStates");
var labelId = this.getElementId("label-" + tick.id);
var labelShape = group2.findById(labelId);
if (labelShape) {
var labelStateStyle = getStatesStyle(tick, "label", tickStates);
labelStateStyle && labelShape.attr(labelStateStyle);
}
var tickLineId = this.getElementId("tickline-" + tick.id);
var tickLineShape = group2.findById(tickLineId);
if (tickLineShape) {
var tickLineStateStyle = getStatesStyle(tick, "tickLine", tickStates);
tickLineStateStyle && tickLineShape.attr(tickLineStateStyle);
}
}
};
AxisBase2.prototype.updateTickStates = function(tick) {
var states = this.getItemStates(tick);
var tickStates = this.get("tickStates");
var labelCfg = this.get("label");
var labelShape = this.getElementByLocalId("label-" + tick.id);
var tickLineCfg = this.get("tickLine");
var tickLineShape = this.getElementByLocalId("tickline-" + tick.id);
if (states.length) {
if (labelShape) {
var labelStateStyle = getStatesStyle(tick, "label", tickStates);
labelStateStyle && labelShape.attr(labelStateStyle);
}
if (tickLineShape) {
var tickLineStateStyle = getStatesStyle(tick, "tickLine", tickStates);
tickLineStateStyle && tickLineShape.attr(tickLineStateStyle);
}
} else {
if (labelShape) {
labelShape.attr(labelCfg.style);
}
if (tickLineShape) {
tickLineShape.attr(tickLineCfg.style);
}
}
};
return AxisBase2;
}(group_component_default);
var base_default8 = AxisBase;
// node_modules/@antv/component/esm/axis/overlap/index.js
var overlap_exports = {};
__export(overlap_exports, {
autoEllipsis: () => auto_ellipsis_exports,
autoHide: () => auto_hide_exports,
autoRotate: () => auto_rotate_exports
});
// node_modules/@antv/component/esm/axis/overlap/auto-ellipsis.js
var auto_ellipsis_exports = {};
__export(auto_ellipsis_exports, {
ellipsisHead: () => ellipsisHead,
ellipsisMiddle: () => ellipsisMiddle,
ellipsisTail: () => ellipsisTail,
getDefault: () => getDefault
});
function ellipseLabels(isVertical2, labelGroup, limitLength, position2) {
var children = labelGroup.getChildren();
var ellipsisFlag = false;
each_default(children, function(label17) {
var rst = ellipsisLabel(isVertical2, label17, limitLength, position2);
ellipsisFlag = ellipsisFlag || rst;
});
return ellipsisFlag;
}
function getDefault() {
return ellipsisTail;
}
function ellipsisHead(isVertical2, labelGroup, limitLength) {
return ellipseLabels(isVertical2, labelGroup, limitLength, "head");
}
function ellipsisTail(isVertical2, labelGroup, limitLength) {
return ellipseLabels(isVertical2, labelGroup, limitLength, "tail");
}
function ellipsisMiddle(isVertical2, labelGroup, limitLength) {
return ellipseLabels(isVertical2, labelGroup, limitLength, "middle");
}
// node_modules/@antv/component/esm/axis/overlap/auto-hide.js
var auto_hide_exports = {};
__export(auto_hide_exports, {
equidistance: () => equidistance,
equidistanceWithReverseBoth: () => equidistanceWithReverseBoth,
getDefault: () => getDefault2,
reserveBoth: () => reserveBoth,
reserveFirst: () => reserveFirst,
reserveLast: () => reserveLast
});
function isRotate(label17) {
var matrix = label17.attr("matrix");
return matrix && matrix[0] !== 1;
}
function getRotateAngle(label17) {
var angle3 = isRotate(label17) ? getAngleByMatrix(label17.attr("matrix")) : 0;
return angle3 % 360;
}
function isOverlap(isVertical2, first, second, minGap) {
var overlap2 = false;
var angle3 = getRotateAngle(first);
var distance15 = isVertical2 ? Math.abs(second.attr("y") - first.attr("y")) : Math.abs(second.attr("x") - first.attr("x"));
var prevBBox = (isVertical2 ? second.attr("y") > first.attr("y") : second.attr("x") > first.attr("x")) ? first.getBBox() : second.getBBox();
if (isVertical2) {
var ratio = Math.abs(Math.cos(angle3));
if (near(ratio, 0, Math.PI / 180)) {
overlap2 = prevBBox.width + minGap > distance15;
} else {
overlap2 = prevBBox.height / ratio + minGap > distance15;
}
} else {
var ratio = Math.abs(Math.sin(angle3));
if (near(ratio, 0, Math.PI / 180)) {
overlap2 = prevBBox.width + minGap > distance15;
} else {
overlap2 = prevBBox.height / ratio + minGap > distance15;
}
}
return overlap2;
}
function reserveOne(isVertical2, labelsGroup, reversed, autoHideCfg) {
var minGap = (autoHideCfg === null || autoHideCfg === void 0 ? void 0 : autoHideCfg.minGap) || 0;
var labels = labelsGroup.getChildren().slice().filter(function(item) {
return item.get("visible");
});
if (!labels.length) {
return false;
}
var hasHide = false;
if (reversed) {
labels.reverse();
}
var count2 = labels.length;
var first = labels[0];
var prev = first;
for (var i4 = 1; i4 < count2; i4++) {
var label17 = labels[i4];
var curBBox = label17.getBBox();
var isHide = isOverlap(isVertical2, prev, label17, minGap);
if (isHide) {
label17.hide();
hasHide = true;
} else {
prev = label17;
}
}
return hasHide;
}
function parityHide(isVertical2, labelsGroup, autoHideCfg) {
var minGap = (autoHideCfg === null || autoHideCfg === void 0 ? void 0 : autoHideCfg.minGap) || 0;
var labels = labelsGroup.getChildren().slice();
if (labels.length < 2) {
return false;
}
var hasHide = false;
var first = labels[0];
var firstBBox = first.getBBox();
var second = labels[1];
var count2 = labels.length;
var angle3 = getRotateAngle(first);
var distance15 = isVertical2 ? Math.abs(second.attr("y") - first.attr("y")) : Math.abs(second.attr("x") - first.attr("x"));
var interval3 = 0;
if (isVertical2) {
var ratio = Math.abs(Math.cos(angle3));
if (near(ratio, 0, Math.PI / 180)) {
var maxWidth = getMaxLabelWidth(labels);
interval3 = (maxWidth + minGap) / distance15;
} else {
interval3 = (firstBBox.height / ratio + minGap) / distance15;
}
} else {
var ratio = Math.abs(Math.sin(angle3));
if (near(ratio, 0, Math.PI / 180)) {
var maxWidth = getMaxLabelWidth(labels);
interval3 = (maxWidth + minGap) / distance15;
} else {
interval3 = (firstBBox.height / ratio + minGap) / distance15;
}
}
if (interval3 > 1) {
interval3 = Math.ceil(interval3);
for (var i4 = 0; i4 < count2; i4++) {
if (i4 % interval3 !== 0) {
labels[i4].hide();
hasHide = true;
}
}
}
return hasHide;
}
function getDefault2() {
return equidistance;
}
function reserveFirst(isVertical2, labelsGroup, limitLength, autoHideCfg) {
return reserveOne(isVertical2, labelsGroup, false, autoHideCfg);
}
function reserveLast(isVertical2, labelsGroup, limitLength, autoHideCfg) {
return reserveOne(isVertical2, labelsGroup, true, autoHideCfg);
}
function reserveBoth(isVertical2, labelsGroup, limitLength, autoHideCfg) {
var minGap = (autoHideCfg === null || autoHideCfg === void 0 ? void 0 : autoHideCfg.minGap) || 0;
var labels = labelsGroup.getChildren().slice();
if (labels.length <= 2) {
return false;
}
var hasHide = false;
var count2 = labels.length;
var first = labels[0];
var last2 = labels[count2 - 1];
var preLabel = first;
for (var i4 = 1; i4 < count2 - 1; i4++) {
var label17 = labels[i4];
var curBBox = label17.getBBox();
var isHide = isOverlap(isVertical2, preLabel, label17, minGap);
if (isHide) {
label17.hide();
hasHide = true;
} else {
preLabel = label17;
}
}
var overlap2 = isOverlap(isVertical2, preLabel, last2, minGap);
if (overlap2) {
preLabel.hide();
hasHide = true;
}
return hasHide;
}
function equidistance(isVertical2, labelsGroup, limitLength, autoHideCfg) {
var hasHide = parityHide(isVertical2, labelsGroup, autoHideCfg);
if (reserveOne(isVertical2, labelsGroup, false)) {
hasHide = true;
}
return hasHide;
}
function equidistanceWithReverseBoth(isVertical2, labelsGroup, limitLength, autoHideCfg) {
var labels = labelsGroup.getChildren().slice();
var hasHide = parityHide(isVertical2, labelsGroup, autoHideCfg);
if (labels.length > 2) {
var first = labels[0];
var last2 = labels[labels.length - 1];
if (!first.get("visible")) {
first.show();
if (reserveOne(isVertical2, labelsGroup, false, autoHideCfg)) {
hasHide = true;
}
}
if (!last2.get("visible")) {
last2.show();
if (reserveOne(isVertical2, labelsGroup, true, autoHideCfg)) {
hasHide = true;
}
}
}
return hasHide;
}
// node_modules/@antv/component/esm/axis/overlap/auto-rotate.js
var auto_rotate_exports = {};
__export(auto_rotate_exports, {
fixedAngle: () => fixedAngle,
getDefault: () => getDefault3,
unfixedAngle: () => unfixedAngle
});
function setLabelsAngle(labels, angle3) {
each_default(labels, function(label17) {
var x6 = label17.attr("x");
var y5 = label17.attr("y");
var matrix = getMatrixByAngle({ x: x6, y: y5 }, angle3);
label17.attr("matrix", matrix);
});
}
function labelRotate(isVertical2, labelsGroup, limitLength, getAngle6) {
var labels = labelsGroup.getChildren();
if (!labels.length) {
return false;
}
if (!isVertical2 && labels.length < 2) {
return false;
}
var maxWidth = getMaxLabelWidth(labels);
var isOverlap2 = false;
if (isVertical2) {
isOverlap2 = !!limitLength && maxWidth > limitLength;
} else {
var tickWidth = Math.abs(labels[1].attr("x") - labels[0].attr("x"));
isOverlap2 = maxWidth > tickWidth;
}
if (isOverlap2) {
var angle3 = getAngle6(limitLength, maxWidth);
setLabelsAngle(labels, angle3);
}
return isOverlap2;
}
function getDefault3() {
return fixedAngle;
}
function fixedAngle(isVertical2, labelsGroup, limitLength, customRotate) {
return labelRotate(isVertical2, labelsGroup, limitLength, function() {
if (is_number_default(customRotate)) {
return customRotate;
}
return isVertical2 ? theme_default.verticalAxisRotate : theme_default.horizontalAxisRotate;
});
}
function unfixedAngle(isVertical2, labelsGroup, limitLength) {
return labelRotate(isVertical2, labelsGroup, limitLength, function(length5, maxWidth) {
if (!length5) {
return isVertical2 ? theme_default.verticalAxisRotate : theme_default.horizontalAxisRotate;
}
if (isVertical2) {
return -Math.acos(length5 / maxWidth);
} else {
var angle3 = 0;
if (length5 > maxWidth) {
angle3 = Math.PI / 4;
} else {
angle3 = Math.asin(length5 / maxWidth);
if (angle3 > Math.PI / 4) {
angle3 = Math.PI / 4;
}
}
return angle3;
}
});
}
// node_modules/@antv/component/esm/axis/line.js
var Line = function(_super) {
__extends(Line9, _super);
function Line9() {
return _super !== null && _super.apply(this, arguments) || this;
}
Line9.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), {
type: "line",
locationType: "region",
start: null,
end: null
});
};
Line9.prototype.getLinePath = function() {
var start = this.get("start");
var end2 = this.get("end");
var path = [];
path.push(["M", start.x, start.y]);
path.push(["L", end2.x, end2.y]);
return path;
};
Line9.prototype.getInnerLayoutBBox = function() {
var start = this.get("start");
var end2 = this.get("end");
var bbox = _super.prototype.getInnerLayoutBBox.call(this);
var minX = Math.min(start.x, end2.x, bbox.x);
var minY = Math.min(start.y, end2.y, bbox.y);
var maxX = Math.max(start.x, end2.x, bbox.maxX);
var maxY2 = Math.max(start.y, end2.y, bbox.maxY);
return {
x: minX,
y: minY,
minX,
minY,
maxX,
maxY: maxY2,
width: maxX - minX,
height: maxY2 - minY
};
};
Line9.prototype.isVertical = function() {
var start = this.get("start");
var end2 = this.get("end");
return isNumberEqual(start.x, end2.x);
};
Line9.prototype.isHorizontal = function() {
var start = this.get("start");
var end2 = this.get("end");
return isNumberEqual(start.y, end2.y);
};
Line9.prototype.getTickPoint = function(tickValue) {
var self2 = this;
var start = self2.get("start");
var end2 = self2.get("end");
var regionX = end2.x - start.x;
var regionY = end2.y - start.y;
return {
x: start.x + regionX * tickValue,
y: start.y + regionY * tickValue
};
};
Line9.prototype.getSideVector = function(offset) {
var axisVector = this.getAxisVector();
var normal2 = vec2_exports.normalize([0, 0], axisVector);
var factor = this.get("verticalFactor");
var verticalVector = [normal2[1], normal2[0] * -1];
return vec2_exports.scale([0, 0], verticalVector, offset * factor);
};
Line9.prototype.getAxisVector = function() {
var start = this.get("start");
var end2 = this.get("end");
return [end2.x - start.x, end2.y - start.y];
};
Line9.prototype.processOverlap = function(labelGroup) {
var _this = this;
var isVertical2 = this.isVertical();
var isHorizontal2 = this.isHorizontal();
if (!isVertical2 && !isHorizontal2) {
return;
}
var labelCfg = this.get("label");
var titleCfg = this.get("title");
var verticalLimitLength = this.get("verticalLimitLength");
var labelOffset = labelCfg.offset;
var limitLength = verticalLimitLength;
var titleHeight = 0;
var titleSpacing = 0;
if (titleCfg) {
titleHeight = titleCfg.style.fontSize;
titleSpacing = titleCfg.spacing;
}
if (limitLength) {
limitLength = limitLength - labelOffset - titleSpacing - titleHeight;
}
var overlapOrder = this.get("overlapOrder");
each_default(overlapOrder, function(name) {
if (labelCfg[name] && _this.canProcessOverlap(name)) {
_this.autoProcessOverlap(name, labelCfg[name], labelGroup, limitLength);
}
});
if (titleCfg) {
if (is_nil_default(titleCfg.offset)) {
var bbox = labelGroup.getCanvasBBox();
var length_1 = isVertical2 ? bbox.width : bbox.height;
titleCfg.offset = labelOffset + length_1 + titleSpacing + titleHeight / 2;
}
}
};
Line9.prototype.canProcessOverlap = function(name) {
var labelCfg = this.get("label");
if (name === "autoRotate") {
return is_nil_default(labelCfg.rotate);
}
return true;
};
Line9.prototype.autoProcessOverlap = function(name, value2, labelGroup, limitLength) {
var _this = this;
var isVertical2 = this.isVertical();
var hasAdjusted = false;
var util = overlap_exports[name];
if (value2 === true) {
var labelCfg = this.get("label");
hasAdjusted = util.getDefault()(isVertical2, labelGroup, limitLength);
} else if (is_function_default(value2)) {
hasAdjusted = value2(isVertical2, labelGroup, limitLength);
} else if (is_object_default(value2)) {
var overlapCfg = value2;
if (util[overlapCfg.type]) {
hasAdjusted = util[overlapCfg.type](isVertical2, labelGroup, limitLength, overlapCfg.cfg);
}
} else if (util[value2]) {
hasAdjusted = util[value2](isVertical2, labelGroup, limitLength);
}
if (name === "autoRotate") {
if (hasAdjusted) {
var labels = labelGroup.getChildren();
var verticalFactor_1 = this.get("verticalFactor");
each_default(labels, function(label17) {
var textAlign = label17.attr("textAlign");
if (textAlign === "center") {
var newAlign = verticalFactor_1 > 0 ? "end" : "start";
label17.attr("textAlign", newAlign);
}
});
}
} else if (name === "autoHide") {
var children = labelGroup.getChildren().slice(0);
each_default(children, function(label17) {
if (!label17.get("visible")) {
if (_this.get("isRegister")) {
_this.unregisterElement(label17);
}
label17.remove();
}
});
}
};
return Line9;
}(base_default8);
var line_default4 = Line;
// node_modules/@antv/component/esm/axis/circle.js
var Circle = function(_super) {
__extends(Circle6, _super);
function Circle6() {
return _super !== null && _super.apply(this, arguments) || this;
}
Circle6.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { type: "circle", locationType: "circle", center: null, radius: null, startAngle: -Math.PI / 2, endAngle: Math.PI * 3 / 2 });
};
Circle6.prototype.getLinePath = function() {
var center2 = this.get("center");
var x6 = center2.x;
var y5 = center2.y;
var rx = this.get("radius");
var ry = rx;
var startAngle = this.get("startAngle");
var endAngle = this.get("endAngle");
var path = [];
if (Math.abs(endAngle - startAngle) === Math.PI * 2) {
path = [["M", x6, y5 - ry], ["A", rx, ry, 0, 1, 1, x6, y5 + ry], ["A", rx, ry, 0, 1, 1, x6, y5 - ry], ["Z"]];
} else {
var startPoint = this.getCirclePoint(startAngle);
var endPoint = this.getCirclePoint(endAngle);
var large = Math.abs(endAngle - startAngle) > Math.PI ? 1 : 0;
var sweep = startAngle > endAngle ? 0 : 1;
path = [
["M", x6, y5],
["L", startPoint.x, startPoint.y],
["A", rx, ry, 0, large, sweep, endPoint.x, endPoint.y],
["L", x6, y5]
];
}
return path;
};
Circle6.prototype.getTickPoint = function(tickValue) {
var startAngle = this.get("startAngle");
var endAngle = this.get("endAngle");
var angle3 = startAngle + (endAngle - startAngle) * tickValue;
return this.getCirclePoint(angle3);
};
Circle6.prototype.getSideVector = function(offset, point2) {
var center2 = this.get("center");
var vector = [point2.x - center2.x, point2.y - center2.y];
var factor = this.get("verticalFactor");
var vecLen = vec2_exports.length(vector);
vec2_exports.scale(vector, vector, factor * offset / vecLen);
return vector;
};
Circle6.prototype.getAxisVector = function(point2) {
var center2 = this.get("center");
var vector = [point2.x - center2.x, point2.y - center2.y];
return [vector[1], -1 * vector[0]];
};
Circle6.prototype.getCirclePoint = function(angle3, radius) {
var center2 = this.get("center");
radius = radius || this.get("radius");
return {
x: center2.x + Math.cos(angle3) * radius,
y: center2.y + Math.sin(angle3) * radius
};
};
Circle6.prototype.canProcessOverlap = function(name) {
var labelCfg = this.get("label");
if (name === "autoRotate") {
return is_nil_default(labelCfg.rotate);
}
return true;
};
Circle6.prototype.processOverlap = function(labelGroup) {
var _this = this;
var labelCfg = this.get("label");
var titleCfg = this.get("title");
var verticalLimitLength = this.get("verticalLimitLength");
var labelOffset = labelCfg.offset;
var limitLength = verticalLimitLength;
var titleHeight = 0;
var titleSpacing = 0;
if (titleCfg) {
titleHeight = titleCfg.style.fontSize;
titleSpacing = titleCfg.spacing;
}
if (limitLength) {
limitLength = limitLength - labelOffset - titleSpacing - titleHeight;
}
var overlapOrder = this.get("overlapOrder");
each_default(overlapOrder, function(name) {
if (labelCfg[name] && _this.canProcessOverlap(name)) {
_this.autoProcessOverlap(name, labelCfg[name], labelGroup, limitLength);
}
});
if (titleCfg) {
if (is_nil_default(titleCfg.offset)) {
var length_1 = labelGroup.getCanvasBBox().height;
titleCfg.offset = labelOffset + length_1 + titleSpacing + titleHeight / 2;
}
}
};
Circle6.prototype.autoProcessOverlap = function(name, value2, labelGroup, limitLength) {
var _this = this;
var hasAdjusted = false;
var util = overlap_exports[name];
if (limitLength > 0) {
if (value2 === true) {
hasAdjusted = util.getDefault()(false, labelGroup, limitLength);
} else if (is_function_default(value2)) {
hasAdjusted = value2(false, labelGroup, limitLength);
} else if (is_object_default(value2)) {
var overlapCfg = value2;
if (util[overlapCfg.type]) {
hasAdjusted = util[overlapCfg.type](false, labelGroup, limitLength, overlapCfg.cfg);
}
} else if (util[value2]) {
hasAdjusted = util[value2](false, labelGroup, limitLength);
}
}
if (name === "autoRotate") {
if (hasAdjusted) {
var labels = labelGroup.getChildren();
var verticalFactor_1 = this.get("verticalFactor");
each_default(labels, function(label17) {
var textAlign = label17.attr("textAlign");
if (textAlign === "center") {
var newAlign = verticalFactor_1 > 0 ? "end" : "start";
label17.attr("textAlign", newAlign);
}
});
}
} else if (name === "autoHide") {
var children = labelGroup.getChildren().slice(0);
each_default(children, function(label17) {
if (!label17.get("visible")) {
if (_this.get("isRegister")) {
_this.unregisterElement(label17);
}
label17.remove();
}
});
}
};
return Circle6;
}(base_default8);
var circle_default2 = Circle;
// node_modules/@antv/component/esm/crosshair/index.js
var crosshair_exports = {};
__export(crosshair_exports, {
Base: () => base_default9,
Circle: () => circle_default3,
Html: () => html_default2,
Line: () => line_default5
});
// node_modules/@antv/component/esm/crosshair/base.js
var CrosshairBase = function(_super) {
__extends(CrosshairBase2, _super);
function CrosshairBase2() {
return _super !== null && _super.apply(this, arguments) || this;
}
CrosshairBase2.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { name: "crosshair", type: "base", line: {}, text: null, textBackground: {}, capture: false, defaultCfg: {
line: {
style: {
lineWidth: 1,
stroke: theme_default.lineColor
}
},
text: {
position: "start",
offset: 10,
autoRotate: false,
content: null,
style: {
fill: theme_default.textColor,
textAlign: "center",
textBaseline: "middle",
fontFamily: theme_default.fontFamily
}
},
textBackground: {
padding: 5,
style: {
stroke: theme_default.lineColor
}
}
} });
};
CrosshairBase2.prototype.renderInner = function(group2) {
if (this.get("line")) {
this.renderLine(group2);
}
if (this.get("text")) {
this.renderText(group2);
this.renderBackground(group2);
}
};
CrosshairBase2.prototype.renderText = function(group2) {
var text = this.get("text");
var style = text.style, autoRotate = text.autoRotate, content = text.content;
if (!is_nil_default(content)) {
var textPoint = this.getTextPoint();
var matrix = null;
if (autoRotate) {
var angle3 = this.getRotateAngle();
matrix = getMatrixByAngle(textPoint, angle3);
}
this.addShape(group2, {
type: "text",
name: "crosshair-text",
id: this.getElementId("text"),
attrs: __assign(__assign(__assign({}, textPoint), { text: content, matrix }), style)
});
}
};
CrosshairBase2.prototype.renderLine = function(group2) {
var path = this.getLinePath();
var line2 = this.get("line");
var style = line2.style;
this.addShape(group2, {
type: "path",
name: "crosshair-line",
id: this.getElementId("line"),
attrs: __assign({ path }, style)
});
};
CrosshairBase2.prototype.renderBackground = function(group2) {
var textId = this.getElementId("text");
var textShape = group2.findById(textId);
var textBackground = this.get("textBackground");
if (textBackground && textShape) {
var textBBox = textShape.getBBox();
var padding3 = formatPadding(textBackground.padding);
var style = textBackground.style;
var backgroundShape = this.addShape(group2, {
type: "rect",
name: "crosshair-text-background",
id: this.getElementId("text-background"),
attrs: __assign({ x: textBBox.x - padding3[3], y: textBBox.y - padding3[0], width: textBBox.width + padding3[1] + padding3[3], height: textBBox.height + padding3[0] + padding3[2], matrix: textShape.attr("matrix") }, style)
});
backgroundShape.toBack();
}
};
return CrosshairBase2;
}(group_component_default);
var base_default9 = CrosshairBase;
// node_modules/@antv/component/esm/crosshair/line.js
var LineCrosshair = function(_super) {
__extends(LineCrosshair3, _super);
function LineCrosshair3() {
return _super !== null && _super.apply(this, arguments) || this;
}
LineCrosshair3.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { type: "line", locationType: "region", start: null, end: null });
};
LineCrosshair3.prototype.getRotateAngle = function() {
var _a6 = this.getLocation(), start = _a6.start, end2 = _a6.end;
var position2 = this.get("text").position;
var angle3 = Math.atan2(end2.y - start.y, end2.x - start.x);
var tangentAngle = position2 === "start" ? angle3 - Math.PI / 2 : angle3 + Math.PI / 2;
return tangentAngle;
};
LineCrosshair3.prototype.getTextPoint = function() {
var _a6 = this.getLocation(), start = _a6.start, end2 = _a6.end;
var _b = this.get("text"), position2 = _b.position, offset = _b.offset;
return getTextPoint(start, end2, position2, offset);
};
LineCrosshair3.prototype.getLinePath = function() {
var _a6 = this.getLocation(), start = _a6.start, end2 = _a6.end;
return [
["M", start.x, start.y],
["L", end2.x, end2.y]
];
};
return LineCrosshair3;
}(base_default9);
var line_default5 = LineCrosshair;
// node_modules/@antv/component/esm/crosshair/circle.js
var LineCrosshair2 = function(_super) {
__extends(LineCrosshair3, _super);
function LineCrosshair3() {
return _super !== null && _super.apply(this, arguments) || this;
}
LineCrosshair3.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { type: "circle", locationType: "circle", center: null, radius: 100, startAngle: -Math.PI / 2, endAngle: Math.PI * 3 / 2 });
};
LineCrosshair3.prototype.getRotateAngle = function() {
var _a6 = this.getLocation(), startAngle = _a6.startAngle, endAngle = _a6.endAngle;
var position2 = this.get("text").position;
var tangentAngle = position2 === "start" ? startAngle + Math.PI / 2 : endAngle - Math.PI / 2;
return tangentAngle;
};
LineCrosshair3.prototype.getTextPoint = function() {
var text = this.get("text");
var position2 = text.position, offset = text.offset;
var _a6 = this.getLocation(), center2 = _a6.center, radius = _a6.radius, startAngle = _a6.startAngle, endAngle = _a6.endAngle;
var angle3 = position2 === "start" ? startAngle : endAngle;
var tangentAngle = this.getRotateAngle() - Math.PI;
var point2 = getCirclePoint(center2, radius, angle3);
var offsetX = Math.cos(tangentAngle) * offset;
var offsetY = Math.sin(tangentAngle) * offset;
return {
x: point2.x + offsetX,
y: point2.y + offsetY
};
};
LineCrosshair3.prototype.getLinePath = function() {
var _a6 = this.getLocation(), center2 = _a6.center, radius = _a6.radius, startAngle = _a6.startAngle, endAngle = _a6.endAngle;
var path = null;
if (endAngle - startAngle === Math.PI * 2) {
var x6 = center2.x, y5 = center2.y;
path = [
["M", x6, y5 - radius],
["A", radius, radius, 0, 1, 1, x6, y5 + radius],
["A", radius, radius, 0, 1, 1, x6, y5 - radius],
["Z"]
];
} else {
var startPoint = getCirclePoint(center2, radius, startAngle);
var endPoint = getCirclePoint(center2, radius, endAngle);
var large = Math.abs(endAngle - startAngle) > Math.PI ? 1 : 0;
var sweep = startAngle > endAngle ? 0 : 1;
path = [
["M", startPoint.x, startPoint.y],
["A", radius, radius, 0, large, sweep, endPoint.x, endPoint.y]
];
}
return path;
};
return LineCrosshair3;
}(base_default9);
var circle_default3 = LineCrosshair2;
// node_modules/@antv/component/esm/crosshair/css-const.js
var CONTAINER_CLASS = "g2-crosshair";
var CROSSHAIR_LINE = CONTAINER_CLASS + "-line";
var CROSSHAIR_TEXT = CONTAINER_CLASS + "-text";
// node_modules/@antv/component/esm/crosshair/html-theme.js
var _a;
var html_theme_default = (_a = {}, _a["" + CONTAINER_CLASS] = {
position: "relative"
}, _a["" + CROSSHAIR_LINE] = {
position: "absolute",
backgroundColor: "rgba(0, 0, 0, 0.25)"
}, _a["" + CROSSHAIR_TEXT] = {
position: "absolute",
color: theme_default.textColor,
fontFamily: theme_default.fontFamily
}, _a);
// node_modules/@antv/component/esm/crosshair/html.js
var HtmlCrosshair = function(_super) {
__extends(HtmlCrosshair2, _super);
function HtmlCrosshair2() {
return _super !== null && _super.apply(this, arguments) || this;
}
HtmlCrosshair2.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { name: "crosshair", type: "html", locationType: "region", start: { x: 0, y: 0 }, end: { x: 0, y: 0 }, capture: false, text: null, containerTpl: '', crosshairTpl: '', textTpl: '{content}', domStyles: null, containerClassName: CONTAINER_CLASS, defaultStyles: html_theme_default, defaultCfg: {
text: {
position: "start",
content: null,
align: "center",
offset: 10
}
} });
};
HtmlCrosshair2.prototype.render = function() {
this.resetText();
this.resetPosition();
};
HtmlCrosshair2.prototype.initCrossHair = function() {
var container2 = this.getContainer();
var crosshairTpl = this.get("crosshairTpl");
var crosshairEl = createDom(crosshairTpl);
container2.appendChild(crosshairEl);
this.applyStyle(CROSSHAIR_LINE, crosshairEl);
this.set("crosshairEl", crosshairEl);
};
HtmlCrosshair2.prototype.getTextPoint = function() {
var _a6 = this.getLocation(), start = _a6.start, end2 = _a6.end;
var _b = this.get("text"), position2 = _b.position, offset = _b.offset;
return getTextPoint(start, end2, position2, offset);
};
HtmlCrosshair2.prototype.resetText = function() {
var text = this.get("text");
var textEl = this.get("textEl");
if (text) {
var content = text.content;
if (!textEl) {
var container2 = this.getContainer();
var textTpl = substitute_default(this.get("textTpl"), text);
textEl = createDom(textTpl);
container2.appendChild(textEl);
this.applyStyle(CROSSHAIR_TEXT, textEl);
this.set("textEl", textEl);
}
textEl.innerHTML = content;
} else if (textEl) {
textEl.remove();
}
};
HtmlCrosshair2.prototype.isVertical = function(start, end2) {
return start.x === end2.x;
};
HtmlCrosshair2.prototype.resetPosition = function() {
var crosshairEl = this.get("crosshairEl");
if (!crosshairEl) {
this.initCrossHair();
crosshairEl = this.get("crosshairEl");
}
var start = this.get("start");
var end2 = this.get("end");
var minX = Math.min(start.x, end2.x);
var minY = Math.min(start.y, end2.y);
if (this.isVertical(start, end2)) {
modifyCSS(crosshairEl, {
width: "1px",
height: toPx(Math.abs(end2.y - start.y))
});
} else {
modifyCSS(crosshairEl, {
height: "1px",
width: toPx(Math.abs(end2.x - start.x))
});
}
modifyCSS(crosshairEl, {
top: toPx(minY),
left: toPx(minX)
});
this.alignText();
};
HtmlCrosshair2.prototype.alignText = function() {
var textEl = this.get("textEl");
if (textEl) {
var align = this.get("text").align;
var clientWidth = textEl.clientWidth;
var point2 = this.getTextPoint();
switch (align) {
case "center":
point2.x = point2.x - clientWidth / 2;
break;
case "right":
point2.x = point2.x - clientWidth;
case "left":
break;
}
modifyCSS(textEl, {
top: toPx(point2.y),
left: toPx(point2.x)
});
}
};
HtmlCrosshair2.prototype.updateInner = function(cfg) {
if (has_key_default(cfg, "text")) {
this.resetText();
}
_super.prototype.updateInner.call(this, cfg);
};
return HtmlCrosshair2;
}(html_component_default);
var html_default2 = HtmlCrosshair;
// node_modules/@antv/component/esm/grid/index.js
var grid_exports = {};
__export(grid_exports, {
Base: () => base_default10,
Circle: () => circle_default4,
Line: () => line_default6
});
// node_modules/@antv/component/esm/grid/base.js
var GridBase = function(_super) {
__extends(GridBase2, _super);
function GridBase2() {
return _super !== null && _super.apply(this, arguments) || this;
}
GridBase2.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { name: "grid", line: {}, alternateColor: null, capture: false, items: [], closed: false, defaultCfg: {
line: {
type: "line",
style: {
lineWidth: 1,
stroke: theme_default.lineColor
}
}
} });
};
GridBase2.prototype.getLineType = function() {
var line2 = this.get("line") || this.get("defaultCfg").line;
return line2.type;
};
GridBase2.prototype.renderInner = function(group2) {
this.drawGrid(group2);
};
GridBase2.prototype.getAlternatePath = function(prePoints, points) {
var regionPath = this.getGridPath(prePoints);
var reversePoints = points.slice(0).reverse();
var nextPath = this.getGridPath(reversePoints, true);
var closed = this.get("closed");
if (closed) {
regionPath = regionPath.concat(nextPath);
} else {
nextPath[0][0] = "L";
regionPath = regionPath.concat(nextPath);
regionPath.push(["Z"]);
}
return regionPath;
};
GridBase2.prototype.getPathStyle = function() {
return this.get("line").style;
};
GridBase2.prototype.drawGrid = function(group2) {
var _this = this;
var line2 = this.get("line");
var items = this.get("items");
var alternateColor = this.get("alternateColor");
var preItem = null;
each_default(items, function(item, index2) {
var id = item.id || index2;
if (line2) {
var style = _this.getPathStyle();
style = is_function_default(style) ? style(item, index2, items) : style;
var lineId = _this.getElementId("line-" + id);
var gridPath = _this.getGridPath(item.points);
_this.addShape(group2, {
type: "path",
name: "grid-line",
id: lineId,
attrs: mix({
path: gridPath
}, style)
});
}
if (alternateColor && index2 > 0) {
var regionId = _this.getElementId("region-" + id);
var isEven = index2 % 2 === 0;
if (is_string_default(alternateColor)) {
if (isEven) {
_this.drawAlternateRegion(regionId, group2, preItem.points, item.points, alternateColor);
}
} else {
var color4 = isEven ? alternateColor[1] : alternateColor[0];
_this.drawAlternateRegion(regionId, group2, preItem.points, item.points, color4);
}
}
preItem = item;
});
};
GridBase2.prototype.drawAlternateRegion = function(id, group2, prePoints, points, color4) {
var regionPath = this.getAlternatePath(prePoints, points);
this.addShape(group2, {
type: "path",
id,
name: "grid-region",
attrs: {
path: regionPath,
fill: color4
}
});
};
return GridBase2;
}(group_component_default);
var base_default10 = GridBase;
// node_modules/@antv/component/esm/grid/circle.js
function distance6(x1, y1, x22, y22) {
var dx = x22 - x1;
var dy = y22 - y1;
return Math.sqrt(dx * dx + dy * dy);
}
var Circle2 = function(_super) {
__extends(Circle6, _super);
function Circle6() {
return _super !== null && _super.apply(this, arguments) || this;
}
Circle6.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), {
type: "circle",
center: null,
closed: true
});
};
Circle6.prototype.getGridPath = function(points, reversed) {
var lineType = this.getLineType();
var closed = this.get("closed");
var path = [];
if (points.length) {
if (lineType === "circle") {
var center2 = this.get("center");
var firstPoint = points[0];
var radius_1 = distance6(center2.x, center2.y, firstPoint.x, firstPoint.y);
var sweepFlag_1 = reversed ? 0 : 1;
if (closed) {
path.push(["M", center2.x, center2.y - radius_1]);
path.push(["A", radius_1, radius_1, 0, 0, sweepFlag_1, center2.x, center2.y + radius_1]);
path.push(["A", radius_1, radius_1, 0, 0, sweepFlag_1, center2.x, center2.y - radius_1]);
path.push(["Z"]);
} else {
each_default(points, function(point2, index2) {
if (index2 === 0) {
path.push(["M", point2.x, point2.y]);
} else {
path.push(["A", radius_1, radius_1, 0, 0, sweepFlag_1, point2.x, point2.y]);
}
});
}
} else {
each_default(points, function(point2, index2) {
if (index2 === 0) {
path.push(["M", point2.x, point2.y]);
} else {
path.push(["L", point2.x, point2.y]);
}
});
if (closed) {
path.push(["Z"]);
}
}
}
return path;
};
return Circle6;
}(base_default10);
var circle_default4 = Circle2;
// node_modules/@antv/component/esm/grid/line.js
var Line2 = function(_super) {
__extends(Line9, _super);
function Line9() {
return _super !== null && _super.apply(this, arguments) || this;
}
Line9.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { type: "line" });
};
Line9.prototype.getGridPath = function(points) {
var path = [];
each_default(points, function(point2, index2) {
if (index2 === 0) {
path.push(["M", point2.x, point2.y]);
} else {
path.push(["L", point2.x, point2.y]);
}
});
return path;
};
return Line9;
}(base_default10);
var line_default6 = Line2;
// node_modules/@antv/component/esm/legend/index.js
var legend_exports = {};
__export(legend_exports, {
Base: () => base_default11,
Category: () => category_default,
Continuous: () => continuous_default
});
// node_modules/@antv/component/esm/legend/base.js
var LegendBase = function(_super) {
__extends(LegendBase2, _super);
function LegendBase2() {
return _super !== null && _super.apply(this, arguments) || this;
}
LegendBase2.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), {
name: "legend",
layout: "horizontal",
locationType: "point",
x: 0,
y: 0,
offsetX: 0,
offsetY: 0,
title: null,
background: null
});
};
LegendBase2.prototype.getLayoutBBox = function() {
var bbox = _super.prototype.getLayoutBBox.call(this);
var maxWidth = this.get("maxWidth");
var maxHeight = this.get("maxHeight");
var width2 = bbox.width, height = bbox.height;
if (maxWidth) {
width2 = Math.min(width2, maxWidth);
}
if (maxHeight) {
height = Math.min(height, maxHeight);
}
return createBBox(bbox.minX, bbox.minY, width2, height);
};
LegendBase2.prototype.setLocation = function(cfg) {
this.set("x", cfg.x);
this.set("y", cfg.y);
this.resetLocation();
};
LegendBase2.prototype.resetLocation = function() {
var x6 = this.get("x");
var y5 = this.get("y");
var offsetX = this.get("offsetX");
var offsetY = this.get("offsetY");
this.moveElementTo(this.get("group"), {
x: x6 + offsetX,
y: y5 + offsetY
});
};
LegendBase2.prototype.applyOffset = function() {
this.resetLocation();
};
LegendBase2.prototype.getDrawPoint = function() {
return this.get("currentPoint");
};
LegendBase2.prototype.setDrawPoint = function(point2) {
return this.set("currentPoint", point2);
};
LegendBase2.prototype.renderInner = function(group2) {
this.resetDraw();
if (this.get("title")) {
this.drawTitle(group2);
}
this.drawLegendContent(group2);
if (this.get("background")) {
this.drawBackground(group2);
}
};
LegendBase2.prototype.drawBackground = function(group2) {
var background = this.get("background");
var bbox = group2.getBBox();
var padding3 = formatPadding(background.padding);
var attrs = __assign({
x: 0,
y: 0,
width: bbox.width + padding3[1] + padding3[3],
height: bbox.height + padding3[0] + padding3[2]
}, background.style);
var backgroundShape = this.addShape(group2, {
type: "rect",
id: this.getElementId("background"),
name: "legend-background",
attrs
});
backgroundShape.toBack();
};
LegendBase2.prototype.drawTitle = function(group2) {
var currentPoint = this.get("currentPoint");
var titleCfg = this.get("title");
var spacing = titleCfg.spacing, style = titleCfg.style, text = titleCfg.text;
var shape = this.addShape(group2, {
type: "text",
id: this.getElementId("title"),
name: "legend-title",
attrs: __assign({ text, x: currentPoint.x, y: currentPoint.y }, style)
});
var bbox = shape.getBBox();
this.set("currentPoint", { x: currentPoint.x, y: bbox.maxY + spacing });
};
LegendBase2.prototype.resetDraw = function() {
var background = this.get("background");
var currentPoint = { x: 0, y: 0 };
if (background) {
var padding3 = formatPadding(background.padding);
currentPoint.x = padding3[3];
currentPoint.y = padding3[0];
}
this.set("currentPoint", currentPoint);
};
return LegendBase2;
}(group_component_default);
var base_default11 = LegendBase;
// node_modules/@antv/component/esm/legend/category.js
var DEFAULT_PAGE_NAVIGATOR = {
marker: {
style: {
inactiveFill: "#000",
inactiveOpacity: 0.45,
fill: "#000",
opacity: 1,
size: 12
}
},
text: {
style: {
fill: "#ccc",
fontSize: 12
}
}
};
var textStyle = {
fill: theme_default.textColor,
fontSize: 12,
textAlign: "start",
textBaseline: "middle",
fontFamily: theme_default.fontFamily,
fontWeight: "normal",
lineHeight: 12
};
var RIGHT_ARROW_NAME = "navigation-arrow-right";
var LEFT_ARROW_NAME = "navigation-arrow-left";
var ROTATE_MAP = {
right: 90 * Math.PI / 180,
left: (360 - 90) * Math.PI / 180,
up: 0,
down: 180 * Math.PI / 180
};
var Category2 = function(_super) {
__extends(Category3, _super);
function Category3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.currentPageIndex = 1;
_this.totalPagesCnt = 1;
_this.pageWidth = 0;
_this.pageHeight = 0;
_this.startX = 0;
_this.startY = 0;
_this.onNavigationBack = function() {
var itemGroup = _this.getElementByLocalId("item-group");
if (_this.currentPageIndex > 1) {
_this.currentPageIndex -= 1;
_this.updateNavigation();
var matrix = _this.getCurrentNavigationMatrix();
if (_this.get("animate")) {
itemGroup.animate({
matrix
}, 100);
} else {
itemGroup.attr({ matrix });
}
}
};
_this.onNavigationAfter = function() {
var itemGroup = _this.getElementByLocalId("item-group");
if (_this.currentPageIndex < _this.totalPagesCnt) {
_this.currentPageIndex += 1;
_this.updateNavigation();
var matrix = _this.getCurrentNavigationMatrix();
if (_this.get("animate")) {
itemGroup.animate({
matrix
}, 100);
} else {
itemGroup.attr({ matrix });
}
}
};
return _this;
}
Category3.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { name: "legend", type: "category", itemSpacing: 24, itemMarginBottom: 8, maxItemWidth: null, itemWidth: null, itemHeight: null, itemName: {}, itemValue: null, maxWidth: null, maxHeight: null, marker: {}, radio: null, items: [], itemStates: {}, itemBackground: {}, pageNavigator: {}, defaultCfg: {
title: {
spacing: 5,
style: {
fill: theme_default.textColor,
fontSize: 12,
textAlign: "start",
textBaseline: "top"
}
},
background: {
padding: 5,
style: {
stroke: theme_default.lineColor
}
},
itemBackground: {
style: {
opacity: 0,
fill: "#fff"
}
},
pageNavigator: DEFAULT_PAGE_NAVIGATOR,
itemName: {
spacing: 16,
style: textStyle
},
marker: {
spacing: 8,
style: {
r: 6,
symbol: "circle"
}
},
itemValue: {
alignRight: false,
formatter: null,
style: textStyle,
spacing: 6
},
itemStates: {
active: {
nameStyle: {
opacity: 0.8
}
},
unchecked: {
nameStyle: {
fill: theme_default.uncheckedColor
},
markerStyle: {
fill: theme_default.uncheckedColor,
stroke: theme_default.uncheckedColor
}
},
inactive: {
nameStyle: {
fill: theme_default.uncheckedColor
},
markerStyle: {
opacity: 0.2
}
}
}
} });
};
Category3.prototype.isList = function() {
return true;
};
Category3.prototype.getItems = function() {
return this.get("items");
};
Category3.prototype.setItems = function(items) {
this.update({
items
});
};
Category3.prototype.updateItem = function(item, cfg) {
mix(item, cfg);
this.clear();
this.render();
};
Category3.prototype.clearItems = function() {
var itemGroup = this.getElementByLocalId("item-group");
itemGroup && itemGroup.clear();
};
Category3.prototype.setItemState = function(item, state2, value2) {
item[state2] = value2;
var itemElement = this.getElementByLocalId("item-" + item.id);
if (itemElement) {
var items = this.getItems();
var index2 = items.indexOf(item);
var offsetGroup = this.createOffScreenGroup();
var newElement = this.drawItem(item, index2, this.getItemHeight(), offsetGroup);
this.updateElements(newElement, itemElement);
this.clearUpdateStatus(itemElement);
}
};
Category3.prototype.hasState = function(item, state2) {
return !!item[state2];
};
Category3.prototype.getItemStates = function(item) {
var itemStates = this.get("itemStates");
var rst = [];
each_default(itemStates, function(v3, k4) {
if (item[k4]) {
rst.push(k4);
}
});
return rst;
};
Category3.prototype.clearItemsState = function(state2) {
var _this = this;
var items = this.getItemsByState(state2);
each_default(items, function(item) {
_this.setItemState(item, state2, false);
});
};
Category3.prototype.getItemsByState = function(state2) {
var _this = this;
var items = this.getItems();
return filter_default(items, function(item) {
return _this.hasState(item, state2);
});
};
Category3.prototype.drawLegendContent = function(group2) {
this.processItems();
this.drawItems(group2);
};
Category3.prototype.processItems = function() {
var items = this.get("items");
each_default(items, function(item) {
if (!item.id) {
item.id = item.name;
}
});
};
Category3.prototype.drawItems = function(group2) {
var _this = this;
var itemContainerGroup = this.addGroup(group2, {
id: this.getElementId("item-container-group"),
name: "legend-item-container-group"
});
var itemGroup = this.addGroup(itemContainerGroup, {
id: this.getElementId("item-group"),
name: "legend-item-group"
});
var itemHeight = this.getItemHeight();
var itemWidth = this.get("itemWidth");
var itemSpacing = this.get("itemSpacing");
var itemMarginBottom = this.get("itemMarginBottom");
var currentPoint = this.get("currentPoint");
var startX = currentPoint.x;
var startY = currentPoint.y;
var layout6 = this.get("layout");
var items = this.get("items");
var wrapped = false;
var pageWidth = 0;
var maxWidth = this.get("maxWidth");
var maxHeight = this.get("maxHeight");
each_default(items, function(item, index2) {
var subGroup = _this.drawItem(item, index2, itemHeight, itemGroup);
var bbox = subGroup.getBBox();
var width2 = itemWidth || bbox.width;
if (width2 > pageWidth) {
pageWidth = width2;
}
if (layout6 === "horizontal") {
if (maxWidth && maxWidth < currentPoint.x + width2 - startX) {
wrapped = true;
currentPoint.x = startX;
currentPoint.y += itemHeight + itemMarginBottom;
}
_this.moveElementTo(subGroup, currentPoint);
currentPoint.x += width2 + itemSpacing;
} else {
if (maxHeight && maxHeight < currentPoint.y + itemHeight + itemMarginBottom - startY) {
wrapped = true;
currentPoint.x += pageWidth + itemSpacing;
currentPoint.y = startY;
pageWidth = 0;
}
_this.moveElementTo(subGroup, currentPoint);
currentPoint.y += itemHeight + itemMarginBottom;
}
});
if (wrapped && this.get("flipPage")) {
this.pageHeight = 0;
this.pageWidth = 0;
this.totalPagesCnt = 1;
this.startX = startX;
this.startY = startY;
this.adjustNavigation(group2, itemGroup);
}
};
Category3.prototype.getItemHeight = function() {
var itemHeight = this.get("itemHeight");
if (!itemHeight) {
var style_1 = (this.get("itemName") || {}).style;
if (is_function_default(style_1)) {
var items_1 = this.getItems();
items_1.forEach(function(item, index2) {
var fontSize = __assign(__assign({}, textStyle), style_1(item, index2, items_1)).fontSize;
if (itemHeight < fontSize) {
itemHeight = fontSize;
}
});
} else if (style_1) {
itemHeight = style_1.fontSize;
}
}
return itemHeight;
};
Category3.prototype.drawMarker = function(container2, markerCfg, item, itemHeight) {
var markerAttrs = __assign(__assign(__assign({ x: 0, y: itemHeight / 2 }, markerCfg.style), { symbol: get_default(item.marker, "symbol", "circle") }), get_default(item.marker, "style", {}));
var shape = this.addShape(container2, {
type: "marker",
id: this.getElementId("item-" + item.id + "-marker"),
name: "legend-item-marker",
attrs: markerAttrs
});
var bbox = shape.getBBox();
shape.attr("x", bbox.width / 2);
var _a6 = shape.attr(), stroke = _a6.stroke, fill = _a6.fill;
if (stroke) {
shape.set("isStroke", true);
}
if (fill) {
shape.set("isFill", true);
}
return shape;
};
Category3.prototype.drawItemText = function(container2, textName, cfg, item, itemHeight, xPosition, index2) {
var formatter = cfg.formatter;
var style = cfg.style;
var attrs = __assign(__assign({ x: xPosition, y: itemHeight / 2, text: formatter ? formatter(item[textName], item, index2) : item[textName] }, textStyle), is_function_default(style) ? style(item, index2, this.getItems()) : style);
return this.addShape(container2, {
type: "text",
id: this.getElementId("item-" + item.id + "-" + textName),
name: "legend-item-" + textName,
attrs
});
};
Category3.prototype.drawRadio = function(container2, style, item, itemHeight, x6) {
var r4 = itemHeight / 2;
var lineWidth = r4 * 3.6 / 8;
var _a6 = [x6 + r4, itemHeight / 2 - r4], x0 = _a6[0], y0 = _a6[1];
var _b = [x0 + r4, y0 + r4], x1 = _b[0], y1 = _b[1];
var _c = [x0, y1 + r4], x22 = _c[0], y22 = _c[1];
var _d = [x6, y0 + r4], x32 = _d[0], y32 = _d[1];
var showRadio = item.showRadio;
var attrs = __assign(__assign({ path: [
["M", x0, y0],
["A", r4, r4, 0, 0, 1, x1, y1],
["L", x1 - lineWidth, y1],
["L", x1, y1],
["A", r4, r4, 0, 0, 1, x22, y22],
["L", x22, y22 - lineWidth],
["L", x22, y22],
["A", r4, r4, 0, 0, 1, x32, y32],
["L", x32 + lineWidth, y32],
["L", x32, y32],
["A", r4, r4, 0, 0, 1, x0, y0],
["L", x0, y0 + lineWidth]
], stroke: "#000000", fill: "#ffffff" }, style), { opacity: showRadio ? 0.45 : 0 });
return this.addShape(container2, {
type: "path",
id: this.getElementId("item-" + item.id + "-radio"),
name: "legend-item-radio",
attrs
});
};
Category3.prototype.drawItem = function(item, index2, itemHeight, itemGroup) {
var groupId = "item-" + item.id;
var subContainer = this.addGroup(itemGroup, {
name: "legend-item-container",
id: this.getElementId("item-container-" + groupId),
delegateObject: {
item,
index: index2
}
});
var subGroup = this.addGroup(subContainer, {
name: "legend-item",
id: this.getElementId(groupId),
delegateObject: {
item,
index: index2
}
});
var marker = this.get("marker");
var itemName = this.get("itemName");
var itemValue = this.get("itemValue");
var itemBackground = this.get("itemBackground");
var radio = this.get("radio");
var itemWidth = this.getLimitItemWidth();
var curX = 0;
if (marker) {
var markerShape = this.drawMarker(subGroup, marker, item, itemHeight);
var spacing = marker.spacing;
var itemMarkerSpacing = get_default(item, ["marker", "spacing"]);
if (is_number_default(itemMarkerSpacing)) {
spacing = itemMarkerSpacing;
}
curX = markerShape.getBBox().maxX + spacing;
}
if (itemName) {
var nameShape = this.drawItemText(subGroup, "name", itemName, item, itemHeight, curX, index2);
if (itemWidth) {
ellipsisLabel(true, nameShape, clamp_default(itemWidth - curX, 0, itemWidth));
}
curX = nameShape.getBBox().maxX + itemName.spacing;
}
if (itemValue) {
var valueShape = this.drawItemText(subGroup, "value", itemValue, item, itemHeight, curX, index2);
if (itemWidth) {
if (itemValue.alignRight) {
valueShape.attr({
textAlign: "right",
x: itemWidth
});
ellipsisLabel(true, valueShape, clamp_default(itemWidth - curX, 0, itemWidth), "head");
} else {
ellipsisLabel(true, valueShape, clamp_default(itemWidth - curX, 0, itemWidth));
}
}
curX = valueShape.getBBox().maxX + itemValue.spacing;
}
if (radio) {
this.drawRadio(subGroup, radio, item, itemHeight, curX);
}
if (itemBackground) {
var bbox = subGroup.getBBox();
var backShape = this.addShape(subGroup, {
type: "rect",
name: "legend-item-background",
id: this.getElementId(groupId + "-background"),
attrs: __assign({ x: 0, y: 0, width: bbox.width, height: itemHeight }, itemBackground.style)
});
backShape.toBack();
}
this.applyItemStates(item, subGroup);
return subGroup;
};
Category3.prototype.adjustNavigation = function(container2, itemGroup) {
var _this = this;
var startX = this.startX;
var startY = this.startY;
var layout6 = this.get("layout");
var subGroups = itemGroup.findAll(function(item) {
return item.get("name") === "legend-item";
});
var maxWidth = this.get("maxWidth");
var maxHeight = this.get("maxHeight");
var itemWidth = this.get("itemWidth");
var itemSpacing = this.get("itemSpacing");
var itemHeight = this.getItemHeight();
var pageNavigator = deep_mix_default({}, DEFAULT_PAGE_NAVIGATOR, this.get("pageNavigator"));
var navigation = this.drawNavigation(container2, layout6, "00/00", pageNavigator);
var navigationBBox = navigation.getBBox();
var currentPoint = { x: startX, y: startY };
var pages = 1;
var widthLimit = 0;
var pageWidth = 0;
var maxItemWidth = 0;
var itemMarginBottom = this.get("itemMarginBottom");
if (layout6 === "horizontal") {
var maxRow = this.get("maxRow") || 1;
var maxRowHeight_1 = itemHeight + (maxRow === 1 ? 0 : itemMarginBottom);
this.pageHeight = maxRowHeight_1 * maxRow;
each_default(subGroups, function(item) {
var bbox = item.getBBox();
var width2 = itemWidth || bbox.width;
if (widthLimit && widthLimit < currentPoint.x + width2 + itemSpacing || maxWidth < currentPoint.x + width2 + itemSpacing + navigationBBox.width) {
if (pages === 1) {
widthLimit = currentPoint.x + itemSpacing;
_this.pageWidth = widthLimit;
_this.moveElementTo(navigation, {
x: maxWidth - itemSpacing - navigationBBox.width - navigationBBox.minX,
y: currentPoint.y + itemHeight / 2 - navigationBBox.height / 2 - navigationBBox.minY
});
}
pages += 1;
currentPoint.x = startX;
currentPoint.y += maxRowHeight_1;
}
_this.moveElementTo(item, currentPoint);
item.getParent().setClip({
type: "rect",
attrs: {
x: currentPoint.x,
y: currentPoint.y,
width: width2 + itemSpacing,
height: itemHeight
}
});
currentPoint.x += width2 + itemSpacing;
});
} else {
each_default(subGroups, function(item) {
var bbox = item.getBBox();
if (bbox.width > pageWidth) {
pageWidth = bbox.width;
}
});
maxItemWidth = pageWidth;
pageWidth += itemSpacing;
if (maxWidth) {
pageWidth = Math.min(maxWidth, pageWidth);
maxItemWidth = Math.min(maxWidth, maxItemWidth);
}
this.pageWidth = pageWidth;
this.pageHeight = maxHeight - Math.max(navigationBBox.height, itemHeight + itemMarginBottom);
var cntPerPage_1 = Math.floor(this.pageHeight / (itemHeight + itemMarginBottom));
each_default(subGroups, function(item, index2) {
if (index2 !== 0 && index2 % cntPerPage_1 === 0) {
pages += 1;
currentPoint.x += pageWidth;
currentPoint.y = startY;
}
_this.moveElementTo(item, currentPoint);
item.getParent().setClip({
type: "rect",
attrs: {
x: currentPoint.x,
y: currentPoint.y,
width: pageWidth,
height: itemHeight
}
});
currentPoint.y += itemHeight + itemMarginBottom;
});
this.totalPagesCnt = pages;
this.moveElementTo(navigation, {
x: startX + maxItemWidth / 2 - navigationBBox.width / 2 - navigationBBox.minX,
y: maxHeight - navigationBBox.height - navigationBBox.minY
});
}
if (this.pageHeight && this.pageWidth) {
itemGroup.getParent().setClip({
type: "rect",
attrs: {
x: this.startX,
y: this.startY,
width: this.pageWidth,
height: this.pageHeight
}
});
}
if (layout6 === "horizontal" && this.get("maxRow")) {
this.totalPagesCnt = Math.ceil(pages / this.get("maxRow"));
} else {
this.totalPagesCnt = pages;
}
if (this.currentPageIndex > this.totalPagesCnt) {
this.currentPageIndex = 1;
}
this.updateNavigation(navigation);
itemGroup.attr("matrix", this.getCurrentNavigationMatrix());
};
Category3.prototype.drawNavigation = function(group2, layout6, text, styleCfg) {
var currentPoint = { x: 0, y: 0 };
var subGroup = this.addGroup(group2, {
id: this.getElementId("navigation-group"),
name: "legend-navigation"
});
var _a6 = get_default(styleCfg.marker, "style", {}), _b = _a6.size, size2 = _b === void 0 ? 12 : _b, arrowStyle = __rest(_a6, ["size"]);
var leftArrow = this.drawArrow(subGroup, currentPoint, LEFT_ARROW_NAME, layout6 === "horizontal" ? "up" : "left", size2, arrowStyle);
leftArrow.on("click", this.onNavigationBack);
var leftArrowBBox = leftArrow.getBBox();
currentPoint.x += leftArrowBBox.width + 2;
var textShape = this.addShape(subGroup, {
type: "text",
id: this.getElementId("navigation-text"),
name: "navigation-text",
attrs: __assign({ x: currentPoint.x, y: currentPoint.y + size2 / 2, text, textBaseline: "middle" }, get_default(styleCfg.text, "style"))
});
var textBBox = textShape.getBBox();
currentPoint.x += textBBox.width + 2;
var rightArrow = this.drawArrow(subGroup, currentPoint, RIGHT_ARROW_NAME, layout6 === "horizontal" ? "down" : "right", size2, arrowStyle);
rightArrow.on("click", this.onNavigationAfter);
return subGroup;
};
Category3.prototype.updateNavigation = function(navigation) {
var pageNavigator = deep_mix_default({}, DEFAULT_PAGE_NAVIGATOR, this.get("pageNavigator"));
var _a6 = pageNavigator.marker.style, fill = _a6.fill, opacity = _a6.opacity, inactiveFill = _a6.inactiveFill, inactiveOpacity = _a6.inactiveOpacity;
var text = this.currentPageIndex + "/" + this.totalPagesCnt;
var textShape = navigation ? navigation.getChildren()[1] : this.getElementByLocalId("navigation-text");
var leftArrow = navigation ? navigation.findById(this.getElementId(LEFT_ARROW_NAME)) : this.getElementByLocalId(LEFT_ARROW_NAME);
var rightArrow = navigation ? navigation.findById(this.getElementId(RIGHT_ARROW_NAME)) : this.getElementByLocalId(RIGHT_ARROW_NAME);
textShape.attr("text", text);
leftArrow.attr("opacity", this.currentPageIndex === 1 ? inactiveOpacity : opacity);
leftArrow.attr("fill", this.currentPageIndex === 1 ? inactiveFill : fill);
leftArrow.attr("cursor", this.currentPageIndex === 1 ? "not-allowed" : "pointer");
rightArrow.attr("opacity", this.currentPageIndex === this.totalPagesCnt ? inactiveOpacity : opacity);
rightArrow.attr("fill", this.currentPageIndex === this.totalPagesCnt ? inactiveFill : fill);
rightArrow.attr("cursor", this.currentPageIndex === this.totalPagesCnt ? "not-allowed" : "pointer");
var cursorX = leftArrow.getBBox().maxX + 2;
textShape.attr("x", cursorX);
cursorX += textShape.getBBox().width + 2;
this.updateArrowPath(rightArrow, { x: cursorX, y: 0 });
};
Category3.prototype.drawArrow = function(group2, currentPoint, name, direction5, size2, style) {
var x6 = currentPoint.x, y5 = currentPoint.y;
var shape = this.addShape(group2, {
type: "path",
id: this.getElementId(name),
name,
attrs: __assign({
size: size2,
direction: direction5,
path: [["M", x6 + size2 / 2, y5], ["L", x6, y5 + size2], ["L", x6 + size2, y5 + size2], ["Z"]],
cursor: "pointer"
}, style)
});
shape.attr("matrix", getMatrixByAngle({ x: x6 + size2 / 2, y: y5 + size2 / 2 }, ROTATE_MAP[direction5]));
return shape;
};
Category3.prototype.updateArrowPath = function(arrow, point2) {
var x6 = point2.x, y5 = point2.y;
var _a6 = arrow.attr(), size2 = _a6.size, direction5 = _a6.direction;
var matrix = getMatrixByAngle({ x: x6 + size2 / 2, y: y5 + size2 / 2 }, ROTATE_MAP[direction5]);
arrow.attr("path", [["M", x6 + size2 / 2, y5], ["L", x6, y5 + size2], ["L", x6 + size2, y5 + size2], ["Z"]]);
arrow.attr("matrix", matrix);
};
Category3.prototype.getCurrentNavigationMatrix = function() {
var _a6 = this, currentPageIndex = _a6.currentPageIndex, pageWidth = _a6.pageWidth, pageHeight = _a6.pageHeight;
var layout6 = this.get("layout");
var translate6 = layout6 === "horizontal" ? {
x: 0,
y: pageHeight * (1 - currentPageIndex)
} : {
x: pageWidth * (1 - currentPageIndex),
y: 0
};
return getMatrixByTranslate(translate6);
};
Category3.prototype.applyItemStates = function(item, subGroup) {
var states = this.getItemStates(item);
var hasStates = states.length > 0;
if (hasStates) {
var children = subGroup.getChildren();
var itemStates_1 = this.get("itemStates");
each_default(children, function(element) {
var name = element.get("name");
var elName = name.split("-")[2];
var statesStyle = getStatesStyle(item, elName, itemStates_1);
if (statesStyle) {
element.attr(statesStyle);
if (elName === "marker" && !(element.get("isStroke") && element.get("isFill"))) {
if (element.get("isStroke")) {
element.attr("fill", null);
}
if (element.get("isFill")) {
element.attr("stroke", null);
}
}
}
});
}
};
Category3.prototype.getLimitItemWidth = function() {
var itemWidth = this.get("itemWidth");
var maxItemWidth = this.get("maxItemWidth");
if (maxItemWidth) {
if (itemWidth) {
maxItemWidth = itemWidth <= maxItemWidth ? itemWidth : maxItemWidth;
}
} else if (itemWidth) {
maxItemWidth = itemWidth;
}
return maxItemWidth;
};
return Category3;
}(base_default11);
var category_default = Category2;
// node_modules/@antv/component/esm/legend/continuous.js
var HANDLER_HEIGHT_RATIO = 1.4;
var HANDLER_TRIANGLE_RATIO = 0.4;
var ContinueLegend = function(_super) {
__extends(ContinueLegend2, _super);
function ContinueLegend2() {
return _super !== null && _super.apply(this, arguments) || this;
}
ContinueLegend2.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { type: "continue", min: 0, max: 100, value: null, colors: [], track: {}, rail: {}, label: {}, handler: {}, slidable: true, tip: null, step: null, maxWidth: null, maxHeight: null, defaultCfg: {
label: {
align: "rail",
spacing: 5,
formatter: null,
style: {
fontSize: 12,
fill: theme_default.textColor,
textBaseline: "middle",
fontFamily: theme_default.fontFamily
}
},
handler: {
size: 10,
style: {
fill: "#fff",
stroke: "#333"
}
},
track: {},
rail: {
type: "color",
size: 20,
defaultLength: 100,
style: {
fill: "#DCDEE2"
}
},
title: {
spacing: 5,
style: {
fill: theme_default.textColor,
fontSize: 12,
textAlign: "start",
textBaseline: "top"
}
}
} });
};
ContinueLegend2.prototype.isSlider = function() {
return true;
};
ContinueLegend2.prototype.getValue = function() {
return this.getCurrentValue();
};
ContinueLegend2.prototype.getRange = function() {
return {
min: this.get("min"),
max: this.get("max")
};
};
ContinueLegend2.prototype.setRange = function(min7, max8) {
this.update({
min: min7,
max: max8
});
};
ContinueLegend2.prototype.setValue = function(value2) {
var originValue = this.getValue();
this.set("value", value2);
var group2 = this.get("group");
this.resetTrackClip();
if (this.get("slidable")) {
this.resetHandlers(group2);
}
this.delegateEmit("valuechanged", {
originValue,
value: value2
});
};
ContinueLegend2.prototype.initEvent = function() {
var group2 = this.get("group");
this.bindSliderEvent(group2);
this.bindRailEvent(group2);
this.bindTrackEvent(group2);
};
ContinueLegend2.prototype.drawLegendContent = function(group2) {
this.drawRail(group2);
this.drawLabels(group2);
this.fixedElements(group2);
this.resetTrack(group2);
this.resetTrackClip(group2);
if (this.get("slidable")) {
this.resetHandlers(group2);
}
};
ContinueLegend2.prototype.bindSliderEvent = function(group2) {
this.bindHandlersEvent(group2);
};
ContinueLegend2.prototype.bindHandlersEvent = function(group2) {
var _this = this;
group2.on("legend-handler-min:drag", function(ev) {
var minValue = _this.getValueByCanvasPoint(ev.x, ev.y);
var currentValue = _this.getCurrentValue();
var maxValue = currentValue[1];
if (maxValue < minValue) {
maxValue = minValue;
}
_this.setValue([minValue, maxValue]);
});
group2.on("legend-handler-max:drag", function(ev) {
var maxValue = _this.getValueByCanvasPoint(ev.x, ev.y);
var currentValue = _this.getCurrentValue();
var minValue = currentValue[0];
if (minValue > maxValue) {
minValue = maxValue;
}
_this.setValue([minValue, maxValue]);
});
};
ContinueLegend2.prototype.bindRailEvent = function(group2) {
};
ContinueLegend2.prototype.bindTrackEvent = function(group2) {
var _this = this;
var prePoint = null;
group2.on("legend-track:dragstart", function(ev) {
prePoint = {
x: ev.x,
y: ev.y
};
});
group2.on("legend-track:drag", function(ev) {
if (!prePoint) {
return;
}
var preValue = _this.getValueByCanvasPoint(prePoint.x, prePoint.y);
var curValue = _this.getValueByCanvasPoint(ev.x, ev.y);
var currentValue = _this.getCurrentValue();
var curDiff = currentValue[1] - currentValue[0];
var range = _this.getRange();
var dValue = curValue - preValue;
if (dValue < 0) {
if (currentValue[0] + dValue > range.min) {
_this.setValue([currentValue[0] + dValue, currentValue[1] + dValue]);
} else {
_this.setValue([range.min, range.min + curDiff]);
}
} else if (dValue > 0) {
if (dValue > 0 && currentValue[1] + dValue < range.max) {
_this.setValue([currentValue[0] + dValue, currentValue[1] + dValue]);
} else {
_this.setValue([range.max - curDiff, range.max]);
}
}
prePoint = {
x: ev.x,
y: ev.y
};
});
group2.on("legend-track:dragend", function(ev) {
prePoint = null;
});
};
ContinueLegend2.prototype.drawLabels = function(group2) {
this.drawLabel("min", group2);
this.drawLabel("max", group2);
};
ContinueLegend2.prototype.drawLabel = function(name, group2) {
var labelCfg = this.get("label");
var style = labelCfg.style;
var labelAlign = labelCfg.align;
var labelFormatter = labelCfg.formatter;
var value2 = this.get(name);
var alignAttrs = this.getLabelAlignAttrs(name, labelAlign);
var localId = "label-" + name;
this.addShape(group2, {
type: "text",
id: this.getElementId(localId),
name: "legend-label-" + name,
attrs: __assign(__assign({ x: 0, y: 0, text: is_function_default(labelFormatter) ? labelFormatter(value2) : value2 }, style), alignAttrs)
});
};
ContinueLegend2.prototype.getLabelAlignAttrs = function(name, align) {
var isVertical2 = this.isVertical();
var textAlign = "center";
var textBaseline = "middle";
if (isVertical2) {
textAlign = "start";
if (align !== "rail") {
if (name === "min") {
textBaseline = "top";
} else {
textBaseline = "bottom";
}
} else {
textBaseline = "top";
}
} else {
if (align !== "rail") {
textBaseline = "top";
if (name === "min") {
textAlign = "start";
} else {
textAlign = "end";
}
} else {
textAlign = "start";
textBaseline = "middle";
}
}
return {
textAlign,
textBaseline
};
};
ContinueLegend2.prototype.getRailPath = function(x6, y5, w4, h3) {
var railCfg = this.get("rail");
var size2 = railCfg.size, defaultLength = railCfg.defaultLength, type2 = railCfg.type;
var isVertical2 = this.isVertical();
var length5 = defaultLength;
var width2 = w4;
var height = h3;
if (!width2) {
width2 = isVertical2 ? size2 : length5;
}
if (!height) {
height = isVertical2 ? length5 : size2;
}
var path = [];
if (type2 === "color") {
path.push(["M", x6, y5]);
path.push(["L", x6 + width2, y5]);
path.push(["L", x6 + width2, y5 + height]);
path.push(["L", x6, y5 + height]);
path.push(["Z"]);
} else {
path.push(["M", x6 + width2, y5]);
path.push(["L", x6 + width2, y5 + height]);
path.push(["L", x6, y5 + height]);
path.push(["Z"]);
}
return path;
};
ContinueLegend2.prototype.drawRail = function(group2) {
var railCfg = this.get("rail");
var style = railCfg.style;
this.addShape(group2, {
type: "path",
id: this.getElementId("rail"),
name: "legend-rail",
attrs: __assign({ path: this.getRailPath(0, 0) }, style)
});
};
ContinueLegend2.prototype.getTrackColor = function(colors) {
var count2 = colors.length;
if (!count2) {
return null;
}
if (count2 === 1) {
return colors[0];
}
var color4;
if (this.isVertical()) {
color4 = "l(90)";
} else {
color4 = "l(0)";
}
for (var i4 = 0; i4 < count2; i4++) {
var percent2 = i4 / (count2 - 1);
color4 += " " + percent2 + ":" + colors[i4];
}
return color4;
};
ContinueLegend2.prototype.getTrackPath = function(group2) {
var railShape = this.getRailShape(group2);
var path = railShape.attr("path");
return clone_default(path);
};
ContinueLegend2.prototype.getClipTrackAttrs = function(group2) {
var value2 = this.getCurrentValue();
var min7 = value2[0], max8 = value2[1];
var railBBox = this.getRailBBox(group2);
var startPoint = this.getPointByValue(min7, group2);
var endPoint = this.getPointByValue(max8, group2);
var isVertical2 = this.isVertical();
var x6;
var y5;
var width2;
var height;
if (isVertical2) {
x6 = railBBox.minX;
y5 = startPoint.y;
width2 = railBBox.width;
height = endPoint.y - startPoint.y;
} else {
x6 = startPoint.x;
y5 = railBBox.minY;
width2 = endPoint.x - startPoint.x;
height = railBBox.height;
}
return {
x: x6,
y: y5,
width: width2,
height
};
};
ContinueLegend2.prototype.getTrackAttrs = function(group2) {
var trackCfg = this.get("track");
var colors = this.get("colors");
var path = this.getTrackPath(group2);
return mix({
path,
fill: this.getTrackColor(colors)
}, trackCfg.style);
};
ContinueLegend2.prototype.resetTrackClip = function(group2) {
var container2 = group2 || this.get("group");
var trackId = this.getElementId("track");
var trackShape = container2.findById(trackId);
var clipShape = trackShape.getClip();
var attrs = this.getClipTrackAttrs(group2);
if (!clipShape) {
trackShape.setClip({
type: "rect",
attrs
});
} else {
clipShape.attr(attrs);
}
};
ContinueLegend2.prototype.resetTrack = function(group2) {
var trackId = this.getElementId("track");
var trackShape = group2.findById(trackId);
var trackAttrs = this.getTrackAttrs(group2);
if (trackShape) {
trackShape.attr(trackAttrs);
} else {
this.addShape(group2, {
type: "path",
id: trackId,
draggable: this.get("slidable"),
name: "legend-track",
attrs: trackAttrs
});
}
};
ContinueLegend2.prototype.getPointByValue = function(value2, group2) {
var _a6 = this.getRange(), min7 = _a6.min, max8 = _a6.max;
var percent2 = (value2 - min7) / (max8 - min7);
var bbox = this.getRailBBox(group2);
var isVertcal = this.isVertical();
var point2 = { x: 0, y: 0 };
if (isVertcal) {
point2.x = bbox.minX + bbox.width / 2;
point2.y = getValueByPercent(bbox.minY, bbox.maxY, percent2);
} else {
point2.x = getValueByPercent(bbox.minX, bbox.maxX, percent2);
point2.y = bbox.minY + bbox.height / 2;
}
return point2;
};
ContinueLegend2.prototype.getRailShape = function(group2) {
var container2 = group2 || this.get("group");
return container2.findById(this.getElementId("rail"));
};
ContinueLegend2.prototype.getRailBBox = function(group2) {
var railShape = this.getRailShape(group2);
var bbox = railShape.getBBox();
return bbox;
};
ContinueLegend2.prototype.getRailCanvasBBox = function() {
var container2 = this.get("group");
var railShape = container2.findById(this.getElementId("rail"));
var bbox = railShape.getCanvasBBox();
return bbox;
};
ContinueLegend2.prototype.isVertical = function() {
return this.get("layout") === "vertical";
};
ContinueLegend2.prototype.getValueByCanvasPoint = function(x6, y5) {
var _a6 = this.getRange(), min7 = _a6.min, max8 = _a6.max;
var bbox = this.getRailCanvasBBox();
var isVertcal = this.isVertical();
var step = this.get("step");
var percent2;
if (isVertcal) {
percent2 = (y5 - bbox.minY) / bbox.height;
} else {
percent2 = (x6 - bbox.minX) / bbox.width;
}
var value2 = getValueByPercent(min7, max8, percent2);
if (step) {
var count2 = Math.round((value2 - min7) / step);
value2 = min7 + count2 * step;
}
if (value2 > max8) {
value2 = max8;
}
if (value2 < min7) {
value2 = min7;
}
return value2;
};
ContinueLegend2.prototype.getCurrentValue = function() {
var value2 = this.get("value");
if (!value2) {
var values2 = this.get("values");
if (!values2) {
return [this.get("min"), this.get("max")];
}
return [Math.max(Math.min.apply(Math, __spreadArrays(values2, [this.get("max")])), this.get("min")), Math.min(Math.max.apply(Math, __spreadArrays(values2, [this.get("min")])), this.get("max"))];
}
return value2;
};
ContinueLegend2.prototype.resetHandlers = function(group2) {
var currentValue = this.getCurrentValue();
var min7 = currentValue[0], max8 = currentValue[1];
this.resetHandler(group2, "min", min7);
this.resetHandler(group2, "max", max8);
};
ContinueLegend2.prototype.getHandlerPath = function(handlerCfg, point2) {
var isVertical2 = this.isVertical();
var path = [];
var width2 = handlerCfg.size;
var x6 = point2.x, y5 = point2.y;
var height = width2 * HANDLER_HEIGHT_RATIO;
var halfWidth = width2 / 2;
var oneSixthWidth = width2 / 6;
if (isVertical2) {
var triangleX = x6 + height * HANDLER_TRIANGLE_RATIO;
path.push(["M", x6, y5]);
path.push(["L", triangleX, y5 + halfWidth]);
path.push(["L", x6 + height, y5 + halfWidth]);
path.push(["L", x6 + height, y5 - halfWidth]);
path.push(["L", triangleX, y5 - halfWidth]);
path.push(["Z"]);
path.push(["M", triangleX, y5 + oneSixthWidth]);
path.push(["L", x6 + height - 2, y5 + oneSixthWidth]);
path.push(["M", triangleX, y5 - oneSixthWidth]);
path.push(["L", x6 + height - 2, y5 - oneSixthWidth]);
} else {
var triangleY = y5 + height * HANDLER_TRIANGLE_RATIO;
path.push(["M", x6, y5]);
path.push(["L", x6 - halfWidth, triangleY]);
path.push(["L", x6 - halfWidth, y5 + height]);
path.push(["L", x6 + halfWidth, y5 + height]);
path.push(["L", x6 + halfWidth, triangleY]);
path.push(["Z"]);
path.push(["M", x6 - oneSixthWidth, triangleY]);
path.push(["L", x6 - oneSixthWidth, y5 + height - 2]);
path.push(["M", x6 + oneSixthWidth, triangleY]);
path.push(["L", x6 + oneSixthWidth, y5 + height - 2]);
}
return path;
};
ContinueLegend2.prototype.resetHandler = function(group2, name, value2) {
var point2 = this.getPointByValue(value2, group2);
var handlerCfg = this.get("handler");
var path = this.getHandlerPath(handlerCfg, point2);
var id = this.getElementId("handler-" + name);
var handlerShape = group2.findById(id);
var isVertical2 = this.isVertical();
if (handlerShape) {
handlerShape.attr("path", path);
} else {
this.addShape(group2, {
type: "path",
name: "legend-handler-" + name,
draggable: true,
id,
attrs: __assign(__assign({ path }, handlerCfg.style), { cursor: isVertical2 ? "ns-resize" : "ew-resize" })
});
}
};
ContinueLegend2.prototype.fixedElements = function(group2) {
var railShape = group2.findById(this.getElementId("rail"));
var minLabel = group2.findById(this.getElementId("label-min"));
var maxLabel = group2.findById(this.getElementId("label-max"));
var startPoint = this.getDrawPoint();
if (this.isVertical()) {
this.fixedVertail(minLabel, maxLabel, railShape, startPoint);
} else {
this.fixedHorizontal(minLabel, maxLabel, railShape, startPoint);
}
};
ContinueLegend2.prototype.fitRailLength = function(minLabelBBox, maxLabelBBox, railBBox, railShape) {
var isVertical2 = this.isVertical();
var lengthField = isVertical2 ? "height" : "width";
var labelCfg = this.get("label");
var labelAlign = labelCfg.align;
var spacing = labelCfg.spacing;
var maxLength = this.get("max" + upper_first_default(lengthField));
if (maxLength) {
var elementsLength = labelAlign === "rail" ? railBBox[lengthField] + minLabelBBox[lengthField] + maxLabelBBox[lengthField] + spacing * 2 : railBBox[lengthField];
var diff2 = elementsLength - maxLength;
if (diff2 > 0) {
this.changeRailLength(railShape, lengthField, railBBox[lengthField] - diff2);
}
}
};
ContinueLegend2.prototype.changeRailLength = function(railShape, lengthField, length5) {
var bbox = railShape.getBBox();
var path;
if (lengthField === "height") {
path = this.getRailPath(bbox.x, bbox.y, bbox.width, length5);
} else {
path = this.getRailPath(bbox.x, bbox.y, length5, bbox.height);
}
railShape.attr("path", path);
};
ContinueLegend2.prototype.changeRailPosition = function(railShape, x6, y5) {
var bbox = railShape.getBBox();
var path = this.getRailPath(x6, y5, bbox.width, bbox.height);
railShape.attr("path", path);
};
ContinueLegend2.prototype.fixedHorizontal = function(minLabel, maxLabel, railShape, startPoint) {
var labelCfg = this.get("label");
var labelAlign = labelCfg.align;
var spacing = labelCfg.spacing;
var railBBox = railShape.getBBox();
var minLabelBBox = minLabel.getBBox();
var maxLabelBBox = maxLabel.getBBox();
var railHeight = railBBox.height;
this.fitRailLength(minLabelBBox, maxLabelBBox, railBBox, railShape);
railBBox = railShape.getBBox();
if (labelAlign === "rail") {
minLabel.attr({
x: startPoint.x,
y: startPoint.y + railHeight / 2
});
this.changeRailPosition(railShape, startPoint.x + minLabelBBox.width + spacing, startPoint.y);
maxLabel.attr({
x: startPoint.x + minLabelBBox.width + railBBox.width + spacing * 2,
y: startPoint.y + railHeight / 2
});
} else if (labelAlign === "top") {
minLabel.attr({
x: startPoint.x,
y: startPoint.y
});
maxLabel.attr({
x: startPoint.x + railBBox.width,
y: startPoint.y
});
this.changeRailPosition(railShape, startPoint.x, startPoint.y + minLabelBBox.height + spacing);
} else {
this.changeRailPosition(railShape, startPoint.x, startPoint.y);
minLabel.attr({
x: startPoint.x,
y: startPoint.y + railBBox.height + spacing
});
maxLabel.attr({
x: startPoint.x + railBBox.width,
y: startPoint.y + railBBox.height + spacing
});
}
};
ContinueLegend2.prototype.fixedVertail = function(minLabel, maxLabel, railShape, startPoint) {
var labelCfg = this.get("label");
var labelAlign = labelCfg.align;
var spacing = labelCfg.spacing;
var railBBox = railShape.getBBox();
var minLabelBBox = minLabel.getBBox();
var maxLabelBBox = maxLabel.getBBox();
this.fitRailLength(minLabelBBox, maxLabelBBox, railBBox, railShape);
railBBox = railShape.getBBox();
if (labelAlign === "rail") {
minLabel.attr({
x: startPoint.x,
y: startPoint.y
});
this.changeRailPosition(railShape, startPoint.x, startPoint.y + minLabelBBox.height + spacing);
maxLabel.attr({
x: startPoint.x,
y: startPoint.y + minLabelBBox.height + railBBox.height + spacing * 2
});
} else if (labelAlign === "right") {
minLabel.attr({
x: startPoint.x + railBBox.width + spacing,
y: startPoint.y
});
this.changeRailPosition(railShape, startPoint.x, startPoint.y);
maxLabel.attr({
x: startPoint.x + railBBox.width + spacing,
y: startPoint.y + railBBox.height
});
} else {
var maxLabelWidth = Math.max(minLabelBBox.width, maxLabelBBox.width);
minLabel.attr({
x: startPoint.x,
y: startPoint.y
});
this.changeRailPosition(railShape, startPoint.x + maxLabelWidth + spacing, startPoint.y);
maxLabel.attr({
x: startPoint.x,
y: startPoint.y + railBBox.height
});
}
};
return ContinueLegend2;
}(base_default11);
var continuous_default = ContinueLegend;
// node_modules/@antv/component/esm/tooltip/index.js
var tooltip_exports = {};
__export(tooltip_exports, {
Html: () => html_default3
});
// node_modules/@antv/component/esm/tooltip/css-const.js
var css_const_exports = {};
__export(css_const_exports, {
CONTAINER_CLASS: () => CONTAINER_CLASS2,
CROSSHAIR_X: () => CROSSHAIR_X,
CROSSHAIR_Y: () => CROSSHAIR_Y,
LIST_CLASS: () => LIST_CLASS,
LIST_ITEM_CLASS: () => LIST_ITEM_CLASS,
MARKER_CLASS: () => MARKER_CLASS,
NAME_CLASS: () => NAME_CLASS,
TITLE_CLASS: () => TITLE_CLASS,
VALUE_CLASS: () => VALUE_CLASS
});
var CONTAINER_CLASS2 = "g2-tooltip";
var TITLE_CLASS = "g2-tooltip-title";
var LIST_CLASS = "g2-tooltip-list";
var LIST_ITEM_CLASS = "g2-tooltip-list-item";
var MARKER_CLASS = "g2-tooltip-marker";
var VALUE_CLASS = "g2-tooltip-value";
var NAME_CLASS = "g2-tooltip-name";
var CROSSHAIR_X = "g2-tooltip-crosshair-x";
var CROSSHAIR_Y = "g2-tooltip-crosshair-y";
// node_modules/@antv/component/esm/tooltip/html-theme.js
var _a2;
var html_theme_default2 = (_a2 = {}, _a2["" + CONTAINER_CLASS2] = {
position: "absolute",
visibility: "visible",
zIndex: 8,
transition: "visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1)",
backgroundColor: "rgba(255, 255, 255, 0.9)",
boxShadow: "0px 0px 10px #aeaeae",
borderRadius: "3px",
color: "rgb(87, 87, 87)",
fontSize: "12px",
fontFamily: theme_default.fontFamily,
lineHeight: "20px",
padding: "10px 10px 6px 10px"
}, _a2["" + TITLE_CLASS] = {
marginBottom: "4px"
}, _a2["" + LIST_CLASS] = {
margin: "0px",
listStyleType: "none",
padding: "0px"
}, _a2["" + LIST_ITEM_CLASS] = {
listStyleType: "none",
marginBottom: "4px"
}, _a2["" + MARKER_CLASS] = {
width: "8px",
height: "8px",
borderRadius: "50%",
display: "inline-block",
marginRight: "8px"
}, _a2["" + VALUE_CLASS] = {
display: "inline-block",
float: "right",
marginLeft: "30px"
}, _a2["" + CROSSHAIR_X] = {
position: "absolute",
width: "1px",
backgroundColor: "rgba(0, 0, 0, 0.25)"
}, _a2["" + CROSSHAIR_Y] = {
position: "absolute",
height: "1px",
backgroundColor: "rgba(0, 0, 0, 0.25)"
}, _a2);
// node_modules/@antv/component/esm/util/align.js
function getOutSides(x6, y5, width2, height, limitBox) {
var hits = {
left: x6 < limitBox.x,
right: x6 + width2 > limitBox.x + limitBox.width,
top: y5 < limitBox.y,
bottom: y5 + height > limitBox.y + limitBox.height
};
return hits;
}
function getPointByPosition(x6, y5, offset, width2, height, position2) {
var px = x6;
var py = y5;
switch (position2) {
case "left":
px = x6 - width2 - offset;
py = y5 - height / 2;
break;
case "right":
px = x6 + offset;
py = y5 - height / 2;
break;
case "top":
px = x6 - width2 / 2;
py = y5 - height - offset;
break;
case "bottom":
px = x6 - width2 / 2;
py = y5 + offset;
break;
default:
px = x6 + offset;
py = y5 - height - offset;
break;
}
return {
x: px,
y: py
};
}
function getAlignPoint(x6, y5, offset, width2, height, position2, limitBox) {
var point2 = getPointByPosition(x6, y5, offset, width2, height, position2);
if (limitBox) {
var outSides = getOutSides(point2.x, point2.y, width2, height, limitBox);
if (position2 === "auto") {
if (outSides.right) {
point2.x = Math.max(0, x6 - width2 - offset);
}
if (outSides.top) {
point2.y = Math.max(0, y5 - height - offset);
}
} else if (position2 === "top" || position2 === "bottom") {
if (outSides.left) {
point2.x = limitBox.x;
}
if (outSides.right) {
point2.x = limitBox.x + limitBox.width - width2;
}
if (position2 === "top" && outSides.top) {
point2.y = y5 + offset;
}
if (position2 === "bottom" && outSides.bottom) {
point2.y = y5 - height - offset;
}
} else {
if (outSides.top) {
point2.y = limitBox.y;
}
if (outSides.bottom) {
point2.y = limitBox.y + limitBox.height - height;
}
if (position2 === "left" && outSides.left) {
point2.x = x6 + offset;
}
if (position2 === "right" && outSides.right) {
point2.x = x6 - width2 - offset;
}
}
}
return point2;
}
// node_modules/@antv/component/esm/tooltip/html.js
function hasOneKey(obj, keys2) {
var result = false;
each_default(keys2, function(key) {
if (has_key_default(obj, key)) {
result = true;
return false;
}
});
return result;
}
var Tooltip = function(_super) {
__extends(Tooltip5, _super);
function Tooltip5() {
return _super !== null && _super.apply(this, arguments) || this;
}
Tooltip5.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), {
name: "tooltip",
type: "html",
x: 0,
y: 0,
items: [],
customContent: null,
containerTpl: '',
itemTpl: '\n \n {name}:\n {value}\n ',
xCrosshairTpl: '',
yCrosshairTpl: '',
title: null,
showTitle: true,
region: null,
crosshairsRegion: null,
containerClassName: CONTAINER_CLASS2,
crosshairs: null,
offset: 10,
position: "right",
domStyles: null,
defaultStyles: html_theme_default2
});
};
Tooltip5.prototype.render = function() {
if (this.get("customContent")) {
this.renderCustomContent();
} else {
this.resetTitle();
this.renderItems();
}
this.resetPosition();
};
Tooltip5.prototype.clear = function() {
this.clearCrosshairs();
this.setTitle("");
this.clearItemDoms();
};
Tooltip5.prototype.show = function() {
var container2 = this.getContainer();
if (!container2 || this.destroyed) {
return;
}
this.set("visible", true);
modifyCSS(container2, {
visibility: "visible"
});
this.setCrossHairsVisible(true);
};
Tooltip5.prototype.hide = function() {
var container2 = this.getContainer();
if (!container2 || this.destroyed) {
return;
}
this.set("visible", false);
modifyCSS(container2, {
visibility: "hidden"
});
this.setCrossHairsVisible(false);
};
Tooltip5.prototype.getLocation = function() {
return { x: this.get("x"), y: this.get("y") };
};
Tooltip5.prototype.setLocation = function(point2) {
this.set("x", point2.x);
this.set("y", point2.y);
this.resetPosition();
};
Tooltip5.prototype.setCrossHairsVisible = function(visible) {
var display = visible ? "" : "none";
var xCrosshairDom = this.get("xCrosshairDom");
var yCrosshairDom = this.get("yCrosshairDom");
xCrosshairDom && modifyCSS(xCrosshairDom, {
display
});
yCrosshairDom && modifyCSS(yCrosshairDom, {
display
});
};
Tooltip5.prototype.initContainer = function() {
_super.prototype.initContainer.call(this);
if (this.get("customContent")) {
if (this.get("container")) {
this.get("container").remove();
}
var container2 = this.getHtmlContentNode();
this.get("parent").appendChild(container2);
this.set("container", container2);
this.resetStyles();
this.applyStyles();
}
};
Tooltip5.prototype.updateInner = function(cfg) {
if (this.get("customContent")) {
this.renderCustomContent();
} else {
if (hasOneKey(cfg, ["title", "showTitle"])) {
this.resetTitle();
}
if (has_key_default(cfg, "items")) {
this.renderItems();
}
}
_super.prototype.updateInner.call(this, cfg);
};
Tooltip5.prototype.initDom = function() {
this.cacheDoms();
};
Tooltip5.prototype.removeDom = function() {
_super.prototype.removeDom.call(this);
this.clearCrosshairs();
};
Tooltip5.prototype.resetPosition = function() {
var x6 = this.get("x");
var y5 = this.get("y");
var offset = this.get("offset");
var _a6 = this.getOffset(), offsetX = _a6.offsetX, offsetY = _a6.offsetY;
var position2 = this.get("position");
var region = this.get("region");
var container2 = this.getContainer();
var bbox = this.getBBox();
var width2 = bbox.width, height = bbox.height;
var limitBox;
if (region) {
limitBox = regionToBBox(region);
}
var point2 = getAlignPoint(x6, y5, offset, width2, height, position2, limitBox);
modifyCSS(container2, {
left: toPx(point2.x + offsetX),
top: toPx(point2.y + offsetY)
});
this.resetCrosshairs();
};
Tooltip5.prototype.renderCustomContent = function() {
var node = this.getHtmlContentNode();
var parent = this.get("parent");
var curContainer = this.get("container");
if (curContainer && curContainer.parentNode === parent) {
parent.replaceChild(node, curContainer);
} else {
parent.appendChild(node);
}
this.set("container", node);
this.resetStyles();
this.applyStyles();
};
Tooltip5.prototype.getHtmlContentNode = function() {
var node;
var customContent = this.get("customContent");
if (customContent) {
var elem = customContent(this.get("title"), this.get("items"));
if (is_element_default(elem)) {
node = elem;
} else {
node = createDom(elem);
}
}
return node;
};
Tooltip5.prototype.cacheDoms = function() {
var container2 = this.getContainer();
var titleDom = container2.getElementsByClassName(TITLE_CLASS)[0];
var listDom = container2.getElementsByClassName(LIST_CLASS)[0];
this.set("titleDom", titleDom);
this.set("listDom", listDom);
};
Tooltip5.prototype.resetTitle = function() {
var title = this.get("title");
var showTitle = this.get("showTitle");
if (showTitle && title) {
this.setTitle(title);
} else {
this.setTitle("");
}
};
Tooltip5.prototype.setTitle = function(text) {
var titleDom = this.get("titleDom");
if (titleDom) {
titleDom.innerText = text;
}
};
Tooltip5.prototype.resetCrosshairs = function() {
var crosshairsRegion = this.get("crosshairsRegion");
var crosshairs = this.get("crosshairs");
if (!crosshairsRegion || !crosshairs) {
this.clearCrosshairs();
} else {
var crosshairBox = regionToBBox(crosshairsRegion);
var xCrosshairDom = this.get("xCrosshairDom");
var yCrosshairDom = this.get("yCrosshairDom");
if (crosshairs === "x") {
this.resetCrosshair("x", crosshairBox);
if (yCrosshairDom) {
yCrosshairDom.remove();
this.set("yCrosshairDom", null);
}
} else if (crosshairs === "y") {
this.resetCrosshair("y", crosshairBox);
if (xCrosshairDom) {
xCrosshairDom.remove();
this.set("xCrosshairDom", null);
}
} else {
this.resetCrosshair("x", crosshairBox);
this.resetCrosshair("y", crosshairBox);
}
this.setCrossHairsVisible(this.get("visible"));
}
};
Tooltip5.prototype.resetCrosshair = function(name, bbox) {
var croshairDom = this.checkCrosshair(name);
var value2 = this.get(name);
if (name === "x") {
modifyCSS(croshairDom, {
left: toPx(value2),
top: toPx(bbox.y),
height: toPx(bbox.height)
});
} else {
modifyCSS(croshairDom, {
top: toPx(value2),
left: toPx(bbox.x),
width: toPx(bbox.width)
});
}
};
Tooltip5.prototype.checkCrosshair = function(name) {
var domName = name + "CrosshairDom";
var tplName = name + "CrosshairTpl";
var constName = "CROSSHAIR_" + name.toUpperCase();
var styleName = css_const_exports[constName];
var croshairDom = this.get(domName);
var parent = this.get("parent");
if (!croshairDom) {
croshairDom = createDom(this.get(tplName));
this.applyStyle(styleName, croshairDom);
parent.appendChild(croshairDom);
this.set(domName, croshairDom);
}
return croshairDom;
};
Tooltip5.prototype.renderItems = function() {
this.clearItemDoms();
var items = this.get("items");
var itemTpl = this.get("itemTpl");
var listDom = this.get("listDom");
if (listDom) {
each_default(items, function(item) {
var color4 = esm_default2.toCSSGradient(item.color);
var substituteObj = __assign(__assign({}, item), { color: color4 });
var domStr = substitute_default(itemTpl, substituteObj);
var itemDom = createDom(domStr);
listDom.appendChild(itemDom);
});
this.applyChildrenStyles(listDom, this.get("domStyles"));
}
};
Tooltip5.prototype.clearItemDoms = function() {
if (this.get("listDom")) {
clearDom(this.get("listDom"));
}
};
Tooltip5.prototype.clearCrosshairs = function() {
var xCrosshairDom = this.get("xCrosshairDom");
var yCrosshairDom = this.get("yCrosshairDom");
xCrosshairDom && xCrosshairDom.remove();
yCrosshairDom && yCrosshairDom.remove();
this.set("xCrosshairDom", null);
this.set("yCrosshairDom", null);
};
return Tooltip5;
}(html_component_default);
var html_default3 = Tooltip;
// node_modules/@antv/component/esm/trend/constant.js
var BACKGROUND_STYLE = {
opacity: 0
};
var LINE_STYLE = {
stroke: "#C5C5C5",
strokeOpacity: 0.85
};
var AREA_STYLE = {
fill: "#CACED4",
opacity: 0.85
};
// node_modules/@antv/component/esm/trend/path.js
function pointsToPath(points) {
return map_default(points, function(p4, idx) {
var command = idx === 0 ? "M" : "L";
var x6 = p4[0], y5 = p4[1];
return [command, x6, y5];
});
}
function getLinePath(points) {
return pointsToPath(points);
}
function getSmoothLinePath(points) {
if (points.length <= 2) {
return getLinePath(points);
}
var data3 = [];
each_default(points, function(p4) {
if (!is_equal_default(p4, data3.slice(data3.length - 2))) {
data3.push(p4[0], p4[1]);
}
});
var path = catmull_rom_2_bezier_default(data3, false);
var _a6 = head(points), x6 = _a6[0], y5 = _a6[1];
path.unshift(["M", x6, y5]);
return path;
}
function dataToPath(data3, width2, height, smooth) {
if (smooth === void 0) {
smooth = true;
}
var y5 = new linear_default({
values: data3
});
var x6 = new base_default5({
values: map_default(data3, function(v3, idx) {
return idx;
})
});
var points = map_default(data3, function(v3, idx) {
return [x6.scale(idx) * width2, height - y5.scale(v3) * height];
});
return smooth ? getSmoothLinePath(points) : getLinePath(points);
}
function getAreaLineY(data3, height) {
var y5 = new linear_default({
values: data3
});
var lineY = Math.max(0, y5.min);
return height - y5.scale(lineY) * height;
}
function linePathToAreaPath(path, width2, height, data3) {
var areaPath = __spreadArrays(path);
var lineYPx = getAreaLineY(data3, height);
areaPath.push(["L", width2, lineYPx]);
areaPath.push(["L", 0, lineYPx]);
areaPath.push(["Z"]);
return areaPath;
}
// node_modules/@antv/component/esm/trend/trend.js
var Trend = function(_super) {
__extends(Trend3, _super);
function Trend3() {
return _super !== null && _super.apply(this, arguments) || this;
}
Trend3.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { name: "trend", x: 0, y: 0, width: 200, height: 16, smooth: true, isArea: false, data: [], backgroundStyle: BACKGROUND_STYLE, lineStyle: LINE_STYLE, areaStyle: AREA_STYLE });
};
Trend3.prototype.renderInner = function(group2) {
var _a6 = this.cfg, width2 = _a6.width, height = _a6.height, data3 = _a6.data, smooth = _a6.smooth, isArea = _a6.isArea, backgroundStyle = _a6.backgroundStyle, lineStyle = _a6.lineStyle, areaStyle = _a6.areaStyle;
this.addShape(group2, {
id: this.getElementId("background"),
type: "rect",
attrs: __assign({
x: 0,
y: 0,
width: width2,
height
}, backgroundStyle)
});
var path = dataToPath(data3, width2, height, smooth);
this.addShape(group2, {
id: this.getElementId("line"),
type: "path",
attrs: __assign({ path }, lineStyle)
});
if (isArea) {
var areaPath = linePathToAreaPath(path, width2, height, data3);
this.addShape(group2, {
id: this.getElementId("area"),
type: "path",
attrs: __assign({ path: areaPath }, areaStyle)
});
}
};
Trend3.prototype.applyOffset = function() {
var _a6 = this.cfg, x6 = _a6.x, y5 = _a6.y;
this.moveElementTo(this.get("group"), {
x: x6,
y: y5
});
};
return Trend3;
}(group_component_default);
// node_modules/@antv/component/esm/slider/handler.js
var DEFAULT_HANDLER_STYLE = {
fill: "#F7F7F7",
stroke: "#BFBFBF",
radius: 2,
opacity: 1,
cursor: "ew-resize",
highLightFill: "#FFF"
};
var Handler = function(_super) {
__extends(Handler3, _super);
function Handler3() {
return _super !== null && _super.apply(this, arguments) || this;
}
Handler3.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { name: "handler", x: 0, y: 0, width: 10, height: 24, style: DEFAULT_HANDLER_STYLE });
};
Handler3.prototype.renderInner = function(group2) {
var _a6 = this.cfg, width2 = _a6.width, height = _a6.height, style = _a6.style;
var fill = style.fill, stroke = style.stroke, radius = style.radius, opacity = style.opacity, cursor = style.cursor;
this.addShape(group2, {
type: "rect",
id: this.getElementId("background"),
attrs: {
x: 0,
y: 0,
width: width2,
height,
fill,
stroke,
radius,
opacity,
cursor
}
});
var x1 = 1 / 3 * width2;
var x22 = 2 / 3 * width2;
var y1 = 1 / 4 * height;
var y22 = 3 / 4 * height;
this.addShape(group2, {
id: this.getElementId("line-left"),
type: "line",
attrs: {
x1,
y1,
x2: x1,
y2: y22,
stroke,
cursor
}
});
this.addShape(group2, {
id: this.getElementId("line-right"),
type: "line",
attrs: {
x1: x22,
y1,
x2: x22,
y2: y22,
stroke,
cursor
}
});
};
Handler3.prototype.applyOffset = function() {
this.moveElementTo(this.get("group"), {
x: this.get("x"),
y: this.get("y")
});
};
Handler3.prototype.initEvent = function() {
this.bindEvents();
};
Handler3.prototype.bindEvents = function() {
var _this = this;
this.get("group").on("mouseenter", function() {
var highLightFill = _this.get("style").highLightFill;
_this.getElementByLocalId("background").attr("fill", highLightFill);
_this.draw();
});
this.get("group").on("mouseleave", function() {
var fill = _this.get("style").fill;
_this.getElementByLocalId("background").attr("fill", fill);
_this.draw();
});
};
Handler3.prototype.draw = function() {
var canvas = this.get("container").get("canvas");
if (canvas) {
canvas.draw();
}
};
return Handler3;
}(group_component_default);
// node_modules/@antv/component/esm/slider/constant.js
var BACKGROUND_STYLE2 = {
fill: "#416180",
opacity: 0.05
};
var FOREGROUND_STYLE = {
fill: "#5B8FF9",
opacity: 0.15,
cursor: "move"
};
var DEFAULT_HANDLER_WIDTH = 10;
var HANDLER_STYLE = {
width: DEFAULT_HANDLER_WIDTH,
height: 24
};
var TEXT_STYLE = {
textBaseline: "middle",
fill: "#000",
opacity: 0.45
};
var SLIDER_CHANGE = "sliderchange";
// node_modules/@antv/component/esm/slider/slider.js
var Slider = function(_super) {
__extends(Slider3, _super);
function Slider3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.onMouseDown = function(target) {
return function(e4) {
_this.currentTarget = target;
var event = e4.originalEvent;
event.stopPropagation();
event.preventDefault();
_this.prevX = get_default(event, "touches.0.pageX", event.pageX);
_this.prevY = get_default(event, "touches.0.pageY", event.pageY);
var containerDOM = _this.getContainerDOM();
containerDOM.addEventListener("mousemove", _this.onMouseMove);
containerDOM.addEventListener("mouseup", _this.onMouseUp);
containerDOM.addEventListener("mouseleave", _this.onMouseUp);
containerDOM.addEventListener("touchmove", _this.onMouseMove);
containerDOM.addEventListener("touchend", _this.onMouseUp);
containerDOM.addEventListener("touchcancel", _this.onMouseUp);
};
};
_this.onMouseMove = function(event) {
var width2 = _this.cfg.width;
var originValue = [_this.get("start"), _this.get("end")];
event.stopPropagation();
event.preventDefault();
var x6 = get_default(event, "touches.0.pageX", event.pageX);
var y5 = get_default(event, "touches.0.pageY", event.pageY);
var offsetX = x6 - _this.prevX;
var offsetXRange = _this.adjustOffsetRange(offsetX / width2);
_this.updateStartEnd(offsetXRange);
_this.updateUI(_this.getElementByLocalId("foreground"), _this.getElementByLocalId("minText"), _this.getElementByLocalId("maxText"));
_this.prevX = x6;
_this.prevY = y5;
_this.draw();
_this.emit(SLIDER_CHANGE, [_this.get("start"), _this.get("end")].sort());
_this.delegateEmit("valuechanged", {
originValue,
value: [_this.get("start"), _this.get("end")]
});
};
_this.onMouseUp = function() {
if (_this.currentTarget) {
_this.currentTarget = void 0;
}
var containerDOM = _this.getContainerDOM();
if (containerDOM) {
containerDOM.removeEventListener("mousemove", _this.onMouseMove);
containerDOM.removeEventListener("mouseup", _this.onMouseUp);
containerDOM.removeEventListener("mouseleave", _this.onMouseUp);
containerDOM.removeEventListener("touchmove", _this.onMouseMove);
containerDOM.removeEventListener("touchend", _this.onMouseUp);
containerDOM.removeEventListener("touchcancel", _this.onMouseUp);
}
};
return _this;
}
Slider3.prototype.setRange = function(min7, max8) {
this.set("minLimit", min7);
this.set("maxLimit", max8);
var oldStart = this.get("start");
var oldEnd = this.get("end");
var newStart = clamp_default(oldStart, min7, max8);
var newEnd = clamp_default(oldEnd, min7, max8);
if (!this.get("isInit") && (oldStart !== newStart || oldEnd !== newEnd)) {
this.setValue([newStart, newEnd]);
}
};
Slider3.prototype.getRange = function() {
return {
min: this.get("minLimit") || 0,
max: this.get("maxLimit") || 1
};
};
Slider3.prototype.setValue = function(value2) {
var range = this.getRange();
if (is_array_default(value2) && value2.length === 2) {
var originValue = [this.get("start"), this.get("end")];
this.update({
start: clamp_default(value2[0], range.min, range.max),
end: clamp_default(value2[1], range.min, range.max)
});
if (!this.get("updateAutoRender")) {
this.render();
}
this.delegateEmit("valuechanged", {
originValue,
value: value2
});
}
};
Slider3.prototype.getValue = function() {
return [this.get("start"), this.get("end")];
};
Slider3.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { name: "slider", x: 0, y: 0, width: 100, height: 16, backgroundStyle: {}, foregroundStyle: {}, handlerStyle: {}, textStyle: {}, defaultCfg: {
backgroundStyle: BACKGROUND_STYLE2,
foregroundStyle: FOREGROUND_STYLE,
handlerStyle: HANDLER_STYLE,
textStyle: TEXT_STYLE
} });
};
Slider3.prototype.update = function(cfg) {
var start = cfg.start, end2 = cfg.end;
var validCfg = __assign({}, cfg);
if (!is_nil_default(start)) {
validCfg.start = clamp_default(start, 0, 1);
}
if (!is_nil_default(end2)) {
validCfg.end = clamp_default(end2, 0, 1);
}
_super.prototype.update.call(this, validCfg);
this.minHandler = this.getChildComponentById(this.getElementId("minHandler"));
this.maxHandler = this.getChildComponentById(this.getElementId("maxHandler"));
this.trend = this.getChildComponentById(this.getElementId("trend"));
};
Slider3.prototype.init = function() {
this.set("start", clamp_default(this.get("start"), 0, 1));
this.set("end", clamp_default(this.get("end"), 0, 1));
_super.prototype.init.call(this);
};
Slider3.prototype.render = function() {
_super.prototype.render.call(this);
this.updateUI(this.getElementByLocalId("foreground"), this.getElementByLocalId("minText"), this.getElementByLocalId("maxText"));
};
Slider3.prototype.renderInner = function(group2) {
var _a6 = this.cfg, start = _a6.start, end2 = _a6.end, width2 = _a6.width, height = _a6.height, _b = _a6.trendCfg, trendCfg = _b === void 0 ? {} : _b, minText = _a6.minText, maxText = _a6.maxText, _c = _a6.backgroundStyle, backgroundStyle = _c === void 0 ? {} : _c, _d = _a6.foregroundStyle, foregroundStyle = _d === void 0 ? {} : _d, _e = _a6.textStyle, textStyle2 = _e === void 0 ? {} : _e;
var handlerStyle = deep_mix_default({}, DEFAULT_HANDLER_STYLE, this.cfg.handlerStyle);
var min7 = start * width2;
var max8 = end2 * width2;
if (size(get_default(trendCfg, "data"))) {
this.trend = this.addComponent(group2, __assign({
component: Trend,
id: this.getElementId("trend"),
x: 0,
y: 0,
width: width2,
height
}, trendCfg));
}
this.addShape(group2, {
id: this.getElementId("background"),
type: "rect",
attrs: __assign({
x: 0,
y: 0,
width: width2,
height
}, backgroundStyle)
});
var minTextShape = this.addShape(group2, {
id: this.getElementId("minText"),
type: "text",
attrs: __assign({
y: height / 2,
textAlign: "right",
text: minText,
silent: false
}, textStyle2)
});
var maxTextShape = this.addShape(group2, {
id: this.getElementId("maxText"),
type: "text",
attrs: __assign({
y: height / 2,
textAlign: "left",
text: maxText,
silent: false
}, textStyle2)
});
var foregroundShape = this.addShape(group2, {
id: this.getElementId("foreground"),
name: "foreground",
type: "rect",
attrs: __assign({
y: 0,
height
}, foregroundStyle)
});
var handlerWidth = get_default(handlerStyle, "width", DEFAULT_HANDLER_WIDTH);
var handlerHeight = get_default(handlerStyle, "height", 24);
this.minHandler = this.addComponent(group2, {
component: Handler,
id: this.getElementId("minHandler"),
name: "handler-min",
x: 0,
y: (height - handlerHeight) / 2,
width: handlerWidth,
height: handlerHeight,
cursor: "ew-resize",
style: handlerStyle
});
this.maxHandler = this.addComponent(group2, {
component: Handler,
id: this.getElementId("maxHandler"),
name: "handler-max",
x: 0,
y: (height - handlerHeight) / 2,
width: handlerWidth,
height: handlerHeight,
cursor: "ew-resize",
style: handlerStyle
});
};
Slider3.prototype.applyOffset = function() {
this.moveElementTo(this.get("group"), {
x: this.get("x"),
y: this.get("y")
});
};
Slider3.prototype.initEvent = function() {
this.bindEvents();
};
Slider3.prototype.updateUI = function(foregroundShape, minTextShape, maxTextShape) {
var _a6 = this.cfg, start = _a6.start, end2 = _a6.end, width2 = _a6.width, minText = _a6.minText, maxText = _a6.maxText, handlerStyle = _a6.handlerStyle, height = _a6.height;
var min7 = start * width2;
var max8 = end2 * width2;
if (this.trend) {
this.trend.update({
width: width2,
height
});
if (!this.get("updateAutoRender")) {
this.trend.render();
}
}
foregroundShape.attr("x", min7);
foregroundShape.attr("width", max8 - min7);
var handlerWidth = get_default(handlerStyle, "width", DEFAULT_HANDLER_WIDTH);
minTextShape.attr("text", minText);
maxTextShape.attr("text", maxText);
var _b = this._dodgeText([min7, max8], minTextShape, maxTextShape), minAttrs = _b[0], maxAttrs = _b[1];
if (this.minHandler) {
this.minHandler.update({
x: min7 - handlerWidth / 2
});
if (!this.get("updateAutoRender")) {
this.minHandler.render();
}
}
each_default(minAttrs, function(v3, k4) {
return minTextShape.attr(k4, v3);
});
if (this.maxHandler) {
this.maxHandler.update({
x: max8 - handlerWidth / 2
});
if (!this.get("updateAutoRender")) {
this.maxHandler.render();
}
}
each_default(maxAttrs, function(v3, k4) {
return maxTextShape.attr(k4, v3);
});
};
Slider3.prototype.bindEvents = function() {
var group2 = this.get("group");
group2.on("handler-min:mousedown", this.onMouseDown("minHandler"));
group2.on("handler-min:touchstart", this.onMouseDown("minHandler"));
group2.on("handler-max:mousedown", this.onMouseDown("maxHandler"));
group2.on("handler-max:touchstart", this.onMouseDown("maxHandler"));
var foreground = group2.findById(this.getElementId("foreground"));
foreground.on("mousedown", this.onMouseDown("foreground"));
foreground.on("touchstart", this.onMouseDown("foreground"));
};
Slider3.prototype.adjustOffsetRange = function(offsetRange) {
var _a6 = this.cfg, start = _a6.start, end2 = _a6.end;
switch (this.currentTarget) {
case "minHandler": {
var min7 = 0 - start;
var max8 = 1 - start;
return Math.min(max8, Math.max(min7, offsetRange));
}
case "maxHandler": {
var min7 = 0 - end2;
var max8 = 1 - end2;
return Math.min(max8, Math.max(min7, offsetRange));
}
case "foreground": {
var min7 = 0 - start;
var max8 = 1 - end2;
return Math.min(max8, Math.max(min7, offsetRange));
}
}
};
Slider3.prototype.updateStartEnd = function(offsetRange) {
var _a6 = this.cfg, start = _a6.start, end2 = _a6.end;
switch (this.currentTarget) {
case "minHandler":
start += offsetRange;
break;
case "maxHandler":
end2 += offsetRange;
break;
case "foreground":
start += offsetRange;
end2 += offsetRange;
break;
}
this.set("start", start);
this.set("end", end2);
};
Slider3.prototype._dodgeText = function(range, minTextShape, maxTextShape) {
var _a6, _b;
var _c = this.cfg, handlerStyle = _c.handlerStyle, width2 = _c.width;
var PADDING2 = 2;
var handlerWidth = get_default(handlerStyle, "width", DEFAULT_HANDLER_WIDTH);
var min7 = range[0], max8 = range[1];
var sorted = false;
if (min7 > max8) {
_a6 = [max8, min7], min7 = _a6[0], max8 = _a6[1];
_b = [maxTextShape, minTextShape], minTextShape = _b[0], maxTextShape = _b[1];
sorted = true;
}
var minBBox = minTextShape.getBBox();
var maxBBox = maxTextShape.getBBox();
var minAttrs = minBBox.width > min7 - PADDING2 ? { x: min7 + handlerWidth / 2 + PADDING2, textAlign: "left" } : { x: min7 - handlerWidth / 2 - PADDING2, textAlign: "right" };
var maxAttrs = maxBBox.width > width2 - max8 - PADDING2 ? { x: max8 - handlerWidth / 2 - PADDING2, textAlign: "right" } : { x: max8 + handlerWidth / 2 + PADDING2, textAlign: "left" };
return !sorted ? [minAttrs, maxAttrs] : [maxAttrs, minAttrs];
};
Slider3.prototype.draw = function() {
var container2 = this.get("container");
var canvas = container2 && container2.get("canvas");
if (canvas) {
canvas.draw();
}
};
Slider3.prototype.getContainerDOM = function() {
var container2 = this.get("container");
var canvas = container2 && container2.get("canvas");
return canvas && canvas.get("container");
};
return Slider3;
}(group_component_default);
// node_modules/@antv/component/esm/scrollbar/scrollbar.js
var DEFAULT_STYLE = {
trackColor: "rgba(0,0,0,0)",
thumbColor: "rgba(0,0,0,0.15)",
size: 8,
lineCap: "round"
};
var DEFAULT_THEME = {
default: DEFAULT_STYLE,
hover: {
thumbColor: "rgba(0,0,0,0.2)"
}
};
var Scrollbar = function(_super) {
__extends(Scrollbar3, _super);
function Scrollbar3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.clearEvents = noop_default;
_this.onStartEvent = function(isMobile) {
return function(e4) {
_this.isMobile = isMobile;
e4.originalEvent.preventDefault();
var clientX = isMobile ? get_default(e4.originalEvent, "touches.0.clientX") : e4.clientX;
var clientY = isMobile ? get_default(e4.originalEvent, "touches.0.clientY") : e4.clientY;
_this.startPos = _this.cfg.isHorizontal ? clientX : clientY;
_this.bindLaterEvent();
};
};
_this.bindLaterEvent = function() {
var containerDOM = _this.getContainerDOM();
var events = [];
if (_this.isMobile) {
events = [
addEventListener(containerDOM, "touchmove", _this.onMouseMove),
addEventListener(containerDOM, "touchend", _this.onMouseUp),
addEventListener(containerDOM, "touchcancel", _this.onMouseUp)
];
} else {
events = [
addEventListener(containerDOM, "mousemove", _this.onMouseMove),
addEventListener(containerDOM, "mouseup", _this.onMouseUp),
addEventListener(containerDOM, "mouseleave", _this.onMouseUp)
];
}
_this.clearEvents = function() {
events.forEach(function(e4) {
e4.remove();
});
};
};
_this.onMouseMove = function(e4) {
var _a6 = _this.cfg, isHorizontal2 = _a6.isHorizontal, thumbOffset = _a6.thumbOffset;
e4.preventDefault();
var clientX = _this.isMobile ? get_default(e4, "touches.0.clientX") : e4.clientX;
var clientY = _this.isMobile ? get_default(e4, "touches.0.clientY") : e4.clientY;
var endPos = isHorizontal2 ? clientX : clientY;
var diff2 = endPos - _this.startPos;
_this.startPos = endPos;
_this.updateThumbOffset(thumbOffset + diff2);
};
_this.onMouseUp = function(e4) {
e4.preventDefault();
_this.clearEvents();
};
_this.onTrackClick = function(e4) {
var _a6 = _this.cfg, isHorizontal2 = _a6.isHorizontal, x6 = _a6.x, y5 = _a6.y, thumbLen = _a6.thumbLen;
var containerDOM = _this.getContainerDOM();
var rect3 = containerDOM.getBoundingClientRect();
var clientX = e4.clientX, clientY = e4.clientY;
var offset = isHorizontal2 ? clientX - rect3.left - x6 - thumbLen / 2 : clientY - rect3.top - y5 - thumbLen / 2;
var newOffset = _this.validateRange(offset);
_this.updateThumbOffset(newOffset);
};
_this.onThumbMouseOver = function() {
var thumbColor = _this.cfg.theme.hover.thumbColor;
_this.getElementByLocalId("thumb").attr("stroke", thumbColor);
_this.draw();
};
_this.onThumbMouseOut = function() {
var thumbColor = _this.cfg.theme.default.thumbColor;
_this.getElementByLocalId("thumb").attr("stroke", thumbColor);
_this.draw();
};
return _this;
}
Scrollbar3.prototype.setRange = function(min7, max8) {
this.set("minLimit", min7);
this.set("maxLimit", max8);
var curValue = this.getValue();
var newValue = clamp_default(curValue, min7, max8);
if (curValue !== newValue && !this.get("isInit")) {
this.setValue(newValue);
}
};
Scrollbar3.prototype.getRange = function() {
var min7 = this.get("minLimit") || 0;
var max8 = this.get("maxLimit") || 1;
return { min: min7, max: max8 };
};
Scrollbar3.prototype.setValue = function(value2) {
var range = this.getRange();
var originalValue = this.getValue();
this.update({
thumbOffset: (this.get("trackLen") - this.get("thumbLen")) * clamp_default(value2, range.min, range.max)
});
this.delegateEmit("valuechange", {
originalValue,
value: this.getValue()
});
};
Scrollbar3.prototype.getValue = function() {
return clamp_default(this.get("thumbOffset") / (this.get("trackLen") - this.get("thumbLen")), 0, 1);
};
Scrollbar3.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
return __assign(__assign({}, cfg), { name: "scrollbar", isHorizontal: true, minThumbLen: 20, thumbOffset: 0, theme: DEFAULT_THEME });
};
Scrollbar3.prototype.renderInner = function(group2) {
this.renderTrackShape(group2);
this.renderThumbShape(group2);
};
Scrollbar3.prototype.applyOffset = function() {
this.moveElementTo(this.get("group"), {
x: this.get("x"),
y: this.get("y")
});
};
Scrollbar3.prototype.initEvent = function() {
this.bindEvents();
};
Scrollbar3.prototype.renderTrackShape = function(group2) {
var _a6 = this.cfg, trackLen = _a6.trackLen, _b = _a6.theme, theme4 = _b === void 0 ? { default: {} } : _b;
var _c = deep_mix_default({}, DEFAULT_THEME, theme4).default, lineCap = _c.lineCap, trackColor = _c.trackColor, themeSize = _c.size;
var size2 = get_default(this.cfg, "size", themeSize);
var attrs = this.get("isHorizontal") ? {
x1: 0 + size2 / 2,
y1: size2 / 2,
x2: trackLen - size2 / 2,
y2: size2 / 2,
lineWidth: size2,
stroke: trackColor,
lineCap
} : {
x1: size2 / 2,
y1: 0 + size2 / 2,
x2: size2 / 2,
y2: trackLen - size2 / 2,
lineWidth: size2,
stroke: trackColor,
lineCap
};
return this.addShape(group2, {
id: this.getElementId("track"),
name: "track",
type: "line",
attrs
});
};
Scrollbar3.prototype.renderThumbShape = function(group2) {
var _a6 = this.cfg, thumbOffset = _a6.thumbOffset, thumbLen = _a6.thumbLen, theme4 = _a6.theme;
var _b = deep_mix_default({}, DEFAULT_THEME, theme4).default, themeSize = _b.size, lineCap = _b.lineCap, thumbColor = _b.thumbColor;
var size2 = get_default(this.cfg, "size", themeSize);
var attrs = this.get("isHorizontal") ? {
x1: thumbOffset + size2 / 2,
y1: size2 / 2,
x2: thumbOffset + thumbLen - size2 / 2,
y2: size2 / 2,
lineWidth: size2,
stroke: thumbColor,
lineCap,
cursor: "default"
} : {
x1: size2 / 2,
y1: thumbOffset + size2 / 2,
x2: size2 / 2,
y2: thumbOffset + thumbLen - size2 / 2,
lineWidth: size2,
stroke: thumbColor,
lineCap,
cursor: "default"
};
return this.addShape(group2, {
id: this.getElementId("thumb"),
name: "thumb",
type: "line",
attrs
});
};
Scrollbar3.prototype.bindEvents = function() {
var group2 = this.get("group");
group2.on("mousedown", this.onStartEvent(false));
group2.on("mouseup", this.onMouseUp);
group2.on("touchstart", this.onStartEvent(true));
group2.on("touchend", this.onMouseUp);
var trackShape = group2.findById(this.getElementId("track"));
trackShape.on("click", this.onTrackClick);
var thumbShape = group2.findById(this.getElementId("thumb"));
thumbShape.on("mouseover", this.onThumbMouseOver);
thumbShape.on("mouseout", this.onThumbMouseOut);
};
Scrollbar3.prototype.getContainerDOM = function() {
var container2 = this.get("container");
var canvas = container2 && container2.get("canvas");
return canvas && canvas.get("container");
};
Scrollbar3.prototype.validateRange = function(offset) {
var _a6 = this.cfg, thumbLen = _a6.thumbLen, trackLen = _a6.trackLen;
var newOffset = offset;
if (offset + thumbLen > trackLen) {
newOffset = trackLen - thumbLen;
} else if (offset + thumbLen < thumbLen) {
newOffset = 0;
}
return newOffset;
};
Scrollbar3.prototype.draw = function() {
var container2 = this.get("container");
var canvas = container2 && container2.get("canvas");
if (canvas) {
canvas.draw();
}
};
Scrollbar3.prototype.updateThumbOffset = function(offset) {
var _a6 = this.cfg, thumbOffset = _a6.thumbOffset, isHorizontal2 = _a6.isHorizontal, thumbLen = _a6.thumbLen, size2 = _a6.size;
var newOffset = this.validateRange(offset);
if (newOffset === thumbOffset) {
return;
}
var thumbShape = this.getElementByLocalId("thumb");
if (isHorizontal2) {
thumbShape.attr({
x1: newOffset + size2 / 2,
x2: newOffset + thumbLen - size2 / 2
});
} else {
thumbShape.attr({
y1: newOffset + size2 / 2,
y2: newOffset + thumbLen - size2 / 2
});
}
this.emitOffsetChange(newOffset);
};
Scrollbar3.prototype.emitOffsetChange = function(offset) {
var _a6 = this.cfg, originalValue = _a6.thumbOffset, trackLen = _a6.trackLen, thumbLen = _a6.thumbLen;
this.cfg.thumbOffset = offset;
this.emit("scrollchange", {
thumbOffset: offset,
ratio: clamp_default(offset / (trackLen - thumbLen), 0, 1)
});
this.delegateEmit("valuechange", {
originalValue,
value: offset
});
};
return Scrollbar3;
}(group_component_default);
// node_modules/@antv/g2/esm/dependents.js
var LineAxis = axis_exports.Line;
var CircleAxis = axis_exports.Circle;
var LineGrid = grid_exports.Line;
var CircleGrid = grid_exports.Circle;
var CategoryLegend = legend_exports.Category;
var ContinuousLegend = legend_exports.Continuous;
var HtmlTooltip = tooltip_exports.Html;
// node_modules/@antv/g2/esm/util/graphics.js
function getPointsBox(points) {
if (is_empty_default(points)) {
return null;
}
var minX = points[0].x;
var maxX = points[0].x;
var minY = points[0].y;
var maxY2 = points[0].y;
each_default(points, function(point2) {
minX = minX > point2.x ? point2.x : minX;
maxX = maxX < point2.x ? point2.x : maxX;
minY = minY > point2.y ? point2.y : minY;
maxY2 = maxY2 < point2.y ? point2.y : maxY2;
});
return {
minX,
maxX,
minY,
maxY: maxY2,
centerX: (minX + maxX) / 2,
centerY: (minY + maxY2) / 2
};
}
function uniqueValues(array) {
return Array.from(new Set(array)).length === 1;
}
function mid(array) {
return (min_default(array) + max_default(array)) / 2;
}
function polarToCartesian(centerX, centerY, radius, angleInRadian) {
return {
x: centerX + radius * Math.cos(angleInRadian),
y: centerY + radius * Math.sin(angleInRadian)
};
}
function getSectorPath(centerX, centerY, radius, startAngleInRadian, endAngleInRadian, innerRadius) {
if (innerRadius === void 0) {
innerRadius = 0;
}
var start = polarToCartesian(centerX, centerY, radius, startAngleInRadian);
var end2 = polarToCartesian(centerX, centerY, radius, endAngleInRadian);
var innerStart = polarToCartesian(centerX, centerY, innerRadius, startAngleInRadian);
var innerEnd = polarToCartesian(centerX, centerY, innerRadius, endAngleInRadian);
if (endAngleInRadian - startAngleInRadian === Math.PI * 2) {
var middlePoint = polarToCartesian(centerX, centerY, radius, startAngleInRadian + Math.PI);
var innerMiddlePoint = polarToCartesian(centerX, centerY, innerRadius, startAngleInRadian + Math.PI);
var circlePathCommands = [
["M", start.x, start.y],
["A", radius, radius, 0, 1, 1, middlePoint.x, middlePoint.y],
["A", radius, radius, 0, 1, 1, end2.x, end2.y],
["M", innerStart.x, innerStart.y]
];
if (innerRadius) {
circlePathCommands.push(["A", innerRadius, innerRadius, 0, 1, 0, innerMiddlePoint.x, innerMiddlePoint.y]);
circlePathCommands.push(["A", innerRadius, innerRadius, 0, 1, 0, innerEnd.x, innerEnd.y]);
}
circlePathCommands.push(["M", start.x, start.y]);
circlePathCommands.push(["Z"]);
return circlePathCommands;
}
var arcSweep = endAngleInRadian - startAngleInRadian <= Math.PI ? 0 : 1;
var sectorPathCommands = [
["M", start.x, start.y],
["A", radius, radius, 0, arcSweep, 1, end2.x, end2.y],
["L", innerEnd.x, innerEnd.y]
];
if (innerRadius) {
sectorPathCommands.push(["A", innerRadius, innerRadius, 0, arcSweep, 0, innerStart.x, innerStart.y]);
}
sectorPathCommands.push(["L", start.x, start.y]);
sectorPathCommands.push(["Z"]);
return sectorPathCommands;
}
function getArcPath(centerX, centerY, radius, startAngleInRadian, endAngleInRadian) {
var start = polarToCartesian(centerX, centerY, radius, startAngleInRadian);
var end2 = polarToCartesian(centerX, centerY, radius, endAngleInRadian);
if (isNumberEqual(endAngleInRadian - startAngleInRadian, Math.PI * 2)) {
var middlePoint = polarToCartesian(centerX, centerY, radius, startAngleInRadian + Math.PI);
return [
["M", start.x, start.y],
["A", radius, radius, 0, 1, 1, middlePoint.x, middlePoint.y],
["A", radius, radius, 0, 1, 1, start.x, start.y],
["A", radius, radius, 0, 1, 0, middlePoint.x, middlePoint.y],
["A", radius, radius, 0, 1, 0, start.x, start.y],
["Z"]
];
}
var arcSweep = endAngleInRadian - startAngleInRadian <= Math.PI ? 0 : 1;
return [
["M", start.x, start.y],
["A", radius, radius, 0, arcSweep, 1, end2.x, end2.y]
];
}
function getAngle3(shapeModel, coordinate11) {
var points = shapeModel.points;
var box2 = getPointsBox(points);
var endAngle;
var startAngle;
var coordStartAngle = coordinate11.startAngle, coordEndAngle = coordinate11.endAngle;
var diffAngle = coordEndAngle - coordStartAngle;
if (coordinate11.isTransposed) {
endAngle = box2.maxY * diffAngle;
startAngle = box2.minY * diffAngle;
} else {
endAngle = box2.maxX * diffAngle;
startAngle = box2.minX * diffAngle;
}
endAngle += coordStartAngle;
startAngle += coordStartAngle;
return {
startAngle,
endAngle
};
}
function getPolygonCentroid(xs, ys) {
if (is_number_default(xs) && is_number_default(ys)) {
return [xs, ys];
}
xs = xs;
ys = ys;
if (uniqueValues(xs) || uniqueValues(ys))
return [mid(xs), mid(ys)];
var i4 = -1;
var x6 = 0;
var y5 = 0;
var former;
var current = xs.length - 1;
var diff2;
var k4 = 0;
while (++i4 < xs.length) {
former = current;
current = i4;
k4 += diff2 = xs[former] * ys[current] - xs[current] * ys[former];
x6 += (xs[former] + xs[current]) * diff2;
y5 += (ys[former] + ys[current]) * diff2;
}
k4 *= 3;
return [x6 / k4, y5 / k4];
}
function getReplaceAttrs(sourceShape, targetShape) {
var originAttrs = sourceShape.attr();
var newAttrs = targetShape.attr();
each_default(originAttrs, function(v3, k4) {
if (newAttrs[k4] === void 0) {
newAttrs[k4] = void 0;
}
});
return newAttrs;
}
// node_modules/@antv/g2/esm/util/helper.js
function isBetween2(value2, start, end2) {
var min7 = Math.min(start, end2);
var max8 = Math.max(start, end2);
return value2 >= min7 && value2 <= max8;
}
function padEnd(source, targetLength, padValue) {
if (is_string_default(source)) {
return source.padEnd(targetLength, padValue);
} else if (is_array_default(source)) {
var sourceLength = source.length;
if (sourceLength < targetLength) {
var diff2 = targetLength - sourceLength;
for (var i4 = 0; i4 < diff2; i4++) {
source.push(padValue);
}
}
}
return source;
}
function omit(obj, keys2) {
if (typeof obj === "object") {
keys2.forEach(function(key) {
delete obj[key];
});
}
return obj;
}
function uniq2(sourceArray, targetArray, map6) {
if (targetArray === void 0) {
targetArray = [];
}
if (map6 === void 0) {
map6 = new Map();
}
for (var _i = 0, sourceArray_1 = sourceArray; _i < sourceArray_1.length; _i++) {
var source = sourceArray_1[_i];
if (!map6.has(source)) {
targetArray.push(source);
map6.set(source, true);
}
}
return targetArray;
}
// node_modules/@antv/g2/esm/util/bbox.js
var BBox = function() {
function BBox2(x6, y5, width2, height) {
if (x6 === void 0) {
x6 = 0;
}
if (y5 === void 0) {
y5 = 0;
}
if (width2 === void 0) {
width2 = 0;
}
if (height === void 0) {
height = 0;
}
this.x = x6;
this.y = y5;
this.height = height;
this.width = width2;
}
BBox2.fromRange = function(minX, minY, maxX, maxY2) {
return new BBox2(minX, minY, maxX - minX, maxY2 - minY);
};
BBox2.fromObject = function(bbox) {
return new BBox2(bbox.minX, bbox.minY, bbox.width, bbox.height);
};
Object.defineProperty(BBox2.prototype, "minX", {
get: function() {
return this.x;
},
enumerable: false,
configurable: true
});
Object.defineProperty(BBox2.prototype, "maxX", {
get: function() {
return this.x + this.width;
},
enumerable: false,
configurable: true
});
Object.defineProperty(BBox2.prototype, "minY", {
get: function() {
return this.y;
},
enumerable: false,
configurable: true
});
Object.defineProperty(BBox2.prototype, "maxY", {
get: function() {
return this.y + this.height;
},
enumerable: false,
configurable: true
});
Object.defineProperty(BBox2.prototype, "tl", {
get: function() {
return { x: this.x, y: this.y };
},
enumerable: false,
configurable: true
});
Object.defineProperty(BBox2.prototype, "tr", {
get: function() {
return { x: this.maxX, y: this.y };
},
enumerable: false,
configurable: true
});
Object.defineProperty(BBox2.prototype, "bl", {
get: function() {
return { x: this.x, y: this.maxY };
},
enumerable: false,
configurable: true
});
Object.defineProperty(BBox2.prototype, "br", {
get: function() {
return { x: this.maxX, y: this.maxY };
},
enumerable: false,
configurable: true
});
Object.defineProperty(BBox2.prototype, "top", {
get: function() {
return {
x: this.x + this.width / 2,
y: this.minY
};
},
enumerable: false,
configurable: true
});
Object.defineProperty(BBox2.prototype, "right", {
get: function() {
return {
x: this.maxX,
y: this.y + this.height / 2
};
},
enumerable: false,
configurable: true
});
Object.defineProperty(BBox2.prototype, "bottom", {
get: function() {
return {
x: this.x + this.width / 2,
y: this.maxY
};
},
enumerable: false,
configurable: true
});
Object.defineProperty(BBox2.prototype, "left", {
get: function() {
return {
x: this.minX,
y: this.y + this.height / 2
};
},
enumerable: false,
configurable: true
});
BBox2.prototype.isEqual = function(bbox) {
return this.x === bbox.x && this.y === bbox.y && this.width === bbox.width && this.height === bbox.height;
};
BBox2.prototype.contains = function(child) {
return child.minX >= this.minX && child.maxX <= this.maxX && child.minY >= this.minY && child.maxY <= this.maxY;
};
BBox2.prototype.clone = function() {
return new BBox2(this.x, this.y, this.width, this.height);
};
BBox2.prototype.add = function() {
var subBBox = [];
for (var _i = 0; _i < arguments.length; _i++) {
subBBox[_i] = arguments[_i];
}
var bbox = this.clone();
each_default(subBBox, function(b10) {
bbox.x = Math.min(b10.x, bbox.x);
bbox.y = Math.min(b10.y, bbox.y);
bbox.width = Math.max(b10.maxX, bbox.maxX) - bbox.x;
bbox.height = Math.max(b10.maxY, bbox.maxY) - bbox.y;
});
return bbox;
};
BBox2.prototype.merge = function() {
var subBBox = [];
for (var _i = 0; _i < arguments.length; _i++) {
subBBox[_i] = arguments[_i];
}
var bbox = this.clone();
each_default(subBBox, function(b10) {
bbox.x = Math.max(b10.x, bbox.x);
bbox.y = Math.max(b10.y, bbox.y);
bbox.width = Math.min(b10.maxX, bbox.maxX) - bbox.x;
bbox.height = Math.min(b10.maxY, bbox.maxY) - bbox.y;
});
return bbox;
};
BBox2.prototype.cut = function(subBBox, direction5) {
var width2 = subBBox.width;
var height = subBBox.height;
switch (direction5) {
case DIRECTION.TOP:
case DIRECTION.TOP_LEFT:
case DIRECTION.TOP_RIGHT:
return BBox2.fromRange(this.minX, this.minY + height, this.maxX, this.maxY);
case DIRECTION.RIGHT:
case DIRECTION.RIGHT_TOP:
case DIRECTION.RIGHT_BOTTOM:
return BBox2.fromRange(this.minX, this.minY, this.maxX - width2, this.maxY);
case DIRECTION.BOTTOM:
case DIRECTION.BOTTOM_LEFT:
case DIRECTION.BOTTOM_RIGHT:
return BBox2.fromRange(this.minX, this.minY, this.maxX, this.maxY - height);
case DIRECTION.LEFT:
case DIRECTION.LEFT_TOP:
case DIRECTION.LEFT_BOTTOM:
return BBox2.fromRange(this.minX + width2, this.minY, this.maxX, this.maxY);
default:
return this;
}
};
BBox2.prototype.shrink = function(gap) {
var top = gap[0], right2 = gap[1], bottom = gap[2], left2 = gap[3];
return new BBox2(this.x + left2, this.y + top, this.width - left2 - right2, this.height - top - bottom);
};
BBox2.prototype.expand = function(gap) {
var top = gap[0], right2 = gap[1], bottom = gap[2], left2 = gap[3];
return new BBox2(this.x - left2, this.y - top, this.width + left2 + right2, this.height + top + bottom);
};
BBox2.prototype.exceed = function(bbox) {
return [
Math.max(-this.minY + bbox.minY, 0),
Math.max(this.maxX - bbox.maxX, 0),
Math.max(this.maxY - bbox.maxY, 0),
Math.max(-this.minX + bbox.minX, 0)
];
};
BBox2.prototype.collide = function(bbox) {
return this.minX < bbox.maxX && this.maxX > bbox.minX && this.minY < bbox.maxY && this.maxY > bbox.minY;
};
BBox2.prototype.size = function() {
return this.width * this.height;
};
BBox2.prototype.isPointIn = function(p4) {
return p4.x >= this.minX && p4.x <= this.maxX && p4.y >= this.minY && p4.y <= this.maxY;
};
return BBox2;
}();
function toPoints(bbox) {
return [
[bbox.minX, bbox.minY],
[bbox.maxX, bbox.minY],
[bbox.maxX, bbox.maxY],
[bbox.minX, bbox.maxY]
];
}
// node_modules/@antv/g2/esm/util/coordinate.js
function getXDimensionLength(coordinate11) {
if (coordinate11.isPolar && !coordinate11.isTransposed) {
return (coordinate11.endAngle - coordinate11.startAngle) * coordinate11.getRadius();
}
var start = coordinate11.convert({ x: 0, y: 0 });
var end2 = coordinate11.convert({ x: 1, y: 0 });
return Math.sqrt(Math.pow(end2.x - start.x, 2) + Math.pow(end2.y - start.y, 2));
}
function isFullCircle(coordinate11) {
if (coordinate11.isPolar) {
var startAngle = coordinate11.startAngle, endAngle = coordinate11.endAngle;
return endAngle - startAngle === Math.PI * 2;
}
return false;
}
function getDistanceToCenter(coordinate11, point2) {
var center2 = coordinate11.getCenter();
return Math.sqrt(Math.pow(point2.x - center2.x, 2) + Math.pow(point2.y - center2.y, 2));
}
function isPointInCoordinate(coordinate11, point2) {
var result = false;
if (coordinate11) {
if (coordinate11.type === "theta") {
var start = coordinate11.start, end2 = coordinate11.end;
result = isBetween2(point2.x, start.x, end2.x) && isBetween2(point2.y, start.y, end2.y);
} else {
var invertPoint = coordinate11.invert(point2);
result = isBetween2(invertPoint.x, 0, 1) && isBetween2(invertPoint.y, 0, 1);
}
}
return result;
}
function getAngleByPoint(coordinate11, point2) {
var center2 = coordinate11.getCenter();
return Math.atan2(point2.y - center2.y, point2.x - center2.x);
}
function getCoordinateClipCfg(coordinate11, margin) {
if (margin === void 0) {
margin = 0;
}
var start = coordinate11.start, end2 = coordinate11.end;
var width2 = coordinate11.getWidth();
var height = coordinate11.getHeight();
if (coordinate11.isPolar) {
var startAngle_1 = coordinate11.startAngle, endAngle_1 = coordinate11.endAngle;
var center_1 = coordinate11.getCenter();
var radius_1 = coordinate11.getRadius();
return {
type: "path",
startState: {
path: getSectorPath(center_1.x, center_1.y, radius_1 + margin, startAngle_1, startAngle_1)
},
endState: function(ratio) {
var diff2 = (endAngle_1 - startAngle_1) * ratio + startAngle_1;
var path = getSectorPath(center_1.x, center_1.y, radius_1 + margin, startAngle_1, diff2);
return {
path
};
},
attrs: {
path: getSectorPath(center_1.x, center_1.y, radius_1 + margin, startAngle_1, endAngle_1)
}
};
}
var endState;
if (coordinate11.isTransposed) {
endState = {
height: height + margin * 2
};
} else {
endState = {
width: width2 + margin * 2
};
}
return {
type: "rect",
startState: {
x: start.x - margin,
y: end2.y - margin,
width: coordinate11.isTransposed ? width2 + margin * 2 : 0,
height: coordinate11.isTransposed ? 0 : height + margin * 2
},
endState,
attrs: {
x: start.x - margin,
y: end2.y - margin,
width: width2 + margin * 2,
height: height + margin * 2
}
};
}
function getCoordinateBBox(coordinate11, margin) {
if (margin === void 0) {
margin = 0;
}
var start = coordinate11.start, end2 = coordinate11.end;
var width2 = coordinate11.getWidth();
var height = coordinate11.getHeight();
var minX = Math.min(start.x, end2.x);
var minY = Math.min(start.y, end2.y);
return BBox.fromRange(minX - margin, minY - margin, minX + width2 + margin, minY + height + margin);
}
// node_modules/@antv/g2/esm/util/scale.js
var dateRegex = /^(?:(?!0000)[0-9]{4}([-/.]+)(?:(?:0?[1-9]|1[0-2])\1(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])\1(?:29|30)|(?:0?[13578]|1[02])\1(?:31))|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)([-/.]+)0?2\2(?:29))(\s+([01]|([01][0-9]|2[0-3])):([0-9]|[0-5][0-9]):([0-9]|[0-5][0-9]))?$/;
function getDefaultType(value2) {
var type2 = "linear";
if (dateRegex.test(value2)) {
type2 = "timeCat";
} else if (is_string_default(value2)) {
type2 = "cat";
}
return type2;
}
function createScaleByField(field6, data3, scaleDef) {
var validData = data3 || [];
if (is_number_default(field6) || is_nil_default(first_value_default(validData, field6)) && is_empty_default(scaleDef)) {
var Identity2 = getClass("identity");
return new Identity2({
field: field6.toString(),
values: [field6]
});
}
var values2 = values_of_key_default(validData, field6);
var type2 = get_default(scaleDef, "type", getDefaultType(values2[0]));
var ScaleCtor = getClass(type2);
return new ScaleCtor(__assign({ field: field6, values: values2 }, scaleDef));
}
function syncScale(scale12, newScale) {
if (scale12.type !== "identity" && newScale.type !== "identity") {
var obj = {};
for (var k4 in newScale) {
if (Object.prototype.hasOwnProperty.call(newScale, k4)) {
obj[k4] = newScale[k4];
}
}
scale12.change(obj);
}
}
function getName(scale12) {
return scale12.alias || scale12.field;
}
function getDefaultCategoryScaleRange(scale12, coordinate11, theme4) {
var values2 = scale12.values;
var count2 = values2.length;
var range;
if (count2 === 1) {
range = [0.5, 1];
} else {
var widthRatio = 1;
var offset = 0;
if (isFullCircle(coordinate11)) {
if (!coordinate11.isTransposed) {
range = [0, 1 - 1 / count2];
} else {
widthRatio = get_default(theme4, "widthRatio.multiplePie", 1 / 1.3);
offset = 1 / count2 * widthRatio;
range = [offset / 2, 1 - offset / 2];
}
} else {
offset = 1 / count2 / 2;
range = [offset, 1 - offset];
}
}
return range;
}
function getMaxScale(scale12) {
var values2 = scale12.values.filter(function(item) {
return !is_nil_default(item) && !isNaN(item);
});
return Math.max.apply(Math, __spreadArray(__spreadArray([], values2, false), [is_nil_default(scale12.max) ? -Infinity : scale12.max], false));
}
// node_modules/@antv/g2/esm/util/axis.js
function getLineAxisRelativeRegion(direction5) {
var start;
var end2;
switch (direction5) {
case DIRECTION.TOP:
start = { x: 0, y: 1 };
end2 = { x: 1, y: 1 };
break;
case DIRECTION.RIGHT:
start = { x: 1, y: 0 };
end2 = { x: 1, y: 1 };
break;
case DIRECTION.BOTTOM:
start = { x: 0, y: 0 };
end2 = { x: 1, y: 0 };
break;
case DIRECTION.LEFT:
start = { x: 0, y: 0 };
end2 = { x: 0, y: 1 };
break;
default:
start = end2 = { x: 0, y: 0 };
}
return { start, end: end2 };
}
function getCircleAxisRelativeRegion(coordinate11) {
var start;
var end2;
if (coordinate11.isTransposed) {
start = {
x: 0,
y: 0
};
end2 = {
x: 1,
y: 0
};
} else {
start = {
x: 0,
y: 0
};
end2 = {
x: 0,
y: 1
};
}
return { start, end: end2 };
}
function getAxisRegion(coordinate11, direction5) {
var region = { start: { x: 0, y: 0 }, end: { x: 0, y: 0 } };
if (coordinate11.isRect) {
region = getLineAxisRelativeRegion(direction5);
} else if (coordinate11.isPolar) {
region = getCircleAxisRelativeRegion(coordinate11);
}
var start = region.start, end2 = region.end;
return {
start: coordinate11.convert(start),
end: coordinate11.convert(end2)
};
}
function isVertical(region) {
var start = region.start, end2 = region.end;
return start.x === end2.x;
}
function getAxisFactorByRegion(region, center2) {
var start = region.start, end2 = region.end;
var isAxisVertical = isVertical(region);
if (isAxisVertical) {
if ((start.y - end2.y) * (center2.x - start.x) > 0) {
return 1;
} else {
return -1;
}
} else {
if ((end2.x - start.x) * (start.y - center2.y) > 0) {
return -1;
} else {
return 1;
}
}
}
function getAxisThemeCfg(theme4, direction5) {
var axisTheme = get_default(theme4, ["components", "axis"], {});
return deep_mix_default({}, get_default(axisTheme, ["common"], {}), deep_mix_default({}, get_default(axisTheme, [direction5], {})));
}
function getAxisTitleOptions(theme4, direction5, axisOptions) {
var axisTheme = get_default(theme4, ["components", "axis"], {});
return deep_mix_default({}, get_default(axisTheme, ["common", "title"], {}), deep_mix_default({}, get_default(axisTheme, [direction5, "title"], {})), axisOptions);
}
function getCircleAxisCenterRadius(coordinate11) {
var x6 = coordinate11.x, y5 = coordinate11.y, center2 = coordinate11.circleCenter;
var isReflectY = y5.start > y5.end;
var start = coordinate11.isTransposed ? coordinate11.convert({
x: isReflectY ? 0 : 1,
y: 0
}) : coordinate11.convert({
x: 0,
y: isReflectY ? 0 : 1
});
var startVector = [start.x - center2.x, start.y - center2.y];
var normalVector = [1, 0];
var startAngle = start.y > center2.y ? vec2_exports.angle(startVector, normalVector) : vec2_exports.angle(startVector, normalVector) * -1;
var endAngle = startAngle + (x6.end - x6.start);
var radius = Math.sqrt(Math.pow(start.x - center2.x, 2) + Math.pow(start.y - center2.y, 2));
return {
center: center2,
radius,
startAngle,
endAngle
};
}
function getAxisOption(axes, field6) {
if (is_boolean_default(axes)) {
return axes === false ? false : {};
}
return get_default(axes, [field6]);
}
function getAxisDirection(axisOption, def) {
return get_default(axisOption, "position", def);
}
function getAxisTitleText(scale12, axisOption) {
return get_default(axisOption, ["title", "text"], getName(scale12));
}
// node_modules/@antv/g2/esm/facet/facet.js
var Facet = function() {
function Facet3(view, cfg) {
this.destroyed = false;
this.facets = [];
this.view = view;
this.cfg = deep_mix_default({}, this.getDefaultCfg(), cfg);
}
Facet3.prototype.init = function() {
if (!this.container) {
this.container = this.createContainer();
}
var data3 = this.view.getData();
this.facets = this.generateFacets(data3);
};
Facet3.prototype.render = function() {
this.renderViews();
};
Facet3.prototype.update = function() {
};
Facet3.prototype.clear = function() {
this.clearFacetViews();
};
Facet3.prototype.destroy = function() {
this.clear();
if (this.container) {
this.container.remove(true);
this.container = void 0;
}
this.destroyed = true;
this.view = void 0;
this.facets = [];
};
Facet3.prototype.facetToView = function(facet) {
var region = facet.region, data3 = facet.data, _a6 = facet.padding, padding3 = _a6 === void 0 ? this.cfg.padding : _a6;
var view = this.view.createView({
region,
padding: padding3
});
view.data(data3 || []);
facet.view = view;
this.beforeEachView(view, facet);
var eachView = this.cfg.eachView;
if (eachView) {
eachView(view, facet);
}
this.afterEachView(view, facet);
return view;
};
Facet3.prototype.createContainer = function() {
var foregroundGroup = this.view.getLayer(LAYER.FORE);
return foregroundGroup.addGroup();
};
Facet3.prototype.renderViews = function() {
this.createFacetViews();
};
Facet3.prototype.createFacetViews = function() {
var _this = this;
return this.facets.map(function(facet) {
return _this.facetToView(facet);
});
};
Facet3.prototype.clearFacetViews = function() {
var _this = this;
each_default(this.facets, function(facet) {
if (facet.view) {
_this.view.removeView(facet.view);
facet.view = void 0;
}
});
};
Facet3.prototype.parseSpacing = function() {
var _a6 = this.view.viewBBox, width2 = _a6.width, height = _a6.height;
var spacing = this.cfg.spacing;
return spacing.map(function(s4, idx) {
if (is_number_default(s4))
return s4 / (idx === 0 ? width2 : height);
else
return parseFloat(s4) / 100;
});
};
Facet3.prototype.getFieldValues = function(data3, field6) {
var rst = [];
var cache3 = {};
each_default(data3, function(d3) {
var value2 = d3[field6];
if (!is_nil_default(value2) && !cache3[value2]) {
rst.push(value2);
cache3[value2] = true;
}
});
return rst;
};
Facet3.prototype.getRegion = function(rows, cols, xIndex, yIndex) {
var _a6 = this.parseSpacing(), xSpacing = _a6[0], ySpacing = _a6[1];
var xRatio = (1 + xSpacing) / (cols === 0 ? 1 : cols) - xSpacing;
var yRatio = (1 + ySpacing) / (rows === 0 ? 1 : rows) - ySpacing;
var start = {
x: (xRatio + xSpacing) * xIndex,
y: (yRatio + ySpacing) * yIndex
};
var end2 = {
x: start.x + xRatio,
y: start.y + yRatio
};
return { start, end: end2 };
};
Facet3.prototype.getDefaultCfg = function() {
return {
eachView: void 0,
showTitle: true,
spacing: [0, 0],
padding: 10,
fields: []
};
};
Facet3.prototype.getDefaultTitleCfg = function() {
var fontFamily = this.view.getTheme().fontFamily;
return {
style: {
fontSize: 14,
fill: "#666",
fontFamily
}
};
};
Facet3.prototype.processAxis = function(view, facet) {
var options = view.getOptions();
var coordinateOption = options.coordinate;
var geometries = view.geometries;
var coordinateType = get_default(coordinateOption, "type", "rect");
if (coordinateType === "rect" && geometries.length) {
if (is_nil_default(options.axes)) {
options.axes = {};
}
var axes = options.axes;
var _a6 = geometries[0].getXYFields(), x6 = _a6[0], y5 = _a6[1];
var xOption = getAxisOption(axes, x6);
var yOption = getAxisOption(axes, y5);
if (xOption !== false) {
options.axes[x6] = this.getXAxisOption(x6, axes, xOption, facet);
}
if (yOption !== false) {
options.axes[y5] = this.getYAxisOption(y5, axes, yOption, facet);
}
}
};
Facet3.prototype.getFacetDataFilter = function(conditions) {
return function(datum) {
return every_default(conditions, function(condition) {
var field6 = condition.field, value2 = condition.value;
if (!is_nil_default(value2) && field6) {
return datum[field6] === value2;
}
return true;
});
};
};
return Facet3;
}();
// node_modules/@antv/g2/esm/facet/index.js
var Facets = {};
var getFacet = function(type2) {
return Facets[lower_case_default(type2)];
};
var registerFacet = function(type2, ctor) {
Facets[lower_case_default(type2)] = ctor;
};
// node_modules/@antv/g2/esm/interaction/action/base.js
var Action = function() {
function Action2(context, cfg) {
this.context = context;
this.cfg = cfg;
context.addAction(this);
}
Action2.prototype.applyCfg = function(cfg) {
mix(this, cfg);
};
Action2.prototype.init = function() {
this.applyCfg(this.cfg);
};
Action2.prototype.destroy = function() {
this.context.removeAction(this);
this.context = null;
};
return Action2;
}();
var base_default12 = Action;
// node_modules/@antv/g2/esm/interaction/action/callback.js
var CallbackAction = function(_super) {
__extends(CallbackAction2, _super);
function CallbackAction2() {
return _super !== null && _super.apply(this, arguments) || this;
}
CallbackAction2.prototype.execute = function() {
if (this.callback) {
this.callback(this.context);
}
};
CallbackAction2.prototype.destroy = function() {
_super.prototype.destroy.call(this);
this.callback = null;
};
return CallbackAction2;
}(base_default12);
var callback_default = CallbackAction;
// node_modules/@antv/g2/esm/interaction/action/register.js
var ActionCache = {};
function createAction(actionName, context) {
var actionOption = ActionCache[actionName];
var action = null;
if (actionOption) {
var ActionClass = actionOption.ActionClass, cfg = actionOption.cfg;
action = new ActionClass(context, cfg);
action.name = actionName;
action.init();
}
return action;
}
function getActionClass(actionName) {
var actionOption = ActionCache[actionName];
return get_default(actionOption, "ActionClass");
}
function registerAction(actionName, ActionClass, cfg) {
ActionCache[actionName] = {
ActionClass,
cfg
};
}
function createCallbackAction(callback, context) {
var action = new callback_default(context);
action.callback = callback;
action.name = "callback";
return action;
}
// node_modules/@antv/g2/esm/geometry/shape/util/path.js
function _points2path(points, isInCircle) {
var path = [];
if (points.length) {
path.push(["M", points[0].x, points[0].y]);
for (var i4 = 1, length_1 = points.length; i4 < length_1; i4 += 1) {
var item = points[i4];
path.push(["L", item.x, item.y]);
}
if (isInCircle) {
path.push(["Z"]);
}
}
return path;
}
function _convertArr(arr, coord2) {
var tmp = [arr[0]];
for (var i4 = 1, len5 = arr.length; i4 < len5; i4 = i4 + 2) {
var point2 = coord2.convert({
x: arr[i4],
y: arr[i4 + 1]
});
tmp.push(point2.x, point2.y);
}
return tmp;
}
function _convertArcPath(path, coord2) {
var isTransposed = coord2.isTransposed;
var r4 = path[1];
var x6 = path[6];
var y5 = path[7];
var point2 = coord2.convert({ x: x6, y: y5 });
var direction5 = isTransposed ? 0 : 1;
return ["A", r4, r4, 0, 0, direction5, point2.x, point2.y];
}
function _convertPolarPath(pre, cur, coord2) {
var isTransposed = coord2.isTransposed, startAngle = coord2.startAngle, endAngle = coord2.endAngle;
var prePoint = pre[0].toLowerCase() === "a" ? {
x: pre[6],
y: pre[7]
} : {
x: pre[1],
y: pre[2]
};
var curPoint = {
x: cur[1],
y: cur[2]
};
var rst = [];
var xDim = isTransposed ? "y" : "x";
var angleRange = Math.abs(curPoint[xDim] - prePoint[xDim]) * (endAngle - startAngle);
var direction5 = curPoint[xDim] >= prePoint[xDim] ? 1 : 0;
var flag = angleRange > Math.PI ? 1 : 0;
var convertPoint = coord2.convert(curPoint);
var r4 = getDistanceToCenter(coord2, convertPoint);
if (r4 >= 0.5) {
if (angleRange === Math.PI * 2) {
var middlePoint = {
x: (curPoint.x + prePoint.x) / 2,
y: (curPoint.y + prePoint.y) / 2
};
var middleConvertPoint = coord2.convert(middlePoint);
rst.push(["A", r4, r4, 0, flag, direction5, middleConvertPoint.x, middleConvertPoint.y]);
rst.push(["A", r4, r4, 0, flag, direction5, convertPoint.x, convertPoint.y]);
} else {
rst.push(["A", r4, r4, 0, flag, direction5, convertPoint.x, convertPoint.y]);
}
}
return rst;
}
function _filterFullCirleLine(path) {
each_default(path, function(subPath, index2) {
var cur = subPath;
if (cur[0].toLowerCase() === "a") {
var pre = path[index2 - 1];
var next = path[index2 + 1];
if (next && next[0].toLowerCase() === "a") {
if (pre && pre[0].toLowerCase() === "l") {
pre[0] = "M";
}
} else if (pre && pre[0].toLowerCase() === "a") {
if (next && next[0].toLowerCase() === "l") {
next[0] = "M";
}
}
}
});
}
var smoothBezier2 = function(points, smooth, isLoop, constraint) {
var cps = [];
var hasConstraint = !!constraint;
var prevPoint;
var nextPoint;
var min7;
var max8;
var nextCp0;
var cp1;
var cp0;
if (hasConstraint) {
min7 = constraint[0], max8 = constraint[1];
for (var i4 = 0, l4 = points.length; i4 < l4; i4++) {
var point2 = points[i4];
min7 = vec2_exports.min([0, 0], min7, point2);
max8 = vec2_exports.max([0, 0], max8, point2);
}
}
for (var i4 = 0, len5 = points.length; i4 < len5; i4++) {
var point2 = points[i4];
if (i4 === 0 && !isLoop) {
cp0 = point2;
} else if (i4 === len5 - 1 && !isLoop) {
cp1 = point2;
cps.push(cp0);
cps.push(cp1);
} else {
prevPoint = points[isLoop ? i4 ? i4 - 1 : len5 - 1 : i4 - 1];
nextPoint = points[isLoop ? (i4 + 1) % len5 : i4 + 1];
var v3 = [0, 0];
v3 = vec2_exports.sub(v3, nextPoint, prevPoint);
v3 = vec2_exports.scale(v3, v3, smooth);
var d0 = vec2_exports.distance(point2, prevPoint);
var d1 = vec2_exports.distance(point2, nextPoint);
var sum = d0 + d1;
if (sum !== 0) {
d0 /= sum;
d1 /= sum;
}
var v1 = vec2_exports.scale([0, 0], v3, -d0);
var v22 = vec2_exports.scale([0, 0], v3, d1);
cp1 = vec2_exports.add([0, 0], point2, v1);
nextCp0 = vec2_exports.add([0, 0], point2, v22);
nextCp0 = vec2_exports.min([0, 0], nextCp0, vec2_exports.max([0, 0], nextPoint, point2));
nextCp0 = vec2_exports.max([0, 0], nextCp0, vec2_exports.min([0, 0], nextPoint, point2));
v1 = vec2_exports.sub([0, 0], nextCp0, point2);
v1 = vec2_exports.scale([0, 0], v1, -d0 / d1);
cp1 = vec2_exports.add([0, 0], point2, v1);
cp1 = vec2_exports.min([0, 0], cp1, vec2_exports.max([0, 0], prevPoint, point2));
cp1 = vec2_exports.max([0, 0], cp1, vec2_exports.min([0, 0], prevPoint, point2));
v22 = vec2_exports.sub([0, 0], point2, cp1);
v22 = vec2_exports.scale([0, 0], v22, d1 / d0);
nextCp0 = vec2_exports.add([0, 0], point2, v22);
if (hasConstraint) {
cp1 = vec2_exports.max([0, 0], cp1, min7);
cp1 = vec2_exports.min([0, 0], cp1, max8);
nextCp0 = vec2_exports.max([0, 0], nextCp0, min7);
nextCp0 = vec2_exports.min([0, 0], nextCp0, max8);
}
cps.push(cp0);
cps.push(cp1);
cp0 = nextCp0;
}
}
if (isLoop) {
cps.push(cps.shift());
}
return cps;
};
function catmullRom2bezier(crp, z3, constraint) {
var isLoop = !!z3;
var pointList = [];
for (var i4 = 0, l4 = crp.length; i4 < l4; i4 += 2) {
pointList.push([crp[i4], crp[i4 + 1]]);
}
var controlPointList = smoothBezier2(pointList, 0.4, isLoop, constraint);
var len5 = pointList.length;
var d1 = [];
var cp1;
var cp2;
var p4;
for (var i4 = 0; i4 < len5 - 1; i4++) {
cp1 = controlPointList[i4 * 2];
cp2 = controlPointList[i4 * 2 + 1];
p4 = pointList[i4 + 1];
d1.push(["C", cp1[0], cp1[1], cp2[0], cp2[1], p4[0], p4[1]]);
}
if (isLoop) {
cp1 = controlPointList[len5];
cp2 = controlPointList[len5 + 1];
p4 = pointList[0];
d1.push(["C", cp1[0], cp1[1], cp2[0], cp2[1], p4[0], p4[1]]);
}
return d1;
}
function getLinePath2(points, isInCircle) {
return _points2path(points, isInCircle);
}
function getSplinePath(points, isInCircle, constaint) {
var data3 = [];
var first = points[0];
var prePoint = null;
if (points.length <= 2) {
return getLinePath2(points, isInCircle);
}
for (var i4 = 0, len5 = points.length; i4 < len5; i4++) {
var point2 = points[i4];
if (!prePoint || !(prePoint.x === point2.x && prePoint.y === point2.y)) {
data3.push(point2.x);
data3.push(point2.y);
prePoint = point2;
}
}
var constraint = constaint || [
[0, 0],
[1, 1]
];
var splinePath2 = catmullRom2bezier(data3, isInCircle, constraint);
splinePath2.unshift(["M", first.x, first.y]);
return splinePath2;
}
function convertNormalPath(coord2, path) {
var tmp = [];
each_default(path, function(subPath) {
var action = subPath[0];
switch (action.toLowerCase()) {
case "m":
case "l":
case "c":
tmp.push(_convertArr(subPath, coord2));
break;
case "a":
tmp.push(_convertArcPath(subPath, coord2));
break;
case "z":
default:
tmp.push(subPath);
break;
}
});
return tmp;
}
function convertPolarPath(coord2, path) {
var tmp = [];
var pre;
var cur;
var transposed;
var equals7;
each_default(path, function(subPath, index2) {
var action = subPath[0];
switch (action.toLowerCase()) {
case "m":
case "c":
case "q":
tmp.push(_convertArr(subPath, coord2));
break;
case "l":
pre = path[index2 - 1];
cur = subPath;
transposed = coord2.isTransposed;
equals7 = transposed ? pre[pre.length - 2] === cur[1] : pre[pre.length - 1] === cur[2];
if (equals7) {
tmp = tmp.concat(_convertPolarPath(pre, cur, coord2));
} else {
tmp.push(_convertArr(subPath, coord2));
}
break;
case "a":
tmp.push(_convertArcPath(subPath, coord2));
break;
case "z":
default:
tmp.push(subPath);
break;
}
});
_filterFullCirleLine(tmp);
return tmp;
}
// node_modules/@antv/g2/esm/interaction/action/util.js
function getMaskBBox(context, tolerance3) {
var event = context.event;
var maskShape = event.target;
var maskBBox = maskShape.getCanvasBBox();
if (!(maskBBox.width >= tolerance3 || maskBBox.height >= tolerance3)) {
return null;
}
return maskBBox;
}
function getMaskPath(context, tolerance3) {
var event = context.event;
var maskShape = event.target;
var maskBBox = maskShape.getCanvasBBox();
if (!(maskBBox.width >= tolerance3 || maskBBox.height >= tolerance3)) {
return null;
}
return maskShape.attr("path");
}
function getCurrentElement(context) {
var event = context.event;
var element;
var target = event.target;
if (target) {
element = target.get("element");
}
return element;
}
function getDelegationObject(context) {
var event = context.event;
var target = event.target;
var delegateObject;
if (target) {
delegateObject = target.get("delegateObject");
}
return delegateObject;
}
function isElementChange(context) {
var event = context.event.gEvent;
if (event && event.fromShape && event.toShape && event.fromShape.get("element") === event.toShape.get("element")) {
return false;
}
return true;
}
function isList(delegateObject) {
return delegateObject && delegateObject.component && delegateObject.component.isList();
}
function isSlider(delegateObject) {
return delegateObject && delegateObject.component && delegateObject.component.isSlider();
}
function isMask(context) {
var event = context.event;
var target = event.target;
return target && target.get("name") === "mask";
}
function getMaskedElements(context, tolerance3) {
var target = context.event.target;
if (target.get("type") === "path") {
var maskPath = getMaskPath(context, tolerance3);
if (!maskPath) {
return;
}
return getElementsByPath(context.view, maskPath);
}
var maskBBox = getMaskBBox(context, tolerance3);
if (!maskBBox) {
return null;
}
return getIntersectElements(context.view, maskBBox);
}
function getSiblingMaskElements(context, sibling, tolerance3) {
var maskBBox = getMaskBBox(context, tolerance3);
if (!maskBBox) {
return null;
}
var view = context.view;
var start = getSiblingPoint(view, sibling, { x: maskBBox.x, y: maskBBox.y });
var end2 = getSiblingPoint(view, sibling, { x: maskBBox.maxX, y: maskBBox.maxY });
var box2 = {
minX: start.x,
minY: start.y,
maxX: end2.x,
maxY: end2.y
};
return getIntersectElements(sibling, box2);
}
function getElements(view) {
var geometries = view.geometries;
var rst = [];
each_default(geometries, function(geom) {
var elements = geom.elements;
rst = rst.concat(elements);
});
if (view.views && view.views.length) {
each_default(view.views, function(subView) {
rst = rst.concat(getElements(subView));
});
}
return rst;
}
function getElementsByField(view, field6, value2) {
var elements = getElements(view);
return elements.filter(function(el) {
return getElementValue(el, field6) === value2;
});
}
function getElementsByState(view, stateName) {
var geometries = view.geometries;
var rst = [];
each_default(geometries, function(geom) {
var elements = geom.getElementsBy(function(el) {
return el.hasState(stateName);
});
rst = rst.concat(elements);
});
return rst;
}
function getElementValue(element, field6) {
var model = element.getModel();
var record = model.data;
var value2;
if (is_array_default(record)) {
value2 = record[0][field6];
} else {
value2 = record[field6];
}
return value2;
}
function intersectRect(box1, box2) {
return !(box2.minX > box1.maxX || box2.maxX < box1.minX || box2.minY > box1.maxY || box2.maxY < box1.minY);
}
function getIntersectElements(view, box2) {
var elements = getElements(view);
var rst = [];
each_default(elements, function(el) {
var shape = el.shape;
var shapeBBox = shape.getCanvasBBox();
if (intersectRect(box2, shapeBBox)) {
rst.push(el);
}
});
return rst;
}
function pathToPoints(path) {
var points = [];
each_default(path, function(seg) {
var command = seg[0];
if (command !== "A") {
for (var i4 = 1; i4 < seg.length; i4 = i4 + 2) {
points.push([seg[i4], seg[i4 + 1]]);
}
} else {
var length_1 = seg.length;
points.push([seg[length_1 - 2], seg[length_1 - 1]]);
}
});
return points;
}
function getElementsByPath(view, path) {
var elements = getElements(view);
var points = pathToPoints(path);
var rst = elements.filter(function(el) {
var shape = el.shape;
var shapePoints;
if (shape.get("type") === "path") {
shapePoints = pathToPoints(shape.attr("path"));
} else {
var shapeBBox = shape.getCanvasBBox();
shapePoints = toPoints(shapeBBox);
}
return isPolygonsIntersect(points, shapePoints);
});
return rst;
}
function getComponents(view) {
return view.getComponents().map(function(co) {
return co.component;
});
}
function distance7(p1, p22) {
var dx = p22.x - p1.x;
var dy = p22.y - p1.y;
return Math.sqrt(dx * dx + dy * dy);
}
function getSpline(points, z3) {
if (points.length <= 2) {
return getLinePath2(points, false);
}
var first = points[0];
var arr = [];
each_default(points, function(point2) {
arr.push(point2.x);
arr.push(point2.y);
});
var path = catmullRom2bezier(arr, z3, null);
path.unshift(["M", first.x, first.y]);
return path;
}
function isInBox(box2, point2) {
return box2.x <= point2.x && box2.maxX >= point2.x && box2.y <= point2.y && box2.maxY > point2.y;
}
function getSilbings(view) {
var parent = view.parent;
var siblings = null;
if (parent) {
siblings = parent.views.filter(function(sub6) {
return sub6 !== view;
});
}
return siblings;
}
function point2Normalize(view, point2) {
var coord2 = view.getCoordinate();
return coord2.invert(point2);
}
function getSiblingPoint(view, sibling, point2) {
var normalPoint = point2Normalize(view, point2);
return sibling.getCoordinate().convert(normalPoint);
}
function isInRecords(records, record, xFiled, yField) {
var isIn = false;
each_default(records, function(r4) {
if (r4[xFiled] === record[xFiled] && r4[yField] === record[yField]) {
isIn = true;
return false;
}
});
return isIn;
}
function getScaleByField(view, field6) {
var scale12 = view.getScaleByField(field6);
if (!scale12 && view.views) {
each_default(view.views, function(subView) {
scale12 = getScaleByField(subView, field6);
if (scale12) {
return false;
}
});
}
return scale12;
}
// node_modules/@antv/g2/esm/interaction/context.js
var Context = function() {
function Context2(view) {
this.actions = [];
this.event = null;
this.cacheMap = {};
this.view = view;
}
Context2.prototype.cache = function() {
var params = [];
for (var _i = 0; _i < arguments.length; _i++) {
params[_i] = arguments[_i];
}
if (params.length === 1) {
return this.cacheMap[params[0]];
} else if (params.length === 2) {
this.cacheMap[params[0]] = params[1];
}
};
Context2.prototype.getAction = function(name) {
return this.actions.find(function(action) {
return action.name === name;
});
};
Context2.prototype.addAction = function(action) {
this.actions.push(action);
};
Context2.prototype.removeAction = function(action) {
var actions = this.actions;
var index2 = this.actions.indexOf(action);
if (index2 >= 0) {
actions.splice(index2, 1);
}
};
Context2.prototype.getCurrentPoint = function() {
var event = this.event;
if (event) {
if (event.target instanceof HTMLElement) {
var canvas = this.view.getCanvas();
var point2 = canvas.getPointByClient(event.clientX, event.clientY);
return point2;
} else {
return {
x: event.x,
y: event.y
};
}
}
return null;
};
Context2.prototype.getCurrentShape = function() {
return get_default(this.event, ["gEvent", "shape"]);
};
Context2.prototype.isInPlot = function() {
var point2 = this.getCurrentPoint();
if (point2) {
return this.view.isPointInPlot(point2);
}
return false;
};
Context2.prototype.isInShape = function(name) {
var shape = this.getCurrentShape();
if (shape) {
return shape.get("name") === name;
}
return false;
};
Context2.prototype.isInComponent = function(name) {
var components = getComponents(this.view);
var point2 = this.getCurrentPoint();
if (point2) {
return !!components.find(function(component2) {
var bbox = component2.getBBox();
if (name) {
return component2.get("name") === name && isInBox(bbox, point2);
} else {
return isInBox(bbox, point2);
}
});
}
return false;
};
Context2.prototype.destroy = function() {
each_default(this.actions.slice(), function(action) {
action.destroy();
});
this.view = null;
this.event = null;
this.actions = null;
this.cacheMap = null;
};
return Context2;
}();
var context_default = Context;
// node_modules/@antv/g2/esm/interaction/interaction.js
var Interaction = function() {
function Interaction2(view, cfg) {
this.view = view;
this.cfg = cfg;
}
Interaction2.prototype.init = function() {
this.initEvents();
};
Interaction2.prototype.initEvents = function() {
};
Interaction2.prototype.clearEvents = function() {
};
Interaction2.prototype.destroy = function() {
this.clearEvents();
};
return Interaction2;
}();
var interaction_default = Interaction;
// node_modules/@antv/g2/esm/interaction/grammar-interaction.js
function parseAction(actionStr, context, arg) {
var arr = actionStr.split(":");
var actionName = arr[0];
var action = context.getAction(actionName) || createAction(actionName, context);
if (!action) {
throw new Error("There is no action named ".concat(actionName));
}
var methodName = arr[1];
return {
action,
methodName,
arg
};
}
function executeAction(actionObject) {
var action = actionObject.action, methodName = actionObject.methodName, arg = actionObject.arg;
if (action[methodName]) {
action[methodName](arg);
} else {
throw new Error("Action(".concat(action.name, ") doesn't have a method called ").concat(methodName));
}
}
var STEP_NAMES = {
START: "start",
SHOW_ENABLE: "showEnable",
END: "end",
ROLLBACK: "rollback",
PROCESSING: "processing"
};
var GrammarInteraction = function(_super) {
__extends(GrammarInteraction2, _super);
function GrammarInteraction2(view, steps) {
var _this = _super.call(this, view, steps) || this;
_this.callbackCaches = {};
_this.emitCaches = {};
_this.steps = steps;
return _this;
}
GrammarInteraction2.prototype.init = function() {
this.initContext();
_super.prototype.init.call(this);
};
GrammarInteraction2.prototype.destroy = function() {
_super.prototype.destroy.call(this);
this.steps = null;
if (this.context) {
this.context.destroy();
this.context = null;
}
this.callbackCaches = null;
this.view = null;
};
GrammarInteraction2.prototype.initEvents = function() {
var _this = this;
each_default(this.steps, function(stepArr, stepName) {
each_default(stepArr, function(step) {
var callback = _this.getActionCallback(stepName, step);
if (callback) {
_this.bindEvent(step.trigger, callback);
}
});
});
};
GrammarInteraction2.prototype.clearEvents = function() {
var _this = this;
each_default(this.steps, function(stepArr, stepName) {
each_default(stepArr, function(step) {
var callback = _this.getActionCallback(stepName, step);
if (callback) {
_this.offEvent(step.trigger, callback);
}
});
});
};
GrammarInteraction2.prototype.initContext = function() {
var view = this.view;
var context = new context_default(view);
this.context = context;
var steps = this.steps;
each_default(steps, function(subSteps) {
each_default(subSteps, function(step) {
if (is_function_default(step.action)) {
step.actionObject = {
action: createCallbackAction(step.action, context),
methodName: "execute"
};
} else if (is_string_default(step.action)) {
step.actionObject = parseAction(step.action, context, step.arg);
} else if (is_array_default(step.action)) {
var actionArr = step.action;
var argArr_1 = is_array_default(step.arg) ? step.arg : [step.arg];
step.actionObject = [];
each_default(actionArr, function(actionStr, idx) {
step.actionObject.push(parseAction(actionStr, context, argArr_1[idx]));
});
}
});
});
};
GrammarInteraction2.prototype.isAllowStep = function(stepName) {
var currentStepName = this.currentStepName;
var steps = this.steps;
if (currentStepName === stepName) {
return true;
}
if (stepName === STEP_NAMES.SHOW_ENABLE) {
return true;
}
if (stepName === STEP_NAMES.PROCESSING) {
return currentStepName === STEP_NAMES.START;
}
if (stepName === STEP_NAMES.START) {
return currentStepName !== STEP_NAMES.PROCESSING;
}
if (stepName === STEP_NAMES.END) {
return currentStepName === STEP_NAMES.PROCESSING || currentStepName === STEP_NAMES.START;
}
if (stepName === STEP_NAMES.ROLLBACK) {
if (steps[STEP_NAMES.END]) {
return currentStepName === STEP_NAMES.END;
} else if (currentStepName === STEP_NAMES.START) {
return true;
}
}
return false;
};
GrammarInteraction2.prototype.isAllowExecute = function(stepName, step) {
if (this.isAllowStep(stepName)) {
var key = this.getKey(stepName, step);
if (step.once && this.emitCaches[key]) {
return false;
}
if (step.isEnable) {
return step.isEnable(this.context);
}
return true;
}
return false;
};
GrammarInteraction2.prototype.enterStep = function(stepName) {
this.currentStepName = stepName;
this.emitCaches = {};
};
GrammarInteraction2.prototype.afterExecute = function(stepName, step) {
if (stepName !== STEP_NAMES.SHOW_ENABLE && this.currentStepName !== stepName) {
this.enterStep(stepName);
}
var key = this.getKey(stepName, step);
this.emitCaches[key] = true;
};
GrammarInteraction2.prototype.getKey = function(stepName, step) {
return stepName + step.trigger + step.action;
};
GrammarInteraction2.prototype.getActionCallback = function(stepName, step) {
var _this = this;
var context = this.context;
var callbackCaches = this.callbackCaches;
var actionObject = step.actionObject;
if (step.action && actionObject) {
var key = this.getKey(stepName, step);
if (!callbackCaches[key]) {
var actionCallback = function(event) {
context.event = event;
if (_this.isAllowExecute(stepName, step)) {
if (is_array_default(actionObject)) {
each_default(actionObject, function(obj) {
context.event = event;
executeAction(obj);
});
} else {
context.event = event;
executeAction(actionObject);
}
_this.afterExecute(stepName, step);
if (step.callback) {
context.event = event;
step.callback(context);
}
} else {
context.event = null;
}
};
if (step.debounce) {
callbackCaches[key] = debounce_default(actionCallback, step.debounce.wait, step.debounce.immediate);
} else if (step.throttle) {
callbackCaches[key] = throttle_default(actionCallback, step.throttle.wait, {
leading: step.throttle.leading,
trailing: step.throttle.trailing
});
} else {
callbackCaches[key] = actionCallback;
}
}
return callbackCaches[key];
}
return null;
};
GrammarInteraction2.prototype.bindEvent = function(eventName, callback) {
var nameArr = eventName.split(":");
if (nameArr[0] === "window") {
window.addEventListener(nameArr[1], callback);
} else if (nameArr[0] === "document") {
document.addEventListener(nameArr[1], callback);
} else {
this.view.on(eventName, callback);
}
};
GrammarInteraction2.prototype.offEvent = function(eventName, callback) {
var nameArr = eventName.split(":");
if (nameArr[0] === "window") {
window.removeEventListener(nameArr[1], callback);
} else if (nameArr[0] === "document") {
document.removeEventListener(nameArr[1], callback);
} else {
this.view.off(eventName, callback);
}
};
return GrammarInteraction2;
}(interaction_default);
var grammar_interaction_default = GrammarInteraction;
// node_modules/@antv/g2/esm/interaction/index.js
var Interactions = {};
function getInteraction(name) {
return Interactions[lower_case_default(name)];
}
function registerInteraction(name, interaction8) {
Interactions[lower_case_default(name)] = interaction8;
}
function createInteraction(name, view, cfg) {
var interaciton = getInteraction(name);
if (!interaciton) {
return null;
}
if (is_plain_object_default(interaciton)) {
var steps = mix(clone_default(interaciton), cfg);
return new grammar_interaction_default(view, steps);
} else {
var cls = interaciton;
return new cls(view, cfg);
}
}
// node_modules/@antv/g2/esm/theme/util/create-by-style-sheet.js
function createAxisStyles(styleSheet) {
return {
title: {
autoRotate: true,
position: "center",
spacing: styleSheet.axisTitleSpacing,
style: {
fill: styleSheet.axisTitleTextFillColor,
fontSize: styleSheet.axisTitleTextFontSize,
lineHeight: styleSheet.axisTitleTextLineHeight,
textBaseline: "middle",
fontFamily: styleSheet.fontFamily
}
},
label: {
autoRotate: false,
autoEllipsis: false,
autoHide: { type: "equidistance", cfg: { minGap: 6 } },
offset: styleSheet.axisLabelOffset,
style: {
fill: styleSheet.axisLabelFillColor,
fontSize: styleSheet.axisLabelFontSize,
lineHeight: styleSheet.axisLabelLineHeight,
fontFamily: styleSheet.fontFamily
}
},
line: {
style: {
lineWidth: styleSheet.axisLineBorder,
stroke: styleSheet.axisLineBorderColor
}
},
grid: {
line: {
type: "line",
style: {
stroke: styleSheet.axisGridBorderColor,
lineWidth: styleSheet.axisGridBorder,
lineDash: styleSheet.axisGridLineDash
}
},
alignTick: true,
animate: true
},
tickLine: {
style: {
lineWidth: styleSheet.axisTickLineBorder,
stroke: styleSheet.axisTickLineBorderColor
},
alignTick: true,
length: styleSheet.axisTickLineLength
},
subTickLine: null,
animate: true
};
}
function createLegendStyles(styleSheet) {
return {
title: null,
marker: {
symbol: "circle",
spacing: styleSheet.legendMarkerSpacing,
style: {
r: styleSheet.legendCircleMarkerSize,
fill: styleSheet.legendMarkerColor
}
},
itemName: {
spacing: 5,
style: {
fill: styleSheet.legendItemNameFillColor,
fontFamily: styleSheet.fontFamily,
fontSize: styleSheet.legendItemNameFontSize,
lineHeight: styleSheet.legendItemNameLineHeight,
fontWeight: styleSheet.legendItemNameFontWeight,
textAlign: "start",
textBaseline: "middle"
}
},
itemStates: {
active: {
nameStyle: {
opacity: 0.8
}
},
unchecked: {
nameStyle: {
fill: "#D8D8D8"
},
markerStyle: {
fill: "#D8D8D8",
stroke: "#D8D8D8"
}
},
inactive: {
nameStyle: {
fill: "#D8D8D8"
},
markerStyle: {
opacity: 0.2
}
}
},
flipPage: true,
pageNavigator: {
marker: {
style: {
size: styleSheet.legendPageNavigatorMarkerSize,
inactiveFill: styleSheet.legendPageNavigatorMarkerInactiveFillColor,
inactiveOpacity: styleSheet.legendPageNavigatorMarkerInactiveFillOpacity,
fill: styleSheet.legendPageNavigatorMarkerFillColor,
opacity: styleSheet.legendPageNavigatorMarkerFillOpacity
}
},
text: {
style: {
fill: styleSheet.legendPageNavigatorTextFillColor,
fontSize: styleSheet.legendPageNavigatorTextFontSize
}
}
},
animate: false,
maxItemWidth: 200,
itemSpacing: styleSheet.legendItemSpacing,
itemMarginBottom: styleSheet.legendItemMarginBottom,
padding: styleSheet.legendPadding
};
}
function createThemeByStyleSheet(styleSheet) {
var _a6;
var shapeStyles = {
point: {
default: {
fill: styleSheet.pointFillColor,
r: styleSheet.pointSize,
stroke: styleSheet.pointBorderColor,
lineWidth: styleSheet.pointBorder,
fillOpacity: styleSheet.pointFillOpacity
},
active: {
stroke: styleSheet.pointActiveBorderColor,
lineWidth: styleSheet.pointActiveBorder
},
selected: {
stroke: styleSheet.pointSelectedBorderColor,
lineWidth: styleSheet.pointSelectedBorder
},
inactive: {
fillOpacity: styleSheet.pointInactiveFillOpacity,
strokeOpacity: styleSheet.pointInactiveBorderOpacity
}
},
hollowPoint: {
default: {
fill: styleSheet.hollowPointFillColor,
lineWidth: styleSheet.hollowPointBorder,
stroke: styleSheet.hollowPointBorderColor,
strokeOpacity: styleSheet.hollowPointBorderOpacity,
r: styleSheet.hollowPointSize
},
active: {
stroke: styleSheet.hollowPointActiveBorderColor,
strokeOpacity: styleSheet.hollowPointActiveBorderOpacity
},
selected: {
lineWidth: styleSheet.hollowPointSelectedBorder,
stroke: styleSheet.hollowPointSelectedBorderColor,
strokeOpacity: styleSheet.hollowPointSelectedBorderOpacity
},
inactive: {
strokeOpacity: styleSheet.hollowPointInactiveBorderOpacity
}
},
area: {
default: {
fill: styleSheet.areaFillColor,
fillOpacity: styleSheet.areaFillOpacity,
stroke: null
},
active: {
fillOpacity: styleSheet.areaActiveFillOpacity
},
selected: {
fillOpacity: styleSheet.areaSelectedFillOpacity
},
inactive: {
fillOpacity: styleSheet.areaInactiveFillOpacity
}
},
hollowArea: {
default: {
fill: null,
stroke: styleSheet.hollowAreaBorderColor,
lineWidth: styleSheet.hollowAreaBorder,
strokeOpacity: styleSheet.hollowAreaBorderOpacity
},
active: {
fill: null,
lineWidth: styleSheet.hollowAreaActiveBorder
},
selected: {
fill: null,
lineWidth: styleSheet.hollowAreaSelectedBorder
},
inactive: {
strokeOpacity: styleSheet.hollowAreaInactiveBorderOpacity
}
},
interval: {
default: {
fill: styleSheet.intervalFillColor,
fillOpacity: styleSheet.intervalFillOpacity
},
active: {
stroke: styleSheet.intervalActiveBorderColor,
lineWidth: styleSheet.intervalActiveBorder
},
selected: {
stroke: styleSheet.intervalSelectedBorderColor,
lineWidth: styleSheet.intervalSelectedBorder
},
inactive: {
fillOpacity: styleSheet.intervalInactiveFillOpacity,
strokeOpacity: styleSheet.intervalInactiveBorderOpacity
}
},
hollowInterval: {
default: {
fill: styleSheet.hollowIntervalFillColor,
stroke: styleSheet.hollowIntervalBorderColor,
lineWidth: styleSheet.hollowIntervalBorder,
strokeOpacity: styleSheet.hollowIntervalBorderOpacity
},
active: {
stroke: styleSheet.hollowIntervalActiveBorderColor,
lineWidth: styleSheet.hollowIntervalActiveBorder,
strokeOpacity: styleSheet.hollowIntervalActiveBorderOpacity
},
selected: {
stroke: styleSheet.hollowIntervalSelectedBorderColor,
lineWidth: styleSheet.hollowIntervalSelectedBorder,
strokeOpacity: styleSheet.hollowIntervalSelectedBorderOpacity
},
inactive: {
stroke: styleSheet.hollowIntervalInactiveBorderColor,
lineWidth: styleSheet.hollowIntervalInactiveBorder,
strokeOpacity: styleSheet.hollowIntervalInactiveBorderOpacity
}
},
line: {
default: {
stroke: styleSheet.lineBorderColor,
lineWidth: styleSheet.lineBorder,
strokeOpacity: styleSheet.lineBorderOpacity,
fill: null,
lineAppendWidth: 10,
lineCap: "round",
lineJoin: "round"
},
active: {
lineWidth: styleSheet.lineActiveBorder
},
selected: {
lineWidth: styleSheet.lineSelectedBorder
},
inactive: {
strokeOpacity: styleSheet.lineInactiveBorderOpacity
}
}
};
var axisStyles = createAxisStyles(styleSheet);
var legendStyles = createLegendStyles(styleSheet);
return {
background: styleSheet.backgroundColor,
defaultColor: styleSheet.brandColor,
subColor: styleSheet.subColor,
semanticRed: styleSheet.paletteSemanticRed,
semanticGreen: styleSheet.paletteSemanticGreen,
padding: "auto",
fontFamily: styleSheet.fontFamily,
columnWidthRatio: 1 / 2,
maxColumnWidth: null,
minColumnWidth: null,
roseWidthRatio: 0.9999999,
multiplePieWidthRatio: 1 / 1.3,
colors10: styleSheet.paletteQualitative10,
colors20: styleSheet.paletteQualitative20,
sequenceColors: styleSheet.paletteSequence,
shapes: {
point: [
"hollow-circle",
"hollow-square",
"hollow-bowtie",
"hollow-diamond",
"hollow-hexagon",
"hollow-triangle",
"hollow-triangle-down",
"circle",
"square",
"bowtie",
"diamond",
"hexagon",
"triangle",
"triangle-down",
"cross",
"tick",
"plus",
"hyphen",
"line"
],
line: ["line", "dash", "dot", "smooth"],
area: ["area", "smooth", "line", "smooth-line"],
interval: ["rect", "hollow-rect", "line", "tick"]
},
sizes: [1, 10],
geometries: {
interval: {
rect: {
default: {
style: shapeStyles.interval.default
},
active: {
style: shapeStyles.interval.active
},
inactive: {
style: shapeStyles.interval.inactive
},
selected: {
style: function(element) {
var coordinate11 = element.geometry.coordinate;
if (coordinate11.isPolar && coordinate11.isTransposed) {
var _a7 = getAngle3(element.getModel(), coordinate11), startAngle = _a7.startAngle, endAngle = _a7.endAngle;
var middleAngle = (startAngle + endAngle) / 2;
var r4 = 7.5;
var x6 = r4 * Math.cos(middleAngle);
var y5 = r4 * Math.sin(middleAngle);
return {
matrix: ext_exports.transform(null, [["t", x6, y5]])
};
}
return shapeStyles.interval.selected;
}
}
},
"hollow-rect": {
default: {
style: shapeStyles.hollowInterval.default
},
active: {
style: shapeStyles.hollowInterval.active
},
inactive: {
style: shapeStyles.hollowInterval.inactive
},
selected: {
style: shapeStyles.hollowInterval.selected
}
},
line: {
default: {
style: shapeStyles.hollowInterval.default
},
active: {
style: shapeStyles.hollowInterval.active
},
inactive: {
style: shapeStyles.hollowInterval.inactive
},
selected: {
style: shapeStyles.hollowInterval.selected
}
},
tick: {
default: {
style: shapeStyles.hollowInterval.default
},
active: {
style: shapeStyles.hollowInterval.active
},
inactive: {
style: shapeStyles.hollowInterval.inactive
},
selected: {
style: shapeStyles.hollowInterval.selected
}
},
funnel: {
default: {
style: shapeStyles.interval.default
},
active: {
style: shapeStyles.interval.active
},
inactive: {
style: shapeStyles.interval.inactive
},
selected: {
style: shapeStyles.interval.selected
}
},
pyramid: {
default: {
style: shapeStyles.interval.default
},
active: {
style: shapeStyles.interval.active
},
inactive: {
style: shapeStyles.interval.inactive
},
selected: {
style: shapeStyles.interval.selected
}
}
},
line: {
line: {
default: {
style: shapeStyles.line.default
},
active: {
style: shapeStyles.line.active
},
inactive: {
style: shapeStyles.line.inactive
},
selected: {
style: shapeStyles.line.selected
}
},
dot: {
default: {
style: __assign(__assign({}, shapeStyles.line.default), { lineCap: null, lineDash: [1, 1] })
},
active: {
style: __assign(__assign({}, shapeStyles.line.active), { lineCap: null, lineDash: [1, 1] })
},
inactive: {
style: __assign(__assign({}, shapeStyles.line.inactive), { lineCap: null, lineDash: [1, 1] })
},
selected: {
style: __assign(__assign({}, shapeStyles.line.selected), { lineCap: null, lineDash: [1, 1] })
}
},
dash: {
default: {
style: __assign(__assign({}, shapeStyles.line.default), { lineCap: null, lineDash: [5.5, 1] })
},
active: {
style: __assign(__assign({}, shapeStyles.line.active), { lineCap: null, lineDash: [5.5, 1] })
},
inactive: {
style: __assign(__assign({}, shapeStyles.line.inactive), { lineCap: null, lineDash: [5.5, 1] })
},
selected: {
style: __assign(__assign({}, shapeStyles.line.selected), { lineCap: null, lineDash: [5.5, 1] })
}
},
smooth: {
default: {
style: shapeStyles.line.default
},
active: {
style: shapeStyles.line.active
},
inactive: {
style: shapeStyles.line.inactive
},
selected: {
style: shapeStyles.line.selected
}
},
hv: {
default: {
style: shapeStyles.line.default
},
active: {
style: shapeStyles.line.active
},
inactive: {
style: shapeStyles.line.inactive
},
selected: {
style: shapeStyles.line.selected
}
},
vh: {
default: {
style: shapeStyles.line.default
},
active: {
style: shapeStyles.line.active
},
inactive: {
style: shapeStyles.line.inactive
},
selected: {
style: shapeStyles.line.selected
}
},
hvh: {
default: {
style: shapeStyles.line.default
},
active: {
style: shapeStyles.line.active
},
inactive: {
style: shapeStyles.line.inactive
},
selected: {
style: shapeStyles.line.selected
}
},
vhv: {
default: {
style: shapeStyles.line.default
},
active: {
style: shapeStyles.line.active
},
inactive: {
style: shapeStyles.line.inactive
},
selected: {
style: shapeStyles.line.selected
}
}
},
polygon: {
polygon: {
default: {
style: shapeStyles.interval.default
},
active: {
style: shapeStyles.interval.active
},
inactive: {
style: shapeStyles.interval.inactive
},
selected: {
style: shapeStyles.interval.selected
}
}
},
point: {
circle: {
default: {
style: shapeStyles.point.default
},
active: {
style: shapeStyles.point.active
},
inactive: {
style: shapeStyles.point.inactive
},
selected: {
style: shapeStyles.point.selected
}
},
square: {
default: {
style: shapeStyles.point.default
},
active: {
style: shapeStyles.point.active
},
inactive: {
style: shapeStyles.point.inactive
},
selected: {
style: shapeStyles.point.selected
}
},
bowtie: {
default: {
style: shapeStyles.point.default
},
active: {
style: shapeStyles.point.active
},
inactive: {
style: shapeStyles.point.inactive
},
selected: {
style: shapeStyles.point.selected
}
},
diamond: {
default: {
style: shapeStyles.point.default
},
active: {
style: shapeStyles.point.active
},
inactive: {
style: shapeStyles.point.inactive
},
selected: {
style: shapeStyles.point.selected
}
},
hexagon: {
default: {
style: shapeStyles.point.default
},
active: {
style: shapeStyles.point.active
},
inactive: {
style: shapeStyles.point.inactive
},
selected: {
style: shapeStyles.point.selected
}
},
triangle: {
default: {
style: shapeStyles.point.default
},
active: {
style: shapeStyles.point.active
},
inactive: {
style: shapeStyles.point.inactive
},
selected: {
style: shapeStyles.point.selected
}
},
"triangle-down": {
default: {
style: shapeStyles.point.default
},
active: {
style: shapeStyles.point.active
},
inactive: {
style: shapeStyles.point.inactive
},
selected: {
style: shapeStyles.point.selected
}
},
"hollow-circle": {
default: {
style: shapeStyles.hollowPoint.default
},
active: {
style: shapeStyles.hollowPoint.active
},
inactive: {
style: shapeStyles.hollowPoint.inactive
},
selected: {
style: shapeStyles.hollowPoint.selected
}
},
"hollow-square": {
default: {
style: shapeStyles.hollowPoint.default
},
active: {
style: shapeStyles.hollowPoint.active
},
inactive: {
style: shapeStyles.hollowPoint.inactive
},
selected: {
style: shapeStyles.hollowPoint.selected
}
},
"hollow-bowtie": {
default: {
style: shapeStyles.hollowPoint.default
},
active: {
style: shapeStyles.hollowPoint.active
},
inactive: {
style: shapeStyles.hollowPoint.inactive
},
selected: {
style: shapeStyles.hollowPoint.selected
}
},
"hollow-diamond": {
default: {
style: shapeStyles.hollowPoint.default
},
active: {
style: shapeStyles.hollowPoint.active
},
inactive: {
style: shapeStyles.hollowPoint.inactive
},
selected: {
style: shapeStyles.hollowPoint.selected
}
},
"hollow-hexagon": {
default: {
style: shapeStyles.hollowPoint.default
},
active: {
style: shapeStyles.hollowPoint.active
},
inactive: {
style: shapeStyles.hollowPoint.inactive
},
selected: {
style: shapeStyles.hollowPoint.selected
}
},
"hollow-triangle": {
default: {
style: shapeStyles.hollowPoint.default
},
active: {
style: shapeStyles.hollowPoint.active
},
inactive: {
style: shapeStyles.hollowPoint.inactive
},
selected: {
style: shapeStyles.hollowPoint.selected
}
},
"hollow-triangle-down": {
default: {
style: shapeStyles.hollowPoint.default
},
active: {
style: shapeStyles.hollowPoint.active
},
inactive: {
style: shapeStyles.hollowPoint.inactive
},
selected: {
style: shapeStyles.hollowPoint.selected
}
},
cross: {
default: {
style: shapeStyles.hollowPoint.default
},
active: {
style: shapeStyles.hollowPoint.active
},
inactive: {
style: shapeStyles.hollowPoint.inactive
},
selected: {
style: shapeStyles.hollowPoint.selected
}
},
tick: {
default: {
style: shapeStyles.hollowPoint.default
},
active: {
style: shapeStyles.hollowPoint.active
},
inactive: {
style: shapeStyles.hollowPoint.inactive
},
selected: {
style: shapeStyles.hollowPoint.selected
}
},
plus: {
default: {
style: shapeStyles.hollowPoint.default
},
active: {
style: shapeStyles.hollowPoint.active
},
inactive: {
style: shapeStyles.hollowPoint.inactive
},
selected: {
style: shapeStyles.hollowPoint.selected
}
},
hyphen: {
default: {
style: shapeStyles.hollowPoint.default
},
active: {
style: shapeStyles.hollowPoint.active
},
inactive: {
style: shapeStyles.hollowPoint.inactive
},
selected: {
style: shapeStyles.hollowPoint.selected
}
},
line: {
default: {
style: shapeStyles.hollowPoint.default
},
active: {
style: shapeStyles.hollowPoint.active
},
inactive: {
style: shapeStyles.hollowPoint.inactive
},
selected: {
style: shapeStyles.hollowPoint.selected
}
}
},
area: {
area: {
default: {
style: shapeStyles.area.default
},
active: {
style: shapeStyles.area.active
},
inactive: {
style: shapeStyles.area.inactive
},
selected: {
style: shapeStyles.area.selected
}
},
smooth: {
default: {
style: shapeStyles.area.default
},
active: {
style: shapeStyles.area.active
},
inactive: {
style: shapeStyles.area.inactive
},
selected: {
style: shapeStyles.area.selected
}
},
line: {
default: {
style: shapeStyles.hollowArea.default
},
active: {
style: shapeStyles.hollowArea.active
},
inactive: {
style: shapeStyles.hollowArea.inactive
},
selected: {
style: shapeStyles.hollowArea.selected
}
},
"smooth-line": {
default: {
style: shapeStyles.hollowArea.default
},
active: {
style: shapeStyles.hollowArea.active
},
inactive: {
style: shapeStyles.hollowArea.inactive
},
selected: {
style: shapeStyles.hollowArea.selected
}
}
},
schema: {
candle: {
default: {
style: shapeStyles.hollowInterval.default
},
active: {
style: shapeStyles.hollowInterval.active
},
inactive: {
style: shapeStyles.hollowInterval.inactive
},
selected: {
style: shapeStyles.hollowInterval.selected
}
},
box: {
default: {
style: shapeStyles.hollowInterval.default
},
active: {
style: shapeStyles.hollowInterval.active
},
inactive: {
style: shapeStyles.hollowInterval.inactive
},
selected: {
style: shapeStyles.hollowInterval.selected
}
}
},
edge: {
line: {
default: {
style: shapeStyles.line.default
},
active: {
style: shapeStyles.line.active
},
inactive: {
style: shapeStyles.line.inactive
},
selected: {
style: shapeStyles.line.selected
}
},
vhv: {
default: {
style: shapeStyles.line.default
},
active: {
style: shapeStyles.line.active
},
inactive: {
style: shapeStyles.line.inactive
},
selected: {
style: shapeStyles.line.selected
}
},
smooth: {
default: {
style: shapeStyles.line.default
},
active: {
style: shapeStyles.line.active
},
inactive: {
style: shapeStyles.line.inactive
},
selected: {
style: shapeStyles.line.selected
}
},
arc: {
default: {
style: shapeStyles.line.default
},
active: {
style: shapeStyles.line.active
},
inactive: {
style: shapeStyles.line.inactive
},
selected: {
style: shapeStyles.line.selected
}
}
},
violin: {
violin: {
default: {
style: shapeStyles.line.default
},
active: {
style: shapeStyles.line.active
},
inactive: {
style: shapeStyles.line.inactive
},
selected: {
style: shapeStyles.line.selected
}
},
smooth: {
default: {
style: shapeStyles.line.default
},
active: {
style: shapeStyles.line.active
},
inactive: {
style: shapeStyles.line.inactive
},
selected: {
style: shapeStyles.line.selected
}
},
hollow: {
default: {
style: shapeStyles.hollowArea.default
},
active: {
style: shapeStyles.hollowArea.active
},
inactive: {
style: shapeStyles.hollowArea.inactive
},
selected: {
style: shapeStyles.hollowArea.selected
}
},
"hollow-smooth": {
default: {
style: shapeStyles.hollowArea.default
},
active: {
style: shapeStyles.hollowArea.active
},
inactive: {
style: shapeStyles.hollowArea.inactive
},
selected: {
style: shapeStyles.hollowArea.selected
}
}
}
},
components: {
axis: {
common: axisStyles,
top: {
position: "top",
grid: null,
title: null,
verticalLimitLength: 1 / 2
},
bottom: {
position: "bottom",
grid: null,
title: null,
verticalLimitLength: 1 / 2
},
left: {
position: "left",
title: null,
line: null,
tickLine: null,
verticalLimitLength: 1 / 3
},
right: {
position: "right",
title: null,
line: null,
tickLine: null,
verticalLimitLength: 1 / 3
},
circle: {
title: null,
grid: deep_mix_default({}, axisStyles.grid, { line: { type: "line" } })
},
radius: {
title: null,
grid: deep_mix_default({}, axisStyles.grid, { line: { type: "circle" } })
}
},
legend: {
common: legendStyles,
right: {
layout: "vertical",
padding: styleSheet.legendVerticalPadding
},
left: {
layout: "vertical",
padding: styleSheet.legendVerticalPadding
},
top: {
layout: "horizontal",
padding: styleSheet.legendHorizontalPadding
},
bottom: {
layout: "horizontal",
padding: styleSheet.legendHorizontalPadding
},
continuous: {
title: null,
background: null,
track: {},
rail: {
type: "color",
size: styleSheet.sliderRailHeight,
defaultLength: styleSheet.sliderRailWidth,
style: {
fill: styleSheet.sliderRailFillColor,
stroke: styleSheet.sliderRailBorderColor,
lineWidth: styleSheet.sliderRailBorder
}
},
label: {
align: "rail",
spacing: 4,
formatter: null,
style: {
fill: styleSheet.sliderLabelTextFillColor,
fontSize: styleSheet.sliderLabelTextFontSize,
lineHeight: styleSheet.sliderLabelTextLineHeight,
textBaseline: "middle",
fontFamily: styleSheet.fontFamily
}
},
handler: {
size: styleSheet.sliderHandlerWidth,
style: {
fill: styleSheet.sliderHandlerFillColor,
stroke: styleSheet.sliderHandlerBorderColor
}
},
slidable: true,
padding: legendStyles.padding
}
},
tooltip: {
showContent: true,
follow: true,
showCrosshairs: false,
showMarkers: true,
shared: false,
enterable: false,
position: "auto",
marker: {
symbol: "circle",
stroke: "#fff",
shadowBlur: 10,
shadowOffsetX: 0,
shadowOffsetY: 0,
shadowColor: "rgba(0,0,0,0.09)",
lineWidth: 2,
r: 4
},
crosshairs: {
line: {
style: {
stroke: styleSheet.tooltipCrosshairsBorderColor,
lineWidth: styleSheet.tooltipCrosshairsBorder
}
},
text: null,
textBackground: {
padding: 2,
style: {
fill: "rgba(0, 0, 0, 0.25)",
lineWidth: 0,
stroke: null
}
},
follow: false
},
domStyles: (_a6 = {}, _a6["".concat(css_const_exports.CONTAINER_CLASS)] = {
position: "absolute",
visibility: "hidden",
zIndex: 8,
transition: "left 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s, top 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s",
backgroundColor: styleSheet.tooltipContainerFillColor,
opacity: styleSheet.tooltipContainerFillOpacity,
boxShadow: styleSheet.tooltipContainerShadow,
borderRadius: "".concat(styleSheet.tooltipContainerBorderRadius, "px"),
color: styleSheet.tooltipTextFillColor,
fontSize: "".concat(styleSheet.tooltipTextFontSize, "px"),
fontFamily: styleSheet.fontFamily,
lineHeight: "".concat(styleSheet.tooltipTextLineHeight, "px"),
padding: "0 12px 0 12px"
}, _a6["".concat(css_const_exports.TITLE_CLASS)] = {
marginBottom: "12px",
marginTop: "12px"
}, _a6["".concat(css_const_exports.LIST_CLASS)] = {
margin: 0,
listStyleType: "none",
padding: 0
}, _a6["".concat(css_const_exports.LIST_ITEM_CLASS)] = {
listStyleType: "none",
padding: 0,
marginBottom: "12px",
marginTop: "12px",
marginLeft: 0,
marginRight: 0
}, _a6["".concat(css_const_exports.MARKER_CLASS)] = {
width: "8px",
height: "8px",
borderRadius: "50%",
display: "inline-block",
marginRight: "8px"
}, _a6["".concat(css_const_exports.VALUE_CLASS)] = {
display: "inline-block",
float: "right",
marginLeft: "30px"
}, _a6)
},
annotation: {
arc: {
style: {
stroke: styleSheet.annotationArcBorderColor,
lineWidth: styleSheet.annotationArcBorder
},
animate: true
},
line: {
style: {
stroke: styleSheet.annotationLineBorderColor,
lineDash: styleSheet.annotationLineDash,
lineWidth: styleSheet.annotationLineBorder
},
text: {
position: "start",
autoRotate: true,
style: {
fill: styleSheet.annotationTextFillColor,
stroke: styleSheet.annotationTextBorderColor,
lineWidth: styleSheet.annotationTextBorder,
fontSize: styleSheet.annotationTextFontSize,
textAlign: "start",
fontFamily: styleSheet.fontFamily,
textBaseline: "bottom"
}
},
animate: true
},
text: {
style: {
fill: styleSheet.annotationTextFillColor,
stroke: styleSheet.annotationTextBorderColor,
lineWidth: styleSheet.annotationTextBorder,
fontSize: styleSheet.annotationTextFontSize,
textBaseline: "middle",
textAlign: "start",
fontFamily: styleSheet.fontFamily
},
animate: true
},
region: {
top: false,
style: {
lineWidth: styleSheet.annotationRegionBorder,
stroke: styleSheet.annotationRegionBorderColor,
fill: styleSheet.annotationRegionFillColor,
fillOpacity: styleSheet.annotationRegionFillOpacity
},
animate: true
},
image: {
top: false,
animate: true
},
dataMarker: {
top: true,
point: {
style: {
r: 3,
stroke: styleSheet.brandColor,
lineWidth: 2
}
},
line: {
style: {
stroke: styleSheet.annotationLineBorderColor,
lineWidth: styleSheet.annotationLineBorder
},
length: styleSheet.annotationDataMarkerLineLength
},
text: {
style: {
textAlign: "start",
fill: styleSheet.annotationTextFillColor,
stroke: styleSheet.annotationTextBorderColor,
lineWidth: styleSheet.annotationTextBorder,
fontSize: styleSheet.annotationTextFontSize,
fontFamily: styleSheet.fontFamily
}
},
direction: "upward",
autoAdjust: true,
animate: true
},
dataRegion: {
style: {
region: {
fill: styleSheet.annotationRegionFillColor,
fillOpacity: styleSheet.annotationRegionFillOpacity
},
text: {
textAlign: "center",
textBaseline: "bottom",
fill: styleSheet.annotationTextFillColor,
stroke: styleSheet.annotationTextBorderColor,
lineWidth: styleSheet.annotationTextBorder,
fontSize: styleSheet.annotationTextFontSize,
fontFamily: styleSheet.fontFamily
}
},
animate: true
}
},
slider: {
common: {
padding: [8, 8, 8, 8],
backgroundStyle: {
fill: styleSheet.cSliderBackgroundFillColor,
opacity: styleSheet.cSliderBackgroundFillOpacity
},
foregroundStyle: {
fill: styleSheet.cSliderForegroundFillColor,
opacity: styleSheet.cSliderForegroundFillOpacity
},
handlerStyle: {
width: styleSheet.cSliderHandlerWidth,
height: styleSheet.cSliderHandlerHeight,
fill: styleSheet.cSliderHandlerFillColor,
opacity: styleSheet.cSliderHandlerFillOpacity,
stroke: styleSheet.cSliderHandlerBorderColor,
lineWidth: styleSheet.cSliderHandlerBorder,
radius: styleSheet.cSliderHandlerBorderRadius,
highLightFill: styleSheet.cSliderHandlerHighlightFillColor
},
textStyle: {
fill: styleSheet.cSliderTextFillColor,
opacity: styleSheet.cSliderTextFillOpacity,
fontSize: styleSheet.cSliderTextFontSize,
lineHeight: styleSheet.cSliderTextLineHeight,
fontWeight: styleSheet.cSliderTextFontWeight,
stroke: styleSheet.cSliderTextBorderColor,
lineWidth: styleSheet.cSliderTextBorder
}
}
},
scrollbar: {
common: {
padding: [8, 8, 8, 8]
},
default: {
style: {
trackColor: styleSheet.scrollbarTrackFillColor,
thumbColor: styleSheet.scrollbarThumbFillColor
}
},
hover: {
style: {
thumbColor: styleSheet.scrollbarThumbHighlightFillColor
}
}
}
},
labels: {
offset: 12,
style: {
fill: styleSheet.labelFillColor,
fontSize: styleSheet.labelFontSize,
fontFamily: styleSheet.fontFamily,
stroke: styleSheet.labelBorderColor,
lineWidth: styleSheet.labelBorder
},
fillColorDark: styleSheet.labelFillColorDark,
fillColorLight: styleSheet.labelFillColorLight,
autoRotate: true
},
innerLabels: {
style: {
fill: styleSheet.innerLabelFillColor,
fontSize: styleSheet.innerLabelFontSize,
fontFamily: styleSheet.fontFamily,
stroke: styleSheet.innerLabelBorderColor,
lineWidth: styleSheet.innerLabelBorder
},
autoRotate: true
},
overflowLabels: {
style: {
fill: styleSheet.overflowLabelFillColor,
fontSize: styleSheet.overflowLabelFontSize,
fontFamily: styleSheet.fontFamily,
stroke: styleSheet.overflowLabelBorderColor,
lineWidth: styleSheet.overflowLabelBorder
}
},
pieLabels: {
labelHeight: 14,
offset: 10,
labelLine: {
style: {
lineWidth: styleSheet.labelLineBorder
}
},
autoRotate: true
}
};
}
// node_modules/@antv/g2/esm/theme/style-sheet/light.js
var BLACK_COLORS = {
100: "#000",
95: "#0D0D0D",
85: "#262626",
65: "#595959",
45: "#8C8C8C",
25: "#BFBFBF",
15: "#D9D9D9",
6: "#F0F0F0"
};
var WHITE_COLORS = {
100: "#FFFFFF",
95: "#F2F2F2",
85: "#D9D9D9",
65: "#A6A6A6",
45: "#737373",
25: "#404040",
15: "#262626",
6: "#0F0F0F"
};
var QUALITATIVE_10 = [
"#5B8FF9",
"#5AD8A6",
"#5D7092",
"#F6BD16",
"#6F5EF9",
"#6DC8EC",
"#945FB9",
"#FF9845",
"#1E9493",
"#FF99C3"
];
var QUALITATIVE_20 = [
"#5B8FF9",
"#CDDDFD",
"#5AD8A6",
"#CDF3E4",
"#5D7092",
"#CED4DE",
"#F6BD16",
"#FCEBB9",
"#6F5EF9",
"#D3CEFD",
"#6DC8EC",
"#D3EEF9",
"#945FB9",
"#DECFEA",
"#FF9845",
"#FFE0C7",
"#1E9493",
"#BBDEDE",
"#FF99C3",
"#FFE0ED"
];
var SINGLE_SEQUENCE = [
"#B8E1FF",
"#9AC5FF",
"#7DAAFF",
"#5B8FF9",
"#3D76DD",
"#085EC0",
"#0047A5",
"#00318A",
"#001D70"
];
var createLightStyleSheet = function(cfg) {
if (cfg === void 0) {
cfg = {};
}
var _a6 = cfg.backgroundColor, backgroundColor = _a6 === void 0 ? "transparent" : _a6, _b = cfg.subColor, subColor = _b === void 0 ? "rgba(0,0,0,0.05)" : _b, _c = cfg.paletteQualitative10, paletteQualitative10 = _c === void 0 ? QUALITATIVE_10 : _c, _d = cfg.paletteQualitative20, paletteQualitative20 = _d === void 0 ? QUALITATIVE_20 : _d, _e = cfg.paletteSemanticRed, paletteSemanticRed = _e === void 0 ? "#F4664A" : _e, _f = cfg.paletteSemanticGreen, paletteSemanticGreen = _f === void 0 ? "#30BF78" : _f, _g = cfg.paletteSemanticYellow, paletteSemanticYellow = _g === void 0 ? "#FAAD14" : _g, _h = cfg.paletteSequence, paletteSequence = _h === void 0 ? SINGLE_SEQUENCE : _h, _j = cfg.fontFamily, fontFamily = _j === void 0 ? '"Segoe UI", Roboto, "Helvetica Neue", Arial,\n "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",\n "Noto Color Emoji"' : _j;
var _k = cfg.brandColor, brandColor = _k === void 0 ? paletteQualitative10[0] : _k;
return {
backgroundColor,
brandColor,
subColor,
paletteQualitative10,
paletteQualitative20,
paletteSemanticRed,
paletteSemanticGreen,
paletteSemanticYellow,
paletteSequence,
fontFamily,
axisLineBorderColor: BLACK_COLORS[25],
axisLineBorder: 1,
axisLineDash: null,
axisTitleTextFillColor: BLACK_COLORS[65],
axisTitleTextFontSize: 12,
axisTitleTextLineHeight: 12,
axisTitleTextFontWeight: "normal",
axisTitleSpacing: 12,
axisTickLineBorderColor: BLACK_COLORS[25],
axisTickLineLength: 4,
axisTickLineBorder: 1,
axisSubTickLineBorderColor: BLACK_COLORS[15],
axisSubTickLineLength: 2,
axisSubTickLineBorder: 1,
axisLabelFillColor: BLACK_COLORS[45],
axisLabelFontSize: 12,
axisLabelLineHeight: 12,
axisLabelFontWeight: "normal",
axisLabelOffset: 8,
axisGridBorderColor: BLACK_COLORS[15],
axisGridBorder: 1,
axisGridLineDash: null,
legendTitleTextFillColor: BLACK_COLORS[45],
legendTitleTextFontSize: 12,
legendTitleTextLineHeight: 21,
legendTitleTextFontWeight: "normal",
legendMarkerColor: brandColor,
legendMarkerSpacing: 8,
legendMarkerSize: 4,
legendCircleMarkerSize: 4,
legendSquareMarkerSize: 4,
legendLineMarkerSize: 5,
legendItemNameFillColor: BLACK_COLORS[65],
legendItemNameFontSize: 12,
legendItemNameLineHeight: 12,
legendItemNameFontWeight: "normal",
legendItemSpacing: 24,
legendItemMarginBottom: 12,
legendPadding: [8, 8, 8, 8],
legendHorizontalPadding: [8, 0, 8, 0],
legendVerticalPadding: [0, 8, 0, 8],
legendPageNavigatorMarkerSize: 12,
legendPageNavigatorMarkerInactiveFillColor: BLACK_COLORS[100],
legendPageNavigatorMarkerInactiveFillOpacity: 0.45,
legendPageNavigatorMarkerFillColor: BLACK_COLORS[100],
legendPageNavigatorMarkerFillOpacity: 1,
legendPageNavigatorTextFillColor: BLACK_COLORS[45],
legendPageNavigatorTextFontSize: 12,
sliderRailFillColor: BLACK_COLORS[15],
sliderRailBorder: 0,
sliderRailBorderColor: null,
sliderRailWidth: 100,
sliderRailHeight: 12,
sliderLabelTextFillColor: BLACK_COLORS[45],
sliderLabelTextFontSize: 12,
sliderLabelTextLineHeight: 12,
sliderLabelTextFontWeight: "normal",
sliderHandlerFillColor: BLACK_COLORS[6],
sliderHandlerWidth: 10,
sliderHandlerHeight: 14,
sliderHandlerBorder: 1,
sliderHandlerBorderColor: BLACK_COLORS[25],
annotationArcBorderColor: BLACK_COLORS[15],
annotationArcBorder: 1,
annotationLineBorderColor: BLACK_COLORS[25],
annotationLineBorder: 1,
annotationLineDash: null,
annotationTextFillColor: BLACK_COLORS[65],
annotationTextFontSize: 12,
annotationTextLineHeight: 12,
annotationTextFontWeight: "normal",
annotationTextBorderColor: null,
annotationTextBorder: 0,
annotationRegionFillColor: BLACK_COLORS[100],
annotationRegionFillOpacity: 0.06,
annotationRegionBorder: 0,
annotationRegionBorderColor: null,
annotationDataMarkerLineLength: 16,
tooltipCrosshairsBorderColor: BLACK_COLORS[25],
tooltipCrosshairsBorder: 1,
tooltipCrosshairsLineDash: null,
tooltipContainerFillColor: "rgb(255, 255, 255)",
tooltipContainerFillOpacity: 0.95,
tooltipContainerShadow: "0px 0px 10px #aeaeae",
tooltipContainerBorderRadius: 3,
tooltipTextFillColor: BLACK_COLORS[65],
tooltipTextFontSize: 12,
tooltipTextLineHeight: 12,
tooltipTextFontWeight: "bold",
labelFillColor: BLACK_COLORS[65],
labelFillColorDark: "#2c3542",
labelFillColorLight: "#ffffff",
labelFontSize: 12,
labelLineHeight: 12,
labelFontWeight: "normal",
labelBorderColor: null,
labelBorder: 0,
innerLabelFillColor: WHITE_COLORS[100],
innerLabelFontSize: 12,
innerLabelLineHeight: 12,
innerLabelFontWeight: "normal",
innerLabelBorderColor: null,
innerLabelBorder: 0,
overflowLabelFillColor: BLACK_COLORS[65],
overflowLabelFontSize: 12,
overflowLabelLineHeight: 12,
overflowLabelFontWeight: "normal",
overflowLabelBorderColor: WHITE_COLORS[100],
overflowLabelBorder: 1,
labelLineBorder: 1,
labelLineBorderColor: BLACK_COLORS[25],
cSliderRailHieght: 16,
cSliderBackgroundFillColor: "#416180",
cSliderBackgroundFillOpacity: 0.05,
cSliderForegroundFillColor: "#5B8FF9",
cSliderForegroundFillOpacity: 0.15,
cSliderHandlerHeight: 24,
cSliderHandlerWidth: 10,
cSliderHandlerFillColor: "#F7F7F7",
cSliderHandlerFillOpacity: 1,
cSliderHandlerHighlightFillColor: "#FFF",
cSliderHandlerBorderColor: "#BFBFBF",
cSliderHandlerBorder: 1,
cSliderHandlerBorderRadius: 2,
cSliderTextFillColor: "#000",
cSliderTextFillOpacity: 0.45,
cSliderTextFontSize: 12,
cSliderTextLineHeight: 12,
cSliderTextFontWeight: "normal",
cSliderTextBorderColor: null,
cSliderTextBorder: 0,
scrollbarTrackFillColor: "rgba(0,0,0,0)",
scrollbarThumbFillColor: "rgba(0,0,0,0.15)",
scrollbarThumbHighlightFillColor: "rgba(0,0,0,0.2)",
pointFillColor: brandColor,
pointFillOpacity: 0.95,
pointSize: 4,
pointBorder: 1,
pointBorderColor: WHITE_COLORS[100],
pointBorderOpacity: 1,
pointActiveBorderColor: BLACK_COLORS[100],
pointSelectedBorder: 2,
pointSelectedBorderColor: BLACK_COLORS[100],
pointInactiveFillOpacity: 0.3,
pointInactiveBorderOpacity: 0.3,
hollowPointSize: 4,
hollowPointBorder: 1,
hollowPointBorderColor: brandColor,
hollowPointBorderOpacity: 0.95,
hollowPointFillColor: WHITE_COLORS[100],
hollowPointActiveBorder: 1,
hollowPointActiveBorderColor: BLACK_COLORS[100],
hollowPointActiveBorderOpacity: 1,
hollowPointSelectedBorder: 2,
hollowPointSelectedBorderColor: BLACK_COLORS[100],
hollowPointSelectedBorderOpacity: 1,
hollowPointInactiveBorderOpacity: 0.3,
lineBorder: 2,
lineBorderColor: brandColor,
lineBorderOpacity: 1,
lineActiveBorder: 3,
lineSelectedBorder: 3,
lineInactiveBorderOpacity: 0.3,
areaFillColor: brandColor,
areaFillOpacity: 0.25,
areaActiveFillColor: brandColor,
areaActiveFillOpacity: 0.5,
areaSelectedFillColor: brandColor,
areaSelectedFillOpacity: 0.5,
areaInactiveFillOpacity: 0.3,
hollowAreaBorderColor: brandColor,
hollowAreaBorder: 2,
hollowAreaBorderOpacity: 1,
hollowAreaActiveBorder: 3,
hollowAreaActiveBorderColor: BLACK_COLORS[100],
hollowAreaSelectedBorder: 3,
hollowAreaSelectedBorderColor: BLACK_COLORS[100],
hollowAreaInactiveBorderOpacity: 0.3,
intervalFillColor: brandColor,
intervalFillOpacity: 0.95,
intervalActiveBorder: 1,
intervalActiveBorderColor: BLACK_COLORS[100],
intervalActiveBorderOpacity: 1,
intervalSelectedBorder: 2,
intervalSelectedBorderColor: BLACK_COLORS[100],
intervalSelectedBorderOpacity: 1,
intervalInactiveBorderOpacity: 0.3,
intervalInactiveFillOpacity: 0.3,
hollowIntervalBorder: 2,
hollowIntervalBorderColor: brandColor,
hollowIntervalBorderOpacity: 1,
hollowIntervalFillColor: WHITE_COLORS[100],
hollowIntervalActiveBorder: 2,
hollowIntervalActiveBorderColor: BLACK_COLORS[100],
hollowIntervalSelectedBorder: 3,
hollowIntervalSelectedBorderColor: BLACK_COLORS[100],
hollowIntervalSelectedBorderOpacity: 1,
hollowIntervalInactiveBorderOpacity: 0.3
};
};
var antvLight = createLightStyleSheet();
// node_modules/@antv/g2/esm/theme/util/create-theme.js
function createTheme(themeCfg) {
var _a6 = themeCfg.styleSheet, styleSheetCfg = _a6 === void 0 ? {} : _a6, themeObject = __rest(themeCfg, ["styleSheet"]);
var styleSheet = createLightStyleSheet(styleSheetCfg);
return deep_mix_default({}, createThemeByStyleSheet(styleSheet), themeObject);
}
// node_modules/@antv/g2/esm/theme/index.js
var defaultTheme = createTheme({});
var Themes = {
default: defaultTheme
};
function getTheme(theme4) {
return get_default(Themes, lower_case_default(theme4), Themes.default);
}
function registerTheme(theme4, value2) {
Themes[lower_case_default(theme4)] = createTheme(value2);
}
// node_modules/@antv/g2/esm/util/tooltip.js
function snapEqual(v1, v22, scale12) {
var value1 = scale12.translate(v1);
var value2 = scale12.translate(v22);
return isNumberEqual(value1, value2);
}
function getXValueByPoint(point2, geometry35) {
var coordinate11 = geometry35.coordinate;
var xScale = geometry35.getXScale();
var range = xScale.range;
var rangeMax = range[range.length - 1];
var rangeMin = range[0];
var invertPoint = coordinate11.invert(point2);
var xValue = invertPoint.x;
if (coordinate11.isPolar && xValue > (1 + rangeMax) / 2) {
xValue = rangeMin;
}
return xScale.translate(xScale.invert(xValue));
}
function filterYValue(data3, point2, geometry35) {
var coordinate11 = geometry35.coordinate;
var yScale = geometry35.getYScale();
var yField = yScale.field;
var invertPoint = coordinate11.invert(point2);
var yValue = yScale.invert(invertPoint.y);
var result = find_default(data3, function(obj) {
var originData = obj[FIELD_ORIGIN];
return originData[yField][0] <= yValue && originData[yField][1] >= yValue;
});
return result || data3[data3.length - 1];
}
var getXDistance = memoize_default(function(scale12) {
if (scale12.isCategory) {
return 1;
}
var scaleValues = scale12.values;
var length5 = scaleValues.length;
var min7 = scale12.translate(scaleValues[0]);
var max8 = min7;
for (var index2 = 0; index2 < length5; index2++) {
var value2 = scaleValues[index2];
var numericValue = scale12.translate(value2);
if (numericValue < min7) {
min7 = numericValue;
}
if (numericValue > max8) {
max8 = numericValue;
}
}
return (max8 - min7) / (length5 - 1);
});
function getTooltipTitle(originData, geometry35, title) {
var positionAttr = geometry35.getAttribute("position");
var fields = positionAttr.getFields();
var scales = geometry35.scales;
var titleField = is_function_default(title) || !title ? fields[0] : title;
var titleScale = scales[titleField];
var tooltipTitle = titleScale ? titleScale.getText(originData[titleField]) : originData[titleField] || titleField;
return is_function_default(title) ? title(tooltipTitle, originData) : tooltipTitle;
}
function getAttributesForLegend(geometry35) {
var attributes = values_default(geometry35.attributes);
return filter_default(attributes, function(attribute) {
return contains_default(GROUP_ATTRS, attribute.type);
});
}
function getTooltipValueScale(geometry35) {
var attributes = getAttributesForLegend(geometry35);
var scale12;
for (var _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) {
var attribute = attributes_1[_i];
var tmpScale = attribute.getScale(attribute.type);
if (tmpScale && tmpScale.isLinear) {
scale12 = tmpScale;
break;
}
}
var xScale = geometry35.getXScale();
var yScale = geometry35.getYScale();
return scale12 || yScale || xScale;
}
function getTooltipValue(originData, valueScale) {
var field6 = valueScale.field;
var value2 = originData[field6];
if (is_array_default(value2)) {
var texts = value2.map(function(eachValue) {
return valueScale.getText(eachValue);
});
return texts.join("-");
}
return valueScale.getText(value2);
}
function getTooltipName(originData, geometry35) {
var nameScale;
var groupScales = geometry35.getGroupScales();
if (groupScales.length) {
nameScale = groupScales[0];
}
if (nameScale) {
var field6 = nameScale.field;
return nameScale.getText(originData[field6]);
}
var valueScale = getTooltipValueScale(geometry35);
return getName(valueScale);
}
function findDataByPoint(point2, data3, geometry35) {
if (data3.length === 0) {
return null;
}
var geometryType = geometry35.type;
var xScale = geometry35.getXScale();
var yScale = geometry35.getYScale();
var xField = xScale.field;
var yField = yScale.field;
var rst = null;
if (geometryType === "heatmap" || geometryType === "point") {
var coordinate11 = geometry35.coordinate;
var invertPoint = coordinate11.invert(point2);
var x6 = xScale.invert(invertPoint.x);
var y5 = yScale.invert(invertPoint.y);
var min7 = Infinity;
for (var index2 = 0; index2 < data3.length; index2++) {
var obj = data3[index2];
var originData = obj[FIELD_ORIGIN];
var range = Math.pow(originData[xField] - x6, 2) + Math.pow(originData[yField] - y5, 2);
if (range < min7) {
min7 = range;
rst = obj;
}
}
return rst;
}
var first = data3[0];
var last2 = data3[data3.length - 1];
var xValue = getXValueByPoint(point2, geometry35);
var firstXValue = first[FIELD_ORIGIN][xField];
var firstYValue = first[FIELD_ORIGIN][yField];
var lastXValue = last2[FIELD_ORIGIN][xField];
var isYArray = yScale.isLinear && is_array_default(firstYValue);
if (is_array_default(firstXValue)) {
for (var index2 = 0; index2 < data3.length; index2++) {
var record = data3[index2];
var originData = record[FIELD_ORIGIN];
if (xScale.translate(originData[xField][0]) <= xValue && xScale.translate(originData[xField][1]) >= xValue) {
if (isYArray) {
if (!is_array_default(rst)) {
rst = [];
}
rst.push(record);
} else {
rst = record;
break;
}
}
}
if (is_array_default(rst)) {
rst = filterYValue(rst, point2, geometry35);
}
} else {
var next = void 0;
if (!xScale.isLinear && xScale.type !== "timeCat") {
for (var index2 = 0; index2 < data3.length; index2++) {
var record = data3[index2];
var originData = record[FIELD_ORIGIN];
if (snapEqual(originData[xField], xValue, xScale)) {
if (isYArray) {
if (!is_array_default(rst)) {
rst = [];
}
rst.push(record);
} else {
rst = record;
break;
}
} else if (xScale.translate(originData[xField]) <= xValue) {
last2 = record;
next = data3[index2 + 1];
}
}
if (is_array_default(rst)) {
rst = filterYValue(rst, point2, geometry35);
}
} else {
if ((xValue > xScale.translate(lastXValue) || xValue < xScale.translate(firstXValue)) && (xValue > xScale.max || xValue < xScale.min)) {
return null;
}
var firstIdx = 0;
var lastIdx = data3.length - 1;
var middleIdx = void 0;
while (firstIdx <= lastIdx) {
middleIdx = Math.floor((firstIdx + lastIdx) / 2);
var item = data3[middleIdx][FIELD_ORIGIN][xField];
if (snapEqual(item, xValue, xScale)) {
return data3[middleIdx];
}
if (xScale.translate(item) <= xScale.translate(xValue)) {
firstIdx = middleIdx + 1;
last2 = data3[middleIdx];
next = data3[middleIdx + 1];
} else {
if (lastIdx === 0) {
last2 = data3[0];
}
lastIdx = middleIdx - 1;
}
}
}
if (last2 && next) {
if (Math.abs(xScale.translate(last2[FIELD_ORIGIN][xField]) - xValue) > Math.abs(xScale.translate(next[FIELD_ORIGIN][xField]) - xValue)) {
last2 = next;
}
}
}
var distance15 = getXDistance(geometry35.getXScale());
if (!rst && Math.abs(xScale.translate(last2[FIELD_ORIGIN][xField]) - xValue) <= distance15 / 2) {
rst = last2;
}
return rst;
}
function getTooltipItems(data3, geometry35, title, showNil) {
if (title === void 0) {
title = "";
}
if (showNil === void 0) {
showNil = false;
}
var originData = data3[FIELD_ORIGIN];
var tooltipTitle = getTooltipTitle(originData, geometry35, title);
var tooltipOption = geometry35.tooltipOption;
var defaultColor = geometry35.theme.defaultColor;
var items = [];
var name;
var value2;
function addItem(itemName, itemValue) {
if (showNil || !is_nil_default(itemValue) && itemValue !== "") {
var item = {
title: tooltipTitle,
data: originData,
mappingData: data3,
name: itemName,
value: itemValue,
color: data3.color || defaultColor,
marker: true
};
items.push(item);
}
}
if (is_object_default(tooltipOption)) {
var fields = tooltipOption.fields, callback = tooltipOption.callback;
if (callback) {
var callbackParams = fields.map(function(field7) {
return data3[FIELD_ORIGIN][field7];
});
var cfg = callback.apply(void 0, callbackParams);
var itemCfg = __assign({ data: data3[FIELD_ORIGIN], mappingData: data3, title: tooltipTitle, color: data3.color || defaultColor, marker: true }, cfg);
items.push(itemCfg);
} else {
var scales = geometry35.scales;
for (var _i = 0, fields_1 = fields; _i < fields_1.length; _i++) {
var field6 = fields_1[_i];
if (!is_nil_default(originData[field6])) {
var scale12 = scales[field6];
name = getName(scale12);
value2 = scale12.getText(originData[field6]);
addItem(name, value2);
}
}
}
} else {
var valueScale = getTooltipValueScale(geometry35);
value2 = getTooltipValue(originData, valueScale);
name = getTooltipName(originData, geometry35);
addItem(name, value2);
}
return items;
}
function getTooltipItemsByFindData(geometry35, point2, title, tooltipCfg) {
var showNil = tooltipCfg.showNil;
var result = [];
var dataArray = geometry35.dataArray;
if (!is_empty_default(dataArray)) {
geometry35.sort(dataArray);
for (var _i = 0, dataArray_1 = dataArray; _i < dataArray_1.length; _i++) {
var data3 = dataArray_1[_i];
var record = findDataByPoint(point2, data3, geometry35);
if (record) {
var elementId = geometry35.getElementId(record);
var element = geometry35.elementsMap[elementId];
if (geometry35.type === "heatmap" || element.visible) {
var items = getTooltipItems(record, geometry35, title, showNil);
if (items.length) {
result.push(items);
}
}
}
}
}
return result;
}
function getTooltipItemsByHitShape(geometry35, point2, title, tooltipCfg) {
var showNil = tooltipCfg.showNil;
var result = [];
var container2 = geometry35.container;
var shape = container2.getShape(point2.x, point2.y);
if (shape && shape.get("visible") && shape.get("origin")) {
var mappingData = shape.get("origin").mappingData;
var items = getTooltipItems(mappingData, geometry35, title, showNil);
if (items.length) {
result.push(items);
}
}
return result;
}
function findItemsFromView(view, point2, tooltipCfg) {
var result = [];
var geometries = view.geometries;
var shared = tooltipCfg.shared, title = tooltipCfg.title, reversed = tooltipCfg.reversed;
for (var _i = 0, geometries_1 = geometries; _i < geometries_1.length; _i++) {
var geometry35 = geometries_1[_i];
if (geometry35.visible && geometry35.tooltipOption !== false) {
var geometryType = geometry35.type;
var tooltipItems = void 0;
if (["point", "edge", "polygon"].includes(geometryType)) {
tooltipItems = getTooltipItemsByHitShape(geometry35, point2, title, tooltipCfg);
} else if (["area", "line", "path", "heatmap"].includes(geometryType)) {
tooltipItems = getTooltipItemsByFindData(geometry35, point2, title, tooltipCfg);
} else {
if (shared !== false) {
tooltipItems = getTooltipItemsByFindData(geometry35, point2, title, tooltipCfg);
} else {
tooltipItems = getTooltipItemsByHitShape(geometry35, point2, title, tooltipCfg);
}
}
if (tooltipItems.length) {
if (reversed) {
tooltipItems.reverse();
}
result.push(tooltipItems);
}
}
}
return result;
}
function findItemsFromViewRecurisive(view, point2, tooltipCfg) {
var result = findItemsFromView(view, point2, tooltipCfg);
for (var _i = 0, _a6 = view.views; _i < _a6.length; _i++) {
var childView = _a6[_i];
result = result.concat(findItemsFromView(childView, point2, tooltipCfg));
}
return result;
}
// node_modules/@antv/g2/esm/util/padding.js
function isAutoPadding(padding3) {
return !is_number_default(padding3) && !is_array_default(padding3);
}
function parsePadding(padding3) {
if (padding3 === void 0) {
padding3 = 0;
}
var paddingArray = is_array_default(padding3) ? padding3 : [padding3];
switch (paddingArray.length) {
case 0:
paddingArray = [0, 0, 0, 0];
break;
case 1:
paddingArray = new Array(4).fill(paddingArray[0]);
break;
case 2:
paddingArray = __spreadArray(__spreadArray([], paddingArray, true), paddingArray, true);
break;
case 3:
paddingArray = __spreadArray(__spreadArray([], paddingArray, true), [paddingArray[1]], false);
break;
default:
paddingArray = paddingArray.slice(0, 4);
break;
}
return paddingArray;
}
// node_modules/@antv/g2/esm/chart/controller/index.js
var LOAD_COMPONENT_CONTROLLERS = {};
function registerComponentController(name, plugin) {
LOAD_COMPONENT_CONTROLLERS[name] = plugin;
}
function getComponentControllerNames() {
return Object.keys(LOAD_COMPONENT_CONTROLLERS);
}
function getComponentController(name) {
return LOAD_COMPONENT_CONTROLLERS[name];
}
// node_modules/@antv/g2/esm/chart/controller/coordinate.js
var CoordinateController = function() {
function CoordinateController2(option) {
this.option = this.wrapperOption(option);
}
CoordinateController2.prototype.update = function(option) {
this.option = this.wrapperOption(option);
return this;
};
CoordinateController2.prototype.hasAction = function(actionName) {
var actions = this.option.actions;
return some_default(actions, function(action) {
return action[0] === actionName;
});
};
CoordinateController2.prototype.create = function(start, end2) {
var _a6 = this.option, type2 = _a6.type, cfg = _a6.cfg;
var isTheta = type2 === "theta";
var props = __assign({ start, end: end2 }, cfg);
var C3 = getCoordinate(isTheta ? "polar" : type2);
this.coordinate = new C3(props);
this.coordinate.type = type2;
if (isTheta) {
if (!this.hasAction("transpose")) {
this.transpose();
}
}
this.execActions();
return this.coordinate;
};
CoordinateController2.prototype.adjust = function(start, end2) {
this.coordinate.update({
start,
end: end2
});
this.coordinate.resetMatrix();
this.execActions(["scale", "rotate", "translate"]);
return this.coordinate;
};
CoordinateController2.prototype.rotate = function(angle3) {
this.option.actions.push(["rotate", angle3]);
return this;
};
CoordinateController2.prototype.reflect = function(dim) {
this.option.actions.push(["reflect", dim]);
return this;
};
CoordinateController2.prototype.scale = function(sx, sy) {
this.option.actions.push(["scale", sx, sy]);
return this;
};
CoordinateController2.prototype.transpose = function() {
this.option.actions.push(["transpose"]);
return this;
};
CoordinateController2.prototype.getOption = function() {
return this.option;
};
CoordinateController2.prototype.getCoordinate = function() {
return this.coordinate;
};
CoordinateController2.prototype.wrapperOption = function(option) {
return __assign({ type: "rect", actions: [], cfg: {} }, option);
};
CoordinateController2.prototype.execActions = function(includeActions) {
var _this = this;
var actions = this.option.actions;
each_default(actions, function(action) {
var _a6;
var actionName = action[0], args = action.slice(1);
var shouldExec = is_nil_default(includeActions) ? true : includeActions.includes(actionName);
if (shouldExec) {
(_a6 = _this.coordinate)[actionName].apply(_a6, args);
}
});
};
return CoordinateController2;
}();
var coordinate_default = CoordinateController;
// node_modules/@antv/g2/esm/chart/event.js
var Event = function() {
function Event2(view, gEvent, data3) {
this.view = view;
this.gEvent = gEvent;
this.data = data3;
this.type = gEvent.type;
}
Event2.fromData = function(view, type2, data3) {
return new Event2(view, new graph_event_default(type2, {}), data3);
};
Object.defineProperty(Event2.prototype, "target", {
get: function() {
return this.gEvent.target;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Event2.prototype, "event", {
get: function() {
return this.gEvent.originalEvent;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Event2.prototype, "x", {
get: function() {
return this.gEvent.x;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Event2.prototype, "y", {
get: function() {
return this.gEvent.y;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Event2.prototype, "clientX", {
get: function() {
return this.gEvent.clientX;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Event2.prototype, "clientY", {
get: function() {
return this.gEvent.clientY;
},
enumerable: false,
configurable: true
});
Event2.prototype.toString = function() {
return "[Event (type=".concat(this.type, ")]");
};
Event2.prototype.clone = function() {
return new Event2(this.view, this.gEvent, this.data);
};
return Event2;
}();
var event_default = Event;
// node_modules/@antv/g2/esm/chart/layout/index.js
function defaultLayout(view) {
var axis22 = view.getController("axis");
var legend18 = view.getController("legend");
var annotation4 = view.getController("annotation");
var slider3 = view.getController("slider");
var scrollbar2 = view.getController("scrollbar");
[axis22, slider3, scrollbar2, legend18, annotation4].forEach(function(controller) {
if (controller) {
controller.layout();
}
});
}
// node_modules/@antv/g2/esm/chart/util/scale-pool.js
var ScalePool = function() {
function ScalePool2() {
this.scales = new Map();
this.syncScales = new Map();
}
ScalePool2.prototype.createScale = function(field6, data3, scaleDef, key) {
var finalScaleDef = scaleDef;
var cacheScaleMeta = this.getScaleMeta(key);
if (data3.length === 0 && cacheScaleMeta) {
var cacheScale = cacheScaleMeta.scale;
var cacheScaleDef = {
type: cacheScale.type
};
if (cacheScale.isCategory) {
cacheScaleDef.values = cacheScale.values;
}
finalScaleDef = deep_mix_default(cacheScaleDef, cacheScaleMeta.scaleDef, scaleDef);
}
var scale12 = createScaleByField(field6, data3, finalScaleDef);
this.cacheScale(scale12, scaleDef, key);
return scale12;
};
ScalePool2.prototype.sync = function(coordinate11, theme4) {
var _this = this;
this.syncScales.forEach(function(scaleKeys, syncKey) {
var min7 = Number.MAX_SAFE_INTEGER;
var max8 = Number.MIN_SAFE_INTEGER;
var values2 = [];
each_default(scaleKeys, function(key) {
var scale12 = _this.getScale(key);
max8 = is_number_default(scale12.max) ? Math.max(max8, scale12.max) : max8;
min7 = is_number_default(scale12.min) ? Math.min(min7, scale12.min) : min7;
each_default(scale12.values, function(v3) {
if (!values2.includes(v3)) {
values2.push(v3);
}
});
});
each_default(scaleKeys, function(key) {
var scale12 = _this.getScale(key);
if (scale12.isContinuous) {
scale12.change({
min: min7,
max: max8,
values: values2
});
} else if (scale12.isCategory) {
var range = scale12.range;
var cacheScaleMeta = _this.getScaleMeta(key);
if (values2 && !get_default(cacheScaleMeta, ["scaleDef", "range"])) {
range = getDefaultCategoryScaleRange(deep_mix_default({}, scale12, {
values: values2
}), coordinate11, theme4);
}
scale12.change({
values: values2,
range
});
}
});
});
};
ScalePool2.prototype.cacheScale = function(scale12, scaleDef, key) {
var sm = this.getScaleMeta(key);
if (sm && sm.scale.type === scale12.type) {
syncScale(sm.scale, scale12);
sm.scaleDef = scaleDef;
} else {
sm = {
key,
scale: scale12,
scaleDef
};
this.scales.set(key, sm);
}
var syncKey = this.getSyncKey(sm);
sm.syncKey = syncKey;
this.removeFromSyncScales(key);
if (syncKey) {
var scaleKeys = this.syncScales.get(syncKey);
if (!scaleKeys) {
scaleKeys = [];
this.syncScales.set(syncKey, scaleKeys);
}
scaleKeys.push(key);
}
};
ScalePool2.prototype.getScale = function(key) {
var scaleMeta = this.getScaleMeta(key);
if (!scaleMeta) {
var field6 = last(key.split("-"));
var scaleKeys = this.syncScales.get(field6);
if (scaleKeys && scaleKeys.length) {
scaleMeta = this.getScaleMeta(scaleKeys[0]);
}
}
return scaleMeta && scaleMeta.scale;
};
ScalePool2.prototype.deleteScale = function(key) {
var scaleMeta = this.getScaleMeta(key);
if (scaleMeta) {
var syncKey = scaleMeta.syncKey;
var scaleKeys = this.syncScales.get(syncKey);
if (scaleKeys && scaleKeys.length) {
var idx = scaleKeys.indexOf(key);
if (idx !== -1) {
scaleKeys.splice(idx, 1);
}
}
}
this.scales.delete(key);
};
ScalePool2.prototype.clear = function() {
this.scales.clear();
this.syncScales.clear();
};
ScalePool2.prototype.removeFromSyncScales = function(key) {
var _this = this;
this.syncScales.forEach(function(scaleKeys, syncKey) {
var idx = scaleKeys.indexOf(key);
if (idx !== -1) {
scaleKeys.splice(idx, 1);
if (scaleKeys.length === 0) {
_this.syncScales.delete(syncKey);
}
return false;
}
});
};
ScalePool2.prototype.getSyncKey = function(sm) {
var scale12 = sm.scale, scaleDef = sm.scaleDef;
var field6 = scale12.field;
var sync = get_default(scaleDef, ["sync"]);
return sync === true ? field6 : sync === false ? void 0 : sync;
};
ScalePool2.prototype.getScaleMeta = function(key) {
return this.scales.get(key);
};
return ScalePool2;
}();
// node_modules/@antv/g2/esm/chart/layout/padding-cal.js
var PaddingCal = function() {
function PaddingCal2(top, right2, bottom, left2) {
if (top === void 0) {
top = 0;
}
if (right2 === void 0) {
right2 = 0;
}
if (bottom === void 0) {
bottom = 0;
}
if (left2 === void 0) {
left2 = 0;
}
this.top = top;
this.right = right2;
this.bottom = bottom;
this.left = left2;
}
PaddingCal2.instance = function(top, right2, bottom, left2) {
if (top === void 0) {
top = 0;
}
if (right2 === void 0) {
right2 = 0;
}
if (bottom === void 0) {
bottom = 0;
}
if (left2 === void 0) {
left2 = 0;
}
return new PaddingCal2(top, right2, bottom, left2);
};
PaddingCal2.prototype.max = function(padding3) {
var top = padding3[0], right2 = padding3[1], bottom = padding3[2], left2 = padding3[3];
this.top = Math.max(this.top, top);
this.right = Math.max(this.right, right2);
this.bottom = Math.max(this.bottom, bottom);
this.left = Math.max(this.left, left2);
return this;
};
PaddingCal2.prototype.shrink = function(padding3) {
var top = padding3[0], right2 = padding3[1], bottom = padding3[2], left2 = padding3[3];
this.top += top;
this.right += right2;
this.bottom += bottom;
this.left += left2;
return this;
};
PaddingCal2.prototype.inc = function(bbox, direction5) {
var width2 = bbox.width, height = bbox.height;
switch (direction5) {
case DIRECTION.TOP:
case DIRECTION.TOP_LEFT:
case DIRECTION.TOP_RIGHT:
this.top += height;
break;
case DIRECTION.RIGHT:
case DIRECTION.RIGHT_TOP:
case DIRECTION.RIGHT_BOTTOM:
this.right += width2;
break;
case DIRECTION.BOTTOM:
case DIRECTION.BOTTOM_LEFT:
case DIRECTION.BOTTOM_RIGHT:
this.bottom += height;
break;
case DIRECTION.LEFT:
case DIRECTION.LEFT_TOP:
case DIRECTION.LEFT_BOTTOM:
this.left += width2;
break;
default:
break;
}
return this;
};
PaddingCal2.prototype.getPadding = function() {
return [this.top, this.right, this.bottom, this.left];
};
PaddingCal2.prototype.clone = function() {
return new (PaddingCal2.bind.apply(PaddingCal2, __spreadArray([void 0], this.getPadding(), false)))();
};
return PaddingCal2;
}();
// node_modules/@antv/g2/esm/chart/layout/auto.js
function calculatePadding(view) {
var padding3 = view.padding;
if (!isAutoPadding(padding3)) {
return new (PaddingCal.bind.apply(PaddingCal, __spreadArray([void 0], parsePadding(padding3), false)))();
}
var viewBBox = view.viewBBox;
var paddingCal = new PaddingCal();
var axisComponents = [];
var paddingComponents = [];
var otherComponents = [];
each_default(view.getComponents(), function(co) {
var type2 = co.type;
if (type2 === COMPONENT_TYPE.AXIS) {
axisComponents.push(co);
} else if ([COMPONENT_TYPE.LEGEND, COMPONENT_TYPE.SLIDER, COMPONENT_TYPE.SCROLLBAR].includes(type2)) {
paddingComponents.push(co);
} else if (type2 !== COMPONENT_TYPE.GRID && type2 !== COMPONENT_TYPE.TOOLTIP) {
otherComponents.push(co);
}
});
each_default(axisComponents, function(co) {
var component2 = co.component;
var bboxObject = component2.getLayoutBBox();
var componentBBox = new BBox(bboxObject.x, bboxObject.y, bboxObject.width, bboxObject.height);
var exceed = componentBBox.exceed(viewBBox);
paddingCal.max(exceed);
});
each_default(paddingComponents, function(co) {
var component2 = co.component, direction5 = co.direction;
var bboxObject = component2.getLayoutBBox();
var componentPadding = component2.get("padding");
var componentBBox = new BBox(bboxObject.x, bboxObject.y, bboxObject.width, bboxObject.height).expand(componentPadding);
paddingCal.inc(componentBBox, direction5);
});
each_default(otherComponents, function(co) {
var component2 = co.component, direction5 = co.direction;
var bboxObject = component2.getLayoutBBox();
var componentBBox = new BBox(bboxObject.x, bboxObject.y, bboxObject.width, bboxObject.height);
paddingCal.inc(componentBBox, direction5);
});
return paddingCal;
}
// node_modules/@antv/g2/esm/chart/util/sync-view-padding.js
function defaultSyncViewPadding(chart, views, PC) {
var syncPadding = PC.instance();
views.forEach(function(v3) {
v3.autoPadding = syncPadding.max(v3.autoPadding.getPadding());
});
}
// node_modules/@antv/g2/esm/chart/view.js
var View = function(_super) {
__extends(View3, _super);
function View3(props) {
var _this = _super.call(this, { visible: props.visible }) || this;
_this.views = [];
_this.geometries = [];
_this.controllers = [];
_this.interactions = {};
_this.limitInPlot = false;
_this.options = {
data: [],
animate: true
};
_this.usedControllers = getComponentControllerNames();
_this.scalePool = new ScalePool();
_this.layoutFunc = defaultLayout;
_this.isPreMouseInPlot = false;
_this.isDataChanged = false;
_this.isCoordinateChanged = false;
_this.createdScaleKeys = new Map();
_this.onCanvasEvent = function(evt) {
var name = evt.name;
if (!name.includes(":")) {
var e4 = _this.createViewEvent(evt);
_this.doPlotEvent(e4);
_this.emit(name, e4);
}
};
_this.onDelegateEvents = function(evt) {
var name = evt.name;
if (!name.includes(":")) {
return;
}
var e4 = _this.createViewEvent(evt);
_this.emit(name, e4);
};
var _a6 = props.id, id = _a6 === void 0 ? unique_id_default("view") : _a6, parent = props.parent, canvas = props.canvas, backgroundGroup = props.backgroundGroup, middleGroup = props.middleGroup, foregroundGroup = props.foregroundGroup, _b = props.region, region = _b === void 0 ? { start: { x: 0, y: 0 }, end: { x: 1, y: 1 } } : _b, padding3 = props.padding, appendPadding = props.appendPadding, theme4 = props.theme, options = props.options, limitInPlot5 = props.limitInPlot, syncViewPadding2 = props.syncViewPadding;
_this.parent = parent;
_this.canvas = canvas;
_this.backgroundGroup = backgroundGroup;
_this.middleGroup = middleGroup;
_this.foregroundGroup = foregroundGroup;
_this.region = region;
_this.padding = padding3;
_this.appendPadding = appendPadding;
_this.options = __assign(__assign({}, _this.options), options);
_this.limitInPlot = limitInPlot5;
_this.id = id;
_this.syncViewPadding = syncViewPadding2;
_this.themeObject = is_object_default(theme4) ? deep_mix_default({}, getTheme("default"), createTheme(theme4)) : getTheme(theme4);
_this.init();
return _this;
}
View3.prototype.setLayout = function(layout6) {
this.layoutFunc = layout6;
};
View3.prototype.init = function() {
this.calculateViewBBox();
this.initEvents();
this.initComponentController();
this.initOptions();
};
View3.prototype.render = function(isUpdate, payload) {
if (isUpdate === void 0) {
isUpdate = false;
}
this.emit(VIEW_LIFE_CIRCLE.BEFORE_RENDER, event_default.fromData(this, VIEW_LIFE_CIRCLE.BEFORE_RENDER, payload));
this.paint(isUpdate);
this.emit(VIEW_LIFE_CIRCLE.AFTER_RENDER, event_default.fromData(this, VIEW_LIFE_CIRCLE.AFTER_RENDER, payload));
if (this.visible === false) {
this.changeVisible(false);
}
};
View3.prototype.clear = function() {
var _this = this;
this.emit(VIEW_LIFE_CIRCLE.BEFORE_CLEAR);
this.filteredData = [];
this.coordinateInstance = void 0;
this.isDataChanged = false;
this.isCoordinateChanged = false;
var geometries = this.geometries;
for (var i4 = 0; i4 < geometries.length; i4++) {
geometries[i4].clear();
geometries[i4].container.remove(true);
geometries[i4].labelsContainer.remove(true);
}
this.geometries = [];
var controllers = this.controllers;
for (var i4 = 0; i4 < controllers.length; i4++) {
if (controllers[i4].name === "annotation") {
controllers[i4].clear(true);
} else {
controllers[i4].clear();
}
}
this.createdScaleKeys.forEach(function(v3, k4) {
_this.getRootView().scalePool.deleteScale(k4);
});
this.createdScaleKeys.clear();
var views = this.views;
for (var i4 = 0; i4 < views.length; i4++) {
views[i4].clear();
}
this.emit(VIEW_LIFE_CIRCLE.AFTER_CLEAR);
};
View3.prototype.destroy = function() {
this.emit(VIEW_LIFE_CIRCLE.BEFORE_DESTROY);
var interactions = this.interactions;
each_default(interactions, function(interaction8) {
if (interaction8) {
interaction8.destroy();
}
});
this.clear();
var controllers = this.controllers;
for (var i4 = 0, len5 = controllers.length; i4 < len5; i4++) {
var controller = controllers[i4];
controller.destroy();
}
this.backgroundGroup.remove(true);
this.middleGroup.remove(true);
this.foregroundGroup.remove(true);
_super.prototype.destroy.call(this);
};
View3.prototype.changeVisible = function(visible) {
_super.prototype.changeVisible.call(this, visible);
var geometries = this.geometries;
for (var i4 = 0, len5 = geometries.length; i4 < len5; i4++) {
var geometry35 = geometries[i4];
geometry35.changeVisible(visible);
}
var controllers = this.controllers;
for (var i4 = 0, len5 = controllers.length; i4 < len5; i4++) {
var controller = controllers[i4];
controller.changeVisible(visible);
}
this.foregroundGroup.set("visible", visible);
this.middleGroup.set("visible", visible);
this.backgroundGroup.set("visible", visible);
this.getCanvas().draw();
return this;
};
View3.prototype.data = function(data3) {
set_default(this.options, "data", data3);
this.isDataChanged = true;
return this;
};
View3.prototype.source = function(data3) {
console.warn("This method will be removed at G2 V4.1. Please use chart.data() instead.");
return this.data(data3);
};
View3.prototype.filter = function(field6, condition) {
if (is_function_default(condition)) {
set_default(this.options, ["filters", field6], condition);
return this;
}
if (!condition && get_default(this.options, ["filters", field6])) {
delete this.options.filters[field6];
}
return this;
};
View3.prototype.axis = function(field6, axisOption) {
if (is_boolean_default(field6)) {
set_default(this.options, ["axes"], field6);
} else {
set_default(this.options, ["axes", field6], axisOption);
}
return this;
};
View3.prototype.legend = function(field6, legendOption) {
if (is_boolean_default(field6)) {
set_default(this.options, ["legends"], field6);
} else if (is_string_default(field6)) {
set_default(this.options, ["legends", field6], legendOption);
if (is_plain_object_default(legendOption) && (legendOption === null || legendOption === void 0 ? void 0 : legendOption.selected)) {
set_default(this.options, ["filters", field6], function(name) {
var _a6;
return (_a6 = legendOption === null || legendOption === void 0 ? void 0 : legendOption.selected[name]) !== null && _a6 !== void 0 ? _a6 : true;
});
}
} else {
set_default(this.options, ["legends"], field6);
}
return this;
};
View3.prototype.scale = function(field6, scaleOption) {
var _this = this;
if (is_string_default(field6)) {
set_default(this.options, ["scales", field6], scaleOption);
} else if (is_object_default(field6)) {
each_default(field6, function(v3, k4) {
set_default(_this.options, ["scales", k4], v3);
});
}
return this;
};
View3.prototype.tooltip = function(cfg) {
set_default(this.options, "tooltip", cfg);
return this;
};
View3.prototype.annotation = function() {
return this.getController("annotation");
};
View3.prototype.guide = function() {
console.warn("This method will be removed at G2 V4.1. Please use chart.annotation() instead.");
return this.annotation();
};
View3.prototype.coordinate = function(type2, coordinateCfg) {
if (is_string_default(type2)) {
set_default(this.options, "coordinate", { type: type2, cfg: coordinateCfg });
} else {
set_default(this.options, "coordinate", type2);
}
this.coordinateController.update(this.options.coordinate);
return this.coordinateController;
};
View3.prototype.coord = function(type2, coordinateCfg) {
console.warn("This method will be removed at G2 V4.1. Please use chart.coordinate() instead.");
return this.coordinate(type2, coordinateCfg);
};
View3.prototype.facet = function(type2, cfg) {
if (this.facetInstance) {
this.facetInstance.destroy();
}
var Ctor = getFacet(type2);
if (!Ctor) {
throw new Error("facet '".concat(type2, "' is not exist!"));
}
this.facetInstance = new Ctor(this, __assign(__assign({}, cfg), { type: type2 }));
return this;
};
View3.prototype.animate = function(status) {
set_default(this.options, "animate", status);
return this;
};
View3.prototype.updateOptions = function(options) {
this.clear();
mix(this.options, options);
this.views.forEach(function(view) {
return view.destroy();
});
this.views = [];
this.initOptions();
this.coordinateBBox = this.viewBBox;
return this;
};
View3.prototype.option = function(name, opt) {
if (View3.prototype[name]) {
throw new Error(`Can't use built in variable name "`.concat(name, '", please change another one.'));
}
set_default(this.options, name, opt);
return this;
};
View3.prototype.theme = function(theme4) {
this.themeObject = is_object_default(theme4) ? deep_mix_default({}, this.themeObject, createTheme(theme4)) : getTheme(theme4);
return this;
};
View3.prototype.interaction = function(name, cfg) {
var existInteraction = this.interactions[name];
if (existInteraction) {
existInteraction.destroy();
}
var interaction8 = createInteraction(name, this, cfg);
if (interaction8) {
interaction8.init();
this.interactions[name] = interaction8;
}
return this;
};
View3.prototype.removeInteraction = function(name) {
var existInteraction = this.interactions[name];
if (existInteraction) {
existInteraction.destroy();
this.interactions[name] = void 0;
}
};
View3.prototype.changeData = function(data3) {
this.isDataChanged = true;
this.emit(VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, event_default.fromData(this, VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, null));
this.data(data3);
this.paint(true);
var views = this.views;
for (var i4 = 0, len5 = views.length; i4 < len5; i4++) {
var view = views[i4];
view.changeData(data3);
}
this.emit(VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA, event_default.fromData(this, VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA, null));
};
View3.prototype.createView = function(cfg) {
if (this.parent && this.parent.parent) {
console.warn("The view nesting recursive feature will be removed at G2 V4.1. Please avoid to use it.");
}
var sharedOptions = {
data: this.options.data,
scales: clone_default(this.options.scales),
axes: clone_default(this.options.axes),
coordinate: clone_default(this.coordinateController.getOption()),
tooltip: clone_default(this.options.tooltip),
legends: clone_default(this.options.legends),
animate: this.options.animate,
visible: this.visible
};
var v3 = new View3(__assign(__assign({
parent: this,
canvas: this.canvas,
backgroundGroup: this.backgroundGroup.addGroup({ zIndex: GROUP_Z_INDEX.BG }),
middleGroup: this.middleGroup.addGroup({ zIndex: GROUP_Z_INDEX.MID }),
foregroundGroup: this.foregroundGroup.addGroup({ zIndex: GROUP_Z_INDEX.FORE }),
theme: this.themeObject,
padding: this.padding
}, cfg), { options: __assign(__assign({}, sharedOptions), get_default(cfg, "options", {})) }));
this.views.push(v3);
return v3;
};
View3.prototype.view = function(cfg) {
console.warn("This method will be removed at G2 V4.1. Please use chart.createView() instead.");
return this.createView(cfg);
};
View3.prototype.removeView = function(view) {
var removedView = remove_default(this.views, function(v3) {
return v3 === view;
})[0];
if (removedView) {
removedView.destroy();
}
return removedView;
};
View3.prototype.getCoordinate = function() {
return this.coordinateInstance;
};
View3.prototype.getTheme = function() {
return this.themeObject;
};
View3.prototype.getXScale = function() {
var g4 = this.geometries[0];
return g4 ? g4.getXScale() : null;
};
View3.prototype.getYScales = function() {
var tmpMap = {};
var yScales = [];
this.geometries.forEach(function(g4) {
var yScale = g4.getYScale();
var field6 = yScale.field;
if (!tmpMap[field6]) {
tmpMap[field6] = true;
yScales.push(yScale);
}
});
return yScales;
};
View3.prototype.getScalesByDim = function(dimType) {
var geometries = this.geometries;
var scales = {};
for (var i4 = 0, len5 = geometries.length; i4 < len5; i4++) {
var geometry35 = geometries[i4];
var scale12 = dimType === "x" ? geometry35.getXScale() : geometry35.getYScale();
if (scale12 && !scales[scale12.field]) {
scales[scale12.field] = scale12;
}
}
return scales;
};
View3.prototype.getScale = function(field6, key) {
var defaultKey = key ? key : this.getScaleKey(field6);
return this.getRootView().scalePool.getScale(defaultKey);
};
View3.prototype.getScaleByField = function(field6, key) {
return this.getScale(field6, key);
};
View3.prototype.getOptions = function() {
return this.options;
};
View3.prototype.getData = function() {
return this.filteredData;
};
View3.prototype.getOriginalData = function() {
return this.options.data;
};
View3.prototype.getPadding = function() {
return this.autoPadding.getPadding();
};
View3.prototype.getGeometries = function() {
return this.geometries;
};
View3.prototype.getElements = function() {
return reduce_default(this.geometries, function(elements, geometry35) {
return elements.concat(geometry35.getElements());
}, []);
};
View3.prototype.getElementsBy = function(condition) {
return this.getElements().filter(function(el) {
return condition(el);
});
};
View3.prototype.getLayer = function(layer) {
return layer === LAYER.BG ? this.backgroundGroup : layer === LAYER.MID ? this.middleGroup : layer === LAYER.FORE ? this.foregroundGroup : this.foregroundGroup;
};
View3.prototype.isPointInPlot = function(point2) {
return isPointInCoordinate(this.getCoordinate(), point2);
};
View3.prototype.getLegendAttributes = function() {
return flatten_default(this.geometries.map(function(g4) {
return g4.getGroupAttributes();
}));
};
View3.prototype.getGroupScales = function() {
var scales = this.geometries.map(function(g4) {
return g4.getGroupScales();
});
return uniq2(flatten_default(scales));
};
View3.prototype.getCanvas = function() {
return this.getRootView().canvas;
};
View3.prototype.getRootView = function() {
var v3 = this;
while (true) {
if (v3.parent) {
v3 = v3.parent;
continue;
}
break;
}
return v3;
};
View3.prototype.getXY = function(data3) {
var coordinate11 = this.getCoordinate();
var xScales = this.getScalesByDim("x");
var yScales = this.getScalesByDim("y");
var x6;
var y5;
each_default(data3, function(value2, key) {
if (xScales[key]) {
x6 = xScales[key].scale(value2);
}
if (yScales[key]) {
y5 = yScales[key].scale(value2);
}
});
if (!is_nil_default(x6) && !is_nil_default(y5)) {
return coordinate11.convert({ x: x6, y: y5 });
}
};
View3.prototype.getController = function(name) {
return find_default(this.controllers, function(c5) {
return c5.name === name;
});
};
View3.prototype.showTooltip = function(point2) {
var tooltip10 = this.getController("tooltip");
if (tooltip10) {
tooltip10.showTooltip(point2);
}
return this;
};
View3.prototype.hideTooltip = function() {
var tooltip10 = this.getController("tooltip");
if (tooltip10) {
tooltip10.hideTooltip();
}
return this;
};
View3.prototype.lockTooltip = function() {
var tooltip10 = this.getController("tooltip");
if (tooltip10) {
tooltip10.lockTooltip();
}
return this;
};
View3.prototype.unlockTooltip = function() {
var tooltip10 = this.getController("tooltip");
if (tooltip10) {
tooltip10.unlockTooltip();
}
return this;
};
View3.prototype.isTooltipLocked = function() {
var tooltip10 = this.getController("tooltip");
return tooltip10 && tooltip10.isTooltipLocked();
};
View3.prototype.getTooltipItems = function(point2) {
var tooltip10 = this.getController("tooltip");
return tooltip10 ? tooltip10.getTooltipItems(point2) : [];
};
View3.prototype.getSnapRecords = function(point2) {
var geometries = this.geometries;
var rst = [];
for (var i4 = 0, len5 = geometries.length; i4 < len5; i4++) {
var geom = geometries[i4];
var dataArray = geom.dataArray;
geom.sort(dataArray);
var record = void 0;
for (var j4 = 0, dataLen = dataArray.length; j4 < dataLen; j4++) {
var data3 = dataArray[j4];
record = findDataByPoint(point2, data3, geom);
if (record) {
rst.push(record);
}
}
}
var views = this.views;
for (var i4 = 0, len5 = views.length; i4 < len5; i4++) {
var view = views[i4];
var snapRecords = view.getSnapRecords(point2);
rst = rst.concat(snapRecords);
}
return rst;
};
View3.prototype.getComponents = function() {
var components = [];
var controllers = this.controllers;
for (var i4 = 0, len5 = controllers.length; i4 < len5; i4++) {
var controller = controllers[i4];
components = components.concat(controller.getComponents());
}
return components;
};
View3.prototype.filterData = function(data3) {
var filters = this.options.filters;
if (size(filters) === 0) {
return data3;
}
return filter_default(data3, function(datum, idx) {
var fields = Object.keys(filters);
return fields.every(function(field6) {
var condition = filters[field6];
return condition(datum[field6], datum, idx);
});
});
};
View3.prototype.filterFieldData = function(field6, data3) {
var filters = this.options.filters;
var condition = get_default(filters, field6);
if (is_undefined_default(condition)) {
return data3;
}
return data3.filter(function(datum, idx) {
return condition(datum[field6], datum, idx);
});
};
View3.prototype.adjustCoordinate = function() {
var _a6 = this.getCoordinate(), curStart = _a6.start, curEnd = _a6.end;
var start = this.coordinateBBox.bl;
var end2 = this.coordinateBBox.tr;
if (is_equal_default(curStart, start) && is_equal_default(curEnd, end2)) {
this.isCoordinateChanged = false;
return;
}
this.isCoordinateChanged = true;
this.coordinateInstance = this.coordinateController.adjust(start, end2);
};
View3.prototype.paint = function(isUpdate) {
this.renderDataRecursive(isUpdate);
this.syncScale();
this.emit(VIEW_LIFE_CIRCLE.BEFORE_PAINT);
this.renderPaddingRecursive(isUpdate);
this.renderLayoutRecursive(isUpdate);
this.renderBackgroundStyleShape();
this.renderPaintRecursive(isUpdate);
this.emit(VIEW_LIFE_CIRCLE.AFTER_PAINT);
this.isDataChanged = false;
};
View3.prototype.renderBackgroundStyleShape = function() {
if (this.parent) {
return;
}
var background = get_default(this.themeObject, "background");
if (background) {
if (!this.backgroundStyleRectShape) {
this.backgroundStyleRectShape = this.backgroundGroup.addShape("rect", {
attrs: {},
zIndex: -1,
capture: false
});
this.backgroundStyleRectShape.toBack();
}
var _a6 = this.viewBBox, x6 = _a6.x, y5 = _a6.y, width2 = _a6.width, height = _a6.height;
this.backgroundStyleRectShape.attr({
fill: background,
x: x6,
y: y5,
width: width2,
height
});
} else {
if (this.backgroundStyleRectShape) {
this.backgroundStyleRectShape.remove(true);
this.backgroundStyleRectShape = void 0;
}
}
};
View3.prototype.renderPaddingRecursive = function(isUpdate) {
this.calculateViewBBox();
this.adjustCoordinate();
this.initComponents(isUpdate);
this.autoPadding = calculatePadding(this).shrink(parsePadding(this.appendPadding));
this.coordinateBBox = this.viewBBox.shrink(this.autoPadding.getPadding());
this.adjustCoordinate();
var views = this.views;
for (var i4 = 0, len5 = views.length; i4 < len5; i4++) {
var view = views[i4];
view.renderPaddingRecursive(isUpdate);
}
};
View3.prototype.renderLayoutRecursive = function(isUpdate) {
var syncViewPaddingFn = this.syncViewPadding === true ? defaultSyncViewPadding : is_function_default(this.syncViewPadding) ? this.syncViewPadding : void 0;
if (syncViewPaddingFn) {
syncViewPaddingFn(this, this.views, PaddingCal);
this.views.forEach(function(v3) {
v3.coordinateBBox = v3.viewBBox.shrink(v3.autoPadding.getPadding());
v3.adjustCoordinate();
});
}
this.doLayout();
var views = this.views;
for (var i4 = 0, len5 = views.length; i4 < len5; i4++) {
var view = views[i4];
view.renderLayoutRecursive(isUpdate);
}
};
View3.prototype.renderPaintRecursive = function(isUpdate) {
var middleGroup = this.middleGroup;
if (this.limitInPlot) {
var _a6 = getCoordinateClipCfg(this.coordinateInstance), type2 = _a6.type, attrs = _a6.attrs;
middleGroup.setClip({
type: type2,
attrs
});
} else {
middleGroup.setClip(void 0);
}
this.paintGeometries(isUpdate);
this.renderComponents(isUpdate);
var views = this.views;
for (var i4 = 0, len5 = views.length; i4 < len5; i4++) {
var view = views[i4];
view.renderPaintRecursive(isUpdate);
}
};
View3.prototype.createScale = function(field6, data3, scaleDef, key) {
var currentScaleDef = get_default(this.options.scales, [field6]);
var mergedScaleDef = __assign(__assign({}, currentScaleDef), scaleDef);
if (this.parent) {
return this.parent.createScale(field6, data3, mergedScaleDef, key);
}
return this.scalePool.createScale(field6, data3, mergedScaleDef, key);
};
View3.prototype.renderDataRecursive = function(isUpdate) {
this.doFilterData();
this.createCoordinate();
this.initGeometries(isUpdate);
this.renderFacet(isUpdate);
var views = this.views;
for (var i4 = 0, len5 = views.length; i4 < len5; i4++) {
var view = views[i4];
view.renderDataRecursive(isUpdate);
}
};
View3.prototype.calculateViewBBox = function() {
var x6;
var y5;
var width2;
var height;
if (this.parent) {
var bbox = this.parent.coordinateBBox;
x6 = bbox.x;
y5 = bbox.y;
width2 = bbox.width;
height = bbox.height;
} else {
x6 = 0;
y5 = 0;
width2 = this.canvas.get("width");
height = this.canvas.get("height");
}
var _a6 = this.region, start = _a6.start, end2 = _a6.end;
var viewBBox = new BBox(x6 + width2 * start.x, y5 + height * start.y, width2 * (end2.x - start.x), height * (end2.y - start.y));
if (!this.viewBBox || !this.viewBBox.isEqual(viewBBox)) {
this.viewBBox = new BBox(x6 + width2 * start.x, y5 + height * start.y, width2 * (end2.x - start.x), height * (end2.y - start.y));
}
this.coordinateBBox = this.viewBBox;
};
View3.prototype.initEvents = function() {
this.foregroundGroup.on("*", this.onDelegateEvents);
this.middleGroup.on("*", this.onDelegateEvents);
this.backgroundGroup.on("*", this.onDelegateEvents);
this.canvas.on("*", this.onCanvasEvent);
};
View3.prototype.initComponentController = function() {
var usedControllers = this.usedControllers;
for (var i4 = 0, len5 = usedControllers.length; i4 < len5; i4++) {
var controllerName = usedControllers[i4];
var Ctor = getComponentController(controllerName);
if (Ctor) {
this.controllers.push(new Ctor(this));
}
}
};
View3.prototype.createViewEvent = function(evt) {
var shape = evt.shape, name = evt.name;
var data3 = shape ? shape.get("origin") : null;
var e4 = new event_default(this, evt, data3);
e4.type = name;
return e4;
};
View3.prototype.doPlotEvent = function(e4) {
var type2 = e4.type, x6 = e4.x, y5 = e4.y;
var point2 = { x: x6, y: y5 };
var ALL_EVENTS = [
"mousedown",
"mouseup",
"mousemove",
"mouseleave",
"mousewheel",
"touchstart",
"touchmove",
"touchend",
"touchcancel",
"click",
"dblclick",
"contextmenu"
];
if (ALL_EVENTS.includes(type2)) {
var currentInPlot = this.isPointInPlot(point2);
var newEvent = e4.clone();
if (currentInPlot) {
var TYPE = "plot:".concat(type2);
newEvent.type = TYPE;
this.emit(TYPE, newEvent);
if (type2 === "mouseleave" || type2 === "touchend") {
this.isPreMouseInPlot = false;
}
}
if (type2 === "mousemove" || type2 === "touchmove") {
if (this.isPreMouseInPlot && !currentInPlot) {
if (type2 === "mousemove") {
newEvent.type = PLOT_EVENTS.MOUSE_LEAVE;
this.emit(PLOT_EVENTS.MOUSE_LEAVE, newEvent);
}
newEvent.type = PLOT_EVENTS.LEAVE;
this.emit(PLOT_EVENTS.LEAVE, newEvent);
} else if (!this.isPreMouseInPlot && currentInPlot) {
if (type2 === "mousemove") {
newEvent.type = PLOT_EVENTS.MOUSE_ENTER;
this.emit(PLOT_EVENTS.MOUSE_ENTER, newEvent);
}
newEvent.type = PLOT_EVENTS.ENTER;
this.emit(PLOT_EVENTS.ENTER, newEvent);
}
this.isPreMouseInPlot = currentInPlot;
} else if (type2 === "mouseleave" || type2 === "touchend") {
if (this.isPreMouseInPlot) {
if (type2 === "mouseleave") {
newEvent.type = PLOT_EVENTS.MOUSE_LEAVE;
this.emit(PLOT_EVENTS.MOUSE_LEAVE, newEvent);
}
newEvent.type = PLOT_EVENTS.LEAVE;
this.emit(PLOT_EVENTS.LEAVE, newEvent);
this.isPreMouseInPlot = false;
}
}
}
};
View3.prototype.doFilterData = function() {
var data3 = this.options.data;
this.filteredData = this.filterData(data3);
};
View3.prototype.initGeometries = function(isUpdate) {
this.createOrUpdateScales();
var coordinate11 = this.getCoordinate();
var scaleDefs = get_default(this.options, "scales", {});
var geometries = this.geometries;
for (var i4 = 0, len5 = geometries.length; i4 < len5; i4++) {
var geometry35 = geometries[i4];
geometry35.scales = this.getGeometryScales();
var cfg = {
coordinate: coordinate11,
scaleDefs,
data: this.filteredData,
theme: this.themeObject,
isDataChanged: this.isDataChanged,
isCoordinateChanged: this.isCoordinateChanged
};
if (isUpdate) {
geometry35.update(cfg);
} else {
geometry35.init(cfg);
}
}
this.adjustScales();
};
View3.prototype.createOrUpdateScales = function() {
var fields = this.getScaleFields();
var groupedFields = this.getGroupedFields();
var _a6 = this.getOptions(), data3 = _a6.data, _b = _a6.scales, scales = _b === void 0 ? {} : _b;
var filteredData = this.filteredData;
for (var i4 = 0, len5 = fields.length; i4 < len5; i4++) {
var field6 = fields[i4];
var scaleDef = scales[field6];
var key = this.getScaleKey(field6);
this.createScale(field6, groupedFields.includes(field6) ? data3 : filteredData, scaleDef, key);
this.createdScaleKeys.set(key, true);
}
};
View3.prototype.syncScale = function() {
this.getRootView().scalePool.sync(this.getCoordinate(), this.theme);
};
View3.prototype.getGeometryScales = function() {
var fields = this.getScaleFields();
var scales = {};
for (var i4 = 0; i4 < fields.length; i4++) {
var field6 = fields[i4];
scales[field6] = this.getScaleByField(field6);
}
return scales;
};
View3.prototype.getScaleFields = function() {
var fields = [];
var tmpMap = new Map();
var geometries = this.geometries;
for (var i4 = 0; i4 < geometries.length; i4++) {
var geometry35 = geometries[i4];
var geometryScales = geometry35.getScaleFields();
uniq2(geometryScales, fields, tmpMap);
}
return fields;
};
View3.prototype.getGroupedFields = function() {
var fields = [];
var tmpMap = new Map();
var geometries = this.geometries;
for (var i4 = 0; i4 < geometries.length; i4++) {
var geometry35 = geometries[i4];
var groupFields = geometry35.getGroupFields();
uniq2(groupFields, fields, tmpMap);
}
return fields;
};
View3.prototype.adjustScales = function() {
this.adjustCategoryScaleRange();
};
View3.prototype.adjustCategoryScaleRange = function() {
var _this = this;
var xyScales = __spreadArray([this.getXScale()], this.getYScales(), true).filter(function(e4) {
return !!e4;
});
var coordinate11 = this.getCoordinate();
var scaleOptions = this.options.scales;
each_default(xyScales, function(scale12) {
var field6 = scale12.field, values2 = scale12.values, isCategory = scale12.isCategory, isIdentity = scale12.isIdentity;
if (isCategory || isIdentity) {
if (values2 && !get_default(scaleOptions, [field6, "range"])) {
scale12.range = getDefaultCategoryScaleRange(scale12, coordinate11, _this.theme);
}
}
});
};
View3.prototype.initComponents = function(isUpdate) {
var controllers = this.controllers;
for (var i4 = 0; i4 < controllers.length; i4++) {
var controller = controllers[i4];
if (isUpdate) {
controller.update();
} else {
controller.clear();
controller.render();
}
}
};
View3.prototype.doLayout = function() {
this.layoutFunc(this);
};
View3.prototype.createCoordinate = function() {
var start = this.coordinateBBox.bl;
var end2 = this.coordinateBBox.tr;
this.coordinateInstance = this.coordinateController.create(start, end2);
};
View3.prototype.paintGeometries = function(isUpdate) {
var doAnimation = this.options.animate;
var coordinate11 = this.getCoordinate();
var canvasRegion = {
x: this.viewBBox.x,
y: this.viewBBox.y,
minX: this.viewBBox.minX,
minY: this.viewBBox.minY,
maxX: this.viewBBox.maxX,
maxY: this.viewBBox.maxY,
width: this.viewBBox.width,
height: this.viewBBox.height
};
var geometries = this.geometries;
for (var i4 = 0; i4 < geometries.length; i4++) {
var geometry35 = geometries[i4];
geometry35.coordinate = coordinate11;
geometry35.canvasRegion = canvasRegion;
if (!doAnimation) {
geometry35.animate(false);
}
geometry35.paint(isUpdate);
}
};
View3.prototype.renderComponents = function(isUpdate) {
for (var i4 = 0; i4 < this.getComponents().length; i4++) {
var co = this.getComponents()[i4];
co.component.render();
}
};
View3.prototype.renderFacet = function(isUpdate) {
if (this.facetInstance) {
if (isUpdate) {
this.facetInstance.update();
} else {
this.facetInstance.clear();
this.facetInstance.init();
this.facetInstance.render();
}
}
};
View3.prototype.initOptions = function() {
var _this = this;
var _a6 = this.options, _b = _a6.geometries, geometries = _b === void 0 ? [] : _b, _c = _a6.interactions, interactions = _c === void 0 ? [] : _c, _d = _a6.views, views = _d === void 0 ? [] : _d, _e = _a6.annotations, annotations = _e === void 0 ? [] : _e, coordinate11 = _a6.coordinate, events = _a6.events, facets = _a6.facets;
if (this.coordinateController) {
coordinate11 && this.coordinateController.update(coordinate11);
} else {
this.coordinateController = new coordinate_default(coordinate11);
}
for (var i4 = 0; i4 < geometries.length; i4++) {
var geometryOption = geometries[i4];
this.createGeometry(geometryOption);
}
for (var j4 = 0; j4 < interactions.length; j4++) {
var interactionOption = interactions[j4];
var type2 = interactionOption.type, cfg = interactionOption.cfg;
this.interaction(type2, cfg);
}
for (var k4 = 0; k4 < views.length; k4++) {
var viewOption = views[k4];
this.createView(viewOption);
}
var annotationComponent = this.getController("annotation");
for (var l4 = 0; l4 < annotations.length; l4++) {
var annotationOption = annotations[l4];
annotationComponent.annotation(annotationOption);
}
if (events) {
each_default(events, function(eventCallback, eventName) {
_this.on(eventName, eventCallback);
});
}
if (facets) {
each_default(facets, function(facet) {
var type3 = facet.type, rest = __rest(facet, ["type"]);
_this.facet(type3, rest);
});
}
};
View3.prototype.createGeometry = function(geometryOption) {
var type2 = geometryOption.type, _a6 = geometryOption.cfg, cfg = _a6 === void 0 ? {} : _a6;
if (this[type2]) {
var geometry_1 = this[type2](cfg);
each_default(geometryOption, function(v3, k4) {
if (is_function_default(geometry_1[k4])) {
geometry_1[k4](v3);
}
});
}
};
View3.prototype.getScaleKey = function(field6) {
return "".concat(this.id, "-").concat(field6);
};
return View3;
}(base_default);
function registerGeometry(name, Ctor) {
View.prototype[name.toLowerCase()] = function(cfg) {
if (cfg === void 0) {
cfg = {};
}
var props = __assign({
container: this.middleGroup.addGroup(),
labelsContainer: this.foregroundGroup.addGroup()
}, cfg);
var geometry35 = new Ctor(props);
this.geometries.push(geometry35);
return geometry35;
};
}
var view_default = View;
// node_modules/@antv/g2/esm/chart/chart.js
var Chart = function(_super) {
__extends(Chart3, _super);
function Chart3(props) {
var _this = this;
var container2 = props.container, width2 = props.width, height = props.height, _a6 = props.autoFit, autoFit = _a6 === void 0 ? false : _a6, padding3 = props.padding, appendPadding = props.appendPadding, _b = props.renderer, renderer = _b === void 0 ? "canvas" : _b, pixelRatio = props.pixelRatio, _c = props.localRefresh, localRefresh = _c === void 0 ? true : _c, _d = props.visible, visible = _d === void 0 ? true : _d, _e = props.supportCSSTransform, supportCSSTransform = _e === void 0 ? false : _e, _f = props.defaultInteractions, defaultInteractions = _f === void 0 ? ["tooltip", "legend-filter", "legend-active", "continuous-filter", "ellipsis-text"] : _f, options = props.options, limitInPlot5 = props.limitInPlot, theme4 = props.theme, syncViewPadding2 = props.syncViewPadding;
var ele = is_string_default(container2) ? document.getElementById(container2) : container2;
var wrapperElement = createDom('');
ele.appendChild(wrapperElement);
var size2 = getChartSize(ele, autoFit, width2, height);
var G2 = getEngine(renderer);
var canvas = new G2.Canvas(__assign({ container: wrapperElement, pixelRatio, localRefresh, supportCSSTransform }, size2));
_this = _super.call(this, {
parent: null,
canvas,
backgroundGroup: canvas.addGroup({ zIndex: GROUP_Z_INDEX.BG }),
middleGroup: canvas.addGroup({ zIndex: GROUP_Z_INDEX.MID }),
foregroundGroup: canvas.addGroup({ zIndex: GROUP_Z_INDEX.FORE }),
padding: padding3,
appendPadding,
visible,
options,
limitInPlot: limitInPlot5,
theme: theme4,
syncViewPadding: syncViewPadding2
}) || this;
_this.onResize = debounce_default(function() {
_this.forceFit();
}, 300);
_this.ele = ele;
_this.canvas = canvas;
_this.width = size2.width;
_this.height = size2.height;
_this.autoFit = autoFit;
_this.localRefresh = localRefresh;
_this.renderer = renderer;
_this.wrapperElement = wrapperElement;
_this.updateCanvasStyle();
_this.bindAutoFit();
_this.initDefaultInteractions(defaultInteractions);
return _this;
}
Chart3.prototype.initDefaultInteractions = function(interactions) {
var _this = this;
each_default(interactions, function(interaction8) {
_this.interaction(interaction8);
});
};
Chart3.prototype.aria = function(ariaOption) {
var ATTR = "aria-label";
if (ariaOption === false) {
this.ele.removeAttribute(ATTR);
} else {
this.ele.setAttribute(ATTR, ariaOption.label);
}
};
Chart3.prototype.changeSize = function(width2, height) {
if (this.width === width2 && this.height === height) {
return this;
}
this.emit(VIEW_LIFE_CIRCLE.BEFORE_CHANGE_SIZE);
this.width = width2;
this.height = height;
this.canvas.changeSize(width2, height);
this.render(true);
this.emit(VIEW_LIFE_CIRCLE.AFTER_CHANGE_SIZE);
return this;
};
Chart3.prototype.clear = function() {
_super.prototype.clear.call(this);
this.aria(false);
};
Chart3.prototype.destroy = function() {
_super.prototype.destroy.call(this);
this.unbindAutoFit();
this.canvas.destroy();
removeDom(this.wrapperElement);
this.wrapperElement = null;
};
Chart3.prototype.changeVisible = function(visible) {
_super.prototype.changeVisible.call(this, visible);
this.wrapperElement.style.display = visible ? "" : "none";
return this;
};
Chart3.prototype.forceFit = function() {
if (!this.destroyed) {
var _a6 = getChartSize(this.ele, true, this.width, this.height), width2 = _a6.width, height = _a6.height;
this.changeSize(width2, height);
}
};
Chart3.prototype.updateCanvasStyle = function() {
modifyCSS(this.canvas.get("el"), {
display: "inline-block",
verticalAlign: "middle"
});
};
Chart3.prototype.bindAutoFit = function() {
if (this.autoFit) {
window.addEventListener("resize", this.onResize);
}
};
Chart3.prototype.unbindAutoFit = function() {
if (this.autoFit) {
window.removeEventListener("resize", this.onResize);
}
};
return Chart3;
}(view_default);
var chart_default = Chart;
// node_modules/@antv/g2/esm/chart/controller/base.js
var Controller = function() {
function Controller2(view) {
this.visible = true;
this.components = [];
this.view = view;
}
Controller2.prototype.clear = function(includeOption) {
each_default(this.components, function(co) {
co.component.destroy();
});
this.components = [];
};
Controller2.prototype.destroy = function() {
this.clear();
};
Controller2.prototype.getComponents = function() {
return this.components;
};
Controller2.prototype.changeVisible = function(visible) {
if (this.visible === visible) {
return;
}
this.components.forEach(function(co) {
if (visible) {
co.component.show();
} else {
co.component.hide();
}
});
this.visible = visible;
};
return Controller2;
}();
// node_modules/@antv/g2/esm/chart/controller/tooltip.js
function uniq3(items) {
var uniqItems = [];
var _loop_1 = function(index3) {
var item = items[index3];
var result = find_default(uniqItems, function(subItem) {
return subItem.color === item.color && subItem.name === item.name && subItem.value === item.value && subItem.title === item.title;
});
if (!result) {
uniqItems.push(item);
}
};
for (var index2 = 0; index2 < items.length; index2++) {
_loop_1(index2);
}
return uniqItems;
}
var Tooltip2 = function(_super) {
__extends(Tooltip5, _super);
function Tooltip5() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.isLocked = false;
return _this;
}
Object.defineProperty(Tooltip5.prototype, "name", {
get: function() {
return "tooltip";
},
enumerable: false,
configurable: true
});
Tooltip5.prototype.init = function() {
};
Tooltip5.prototype.isVisible = function() {
var option = this.view.getOptions().tooltip;
return option !== false;
};
Tooltip5.prototype.render = function() {
};
Tooltip5.prototype.showTooltip = function(point2) {
this.point = point2;
if (!this.isVisible()) {
return;
}
var view = this.view;
var items = this.getTooltipItems(point2);
if (!items.length) {
this.hideTooltip();
return;
}
var title = this.getTitle(items);
var dataPoint = {
x: items[0].x,
y: items[0].y
};
view.emit("tooltip:show", event_default.fromData(view, "tooltip:show", __assign({ items, title }, point2)));
var cfg = this.getTooltipCfg();
var follow = cfg.follow, showMarkers = cfg.showMarkers, showCrosshairs = cfg.showCrosshairs, showContent = cfg.showContent, marker = cfg.marker;
var lastItems = this.items;
var lastTitle = this.title;
if (!is_equal_default(lastTitle, title) || !is_equal_default(lastItems, items)) {
view.emit("tooltip:change", event_default.fromData(view, "tooltip:change", __assign({ items, title }, point2)));
if (is_function_default(showContent) ? showContent(items) : showContent) {
if (!this.tooltip) {
this.renderTooltip();
}
this.tooltip.update(mix({}, cfg, {
items: this.getItemsAfterProcess(items),
title
}, follow ? point2 : {}));
this.tooltip.show();
}
if (showMarkers) {
this.renderTooltipMarkers(items, marker);
}
} else {
if (this.tooltip && follow) {
this.tooltip.update(point2);
this.tooltip.show();
}
if (this.tooltipMarkersGroup) {
this.tooltipMarkersGroup.show();
}
}
this.items = items;
this.title = title;
if (showCrosshairs) {
var isCrosshairsFollowCursor = get_default(cfg, ["crosshairs", "follow"], false);
this.renderCrosshairs(isCrosshairsFollowCursor ? point2 : dataPoint, cfg);
}
};
Tooltip5.prototype.hideTooltip = function() {
var follow = this.getTooltipCfg().follow;
if (!follow) {
this.point = null;
return;
}
var tooltipMarkersGroup = this.tooltipMarkersGroup;
if (tooltipMarkersGroup) {
tooltipMarkersGroup.hide();
}
var xCrosshair = this.xCrosshair;
var yCrosshair = this.yCrosshair;
if (xCrosshair) {
xCrosshair.hide();
}
if (yCrosshair) {
yCrosshair.hide();
}
var tooltip10 = this.tooltip;
if (tooltip10) {
tooltip10.hide();
}
this.view.emit("tooltip:hide", event_default.fromData(this.view, "tooltip:hide", {}));
this.point = null;
};
Tooltip5.prototype.lockTooltip = function() {
this.isLocked = true;
if (this.tooltip) {
this.tooltip.setCapture(true);
}
};
Tooltip5.prototype.unlockTooltip = function() {
this.isLocked = false;
var cfg = this.getTooltipCfg();
if (this.tooltip) {
this.tooltip.setCapture(cfg.capture);
}
};
Tooltip5.prototype.isTooltipLocked = function() {
return this.isLocked;
};
Tooltip5.prototype.clear = function() {
var _a6 = this, tooltip10 = _a6.tooltip, xCrosshair = _a6.xCrosshair, yCrosshair = _a6.yCrosshair, tooltipMarkersGroup = _a6.tooltipMarkersGroup;
if (tooltip10) {
tooltip10.hide();
tooltip10.clear();
}
if (xCrosshair) {
xCrosshair.clear();
}
if (yCrosshair) {
yCrosshair.clear();
}
if (tooltipMarkersGroup) {
tooltipMarkersGroup.clear();
}
if (tooltip10 === null || tooltip10 === void 0 ? void 0 : tooltip10.get("customContent")) {
this.tooltip.destroy();
this.tooltip = null;
}
this.title = null;
this.items = null;
};
Tooltip5.prototype.destroy = function() {
if (this.tooltip) {
this.tooltip.destroy();
}
if (this.xCrosshair) {
this.xCrosshair.destroy();
}
if (this.yCrosshair) {
this.yCrosshair.destroy();
}
if (this.guideGroup) {
this.guideGroup.remove(true);
}
this.reset();
};
Tooltip5.prototype.reset = function() {
this.items = null;
this.title = null;
this.tooltipMarkersGroup = null;
this.tooltipCrosshairsGroup = null;
this.xCrosshair = null;
this.yCrosshair = null;
this.tooltip = null;
this.guideGroup = null;
this.isLocked = false;
this.point = null;
};
Tooltip5.prototype.changeVisible = function(visible) {
if (this.visible === visible) {
return;
}
var _a6 = this, tooltip10 = _a6.tooltip, tooltipMarkersGroup = _a6.tooltipMarkersGroup, xCrosshair = _a6.xCrosshair, yCrosshair = _a6.yCrosshair;
if (visible) {
if (tooltip10) {
tooltip10.show();
}
if (tooltipMarkersGroup) {
tooltipMarkersGroup.show();
}
if (xCrosshair) {
xCrosshair.show();
}
if (yCrosshair) {
yCrosshair.show();
}
} else {
if (tooltip10) {
tooltip10.hide();
}
if (tooltipMarkersGroup) {
tooltipMarkersGroup.hide();
}
if (xCrosshair) {
xCrosshair.hide();
}
if (yCrosshair) {
yCrosshair.hide();
}
}
this.visible = visible;
};
Tooltip5.prototype.getTooltipItems = function(point2) {
var items = this.findItemsFromView(this.view, point2);
if (items.length) {
items = flatten_default(items);
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
var itemArr = items_1[_i];
for (var _a6 = 0, itemArr_1 = itemArr; _a6 < itemArr_1.length; _a6++) {
var item = itemArr_1[_a6];
var _b = item.mappingData, x6 = _b.x, y5 = _b.y;
item.x = is_array_default(x6) ? x6[x6.length - 1] : x6;
item.y = is_array_default(y5) ? y5[y5.length - 1] : y5;
}
}
var shared = this.getTooltipCfg().shared;
if (shared === false && items.length > 1) {
var snapItem = items[0];
var min7 = Math.abs(point2.y - snapItem[0].y);
for (var _c = 0, items_2 = items; _c < items_2.length; _c++) {
var aItem = items_2[_c];
var yDistance = Math.abs(point2.y - aItem[0].y);
if (yDistance <= min7) {
snapItem = aItem;
min7 = yDistance;
}
}
items = [snapItem];
}
return uniq3(flatten_default(items));
}
return [];
};
Tooltip5.prototype.layout = function() {
};
Tooltip5.prototype.update = function() {
if (this.point) {
this.showTooltip(this.point);
}
if (this.tooltip) {
var canvas = this.view.getCanvas();
this.tooltip.set("region", {
start: { x: 0, y: 0 },
end: { x: canvas.get("width"), y: canvas.get("height") }
});
}
};
Tooltip5.prototype.isCursorEntered = function(point2) {
if (this.tooltip) {
var el = this.tooltip.getContainer();
var capture = this.tooltip.get("capture");
if (el && capture) {
var _a6 = el.getBoundingClientRect(), x6 = _a6.x, y5 = _a6.y, width2 = _a6.width, height = _a6.height;
return new BBox(x6, y5, width2, height).isPointIn(point2);
}
}
return false;
};
Tooltip5.prototype.getTooltipCfg = function() {
var view = this.view;
var option = view.getOptions().tooltip;
var processOption = this.processCustomContent(option);
var theme4 = view.getTheme();
var defaultCfg2 = get_default(theme4, ["components", "tooltip"], {});
var enterable = get_default(processOption, "enterable", defaultCfg2.enterable);
return deep_mix_default({}, defaultCfg2, processOption, {
capture: enterable || this.isLocked ? true : false
});
};
Tooltip5.prototype.processCustomContent = function(option) {
if (is_boolean_default(option) || !get_default(option, "customContent")) {
return option;
}
var currentCustomContent = option.customContent;
var customContent = function(title, items) {
var content = currentCustomContent(title, items) || "";
return is_string_default(content) ? '' + content + "
" : content;
};
return __assign(__assign({}, option), { customContent });
};
Tooltip5.prototype.getTitle = function(items) {
var title = items[0].title || items[0].name;
this.title = title;
return title;
};
Tooltip5.prototype.renderTooltip = function() {
var canvas = this.view.getCanvas();
var region = {
start: { x: 0, y: 0 },
end: { x: canvas.get("width"), y: canvas.get("height") }
};
var cfg = this.getTooltipCfg();
var tooltip10 = new HtmlTooltip(__assign(__assign({ parent: canvas.get("el").parentNode, region }, cfg), { visible: false, crosshairs: null }));
tooltip10.init();
this.tooltip = tooltip10;
};
Tooltip5.prototype.renderTooltipMarkers = function(items, marker) {
var tooltipMarkersGroup = this.getTooltipMarkersGroup();
for (var _i = 0, items_3 = items; _i < items_3.length; _i++) {
var item = items_3[_i];
var x6 = item.x, y5 = item.y;
var attrs = __assign(__assign({ fill: item.color, symbol: "circle", shadowColor: item.color }, marker), { x: x6, y: y5 });
tooltipMarkersGroup.addShape("marker", {
attrs
});
}
};
Tooltip5.prototype.renderCrosshairs = function(point2, cfg) {
var crosshairsType = get_default(cfg, ["crosshairs", "type"], "x");
if (crosshairsType === "x") {
if (this.yCrosshair) {
this.yCrosshair.hide();
}
this.renderXCrosshairs(point2, cfg);
} else if (crosshairsType === "y") {
if (this.xCrosshair) {
this.xCrosshair.hide();
}
this.renderYCrosshairs(point2, cfg);
} else if (crosshairsType === "xy") {
this.renderXCrosshairs(point2, cfg);
this.renderYCrosshairs(point2, cfg);
}
};
Tooltip5.prototype.renderXCrosshairs = function(point2, tooltipCfg) {
var coordinate11 = this.getViewWithGeometry(this.view).getCoordinate();
if (!isPointInCoordinate(coordinate11, point2)) {
return;
}
var start;
var end2;
if (coordinate11.isRect) {
if (coordinate11.isTransposed) {
start = {
x: coordinate11.start.x,
y: point2.y
};
end2 = {
x: coordinate11.end.x,
y: point2.y
};
} else {
start = {
x: point2.x,
y: coordinate11.end.y
};
end2 = {
x: point2.x,
y: coordinate11.start.y
};
}
} else {
var angle3 = getAngleByPoint(coordinate11, point2);
var center2 = coordinate11.getCenter();
var radius = coordinate11.getRadius();
end2 = polarToCartesian(center2.x, center2.y, radius, angle3);
start = center2;
}
var cfg = deep_mix_default({
start,
end: end2,
container: this.getTooltipCrosshairsGroup()
}, get_default(tooltipCfg, "crosshairs", {}), this.getCrosshairsText("x", point2, tooltipCfg));
delete cfg.type;
var xCrosshair = this.xCrosshair;
if (xCrosshair) {
xCrosshair.update(cfg);
} else {
xCrosshair = new crosshair_exports.Line(cfg);
xCrosshair.init();
}
xCrosshair.render();
xCrosshair.show();
this.xCrosshair = xCrosshair;
};
Tooltip5.prototype.renderYCrosshairs = function(point2, tooltipCfg) {
var coordinate11 = this.getViewWithGeometry(this.view).getCoordinate();
if (!isPointInCoordinate(coordinate11, point2)) {
return;
}
var cfg;
var type2;
if (coordinate11.isRect) {
var start = void 0;
var end2 = void 0;
if (coordinate11.isTransposed) {
start = {
x: point2.x,
y: coordinate11.end.y
};
end2 = {
x: point2.x,
y: coordinate11.start.y
};
} else {
start = {
x: coordinate11.start.x,
y: point2.y
};
end2 = {
x: coordinate11.end.x,
y: point2.y
};
}
cfg = {
start,
end: end2
};
type2 = "Line";
} else {
cfg = {
center: coordinate11.getCenter(),
radius: getDistanceToCenter(coordinate11, point2),
startAngle: coordinate11.startAngle,
endAngle: coordinate11.endAngle
};
type2 = "Circle";
}
cfg = deep_mix_default({
container: this.getTooltipCrosshairsGroup()
}, cfg, get_default(tooltipCfg, "crosshairs", {}), this.getCrosshairsText("y", point2, tooltipCfg));
delete cfg.type;
var yCrosshair = this.yCrosshair;
if (yCrosshair) {
if (coordinate11.isRect && yCrosshair.get("type") === "circle" || !coordinate11.isRect && yCrosshair.get("type") === "line") {
yCrosshair = new crosshair_exports[type2](cfg);
yCrosshair.init();
} else {
yCrosshair.update(cfg);
}
} else {
yCrosshair = new crosshair_exports[type2](cfg);
yCrosshair.init();
}
yCrosshair.render();
yCrosshair.show();
this.yCrosshair = yCrosshair;
};
Tooltip5.prototype.getCrosshairsText = function(type2, point2, tooltipCfg) {
var textCfg = get_default(tooltipCfg, ["crosshairs", "text"]);
var follow = get_default(tooltipCfg, ["crosshairs", "follow"]);
var items = this.items;
if (textCfg) {
var view = this.getViewWithGeometry(this.view);
var firstItem = items[0];
var xScale = view.getXScale();
var yScale = view.getYScales()[0];
var xValue = void 0;
var yValue = void 0;
if (follow) {
var invertPoint = this.view.getCoordinate().invert(point2);
xValue = xScale.invert(invertPoint.x);
yValue = yScale.invert(invertPoint.y);
} else {
xValue = firstItem.data[xScale.field];
yValue = firstItem.data[yScale.field];
}
var content = type2 === "x" ? xValue : yValue;
if (is_function_default(textCfg)) {
textCfg = textCfg(type2, content, items, point2);
} else {
textCfg.content = content;
}
return {
text: textCfg
};
}
};
Tooltip5.prototype.getGuideGroup = function() {
if (!this.guideGroup) {
var foregroundGroup = this.view.foregroundGroup;
this.guideGroup = foregroundGroup.addGroup({
name: "tooltipGuide",
capture: false
});
}
return this.guideGroup;
};
Tooltip5.prototype.getTooltipMarkersGroup = function() {
var tooltipMarkersGroup = this.tooltipMarkersGroup;
if (tooltipMarkersGroup && !tooltipMarkersGroup.destroyed) {
tooltipMarkersGroup.clear();
tooltipMarkersGroup.show();
} else {
tooltipMarkersGroup = this.getGuideGroup().addGroup({
name: "tooltipMarkersGroup"
});
tooltipMarkersGroup.toFront();
this.tooltipMarkersGroup = tooltipMarkersGroup;
}
return tooltipMarkersGroup;
};
Tooltip5.prototype.getTooltipCrosshairsGroup = function() {
var tooltipCrosshairsGroup = this.tooltipCrosshairsGroup;
if (!tooltipCrosshairsGroup) {
tooltipCrosshairsGroup = this.getGuideGroup().addGroup({
name: "tooltipCrosshairsGroup",
capture: false
});
tooltipCrosshairsGroup.toBack();
this.tooltipCrosshairsGroup = tooltipCrosshairsGroup;
}
return tooltipCrosshairsGroup;
};
Tooltip5.prototype.findItemsFromView = function(view, point2) {
if (view.getOptions().tooltip === false) {
return [];
}
var tooltipCfg = this.getTooltipCfg();
var result = findItemsFromView(view, point2, tooltipCfg);
for (var _i = 0, _a6 = view.views; _i < _a6.length; _i++) {
var childView = _a6[_i];
result = result.concat(this.findItemsFromView(childView, point2));
}
return result;
};
Tooltip5.prototype.getViewWithGeometry = function(view) {
var _this = this;
if (view.geometries.length) {
return view;
}
return find_default(view.views, function(childView) {
return _this.getViewWithGeometry(childView);
});
};
Tooltip5.prototype.getItemsAfterProcess = function(originalItems) {
var customItems = this.getTooltipCfg().customItems;
var fn2 = customItems ? customItems : function(v3) {
return v3;
};
return fn2(originalItems);
};
return Tooltip5;
}(Controller);
var tooltip_default = Tooltip2;
// node_modules/@antv/g2/esm/animate/animation/index.js
var ANIMATIONS_MAP = {};
function getAnimation(type2) {
return ANIMATIONS_MAP[type2.toLowerCase()];
}
function registerAnimation(type2, animation7) {
ANIMATIONS_MAP[type2.toLowerCase()] = animation7;
}
// node_modules/@antv/g2/esm/animate/index.js
var DEFAULT_ANIMATE_CFG = {
appear: {
duration: 450,
easing: "easeQuadOut"
},
update: {
duration: 400,
easing: "easeQuadInOut"
},
enter: {
duration: 400,
easing: "easeQuadInOut"
},
leave: {
duration: 350,
easing: "easeQuadIn"
}
};
var GEOMETRY_ANIMATE_CFG = {
interval: function(coordinate11) {
return {
enter: {
animation: coordinate11.isRect ? coordinate11.isTransposed ? "scale-in-x" : "scale-in-y" : "fade-in"
},
update: {
animation: coordinate11.isPolar && coordinate11.isTransposed ? "sector-path-update" : null
},
leave: {
animation: "fade-out"
}
};
},
line: {
enter: {
animation: "fade-in"
},
leave: {
animation: "fade-out"
}
},
path: {
enter: {
animation: "fade-in"
},
leave: {
animation: "fade-out"
}
},
point: {
appear: {
animation: "zoom-in"
},
enter: {
animation: "zoom-in"
},
leave: {
animation: "zoom-out"
}
},
area: {
enter: {
animation: "fade-in"
},
leave: {
animation: "fade-out"
}
},
polygon: {
enter: {
animation: "fade-in"
},
leave: {
animation: "fade-out"
}
},
schema: {
enter: {
animation: "fade-in"
},
leave: {
animation: "fade-out"
}
},
edge: {
enter: {
animation: "fade-in"
},
leave: {
animation: "fade-out"
}
},
label: {
appear: {
animation: "fade-in",
delay: 450
},
enter: {
animation: "fade-in"
},
update: {
animation: "position-update"
},
leave: {
animation: "fade-out"
}
}
};
var GEOMETRY_GROUP_APPEAR_ANIMATION = {
line: function() {
return {
animation: "wave-in"
};
},
area: function() {
return {
animation: "wave-in"
};
},
path: function() {
return {
animation: "fade-in"
};
},
interval: function(coordinate11) {
var animation7;
if (coordinate11.isRect) {
animation7 = coordinate11.isTransposed ? "grow-in-x" : "grow-in-y";
} else {
animation7 = "grow-in-xy";
if (coordinate11.isPolar && coordinate11.isTransposed) {
animation7 = "wave-in";
}
}
return {
animation: animation7
};
},
schema: function(coordinate11) {
var animation7;
if (coordinate11.isRect) {
animation7 = coordinate11.isTransposed ? "grow-in-x" : "grow-in-y";
} else {
animation7 = "grow-in-xy";
}
return {
animation: animation7
};
},
polygon: function() {
return {
animation: "fade-in",
duration: 500
};
},
edge: function() {
return {
animation: "fade-in"
};
}
};
function parseAnimateConfig(animateCfg, data3) {
return {
delay: is_function_default(animateCfg.delay) ? animateCfg.delay(data3) : animateCfg.delay,
easing: is_function_default(animateCfg.easing) ? animateCfg.easing(data3) : animateCfg.easing,
duration: is_function_default(animateCfg.duration) ? animateCfg.duration(data3) : animateCfg.duration,
callback: animateCfg.callback,
repeat: animateCfg.repeat
};
}
function getDefaultAnimateCfg(elementName, coordinate11, animateType) {
var animateCfg = GEOMETRY_ANIMATE_CFG[elementName];
if (animateCfg) {
if (is_function_default(animateCfg)) {
animateCfg = animateCfg(coordinate11);
}
animateCfg = deep_mix_default({}, DEFAULT_ANIMATE_CFG, animateCfg);
if (animateType) {
return animateCfg[animateType];
}
}
return animateCfg;
}
function doAnimate(shape, animateCfg, cfg) {
var data3 = get_default(shape.get("origin"), "data", FIELD_ORIGIN);
var animation7 = animateCfg.animation;
var parsedAnimateCfg = parseAnimateConfig(animateCfg, data3);
if (animation7) {
var animateFunction = getAnimation(animation7);
if (animateFunction) {
animateFunction(shape, parsedAnimateCfg, cfg);
}
} else {
shape.animate(cfg.toAttrs, parsedAnimateCfg);
}
}
function doGroupAppearAnimate(container2, animateCfg, geometryType, coordinate11, minYPoint) {
if (GEOMETRY_GROUP_APPEAR_ANIMATION[geometryType]) {
var defaultCfg2 = GEOMETRY_GROUP_APPEAR_ANIMATION[geometryType](coordinate11);
var animation7 = getAnimation(get_default(defaultCfg2, "animation", ""));
if (animation7) {
var cfg = __assign(__assign(__assign({}, DEFAULT_ANIMATE_CFG.appear), defaultCfg2), animateCfg);
container2.stopAnimate();
animation7(container2, cfg, {
coordinate: coordinate11,
minYPoint,
toAttrs: null
});
}
}
}
// node_modules/@antv/g2/esm/geometry/shape/constant.js
var BACKGROUND_SHAPE = "element-background";
// node_modules/@antv/g2/esm/geometry/element/index.js
var Element3 = function(_super) {
__extends(Element4, _super);
function Element4(cfg) {
var _this = _super.call(this, cfg) || this;
_this.states = [];
var shapeFactory = cfg.shapeFactory, container2 = cfg.container, offscreenGroup = cfg.offscreenGroup, elementIndex = cfg.elementIndex, _a6 = cfg.visible, visible = _a6 === void 0 ? true : _a6;
_this.shapeFactory = shapeFactory;
_this.container = container2;
_this.offscreenGroup = offscreenGroup;
_this.visible = visible;
_this.elementIndex = elementIndex;
return _this;
}
Element4.prototype.draw = function(model, isUpdate) {
if (isUpdate === void 0) {
isUpdate = false;
}
this.model = model;
this.data = model.data;
this.shapeType = this.getShapeType(model);
this.drawShape(model, isUpdate);
if (this.visible === false) {
this.changeVisible(false);
}
};
Element4.prototype.update = function(model) {
var _a6 = this, shapeFactory = _a6.shapeFactory, shape = _a6.shape;
if (!shape) {
return;
}
this.model = model;
this.data = model.data;
this.shapeType = this.getShapeType(model);
this.setShapeInfo(shape, model);
var offscreenGroup = this.getOffscreenGroup();
var newShape = shapeFactory.drawShape(this.shapeType, model, offscreenGroup);
newShape.cfg.data = this.data;
newShape.cfg.origin = model;
newShape.cfg.element = this;
this.syncShapeStyle(shape, newShape, this.getStates(), this.getAnimateCfg("update"));
};
Element4.prototype.destroy = function() {
var _a6 = this, shapeFactory = _a6.shapeFactory, shape = _a6.shape;
if (shape) {
var animateCfg = this.getAnimateCfg("leave");
if (animateCfg) {
doAnimate(shape, animateCfg, {
coordinate: shapeFactory.coordinate,
toAttrs: __assign({}, shape.attr())
});
} else {
shape.remove(true);
}
}
this.states = [];
this.shapeFactory = void 0;
this.container = void 0;
this.shape = void 0;
this.animate = void 0;
this.geometry = void 0;
this.labelShape = void 0;
this.model = void 0;
this.data = void 0;
this.offscreenGroup = void 0;
this.statesStyle = void 0;
_super.prototype.destroy.call(this);
};
Element4.prototype.changeVisible = function(visible) {
_super.prototype.changeVisible.call(this, visible);
if (visible) {
if (this.shape) {
this.shape.show();
}
if (this.labelShape) {
this.labelShape.forEach(function(label17) {
label17.show();
});
}
} else {
if (this.shape) {
this.shape.hide();
}
if (this.labelShape) {
this.labelShape.forEach(function(label17) {
label17.hide();
});
}
}
};
Element4.prototype.setState = function(stateName, stateStatus) {
var _a6 = this, states = _a6.states, shapeFactory = _a6.shapeFactory, model = _a6.model, shape = _a6.shape, shapeType = _a6.shapeType;
var index2 = states.indexOf(stateName);
if (stateStatus) {
if (index2 > -1) {
return;
}
states.push(stateName);
if (stateName === "active" || stateName === "selected") {
shape === null || shape === void 0 ? void 0 : shape.toFront();
}
} else {
if (index2 === -1) {
return;
}
states.splice(index2, 1);
if (stateName === "active" || stateName === "selected") {
var _b = this.geometry, sortZIndex = _b.sortZIndex, zIndexReversed = _b.zIndexReversed;
var idx = zIndexReversed ? this.geometry.elements.length - this.elementIndex : this.elementIndex;
sortZIndex ? shape.setZIndex(idx) : shape.set("zIndex", idx);
}
}
var offscreenShape = shapeFactory.drawShape(shapeType, model, this.getOffscreenGroup());
if (states.length) {
this.syncShapeStyle(shape, offscreenShape, states, null);
} else {
this.syncShapeStyle(shape, offscreenShape, ["reset"], null);
}
offscreenShape.remove(true);
var eventObject = {
state: stateName,
stateStatus,
element: this,
target: this.container
};
this.container.emit("statechange", eventObject);
propagationDelegate(this.shape, "statechange", eventObject);
};
Element4.prototype.clearStates = function() {
var _this = this;
var states = this.states;
each_default(states, function(state2) {
_this.setState(state2, false);
});
this.states = [];
};
Element4.prototype.hasState = function(stateName) {
return this.states.includes(stateName);
};
Element4.prototype.getStates = function() {
return this.states;
};
Element4.prototype.getData = function() {
return this.data;
};
Element4.prototype.getModel = function() {
return this.model;
};
Element4.prototype.getBBox = function() {
var _a6 = this, shape = _a6.shape, labelShape = _a6.labelShape;
var bbox = {
x: 0,
y: 0,
minX: 0,
minY: 0,
maxX: 0,
maxY: 0,
width: 0,
height: 0
};
if (shape) {
bbox = shape.getCanvasBBox();
}
if (labelShape) {
labelShape.forEach(function(label17) {
var labelBBox = label17.getCanvasBBox();
bbox.x = Math.min(labelBBox.x, bbox.x);
bbox.y = Math.min(labelBBox.y, bbox.y);
bbox.minX = Math.min(labelBBox.minX, bbox.minX);
bbox.minY = Math.min(labelBBox.minY, bbox.minY);
bbox.maxX = Math.max(labelBBox.maxX, bbox.maxX);
bbox.maxY = Math.max(labelBBox.maxY, bbox.maxY);
});
}
bbox.width = bbox.maxX - bbox.minX;
bbox.height = bbox.maxY - bbox.minY;
return bbox;
};
Element4.prototype.getStatesStyle = function() {
if (!this.statesStyle) {
var _a6 = this, shapeType = _a6.shapeType, geometry35 = _a6.geometry, shapeFactory = _a6.shapeFactory;
var stateOption = geometry35.stateOption;
var defaultShapeType = shapeFactory.defaultShapeType;
var stateTheme = shapeFactory.theme[shapeType] || shapeFactory.theme[defaultShapeType];
this.statesStyle = deep_mix_default({}, stateTheme, stateOption);
}
return this.statesStyle;
};
Element4.prototype.getStateStyle = function(stateName, shapeKey) {
var statesStyle = this.getStatesStyle();
var stateCfg = get_default(statesStyle, [stateName, "style"], {});
var shapeStyle = stateCfg[shapeKey] || stateCfg;
if (is_function_default(shapeStyle)) {
return shapeStyle(this);
}
return shapeStyle;
};
Element4.prototype.getAnimateCfg = function(animateType) {
var _this = this;
var animate = this.animate;
if (animate) {
var cfg_1 = animate[animateType];
if (cfg_1) {
return __assign(__assign({}, cfg_1), { callback: function() {
var _a6;
is_function_default(cfg_1.callback) && cfg_1.callback();
(_a6 = _this.geometry) === null || _a6 === void 0 ? void 0 : _a6.emit(GEOMETRY_LIFE_CIRCLE.AFTER_DRAW_ANIMATE);
} });
}
return cfg_1;
}
return null;
};
Element4.prototype.drawShape = function(model, isUpdate) {
var _a6;
if (isUpdate === void 0) {
isUpdate = false;
}
var _b = this, shapeFactory = _b.shapeFactory, container2 = _b.container, shapeType = _b.shapeType;
this.shape = shapeFactory.drawShape(shapeType, model, container2);
if (this.shape) {
this.setShapeInfo(this.shape, model);
var name_1 = this.shape.cfg.name;
if (!name_1) {
this.shape.cfg.name = ["element", this.shapeFactory.geometryType];
} else if (is_string_default(name_1)) {
this.shape.cfg.name = ["element", name_1];
}
var animateType = isUpdate ? "enter" : "appear";
var animateCfg = this.getAnimateCfg(animateType);
if (animateCfg) {
(_a6 = this.geometry) === null || _a6 === void 0 ? void 0 : _a6.emit(GEOMETRY_LIFE_CIRCLE.BEFORE_DRAW_ANIMATE);
doAnimate(this.shape, animateCfg, {
coordinate: shapeFactory.coordinate,
toAttrs: __assign({}, this.shape.attr())
});
}
}
};
Element4.prototype.getOffscreenGroup = function() {
if (!this.offscreenGroup) {
var GroupCtor = this.container.getGroupBase();
this.offscreenGroup = new GroupCtor({});
}
return this.offscreenGroup;
};
Element4.prototype.setShapeInfo = function(shape, data3) {
var _this = this;
shape.cfg.origin = data3;
shape.cfg.element = this;
if (shape.isGroup()) {
var children = shape.get("children");
children.forEach(function(child) {
_this.setShapeInfo(child, data3);
});
}
};
Element4.prototype.syncShapeStyle = function(sourceShape, targetShape, states, animateCfg, index2) {
var _this = this;
var _a6;
if (states === void 0) {
states = [];
}
if (index2 === void 0) {
index2 = 0;
}
if (!sourceShape || !targetShape) {
return;
}
var clip = sourceShape.get("clipShape");
var newClip = targetShape.get("clipShape");
this.syncShapeStyle(clip, newClip, states, animateCfg);
if (sourceShape.isGroup()) {
var children = sourceShape.get("children");
var newChildren = targetShape.get("children");
for (var i4 = 0; i4 < children.length; i4++) {
this.syncShapeStyle(children[i4], newChildren[i4], states, animateCfg, index2 + i4);
}
} else {
if (!is_empty_default(states) && !is_equal_default(states, ["reset"])) {
var name_2 = sourceShape.get("name");
if (is_array_default(name_2)) {
name_2 = name_2[1];
}
each_default(states, function(state2) {
if (targetShape.get("name") !== BACKGROUND_SHAPE) {
var style = _this.getStateStyle(state2, name_2 || index2);
targetShape.attr(style);
}
});
}
var newAttrs = getReplaceAttrs(sourceShape, targetShape);
if (this.animate) {
if (animateCfg) {
(_a6 = this.geometry) === null || _a6 === void 0 ? void 0 : _a6.emit(GEOMETRY_LIFE_CIRCLE.BEFORE_DRAW_ANIMATE);
doAnimate(sourceShape, animateCfg, {
coordinate: this.shapeFactory.coordinate,
toAttrs: newAttrs,
shapeModel: this.model
});
} else if (!is_empty_default(states)) {
sourceShape.stopAnimate();
sourceShape.animate(newAttrs, {
duration: 300
});
} else {
sourceShape.attr(newAttrs);
}
} else {
sourceShape.attr(newAttrs);
}
}
};
Element4.prototype.getShapeType = function(model) {
var shape = get_default(model, "shape");
return is_array_default(shape) ? shape[0] : shape;
};
return Element4;
}(base_default);
var element_default2 = Element3;
// node_modules/@antv/g2/esm/geometry/label/index.js
var GEOMETRY_LABELS_MAP = {};
var GEOMETRY_LABELS_LAYOUT_MAP = {};
function getGeometryLabel(type2) {
return GEOMETRY_LABELS_MAP[type2.toLowerCase()];
}
function registerGeometryLabel(type2, ctor) {
GEOMETRY_LABELS_MAP[type2.toLowerCase()] = ctor;
}
function getGeometryLabelLayout(type2) {
return GEOMETRY_LABELS_LAYOUT_MAP[type2.toLowerCase()];
}
function registerGeometryLabelLayout(type2, layoutFn) {
GEOMETRY_LABELS_LAYOUT_MAP[type2.toLowerCase()] = layoutFn;
}
// node_modules/@antv/g2/esm/geometry/shape/base.js
var ShapeFactoryBase = {
coordinate: null,
defaultShapeType: null,
theme: null,
getShapePoints: function(shapeType, shapePoint) {
var shape = this.getShape(shapeType);
if (shape.getPoints) {
return shape.getPoints(shapePoint);
}
return this.getDefaultPoints(shapePoint);
},
getShape: function(shapeType) {
var shape = this[shapeType] || this[this.defaultShapeType];
shape.coordinate = this.coordinate;
return shape;
},
getDefaultPoints: function() {
return [];
},
getDefaultStyle: function(geometryTheme) {
return get_default(geometryTheme, [this.defaultShapeType, "default", "style"], {});
},
getMarker: function(shapeType, markerCfg) {
var shape = this.getShape(shapeType);
if (!shape.getMarker) {
var defaultShapeType = this.defaultShapeType;
shape = this.getShape(defaultShapeType);
}
var theme4 = this.theme;
var shapeStyle = get_default(theme4, [shapeType, "default"], {});
var markerStyle = shape.getMarker(markerCfg);
return deep_mix_default({}, shapeStyle, markerStyle);
},
drawShape: function(shapeType, cfg, container2) {
var shape = this.getShape(shapeType);
return shape.draw(cfg, container2);
}
};
var ShapeBase = {
coordinate: null,
parsePath: function(path) {
var coordinate11 = this.coordinate;
var parsedPath = parsePathString2(path);
if (coordinate11.isPolar) {
parsedPath = convertPolarPath(coordinate11, parsedPath);
} else {
parsedPath = convertNormalPath(coordinate11, parsedPath);
}
return parsedPath;
},
parsePoint: function(point2) {
var coordinate11 = this.coordinate;
return coordinate11.convert(point2);
},
parsePoints: function(points) {
var coordinate11 = this.coordinate;
return points.map(function(point2) {
return coordinate11.convert(point2);
});
},
draw: function(cfg, container2) {
}
};
var ShapeFactoryMap = {};
function registerShapeFactory(factoryName, cfg) {
var className = upper_first_default(factoryName);
var geomObj = __assign(__assign(__assign({}, ShapeFactoryBase), cfg), { geometryType: factoryName });
ShapeFactoryMap[className] = geomObj;
return geomObj;
}
function registerShape(factoryName, shapeType, cfg) {
var className = upper_first_default(factoryName);
var factory = ShapeFactoryMap[className];
var shapeObj = __assign(__assign({}, ShapeBase), cfg);
factory[shapeType] = shapeObj;
return shapeObj;
}
function getShapeFactory(factoryName) {
var className = upper_first_default(factoryName);
return ShapeFactoryMap[className];
}
// node_modules/@antv/g2/esm/geometry/util/group-data.js
function group(data3, fields, appendConditions) {
if (appendConditions === void 0) {
appendConditions = {};
}
if (!fields) {
return [data3];
}
var groups = groupToMap(data3, fields);
var array = [];
if (fields.length === 1 && appendConditions[fields[0]]) {
var values2 = appendConditions[fields[0]];
for (var _i = 0, values_1 = values2; _i < values_1.length; _i++) {
var value2 = values_1[_i];
var arr = groups["_".concat(value2)];
if (arr) {
array.push(arr);
}
}
} else {
for (var k4 in groups) {
if (groups.hasOwnProperty(k4)) {
var eachGroup = groups[k4];
array.push(eachGroup);
}
}
}
return array;
}
// node_modules/@antv/g2/esm/geometry/util/is-model-change.js
function isModelChange(currentModel, preModel) {
return some_default(["color", "shape", "size", "x", "y", "isInCircle", "data", "style", "defaultStyle", "points", "mappingData"], function(key) {
return !is_equal_default(currentModel[key], preModel[key]);
});
}
// node_modules/@antv/g2/esm/geometry/util/parse-fields.js
function parseFields(field6) {
if (is_array_default(field6)) {
return field6;
}
return field6.split("*");
}
// node_modules/@antv/g2/esm/geometry/util/diff.js
function diff(keyItem, keys2) {
var added = [];
var updated = [];
var removed = [];
var keyIncluded = new Map();
for (var i4 = 0; i4 < keys2.length; i4++) {
var key = keys2[i4];
if (keyItem[key])
updated.push(key);
else
added.push(key);
keyIncluded.set(key, true);
}
Object.keys(keyItem).forEach(function(key2) {
if (!keyIncluded.has(key2))
removed.push(key2);
});
return {
added,
updated,
removed
};
}
// node_modules/@antv/g2/esm/geometry/base.js
function filterLabelsById(id, labelsMap) {
var labels = [];
each_default(labelsMap, function(label17, labelId) {
var elementId = labelId.split(" ")[0];
if (elementId === id) {
labels.push(label17);
}
});
return labels;
}
var Geometry = function(_super) {
__extends(Geometry3, _super);
function Geometry3(cfg) {
var _this = _super.call(this, cfg) || this;
_this.type = "base";
_this.attributes = {};
_this.elements = [];
_this.elementsMap = {};
_this.animateOption = true;
_this.attributeOption = {};
_this.lastElementsMap = {};
_this.generatePoints = false;
_this.beforeMappingData = null;
_this.adjusts = {};
_this.idFields = [];
_this.hasSorted = false;
_this.isCoordinateChanged = false;
var container2 = cfg.container, labelsContainer = cfg.labelsContainer, coordinate11 = cfg.coordinate, data3 = cfg.data, _a6 = cfg.sortable, sortable = _a6 === void 0 ? false : _a6, _b = cfg.visible, visible = _b === void 0 ? true : _b, theme4 = cfg.theme, _c = cfg.scales, scales = _c === void 0 ? {} : _c, _d = cfg.scaleDefs, scaleDefs = _d === void 0 ? {} : _d, intervalPadding = cfg.intervalPadding, dodgePadding = cfg.dodgePadding, maxColumnWidth = cfg.maxColumnWidth, minColumnWidth = cfg.minColumnWidth, columnWidthRatio = cfg.columnWidthRatio, roseWidthRatio = cfg.roseWidthRatio, multiplePieWidthRatio = cfg.multiplePieWidthRatio, zIndexReversed = cfg.zIndexReversed, sortZIndex = cfg.sortZIndex;
_this.container = container2;
_this.labelsContainer = labelsContainer;
_this.coordinate = coordinate11;
_this.data = data3;
_this.sortable = sortable;
_this.visible = visible;
_this.userTheme = theme4;
_this.scales = scales;
_this.scaleDefs = scaleDefs;
_this.intervalPadding = intervalPadding;
_this.dodgePadding = dodgePadding;
_this.maxColumnWidth = maxColumnWidth;
_this.minColumnWidth = minColumnWidth;
_this.columnWidthRatio = columnWidthRatio;
_this.roseWidthRatio = roseWidthRatio;
_this.multiplePieWidthRatio = multiplePieWidthRatio;
_this.zIndexReversed = zIndexReversed;
_this.sortZIndex = sortZIndex;
return _this;
}
Geometry3.prototype.position = function(cfg) {
var positionCfg = cfg;
if (!is_plain_object_default(cfg)) {
positionCfg = {
fields: parseFields(cfg)
};
}
var fields = get_default(positionCfg, "fields");
if (fields.length === 1) {
fields.unshift("1");
set_default(positionCfg, "fields", fields);
}
set_default(this.attributeOption, "position", positionCfg);
return this;
};
Geometry3.prototype.color = function(field6, cfg) {
this.createAttrOption("color", field6, cfg);
return this;
};
Geometry3.prototype.shape = function(field6, cfg) {
this.createAttrOption("shape", field6, cfg);
return this;
};
Geometry3.prototype.size = function(field6, cfg) {
this.createAttrOption("size", field6, cfg);
return this;
};
Geometry3.prototype.adjust = function(adjustCfg2) {
var adjusts = adjustCfg2;
if (is_string_default(adjustCfg2) || is_plain_object_default(adjustCfg2)) {
adjusts = [adjustCfg2];
}
each_default(adjusts, function(adjust4, index2) {
if (!is_object_default(adjust4)) {
adjusts[index2] = { type: adjust4 };
}
});
this.adjustOption = adjusts;
return this;
};
Geometry3.prototype.style = function(field6, styleFunc) {
if (is_string_default(field6)) {
var fields = parseFields(field6);
this.styleOption = {
fields,
callback: styleFunc
};
} else {
var _a6 = field6, fields = _a6.fields, callback = _a6.callback, cfg = _a6.cfg;
if (fields || callback || cfg) {
this.styleOption = field6;
} else {
this.styleOption = {
cfg: field6
};
}
}
return this;
};
Geometry3.prototype.tooltip = function(field6, cfg) {
if (is_string_default(field6)) {
var fields = parseFields(field6);
this.tooltipOption = {
fields,
callback: cfg
};
} else {
this.tooltipOption = field6;
}
return this;
};
Geometry3.prototype.animate = function(cfg) {
this.animateOption = cfg;
return this;
};
Geometry3.prototype.label = function(field6, secondParam, thirdParam) {
if (is_string_default(field6)) {
var labelOption = {};
var fields = parseFields(field6);
labelOption.fields = fields;
if (is_function_default(secondParam)) {
labelOption.callback = secondParam;
} else if (is_plain_object_default(secondParam)) {
labelOption.cfg = secondParam;
}
if (thirdParam) {
labelOption.cfg = thirdParam;
}
this.labelOption = labelOption;
} else {
this.labelOption = field6;
}
return this;
};
Geometry3.prototype.state = function(cfg) {
this.stateOption = cfg;
return this;
};
Geometry3.prototype.customInfo = function(cfg) {
this.customOption = cfg;
return this;
};
Geometry3.prototype.init = function(cfg) {
if (cfg === void 0) {
cfg = {};
}
this.setCfg(cfg);
this.initAttributes();
this.processData(this.data);
this.adjustScale();
};
Geometry3.prototype.update = function(cfg) {
if (cfg === void 0) {
cfg = {};
}
var data3 = cfg.data, isDataChanged = cfg.isDataChanged, isCoordinateChanged = cfg.isCoordinateChanged;
var _a6 = this, attributeOption = _a6.attributeOption, lastAttributeOption = _a6.lastAttributeOption;
if (!is_equal_default(attributeOption, lastAttributeOption)) {
this.init(cfg);
} else if (data3 && (isDataChanged || !is_equal_default(data3, this.data))) {
this.setCfg(cfg);
this.initAttributes();
this.processData(data3);
} else {
this.setCfg(cfg);
}
this.adjustScale();
this.isCoordinateChanged = isCoordinateChanged;
};
Geometry3.prototype.paint = function(isUpdate) {
if (isUpdate === void 0) {
isUpdate = false;
}
if (this.animateOption) {
this.animateOption = deep_mix_default({}, getDefaultAnimateCfg(this.type, this.coordinate), this.animateOption);
}
this.defaultSize = void 0;
this.elementsMap = {};
this.elements = [];
var offscreenGroup = this.getOffscreenGroup();
offscreenGroup.clear();
var beforeMappingData = this.beforeMappingData;
var dataArray = this.beforeMapping(beforeMappingData);
this.dataArray = new Array(dataArray.length);
for (var i4 = 0; i4 < dataArray.length; i4++) {
var data3 = dataArray[i4];
this.dataArray[i4] = this.mapping(data3);
}
this.updateElements(this.dataArray, isUpdate);
this.lastElementsMap = this.elementsMap;
if (this.canDoGroupAnimation(isUpdate)) {
var container2 = this.container;
var type2 = this.type;
var coordinate11 = this.coordinate;
var animateCfg = get_default(this.animateOption, "appear");
var yScale = this.getYScale();
var yMinPoint = coordinate11.convert({
x: 0,
y: yScale.scale(this.getYMinValue())
});
doGroupAppearAnimate(container2, animateCfg, type2, coordinate11, yMinPoint);
}
if (this.labelOption) {
this.renderLabels(flatten_default(this.dataArray), isUpdate);
}
this.lastAttributeOption = __assign({}, this.attributeOption);
if (this.visible === false) {
this.changeVisible(false);
}
};
Geometry3.prototype.clear = function() {
var _a6 = this, container2 = _a6.container, geometryLabel = _a6.geometryLabel, offscreenGroup = _a6.offscreenGroup;
if (container2) {
container2.clear();
}
if (geometryLabel) {
geometryLabel.clear();
}
if (offscreenGroup) {
offscreenGroup.clear();
}
this.scaleDefs = void 0;
this.attributes = {};
this.scales = {};
this.elementsMap = {};
this.lastElementsMap = {};
this.elements = [];
this.adjusts = {};
this.dataArray = null;
this.beforeMappingData = null;
this.lastAttributeOption = void 0;
this.defaultSize = void 0;
this.idFields = [];
this.groupScales = void 0;
this.hasSorted = false;
this.isCoordinateChanged = false;
};
Geometry3.prototype.destroy = function() {
this.clear();
var container2 = this.container;
container2.remove(true);
if (this.offscreenGroup) {
this.offscreenGroup.remove(true);
this.offscreenGroup = null;
}
if (this.geometryLabel) {
this.geometryLabel.destroy();
this.geometryLabel = null;
}
this.theme = void 0;
this.shapeFactory = void 0;
_super.prototype.destroy.call(this);
};
Geometry3.prototype.getGroupScales = function() {
return this.groupScales;
};
Geometry3.prototype.getAttribute = function(name) {
return this.attributes[name];
};
Geometry3.prototype.getXScale = function() {
return this.getAttribute("position").scales[0];
};
Geometry3.prototype.getYScale = function() {
return this.getAttribute("position").scales[1];
};
Geometry3.prototype.getGroupAttributes = function() {
var rst = [];
each_default(this.attributes, function(attr) {
if (GROUP_ATTRS.includes(attr.type)) {
rst.push(attr);
}
});
return rst;
};
Geometry3.prototype.getDefaultValue = function(attrName) {
var value2;
var attr = this.getAttribute(attrName);
if (attr && is_empty_default(attr.scales)) {
value2 = attr.values[0];
}
return value2;
};
Geometry3.prototype.getAttributeValues = function(attr, obj) {
var params = [];
var scales = attr.scales;
for (var index2 = 0, length_1 = scales.length; index2 < length_1; index2++) {
var scale12 = scales[index2];
var field6 = scale12.field;
if (scale12.isIdentity) {
params.push(scale12.values);
} else {
params.push(obj[field6]);
}
}
return attr.mapping.apply(attr, params);
};
Geometry3.prototype.getAdjust = function(adjustType) {
return this.adjusts[adjustType];
};
Geometry3.prototype.getCoordinate = function() {
return this.coordinate;
};
Geometry3.prototype.getData = function() {
return this.data;
};
Geometry3.prototype.getShapeMarker = function(shapeName, cfg) {
var shapeFactory = this.getShapeFactory();
return shapeFactory.getMarker(shapeName, cfg);
};
Geometry3.prototype.getElementsBy = function(condition) {
return this.elements.filter(function(element) {
return condition(element);
});
};
Geometry3.prototype.getElements = function() {
return this.elements;
};
Geometry3.prototype.getElementId = function(data3) {
data3 = is_array_default(data3) ? data3[0] : data3;
var originData = data3[FIELD_ORIGIN];
if (this.idFields.length) {
var elementId = originData[this.idFields[0]];
for (var index2 = 1; index2 < this.idFields.length; index2++) {
elementId += "-" + originData[this.idFields[index2]];
}
return elementId;
}
var type2 = this.type;
var xScale = this.getXScale();
var yScale = this.getYScale();
var xField = xScale.field || "x";
var yField = yScale.field || "y";
var yVal = originData[yField];
var xVal;
if (xScale.type === "identity") {
xVal = xScale.values[0];
} else {
xVal = originData[xField];
}
var id;
if (type2 === "interval" || type2 === "schema") {
id = "".concat(xVal);
} else if (type2 === "line" || type2 === "area" || type2 === "path") {
id = type2;
} else {
id = "".concat(xVal, "-").concat(yVal);
}
var groupScales = this.groupScales;
if (is_empty_default(groupScales)) {
groupScales = get_default(this.getAttribute("color"), "scales", []);
}
for (var index2 = 0, length_2 = groupScales.length; index2 < length_2; index2++) {
var groupScale = groupScales[index2];
var field6 = groupScale.field;
id = "".concat(id, "-").concat(originData[field6]);
}
var dodgeAdjust = this.getAdjust("dodge");
if (dodgeAdjust) {
var dodgeBy = dodgeAdjust.dodgeBy;
if (dodgeBy) {
id = "".concat(id, "-").concat(originData[dodgeBy]);
}
}
if (this.getAdjust("jitter")) {
id = "".concat(id, "-").concat(data3.x, "-").concat(data3.y);
}
return id;
};
Geometry3.prototype.getScaleFields = function() {
var fields = [];
var tmpMap = new Map();
var _a6 = this, attributeOption = _a6.attributeOption, labelOption = _a6.labelOption, tooltipOption = _a6.tooltipOption;
for (var attributeType in attributeOption) {
if (attributeOption.hasOwnProperty(attributeType)) {
var eachOpt = attributeOption[attributeType];
if (eachOpt.fields) {
uniq2(eachOpt.fields, fields, tmpMap);
} else if (eachOpt.values) {
uniq2(eachOpt.values, fields, tmpMap);
}
}
}
if (labelOption && labelOption.fields) {
uniq2(labelOption.fields, fields, tmpMap);
}
if (is_object_default(tooltipOption) && tooltipOption.fields) {
uniq2(tooltipOption.fields, fields, tmpMap);
}
return fields;
};
Geometry3.prototype.changeVisible = function(visible) {
_super.prototype.changeVisible.call(this, visible);
var elements = this.elements;
for (var index2 = 0, length_3 = elements.length; index2 < length_3; index2++) {
var element = elements[index2];
element.changeVisible(visible);
}
if (visible) {
if (this.container) {
this.container.show();
}
if (this.labelsContainer) {
this.labelsContainer.show();
}
} else {
if (this.container) {
this.container.hide();
}
if (this.labelsContainer) {
this.labelsContainer.hide();
}
}
};
Geometry3.prototype.getFields = function() {
var uniqMap = new Map();
var fields = [];
Object.values(this.attributeOption).forEach(function(cfg) {
var fs = (cfg === null || cfg === void 0 ? void 0 : cfg.fields) || [];
fs.forEach(function(f3) {
if (!uniqMap.has(f3)) {
fields.push(f3);
}
uniqMap.set(f3, true);
});
}, []);
return fields;
};
Geometry3.prototype.getGroupFields = function() {
var groupFields = [];
var tmpMap = new Map();
for (var index2 = 0, length_4 = GROUP_ATTRS.length; index2 < length_4; index2++) {
var attributeName = GROUP_ATTRS[index2];
var cfg = this.attributeOption[attributeName];
if (cfg && cfg.fields) {
uniq2(cfg.fields, groupFields, tmpMap);
}
}
return groupFields;
};
Geometry3.prototype.getXYFields = function() {
var _a6 = this.attributeOption.position.fields, x6 = _a6[0], y5 = _a6[1];
return [x6, y5];
};
Geometry3.prototype.getXField = function() {
return get_default(this.getXYFields(), [0]);
};
Geometry3.prototype.getYField = function() {
return get_default(this.getXYFields(), [1]);
};
Geometry3.prototype.getShapes = function() {
return this.elements.map(function(element) {
return element.shape;
});
};
Geometry3.prototype.getOffscreenGroup = function() {
if (!this.offscreenGroup) {
var GroupCtor = this.container.getGroupBase();
this.offscreenGroup = new GroupCtor({});
}
return this.offscreenGroup;
};
Geometry3.prototype.sort = function(mappingArray) {
if (!this.hasSorted) {
var xScale_1 = this.getXScale();
var xField_1 = xScale_1.field;
for (var index2 = 0; index2 < mappingArray.length; index2++) {
var itemArr = mappingArray[index2];
itemArr.sort(function(obj1, obj2) {
return xScale_1.translate(obj1[FIELD_ORIGIN][xField_1]) - xScale_1.translate(obj2[FIELD_ORIGIN][xField_1]);
});
}
}
this.hasSorted = true;
};
Geometry3.prototype.adjustScale = function() {
var yScale = this.getYScale();
if (yScale && this.getAdjust("stack")) {
this.updateStackRange(yScale, this.beforeMappingData);
}
};
Geometry3.prototype.getShapeFactory = function() {
var shapeType = this.shapeType;
if (!getShapeFactory(shapeType)) {
return;
}
if (!this.shapeFactory) {
this.shapeFactory = clone_default(getShapeFactory(shapeType));
}
this.shapeFactory.coordinate = this.coordinate;
this.shapeFactory.theme = this.theme.geometries[shapeType] || {};
return this.shapeFactory;
};
Geometry3.prototype.createShapePointsCfg = function(obj) {
var xScale = this.getXScale();
var yScale = this.getYScale();
var x6 = this.normalizeValues(obj[xScale.field], xScale);
var y5;
if (yScale) {
y5 = this.normalizeValues(obj[yScale.field], yScale);
} else {
y5 = obj.y ? obj.y : 0.1;
}
return {
x: x6,
y: y5,
y0: yScale ? yScale.scale(this.getYMinValue()) : void 0
};
};
Geometry3.prototype.createElement = function(mappingDatum, index2, isUpdate) {
if (isUpdate === void 0) {
isUpdate = false;
}
var container2 = this.container;
var shapeCfg = this.getDrawCfg(mappingDatum);
var shapeFactory = this.getShapeFactory();
var element = new element_default2({
shapeFactory,
container: container2,
offscreenGroup: this.getOffscreenGroup(),
elementIndex: index2
});
element.animate = this.animateOption;
element.geometry = this;
element.draw(shapeCfg, isUpdate);
return element;
};
Geometry3.prototype.getDrawCfg = function(mappingDatum) {
var originData = mappingDatum[FIELD_ORIGIN];
var cfg = {
mappingData: mappingDatum,
data: originData,
x: mappingDatum.x,
y: mappingDatum.y,
color: mappingDatum.color,
size: mappingDatum.size,
isInCircle: this.coordinate.isPolar,
customInfo: this.customOption
};
var shapeName = mappingDatum.shape;
if (!shapeName && this.getShapeFactory()) {
shapeName = this.getShapeFactory().defaultShapeType;
}
cfg.shape = shapeName;
var theme4 = this.theme.geometries[this.shapeType];
cfg.defaultStyle = get_default(theme4, [shapeName, "default"], {}).style;
if (!cfg.defaultStyle && this.getShapeFactory()) {
cfg.defaultStyle = this.getShapeFactory().getDefaultStyle(theme4);
}
var styleOption = this.styleOption;
if (styleOption) {
cfg.style = this.getStyleCfg(styleOption, originData);
}
if (this.generatePoints) {
cfg.points = mappingDatum.points;
cfg.nextPoints = mappingDatum.nextPoints;
}
return cfg;
};
Geometry3.prototype.updateElements = function(mappingDataArray, isUpdate) {
if (isUpdate === void 0) {
isUpdate = false;
}
var keyDatum = new Map();
var keys2 = [];
var keyIndex = new Map();
var index2 = 0;
for (var i4 = 0; i4 < mappingDataArray.length; i4++) {
var mappingData = mappingDataArray[i4];
for (var j4 = 0; j4 < mappingData.length; j4++) {
var mappingDatum = mappingData[j4];
var key = this.getElementId(mappingDatum);
var finalKey = keyDatum.has(key) ? "".concat(key, "-").concat(i4, "-").concat(j4) : key;
keys2.push(finalKey);
keyDatum.set(finalKey, mappingDatum);
keyIndex.set(finalKey, index2);
index2++;
}
}
this.elements = new Array(index2);
var _a6 = diff(this.lastElementsMap, keys2), added = _a6.added, updated = _a6.updated, removed = _a6.removed;
for (var _i = 0, added_1 = added; _i < added_1.length; _i++) {
var key = added_1[_i];
var mappingDatum = keyDatum.get(key);
var i4 = keyIndex.get(key);
var element = this.createElement(mappingDatum, i4, isUpdate);
this.elements[i4] = element;
this.elementsMap[key] = element;
if (element.shape) {
element.shape.set("zIndex", this.zIndexReversed ? this.elements.length - i4 : i4);
}
}
for (var _b = 0, updated_1 = updated; _b < updated_1.length; _b++) {
var key = updated_1[_b];
var element = this.lastElementsMap[key];
var mappingDatum = keyDatum.get(key);
var currentShapeCfg = this.getDrawCfg(mappingDatum);
var preShapeCfg = element.getModel();
var i4 = keyIndex.get(key);
if (this.isCoordinateChanged || isModelChange(currentShapeCfg, preShapeCfg)) {
element.animate = this.animateOption;
element.update(currentShapeCfg);
}
this.elements[i4] = element;
this.elementsMap[key] = element;
if (element.shape) {
element.shape.set("zIndex", this.zIndexReversed ? this.elements.length - i4 : i4);
}
}
if (this.container) {
this.container.sort();
}
for (var _c = 0, removed_1 = removed; _c < removed_1.length; _c++) {
var key = removed_1[_c];
var element = this.lastElementsMap[key];
element.animate = this.animateOption;
element.destroy();
}
};
Geometry3.prototype.getLabelType = function() {
var _a6 = this, labelOption = _a6.labelOption, coordinate11 = _a6.coordinate, type2 = _a6.type;
var coordinateType = coordinate11.type, isTransposed = coordinate11.isTransposed;
var labelType = get_default(labelOption, ["cfg", "type"]);
if (!labelType) {
if (coordinateType === "polar") {
labelType = isTransposed ? "pie" : "polar";
} else if (coordinateType === "theta") {
labelType = "pie";
} else if (type2 === "interval" || type2 === "polygon") {
labelType = "interval";
} else {
labelType = "base";
}
}
return labelType;
};
Geometry3.prototype.getYMinValue = function() {
var yScale = this.getYScale();
var min7 = yScale.min, max8 = yScale.max;
var value2;
if (min7 >= 0) {
value2 = min7;
} else if (max8 <= 0) {
value2 = max8;
} else {
value2 = 0;
}
return value2;
};
Geometry3.prototype.createAttrOption = function(attrName, field6, cfg) {
if (is_nil_default(field6) || is_object_default(field6)) {
if (is_object_default(field6) && is_equal_default(Object.keys(field6), ["values"])) {
set_default(this.attributeOption, attrName, {
fields: field6.values
});
} else {
set_default(this.attributeOption, attrName, field6);
}
} else {
var attrCfg = {};
if (is_number_default(field6)) {
attrCfg.values = [field6];
} else {
attrCfg.fields = parseFields(field6);
}
if (cfg) {
if (is_function_default(cfg)) {
attrCfg.callback = cfg;
} else {
attrCfg.values = cfg;
}
}
set_default(this.attributeOption, attrName, attrCfg);
}
};
Geometry3.prototype.initAttributes = function() {
var _this = this;
var _a6 = this, attributes = _a6.attributes, attributeOption = _a6.attributeOption, theme4 = _a6.theme, shapeType = _a6.shapeType;
this.groupScales = [];
var tmpMap = {};
var _loop_1 = function(attrType2) {
if (attributeOption.hasOwnProperty(attrType2)) {
var option = attributeOption[attrType2];
if (!option) {
return { value: void 0 };
}
var attrCfg = __assign({}, option);
var callback = attrCfg.callback, values2 = attrCfg.values, _b = attrCfg.fields, fields = _b === void 0 ? [] : _b;
var scales = fields.map(function(field6) {
var scale12 = _this.scales[field6];
if (scale12.isCategory && !tmpMap[field6] && GROUP_ATTRS.includes(attrType2)) {
_this.groupScales.push(scale12);
tmpMap[field6] = true;
}
return scale12;
});
attrCfg.scales = scales;
if (attrType2 !== "position" && scales.length === 1 && scales[0].type === "identity") {
attrCfg.values = scales[0].values;
} else if (!callback && !values2) {
if (attrType2 === "size") {
attrCfg.values = theme4.sizes;
} else if (attrType2 === "shape") {
attrCfg.values = theme4.shapes[shapeType] || [];
} else if (attrType2 === "color") {
if (scales.length) {
attrCfg.values = scales[0].values.length <= 10 ? theme4.colors10 : theme4.colors20;
} else {
attrCfg.values = theme4.colors10;
}
}
}
var AttributeCtor = getAttribute(attrType2);
attributes[attrType2] = new AttributeCtor(attrCfg);
}
};
for (var attrType in attributeOption) {
var state_1 = _loop_1(attrType);
if (typeof state_1 === "object")
return state_1.value;
}
};
Geometry3.prototype.processData = function(data3) {
this.hasSorted = false;
var scales = this.getAttribute("position").scales;
var categoryScales = scales.filter(function(scale13) {
return scale13.isCategory;
});
var groupedArray = this.groupData(data3);
var beforeAdjust = [];
for (var i4 = 0, len5 = groupedArray.length; i4 < len5; i4++) {
var subData = groupedArray[i4];
var arr = [];
for (var j4 = 0, subLen = subData.length; j4 < subLen; j4++) {
var originData = subData[j4];
var item = {};
for (var k4 in originData) {
item[k4] = originData[k4];
}
item[FIELD_ORIGIN] = originData;
for (var _i = 0, categoryScales_1 = categoryScales; _i < categoryScales_1.length; _i++) {
var scale12 = categoryScales_1[_i];
var field6 = scale12.field;
item[field6] = scale12.translate(item[field6]);
}
arr.push(item);
}
beforeAdjust.push(arr);
}
var dataArray = this.adjustData(beforeAdjust);
this.beforeMappingData = dataArray;
return dataArray;
};
Geometry3.prototype.adjustData = function(dataArray) {
var adjustOption = this.adjustOption;
var _a6 = this, intervalPadding = _a6.intervalPadding, dodgePadding = _a6.dodgePadding, theme4 = _a6.theme;
var maxColumnWidth = this.maxColumnWidth || theme4.maxColumnWidth;
var minColumnWidth = this.minColumnWidth || theme4.minColumnWidth;
var columnWidthRatio = this.columnWidthRatio || theme4.columnWidthRatio;
var result = dataArray;
if (adjustOption) {
var xScale = this.getXScale();
var yScale = this.getYScale();
var xField = xScale.field;
var yField = yScale ? yScale.field : null;
var xDimensionLength = getXDimensionLength(this.coordinate);
var groupNum = xScale.values.length;
var sizeAttr = this.getAttribute("size");
var defaultSize = void 0;
if (sizeAttr) {
defaultSize = sizeAttr.values[0];
}
for (var i4 = 0, len5 = adjustOption.length; i4 < len5; i4++) {
var adjust4 = adjustOption[i4];
var adjustCfg2 = __assign({ xField, yField, intervalPadding, dodgePadding, xDimensionLength, groupNum, defaultSize, maxColumnWidth, minColumnWidth, columnWidthRatio }, adjust4);
var type2 = adjust4.type;
if (type2 === "dodge") {
var adjustNames = [];
if (xScale.isCategory || xScale.type === "identity") {
adjustNames.push("x");
} else if (!yScale) {
adjustNames.push("y");
} else {
throw new Error("dodge is not support linear attribute, please use category attribute!");
}
adjustCfg2.adjustNames = adjustNames;
adjustCfg2.dodgeRatio = columnWidthRatio;
} else if (type2 === "stack") {
var coordinate11 = this.coordinate;
if (!yScale) {
adjustCfg2.height = coordinate11.getHeight();
var size2 = this.getDefaultValue("size") || 3;
adjustCfg2.size = size2;
}
if (!coordinate11.isTransposed && is_nil_default(adjustCfg2.reverseOrder)) {
adjustCfg2.reverseOrder = true;
}
}
var adjustCtor = getAdjust(type2);
var adjustInstance = new adjustCtor(adjustCfg2);
result = adjustInstance.process(result);
this.adjusts[type2] = adjustInstance;
}
}
return result;
};
Geometry3.prototype.groupData = function(data3) {
var groupScales = this.getGroupScales();
var scaleDefs = this.scaleDefs;
var appendConditions = {};
var groupFields = [];
for (var index2 = 0; index2 < groupScales.length; index2++) {
var scale12 = groupScales[index2];
var field6 = scale12.field;
groupFields.push(field6);
if (get_default(scaleDefs, [field6, "values"])) {
appendConditions[field6] = scaleDefs[field6].values;
}
}
return group(data3, groupFields, appendConditions);
};
Geometry3.prototype.updateStackRange = function(scale12, dataArray) {
var mergeArray = flatten_default(dataArray);
var field6 = scale12.field;
var min7 = scale12.min;
var max8 = scale12.max;
for (var index2 = 0; index2 < mergeArray.length; index2++) {
var obj = mergeArray[index2];
var tmpMin = Math.min.apply(null, obj[field6]);
var tmpMax = Math.max.apply(null, obj[field6]);
if (tmpMin < min7) {
min7 = tmpMin;
}
if (tmpMax > max8) {
max8 = tmpMax;
}
}
var scaleDefs = this.scaleDefs;
var cfg = {};
if (min7 < scale12.min && !get_default(scaleDefs, [field6, "min"])) {
cfg.min = min7;
}
if (max8 > scale12.max && !get_default(scaleDefs, [field6, "max"])) {
cfg.max = max8;
}
scale12.change(cfg);
};
Geometry3.prototype.beforeMapping = function(beforeMappingData) {
var source = beforeMappingData;
if (this.sortable) {
this.sort(source);
}
if (this.generatePoints) {
for (var index2 = 0, length_5 = source.length; index2 < length_5; index2++) {
var currentData = source[index2];
this.generateShapePoints(currentData);
var nextData = source[index2 + 1];
if (nextData) {
this.generateShapePoints(nextData);
currentData[0].nextPoints = nextData[0].points;
}
}
}
return source;
};
Geometry3.prototype.generateShapePoints = function(data3) {
var shapeFactory = this.getShapeFactory();
var shapeAttr = this.getAttribute("shape");
for (var index2 = 0; index2 < data3.length; index2++) {
var obj = data3[index2];
var cfg = this.createShapePointsCfg(obj);
var shape = shapeAttr ? this.getAttributeValues(shapeAttr, obj) : null;
var points = shapeFactory.getShapePoints(shape, cfg);
obj.points = points;
}
};
Geometry3.prototype.normalizeValues = function(values2, scale12) {
var rst = [];
if (is_array_default(values2)) {
for (var index2 = 0; index2 < values2.length; index2++) {
var value2 = values2[index2];
rst.push(scale12.scale(value2));
}
} else {
rst = scale12.scale(values2);
}
return rst;
};
Geometry3.prototype.mapping = function(data3) {
var attributes = this.attributes;
var mappingData = [];
for (var index2 = 0; index2 < data3.length; index2++) {
var record = data3[index2];
var newRecord = {
_origin: record[FIELD_ORIGIN],
points: record.points,
nextPoints: record.nextPoints
};
for (var k4 in attributes) {
if (attributes.hasOwnProperty(k4)) {
var attr = attributes[k4];
var names = attr.names;
var values2 = this.getAttributeValues(attr, record);
if (names.length > 1) {
for (var j4 = 0; j4 < values2.length; j4 += 1) {
var val = values2[j4];
var name_1 = names[j4];
newRecord[name_1] = is_array_default(val) && val.length === 1 ? val[0] : val;
}
} else {
newRecord[names[0]] = values2.length === 1 ? values2[0] : values2;
}
}
}
this.convertPoint(newRecord);
mappingData.push(newRecord);
}
return mappingData;
};
Geometry3.prototype.convertPoint = function(mappingRecord) {
var x6 = mappingRecord.x, y5 = mappingRecord.y;
var rstX;
var rstY;
var obj;
var coordinate11 = this.coordinate;
if (is_array_default(x6) && is_array_default(y5)) {
rstX = [];
rstY = [];
for (var i4 = 0, j4 = 0, xLen = x6.length, yLen = y5.length; i4 < xLen && j4 < yLen; i4 += 1, j4 += 1) {
obj = coordinate11.convert({
x: x6[i4],
y: y5[j4]
});
rstX.push(obj.x);
rstY.push(obj.y);
}
} else if (is_array_default(y5)) {
rstY = [];
for (var index2 = 0; index2 < y5.length; index2++) {
var yVal = y5[index2];
obj = coordinate11.convert({
x: x6,
y: yVal
});
if (rstX && rstX !== obj.x) {
if (!is_array_default(rstX)) {
rstX = [rstX];
}
rstX.push(obj.x);
} else {
rstX = obj.x;
}
rstY.push(obj.y);
}
} else if (is_array_default(x6)) {
rstX = [];
for (var index2 = 0; index2 < x6.length; index2++) {
var xVal = x6[index2];
obj = coordinate11.convert({
x: xVal,
y: y5
});
if (rstY && rstY !== obj.y) {
if (!is_array_default(rstY)) {
rstY = [rstY];
}
rstY.push(obj.y);
} else {
rstY = obj.y;
}
rstX.push(obj.x);
}
} else {
var point2 = coordinate11.convert({
x: x6,
y: y5
});
rstX = point2.x;
rstY = point2.y;
}
mappingRecord.x = rstX;
mappingRecord.y = rstY;
};
Geometry3.prototype.getStyleCfg = function(styleOption, originData) {
var _a6 = styleOption.fields, fields = _a6 === void 0 ? [] : _a6, callback = styleOption.callback, cfg = styleOption.cfg;
if (cfg) {
return cfg;
}
var params = fields.map(function(field6) {
return originData[field6];
});
return callback.apply(void 0, params);
};
Geometry3.prototype.setCfg = function(cfg) {
var _this = this;
var coordinate11 = cfg.coordinate, data3 = cfg.data, theme4 = cfg.theme, scaleDefs = cfg.scaleDefs;
if (coordinate11) {
this.coordinate = coordinate11;
}
if (data3) {
this.data = data3;
}
if (scaleDefs) {
this.scaleDefs = scaleDefs;
this.idFields = [];
each_default(scaleDefs, function(scaleDef, field6) {
if (scaleDef && scaleDef.key) {
_this.idFields.push(field6);
}
});
}
if (theme4) {
this.theme = this.userTheme ? deep_mix_default({}, theme4, this.userTheme) : theme4;
}
};
Geometry3.prototype.renderLabels = function(mappingArray, isUpdate) {
if (isUpdate === void 0) {
isUpdate = false;
}
var geometryLabel = this.geometryLabel;
if (!geometryLabel) {
var labelType = this.getLabelType();
var GeometryLabelsCtor = getGeometryLabel(labelType);
geometryLabel = new GeometryLabelsCtor(this);
this.geometryLabel = geometryLabel;
}
geometryLabel.render(mappingArray, isUpdate);
var labelsMap = geometryLabel.labelsRenderer.shapesMap;
each_default(this.elementsMap, function(element, id) {
var labels = filterLabelsById(id, labelsMap);
if (labels.length) {
element.labelShape = labels;
for (var i4 = 0; i4 < labels.length; i4++) {
var label17 = labels[i4];
var labelChildren = label17.getChildren();
for (var j4 = 0; j4 < labelChildren.length; j4++) {
var child = labelChildren[j4];
child.cfg.name = ["element", "label"];
child.cfg.element = element;
}
}
}
});
};
Geometry3.prototype.canDoGroupAnimation = function(isUpdate) {
return !isUpdate && this.animateOption && (get_default(this.animateOption, "appear") === void 0 || get_default(this.animateOption, "appear") && get_default(this.animateOption, ["appear", "animation"]) === void 0);
};
return Geometry3;
}(base_default);
var base_default13 = Geometry;
// node_modules/@antv/g2/esm/util/transform.js
var transform3 = ext_exports.transform;
function translate3(element, x6, y5) {
var matrix = transform3(element.getMatrix(), [["t", x6, y5]]);
element.setMatrix(matrix);
}
function getRotateMatrix(element, rotateRadian) {
var _a6 = element.attr(), x6 = _a6.x, y5 = _a6.y;
var matrix = transform3(element.getMatrix(), [
["t", -x6, -y5],
["r", rotateRadian],
["t", x6, y5]
]);
return matrix;
}
function rotate5(element, rotateRadian) {
var matrix = getRotateMatrix(element, rotateRadian);
element.setMatrix(matrix);
}
function zoom(element, ratio) {
var bbox = element.getBBox();
var x6 = (bbox.minX + bbox.maxX) / 2;
var y5 = (bbox.minY + bbox.maxY) / 2;
element.applyToMatrix([x6, y5, 1]);
var matrix = transform3(element.getMatrix(), [
["t", -x6, -y5],
["s", ratio, ratio],
["t", x6, y5]
]);
element.setMatrix(matrix);
}
// node_modules/@antv/g2/esm/geometry/label/util/index.js
function findLabelTextShape(label17) {
return label17.find(function(el) {
return el.get("type") === "text";
});
}
function getlLabelBackgroundInfo(labelGroup, labelItem, padding3) {
if (padding3 === void 0) {
padding3 = [0, 0, 0, 0];
}
var content = labelGroup.getChildren()[0];
if (content) {
var labelShape = content.clone();
if (labelItem === null || labelItem === void 0 ? void 0 : labelItem.rotate) {
rotate5(labelShape, -labelItem.rotate);
}
var _a6 = labelShape.getCanvasBBox(), x6 = _a6.x, y5 = _a6.y, width2 = _a6.width, height = _a6.height;
labelShape.destroy();
var boxPadding = padding3;
if (is_nil_default(boxPadding)) {
boxPadding = [2, 2, 2, 2];
} else if (is_number_default(boxPadding)) {
boxPadding = new Array(4).fill(boxPadding);
}
return {
x: x6 - boxPadding[3],
y: y5 - boxPadding[0],
width: width2 + boxPadding[1] + boxPadding[3],
height: height + boxPadding[0] + boxPadding[2],
rotation: (labelItem === null || labelItem === void 0 ? void 0 : labelItem.rotate) || 0
};
}
}
function getOverlapArea(a4, b10, margin) {
if (margin === void 0) {
margin = 0;
}
var xOverlap = Math.max(0, Math.min(a4.x + a4.width + margin, b10.x + b10.width + margin) - Math.max(a4.x - margin, b10.x - margin));
var yOverlap = Math.max(0, Math.min(a4.y + a4.height + margin, b10.y + b10.height + margin) - Math.max(a4.y - margin, b10.y - margin));
return xOverlap * yOverlap;
}
function checkShapeOverlap(cur, dones) {
var box2 = cur.getBBox();
return some_default(dones, function(done) {
var target = done.getBBox();
return getOverlapArea(box2, target, 2) > 0;
});
}
// node_modules/@antv/g2/esm/component/update-label.js
function updateLabel(fromShape, toShape, cfg) {
var data3 = cfg.data, origin = cfg.origin, animateCfg = cfg.animateCfg, coordinate11 = cfg.coordinate;
var updateAnimateCfg = get_default(animateCfg, "update");
fromShape.set("data", data3);
fromShape.set("origin", origin);
fromShape.set("animateCfg", animateCfg);
fromShape.set("coordinate", coordinate11);
fromShape.set("visible", toShape.get("visible"));
fromShape.getChildren().forEach(function(fromChild, idx) {
var toChild = toShape.getChildByIndex(idx);
if (!toChild) {
fromShape.removeChild(fromChild);
fromChild.remove(true);
} else {
fromChild.set("data", data3);
fromChild.set("origin", origin);
fromChild.set("animateCfg", animateCfg);
fromChild.set("coordinate", coordinate11);
var newAttrs = getReplaceAttrs(fromChild, toChild);
if (updateAnimateCfg) {
doAnimate(fromChild, updateAnimateCfg, {
toAttrs: newAttrs,
coordinate: coordinate11
});
} else {
fromChild.attr(newAttrs);
}
if (toChild.isGroup()) {
updateLabel(fromChild, toChild, cfg);
}
}
});
each_default(toShape.getChildren(), function(child, idx) {
if (idx >= fromShape.getCount()) {
if (!child.destroyed) {
fromShape.add(child);
}
}
});
}
// node_modules/@antv/g2/esm/component/labels.js
var Labels = function() {
function Labels2(cfg) {
this.shapesMap = {};
this.lastShapesMap = {};
var layout6 = cfg.layout, container2 = cfg.container;
this.layout = layout6;
this.container = container2;
}
Labels2.prototype.render = function(items, shapes, isUpdate) {
var _this = this;
if (isUpdate === void 0) {
isUpdate = false;
}
this.shapesMap = {};
var container2 = this.container;
var offscreenGroup = this.createOffscreenGroup();
if (items.length) {
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
var item = items_1[_i];
if (item) {
this.renderLabel(item, offscreenGroup);
}
}
this.doLayout(items, shapes);
this.renderLabelLine(items);
this.renderLabelBackground(items);
this.adjustLabel(items);
}
var lastShapesMap = this.lastShapesMap;
var shapesMap = this.shapesMap;
each_default(shapesMap, function(shape, id) {
if (shape.destroyed) {
delete shapesMap[id];
} else {
if (lastShapesMap[id]) {
var data3 = shape.get("data");
var origin_1 = shape.get("origin");
var coordinate11 = shape.get("coordinate");
var currentAnimateCfg = shape.get("animateCfg");
var currentShape = lastShapesMap[id];
updateLabel(currentShape, shapesMap[id], {
data: data3,
origin: origin_1,
animateCfg: currentAnimateCfg,
coordinate: coordinate11
});
_this.shapesMap[id] = currentShape;
} else {
container2.add(shape);
var animateCfg = get_default(shape.get("animateCfg"), isUpdate ? "enter" : "appear");
if (animateCfg) {
doAnimate(shape, animateCfg, {
toAttrs: __assign({}, shape.attr()),
coordinate: shape.get("coordinate")
});
}
}
delete lastShapesMap[id];
}
});
each_default(lastShapesMap, function(deleteShape) {
var animateCfg = get_default(deleteShape.get("animateCfg"), "leave");
if (animateCfg) {
doAnimate(deleteShape, animateCfg, {
toAttrs: null,
coordinate: deleteShape.get("coordinate")
});
} else {
deleteShape.remove(true);
}
});
this.lastShapesMap = shapesMap;
offscreenGroup.destroy();
};
Labels2.prototype.clear = function() {
this.container.clear();
this.shapesMap = {};
this.lastShapesMap = {};
};
Labels2.prototype.destroy = function() {
this.container.destroy();
this.shapesMap = null;
this.lastShapesMap = null;
};
Labels2.prototype.renderLabel = function(cfg, container2) {
var id = cfg.id, elementId = cfg.elementId, data3 = cfg.data, mappingData = cfg.mappingData, coordinate11 = cfg.coordinate, animate = cfg.animate, content = cfg.content;
var shapeAppendCfg = {
id,
elementId,
data: data3,
origin: __assign(__assign({}, mappingData), { data: mappingData[FIELD_ORIGIN] }),
coordinate: coordinate11
};
var labelGroup = container2.addGroup(__assign({
name: "label",
animateCfg: this.animate === false || animate === null || animate === false ? false : deep_mix_default({}, this.animate, animate)
}, shapeAppendCfg));
var labelShape;
if (content.isGroup && content.isGroup() || content.isShape && content.isShape()) {
var _a6 = content.getCanvasBBox(), width2 = _a6.width, height = _a6.height;
var textAlign = get_default(cfg, "textAlign", "left");
var x6 = cfg.x;
var y5 = cfg.y - height / 2;
if (textAlign === "center") {
x6 = x6 - width2 / 2;
} else if (textAlign === "right" || textAlign === "end") {
x6 = x6 - width2;
}
translate3(content, x6, y5);
labelShape = content;
labelGroup.add(content);
} else {
var fill = get_default(cfg, ["style", "fill"]);
labelShape = labelGroup.addShape("text", __assign({ attrs: __assign(__assign({ x: cfg.x, y: cfg.y, textAlign: cfg.textAlign, textBaseline: get_default(cfg, "textBaseline", "middle"), text: cfg.content }, cfg.style), { fill: is_null_default(fill) ? cfg.color : fill }) }, shapeAppendCfg));
}
if (cfg.rotate) {
rotate5(labelShape, cfg.rotate);
}
this.shapesMap[id] = labelGroup;
};
Labels2.prototype.doLayout = function(items, shapes) {
var _this = this;
if (this.layout) {
var layouts = is_array_default(this.layout) ? this.layout : [this.layout];
each_default(layouts, function(layout6) {
var layoutFn = getGeometryLabelLayout(get_default(layout6, "type", ""));
if (layoutFn) {
var labelShapes_1 = [];
var geometryShapes_1 = [];
each_default(_this.shapesMap, function(labelShape, id) {
labelShapes_1.push(labelShape);
geometryShapes_1.push(shapes[labelShape.get("elementId")]);
});
layoutFn(items, labelShapes_1, geometryShapes_1, _this.region, layout6.cfg);
}
});
}
};
Labels2.prototype.renderLabelLine = function(labelItems) {
var _this = this;
each_default(labelItems, function(labelItem) {
var coordinate11 = get_default(labelItem, "coordinate");
if (!labelItem || !coordinate11) {
return;
}
var center2 = coordinate11.getCenter();
var radius = coordinate11.getRadius();
if (!labelItem.labelLine) {
return;
}
var labelLineCfg = get_default(labelItem, "labelLine", {});
var id = labelItem.id;
var path = labelLineCfg.path;
if (!path) {
var start = polarToCartesian(center2.x, center2.y, radius, labelItem.angle);
path = [
["M", start.x, start.y],
["L", labelItem.x, labelItem.y]
];
}
var labelGroup = _this.shapesMap[id];
if (!labelGroup.destroyed) {
labelGroup.addShape("path", {
capture: false,
attrs: __assign({ path, stroke: labelItem.color ? labelItem.color : get_default(labelItem, ["style", "fill"], "#000"), fill: null }, labelLineCfg.style),
id,
origin: labelItem.mappingData,
data: labelItem.data,
coordinate: labelItem.coordinate
});
}
});
};
Labels2.prototype.renderLabelBackground = function(labelItems) {
var _this = this;
each_default(labelItems, function(labelItem) {
var coordinate11 = get_default(labelItem, "coordinate");
var background = get_default(labelItem, "background");
if (!background || !coordinate11) {
return;
}
var id = labelItem.id;
var labelGroup = _this.shapesMap[id];
if (!labelGroup.destroyed) {
var labelContentShape = labelGroup.getChildren()[0];
if (labelContentShape) {
var _a6 = getlLabelBackgroundInfo(labelGroup, labelItem, background.padding), rotation = _a6.rotation, box2 = __rest(_a6, ["rotation"]);
var backgroundShape = labelGroup.addShape("rect", {
attrs: __assign(__assign({}, box2), background.style || {}),
id,
origin: labelItem.mappingData,
data: labelItem.data,
coordinate: labelItem.coordinate
});
backgroundShape.setZIndex(-1);
if (rotation) {
var matrix = labelContentShape.getMatrix();
backgroundShape.setMatrix(matrix);
}
}
}
});
};
Labels2.prototype.createOffscreenGroup = function() {
var container2 = this.container;
var GroupClass = container2.getGroupBase();
var newGroup = new GroupClass({});
return newGroup;
};
Labels2.prototype.adjustLabel = function(items) {
var _this = this;
each_default(items, function(item) {
if (item) {
var id = item.id;
var labelGroup = _this.shapesMap[id];
if (!labelGroup.destroyed) {
var labelShapes = labelGroup.findAll(function(ele) {
return ele.get("type") !== "path";
});
each_default(labelShapes, function(labelShape) {
if (labelShape) {
if (item.offsetX) {
labelShape.attr("x", labelShape.attr("x") + item.offsetX);
}
if (item.offsetY) {
labelShape.attr("y", labelShape.attr("y") + item.offsetY);
}
}
});
}
}
});
};
return Labels2;
}();
var labels_default = Labels;
// node_modules/@antv/g2/esm/geometry/label/base.js
function avg(arr) {
var sum = 0;
each_default(arr, function(value2) {
sum += value2;
});
return sum / arr.length;
}
var GeometryLabel = function() {
function GeometryLabel2(geometry35) {
this.geometry = geometry35;
}
GeometryLabel2.prototype.getLabelItems = function(mapppingArray) {
var _this = this;
var items = [];
var labelCfgs = this.getLabelCfgs(mapppingArray);
each_default(mapppingArray, function(mappingData, index2) {
var labelCfg = labelCfgs[index2];
if (!labelCfg || is_nil_default(mappingData.x) || is_nil_default(mappingData.y)) {
items.push(null);
return;
}
var labelContent = !is_array_default(labelCfg.content) ? [labelCfg.content] : labelCfg.content;
labelCfg.content = labelContent;
var total = labelContent.length;
each_default(labelContent, function(content, subIndex) {
if (is_nil_default(content) || content === "") {
items.push(null);
return;
}
var item = __assign(__assign({}, labelCfg), _this.getLabelPoint(labelCfg, mappingData, subIndex));
if (!item.textAlign) {
item.textAlign = _this.getLabelAlign(item, subIndex, total);
}
if (item.offset <= 0) {
item.labelLine = null;
}
items.push(item);
});
});
return items;
};
GeometryLabel2.prototype.render = function(mapppingArray, isUpdate) {
if (isUpdate === void 0) {
isUpdate = false;
}
var labelItems = this.getLabelItems(mapppingArray);
var labelsRenderer = this.getLabelsRenderer();
var shapes = this.getGeometryShapes();
labelsRenderer.render(labelItems, shapes, isUpdate);
};
GeometryLabel2.prototype.clear = function() {
var labelsRenderer = this.labelsRenderer;
if (labelsRenderer) {
labelsRenderer.clear();
}
};
GeometryLabel2.prototype.destroy = function() {
var labelsRenderer = this.labelsRenderer;
if (labelsRenderer) {
labelsRenderer.destroy();
}
this.labelsRenderer = null;
};
GeometryLabel2.prototype.getCoordinate = function() {
return this.geometry.coordinate;
};
GeometryLabel2.prototype.getDefaultLabelCfg = function(offset, position2) {
var geometry35 = this.geometry;
var type2 = geometry35.type, theme4 = geometry35.theme;
if (type2 === "polygon" || type2 === "interval" && position2 === "middle" || offset < 0 && !["line", "point", "path"].includes(type2)) {
return get_default(theme4, "innerLabels", {});
}
return get_default(theme4, "labels", {});
};
GeometryLabel2.prototype.getThemedLabelCfg = function(labelCfg) {
var geometry35 = this.geometry;
var defaultLabelCfg3 = this.getDefaultLabelCfg();
var type2 = geometry35.type, theme4 = geometry35.theme;
var themedLabelCfg;
if (type2 === "polygon" || labelCfg.offset < 0 && !["line", "point", "path"].includes(type2)) {
themedLabelCfg = deep_mix_default({}, defaultLabelCfg3, theme4.innerLabels, labelCfg);
} else {
themedLabelCfg = deep_mix_default({}, defaultLabelCfg3, theme4.labels, labelCfg);
}
return themedLabelCfg;
};
GeometryLabel2.prototype.setLabelPosition = function(labelPointCfg, mappingData, index2, position2) {
};
GeometryLabel2.prototype.getLabelOffset = function(offset) {
var coordinate11 = this.getCoordinate();
var vector = this.getOffsetVector(offset);
return coordinate11.isTransposed ? vector[0] : vector[1];
};
GeometryLabel2.prototype.getLabelOffsetPoint = function(labelCfg, index2, total) {
var offset = labelCfg.offset;
var coordinate11 = this.getCoordinate();
var transposed = coordinate11.isTransposed;
var dim = transposed ? "x" : "y";
var factor = transposed ? 1 : -1;
var offsetPoint = {
x: 0,
y: 0
};
if (index2 > 0 || total === 1) {
offsetPoint[dim] = offset * factor;
} else {
offsetPoint[dim] = offset * factor * -1;
}
return offsetPoint;
};
GeometryLabel2.prototype.getLabelPoint = function(labelCfg, mappingData, index2) {
var coordinate11 = this.getCoordinate();
var total = labelCfg.content.length;
function getDimValue(value2, idx, isAvg) {
if (isAvg === void 0) {
isAvg = false;
}
var v3 = value2;
if (is_array_default(v3)) {
if (labelCfg.content.length === 1) {
if (isAvg) {
v3 = avg(v3);
} else {
if (v3.length <= 2) {
v3 = v3[value2.length - 1];
} else {
v3 = avg(v3);
}
}
} else {
v3 = v3[idx];
}
}
return v3;
}
var label17 = {
content: labelCfg.content[index2],
x: 0,
y: 0,
start: { x: 0, y: 0 },
color: "#fff"
};
var shape = is_array_default(mappingData.shape) ? mappingData.shape[0] : mappingData.shape;
var isFunnel = shape === "funnel" || shape === "pyramid";
if (this.geometry.type === "polygon") {
var centroid = getPolygonCentroid(mappingData.x, mappingData.y);
label17.x = centroid[0];
label17.y = centroid[1];
} else if (this.geometry.type === "interval" && !isFunnel) {
label17.x = getDimValue(mappingData.x, index2, true);
label17.y = getDimValue(mappingData.y, index2);
} else {
label17.x = getDimValue(mappingData.x, index2);
label17.y = getDimValue(mappingData.y, index2);
}
if (isFunnel) {
var nextPoints = get_default(mappingData, "nextPoints");
var points = get_default(mappingData, "points");
if (nextPoints) {
var point1 = coordinate11.convert(points[1]);
var point2 = coordinate11.convert(nextPoints[1]);
label17.x = (point1.x + point2.x) / 2;
label17.y = (point1.y + point2.y) / 2;
} else if (shape === "pyramid") {
var point1 = coordinate11.convert(points[1]);
var point2 = coordinate11.convert(points[2]);
label17.x = (point1.x + point2.x) / 2;
label17.y = (point1.y + point2.y) / 2;
}
}
if (labelCfg.position) {
this.setLabelPosition(label17, mappingData, index2, labelCfg.position);
}
var offsetPoint = this.getLabelOffsetPoint(labelCfg, index2, total);
label17.start = { x: label17.x, y: label17.y };
label17.x += offsetPoint.x;
label17.y += offsetPoint.y;
label17.color = mappingData.color;
return label17;
};
GeometryLabel2.prototype.getLabelAlign = function(item, index2, total) {
var align = "center";
var coordinate11 = this.getCoordinate();
if (coordinate11.isTransposed) {
var offset = item.offset;
if (offset < 0) {
align = "right";
} else if (offset === 0) {
align = "center";
} else {
align = "left";
}
if (total > 1 && index2 === 0) {
if (align === "right") {
align = "left";
} else if (align === "left") {
align = "right";
}
}
}
return align;
};
GeometryLabel2.prototype.getLabelId = function(mappingData) {
var geometry35 = this.geometry;
var type2 = geometry35.type;
var xScale = geometry35.getXScale();
var yScale = geometry35.getYScale();
var origin = mappingData[FIELD_ORIGIN];
var labelId = geometry35.getElementId(mappingData);
if (type2 === "line" || type2 === "area") {
labelId += " ".concat(origin[xScale.field]);
} else if (type2 === "path") {
labelId += " ".concat(origin[xScale.field], "-").concat(origin[yScale.field]);
}
return labelId;
};
GeometryLabel2.prototype.getLabelsRenderer = function() {
var _a6 = this.geometry, labelsContainer = _a6.labelsContainer, labelOption = _a6.labelOption, canvasRegion = _a6.canvasRegion, animateOption = _a6.animateOption;
var coordinate11 = this.geometry.coordinate;
var labelsRenderer = this.labelsRenderer;
if (!labelsRenderer) {
labelsRenderer = new labels_default({
container: labelsContainer,
layout: get_default(labelOption, ["cfg", "layout"], {
type: this.defaultLayout
})
});
this.labelsRenderer = labelsRenderer;
}
labelsRenderer.region = canvasRegion;
labelsRenderer.animate = animateOption ? getDefaultAnimateCfg("label", coordinate11) : false;
return labelsRenderer;
};
GeometryLabel2.prototype.getLabelCfgs = function(mapppingArray) {
var _this = this;
var geometry35 = this.geometry;
var labelOption = geometry35.labelOption, scales = geometry35.scales, coordinate11 = geometry35.coordinate;
var _a6 = labelOption, fields = _a6.fields, callback = _a6.callback, cfg = _a6.cfg;
var labelScales = fields.map(function(field6) {
return scales[field6];
});
var labelCfgs = [];
each_default(mapppingArray, function(mappingData, index2) {
var origin = mappingData[FIELD_ORIGIN];
var originText = _this.getLabelText(origin, labelScales);
var callbackCfg;
if (callback) {
var originValues = fields.map(function(field6) {
return origin[field6];
});
callbackCfg = callback.apply(void 0, originValues);
if (is_nil_default(callbackCfg)) {
labelCfgs.push(null);
return;
}
}
var labelCfg = __assign(__assign({
id: _this.getLabelId(mappingData),
elementId: _this.geometry.getElementId(mappingData),
data: origin,
mappingData,
coordinate: coordinate11
}, cfg), callbackCfg);
if (is_function_default(labelCfg.position)) {
labelCfg.position = labelCfg.position(origin, mappingData, index2);
}
var offset = _this.getLabelOffset(labelCfg.offset || 0);
var defaultLabelCfg3 = _this.getDefaultLabelCfg(offset, labelCfg.position);
labelCfg = deep_mix_default({}, defaultLabelCfg3, labelCfg);
labelCfg.offset = _this.getLabelOffset(labelCfg.offset || 0);
var content = labelCfg.content;
if (is_function_default(content)) {
labelCfg.content = content(origin, mappingData, index2);
} else if (is_undefined_default(content)) {
labelCfg.content = originText[0];
}
labelCfgs.push(labelCfg);
});
return labelCfgs;
};
GeometryLabel2.prototype.getLabelText = function(origin, scales) {
var labelTexts = [];
each_default(scales, function(scale12) {
var value2 = origin[scale12.field];
if (is_array_default(value2)) {
value2 = value2.map(function(subVal) {
return scale12.getText(subVal);
});
} else {
value2 = scale12.getText(value2);
}
if (is_nil_default(value2) || value2 === "") {
labelTexts.push(null);
} else {
labelTexts.push(value2);
}
});
return labelTexts;
};
GeometryLabel2.prototype.getOffsetVector = function(offset) {
if (offset === void 0) {
offset = 0;
}
var coordinate11 = this.getCoordinate();
var actualOffset = 0;
if (is_number_default(offset)) {
actualOffset = offset;
}
return coordinate11.isTransposed ? coordinate11.applyMatrix(actualOffset, 0) : coordinate11.applyMatrix(0, actualOffset);
};
GeometryLabel2.prototype.getGeometryShapes = function() {
var geometry35 = this.geometry;
var shapes = {};
each_default(geometry35.elementsMap, function(element, id) {
shapes[id] = element.shape;
});
each_default(geometry35.getOffscreenGroup().getChildren(), function(child) {
var id = geometry35.getElementId(child.get("origin").mappingData);
shapes[id] = child;
});
return shapes;
};
return GeometryLabel2;
}();
var base_default14 = GeometryLabel;
// node_modules/@antv/g2/esm/util/attr.js
function getMappingValue(attr, value2, def) {
if (!attr) {
return def;
}
var r4;
if (attr.callback && attr.callback.length > 1) {
var restArgs = Array(attr.callback.length - 1).fill("");
r4 = attr.mapping.apply(attr, __spreadArray([value2], restArgs, false)).join("");
} else {
r4 = attr.mapping(value2).join("");
}
return r4 || def;
}
// node_modules/@antv/g2/esm/util/marker.js
var MarkerSymbols = {
hexagon: function(x6, y5, r4) {
var diffX = r4 / 2 * Math.sqrt(3);
return [
["M", x6, y5 - r4],
["L", x6 + diffX, y5 - r4 / 2],
["L", x6 + diffX, y5 + r4 / 2],
["L", x6, y5 + r4],
["L", x6 - diffX, y5 + r4 / 2],
["L", x6 - diffX, y5 - r4 / 2],
["Z"]
];
},
bowtie: function(x6, y5, r4) {
var diffY = r4 - 1.5;
return [["M", x6 - r4, y5 - diffY], ["L", x6 + r4, y5 + diffY], ["L", x6 + r4, y5 - diffY], ["L", x6 - r4, y5 + diffY], ["Z"]];
},
cross: function(x6, y5, r4) {
return [
["M", x6 - r4, y5 - r4],
["L", x6 + r4, y5 + r4],
["M", x6 + r4, y5 - r4],
["L", x6 - r4, y5 + r4]
];
},
tick: function(x6, y5, r4) {
return [
["M", x6 - r4 / 2, y5 - r4],
["L", x6 + r4 / 2, y5 - r4],
["M", x6, y5 - r4],
["L", x6, y5 + r4],
["M", x6 - r4 / 2, y5 + r4],
["L", x6 + r4 / 2, y5 + r4]
];
},
plus: function(x6, y5, r4) {
return [
["M", x6 - r4, y5],
["L", x6 + r4, y5],
["M", x6, y5 - r4],
["L", x6, y5 + r4]
];
},
hyphen: function(x6, y5, r4) {
return [
["M", x6 - r4, y5],
["L", x6 + r4, y5]
];
},
line: function(x6, y5, r4) {
return [
["M", x6, y5 - r4],
["L", x6, y5 + r4]
];
}
};
// node_modules/@antv/g2/esm/util/legend.js
var STROKES_SYMBOLS = ["line", "cross", "tick", "plus", "hyphen"];
function handleUserMarkerStyle(markerStyle, style) {
if (is_function_default(style)) {
return style(markerStyle);
}
return deep_mix_default({}, markerStyle, style);
}
function adpatorMarkerStyle(marker, color4) {
var symbol = marker.symbol;
if (is_string_default(symbol) && STROKES_SYMBOLS.indexOf(symbol) !== -1) {
var markerStyle = get_default(marker, "style", {});
var lineWidth = get_default(markerStyle, "lineWidth", 1);
var stroke = markerStyle.stroke || markerStyle.fill || color4;
marker.style = deep_mix_default({}, marker.style, { lineWidth, stroke, fill: null });
}
}
function setMarkerSymbol(marker) {
var symbol = marker.symbol;
if (is_string_default(symbol) && MarkerSymbols[symbol]) {
marker.symbol = MarkerSymbols[symbol];
}
}
function getLegendLayout(direction5) {
return direction5.startsWith(DIRECTION.LEFT) || direction5.startsWith(DIRECTION.RIGHT) ? "vertical" : "horizontal";
}
function getLegendItems(view, geometry35, attr, themeMarker, userMarker) {
var scale12 = attr.getScale(attr.type);
if (scale12.isCategory) {
var field_1 = scale12.field;
var colorAttr_1 = geometry35.getAttribute("color");
var shapeAttr_1 = geometry35.getAttribute("shape");
var defaultColor_1 = view.getTheme().defaultColor;
var isInPolar_1 = geometry35.coordinate.isPolar;
return scale12.getTicks().map(function(tick, index2) {
var _a6;
var text = tick.text, scaleValue = tick.value;
var name = text;
var value2 = scale12.invert(scaleValue);
var unchecked = view.filterFieldData(field_1, [(_a6 = {}, _a6[field_1] = value2, _a6)]).length === 0;
each_default(view.views, function(subView) {
var _a7;
if (!subView.filterFieldData(field_1, [(_a7 = {}, _a7[field_1] = value2, _a7)]).length) {
unchecked = true;
}
});
var color4 = getMappingValue(colorAttr_1, value2, defaultColor_1);
var shape = getMappingValue(shapeAttr_1, value2, "point");
var marker = geometry35.getShapeMarker(shape, {
color: color4,
isInPolar: isInPolar_1
});
var markerCfg = userMarker;
if (is_function_default(markerCfg)) {
markerCfg = markerCfg(name, index2, __assign({ name, value: value2 }, deep_mix_default({}, themeMarker, marker)));
}
marker = deep_mix_default({}, themeMarker, marker, omit(__assign({}, markerCfg), ["style"]));
adpatorMarkerStyle(marker, color4);
if (markerCfg && markerCfg.style) {
marker.style = handleUserMarkerStyle(marker.style, markerCfg.style);
}
setMarkerSymbol(marker);
return { id: value2, name, value: value2, marker, unchecked };
});
}
return [];
}
function getCustomLegendItems(themeMarker, userMarker, customItems) {
return customItems.map(function(item, index2) {
var markerCfg = userMarker;
if (is_function_default(markerCfg)) {
markerCfg = markerCfg(item.name, index2, deep_mix_default({}, themeMarker, item));
}
var itemMarker = is_function_default(item.marker) ? item.marker(item.name, index2, deep_mix_default({}, themeMarker, item)) : item.marker;
var marker = deep_mix_default({}, themeMarker, markerCfg, itemMarker);
setMarkerSymbol(marker);
item.marker = marker;
return item;
});
}
function getLegendThemeCfg(theme4, direction5) {
var legendTheme = get_default(theme4, ["components", "legend"], {});
return deep_mix_default({}, get_default(legendTheme, ["common"], {}), deep_mix_default({}, get_default(legendTheme, [direction5], {})));
}
// node_modules/@antv/g2/esm/geometry/shape/util/get-path-points.js
function isValueEmpty(value2) {
if (value2) {
return false;
}
return value2 === null || value2 === void 0 || isNaN(value2);
}
function isYNil(point2) {
if (is_array_default(point2)) {
return isValueEmpty(point2[1].y);
}
var value2 = point2.y;
return is_array_default(value2) ? isValueEmpty(value2[0]) : isValueEmpty(value2);
}
function getPathPoints(points, connectNulls, showSinglePoint) {
if (connectNulls === void 0) {
connectNulls = false;
}
if (showSinglePoint === void 0) {
showSinglePoint = true;
}
if (!points.length || points.length === 1 && !showSinglePoint) {
return [];
}
if (connectNulls) {
var filtered = [];
for (var i4 = 0, len5 = points.length; i4 < len5; i4++) {
var point2 = points[i4];
if (!isYNil(point2)) {
filtered.push(point2);
}
}
return [filtered];
}
var result = [];
var tmp = [];
for (var i4 = 0, len5 = points.length; i4 < len5; i4++) {
var point2 = points[i4];
if (isYNil(point2)) {
if (tmp.length) {
if (!(tmp.length === 1 && !showSinglePoint)) {
result.push(tmp);
}
tmp = [];
}
} else {
tmp.push(point2);
}
}
if (tmp.length) {
result.push(tmp);
}
return result;
}
function getViolinPath(points) {
var path = [];
for (var i4 = 0; i4 < points.length; i4++) {
var point2 = points[i4];
if (point2) {
var action = i4 === 0 ? "M" : "L";
path.push([action, point2.x, point2.y]);
}
}
var first = points[0];
if (first) {
path.push(["L", first.x, first.y]);
path.push(["z"]);
}
return path;
}
function getSmoothViolinPath(points) {
var half = points.length / 2;
var leftPoints = [];
var rightPoints = [];
for (var i4 = 0; i4 < points.length; i4++) {
if (i4 < half) {
leftPoints.push(points[i4]);
} else {
rightPoints.push(points[i4]);
}
}
var leftPath = getSplinePath(leftPoints, false);
var rightPath = getSplinePath(rightPoints, false);
if (rightPoints.length) {
leftPath.push(["L", rightPoints[0].x, rightPoints[0].y]);
}
rightPath.shift();
var path = leftPath.concat(rightPath);
if (leftPoints.length) {
path.push(["L", leftPoints[0].x, leftPoints[0].y]);
}
path.push(["z"]);
return path;
}
// node_modules/@antv/g2/esm/geometry/shape/util/get-style.js
function getStyle2(cfg, isStroke, isFill, sizeName) {
if (sizeName === void 0) {
sizeName = "";
}
var _a6 = cfg.style, style = _a6 === void 0 ? {} : _a6, defaultStyle = cfg.defaultStyle, color4 = cfg.color, size2 = cfg.size;
var attrs = __assign(__assign({}, defaultStyle), style);
if (color4) {
if (isStroke) {
if (!style.stroke) {
attrs.stroke = color4;
}
}
if (isFill) {
if (!style.fill) {
attrs.fill = color4;
}
}
}
if (sizeName && is_nil_default(style[sizeName]) && !is_nil_default(size2)) {
attrs[sizeName] = size2;
}
return attrs;
}
function getBackgroundRectStyle(cfg) {
return deep_mix_default({}, {
fill: "#CCD6EC",
fillOpacity: 0.3
}, get_default(cfg, ["background", "style"]));
}
// node_modules/@antv/g2/esm/geometry/shape/util/split-points.js
function splitPoints(obj) {
var x6 = obj.x;
var y5 = is_array_default(obj.y) ? obj.y : [obj.y];
return y5.map(function(eachY, index2) {
return {
x: is_array_default(x6) ? x6[index2] : x6,
y: eachY
};
});
}
// node_modules/@antv/g2/esm/geometry/shape/line/util.js
var LineSymbols = {
line: function(x6, y5, r4) {
return [
["M", x6 - r4, y5],
["L", x6 + r4, y5]
];
},
dot: function(x6, y5, r4) {
return [
["M", x6 - r4, y5],
["L", x6 + r4, y5]
];
},
dash: function(x6, y5, r4) {
return [
["M", x6 - r4, y5],
["L", x6 + r4, y5]
];
},
smooth: function(x6, y5, r4) {
return [
["M", x6 - r4, y5],
["A", r4 / 2, r4 / 2, 0, 1, 1, x6, y5],
["A", r4 / 2, r4 / 2, 0, 1, 0, x6 + r4, y5]
];
},
hv: function(x6, y5, r4) {
return [
["M", x6 - r4 - 1, y5 - 2.5],
["L", x6, y5 - 2.5],
["L", x6, y5 + 2.5],
["L", x6 + r4 + 1, y5 + 2.5]
];
},
vh: function(x6, y5, r4) {
return [
["M", x6 - r4 - 1, y5 + 2.5],
["L", x6, y5 + 2.5],
["L", x6, y5 - 2.5],
["L", x6 + r4 + 1, y5 - 2.5]
];
},
hvh: function(x6, y5, r4) {
return [
["M", x6 - (r4 + 1), y5 + 2.5],
["L", x6 - r4 / 2, y5 + 2.5],
["L", x6 - r4 / 2, y5 - 2.5],
["L", x6 + r4 / 2, y5 - 2.5],
["L", x6 + r4 / 2, y5 + 2.5],
["L", x6 + r4 + 1, y5 + 2.5]
];
},
vhv: function(x6, y5) {
return [
["M", x6 - 5, y5 + 2.5],
["L", x6 - 5, y5],
["L", x6, y5],
["L", x6, y5 - 3],
["L", x6, y5 + 3],
["L", x6 + 6.5, y5 + 3]
];
}
};
function getLineMarker(markerCfg, shapeType) {
var color4 = markerCfg.color;
return {
symbol: LineSymbols[shapeType],
style: {
lineWidth: 2,
r: 6,
stroke: color4
}
};
}
// node_modules/@antv/g2/esm/geometry/shape/line/index.js
function getShapeAttrs(cfg, smooth, constraint) {
var isStack = cfg.isStack, connectNulls = cfg.connectNulls, isInCircle = cfg.isInCircle, showSinglePoint = cfg.showSinglePoint;
var shapeAttrs = getStyle2(cfg, true, false, "lineWidth");
var points = getPathPoints(cfg.points, connectNulls, showSinglePoint);
var path = [];
for (var i4 = 0, len5 = points.length; i4 < len5; i4++) {
var eachLinePoints = points[i4];
path = path.concat(getPath(eachLinePoints, isInCircle, isStack, smooth, constraint, shapeAttrs));
}
shapeAttrs.path = path;
return shapeAttrs;
}
function getSinglePath(points, isInCircle, smooth, constraint, style) {
if (points.length === 1) {
return [
["M", points[0].x, points[0].y - style.lineWidth / 2],
["L", points[0].x, points[0].y],
["L", points[0].x, points[0].y + style.lineWidth / 2]
];
}
var path;
if (!smooth) {
path = getLinePath2(points, false);
if (isInCircle) {
path.push(["Z"]);
}
} else {
if (isInCircle && points.length) {
points.push({ x: points[0].x, y: points[0].y });
}
path = getSplinePath(points, false, constraint);
}
return path;
}
function getRangePath(points, isInCircle, isStack, smooth, constraint, style) {
var topPoints = [];
var bottomPoints = [];
each_default(points, function(point2) {
var result = splitPoints(point2);
topPoints.push(result[1]);
bottomPoints.push(result[0]);
});
var topPath = getSinglePath(topPoints, isInCircle, smooth, constraint, style);
var bottomPath = getSinglePath(bottomPoints, isInCircle, smooth, constraint, style);
if (isStack) {
return topPath;
}
return topPath.concat(bottomPath);
}
function getPath(points, isInCircle, isStack, smooth, constraint, style) {
if (points.length) {
var first = points[0];
return is_array_default(first.y) ? getRangePath(points, isInCircle, isStack, smooth, constraint, style) : getSinglePath(points, isInCircle, smooth, constraint, style);
}
return [];
}
var LineShapeFactory = registerShapeFactory("line", {
defaultShapeType: "line"
});
each_default(["line", "dot", "dash", "smooth"], function(shapeType) {
registerShape("line", shapeType, {
draw: function(cfg, container2) {
var smooth = shapeType === "smooth";
var constraint;
if (smooth) {
var _a6 = this.coordinate, start = _a6.start, end2 = _a6.end;
constraint = [
[start.x, end2.y],
[end2.x, start.y]
];
}
var attrs = getShapeAttrs(cfg, smooth, constraint);
var shape = container2.addShape({
type: "path",
attrs,
name: "line",
capture: !smooth
});
return shape;
},
getMarker: function(markerCfg) {
return getLineMarker(markerCfg, shapeType);
}
});
});
// node_modules/@antv/g2/esm/core.js
var VERSION = "4.1.39";
var Util = {
getLegendItems,
translate: translate3,
rotate: rotate5,
zoom,
transform: transform3,
getAngle: getAngle3,
getSectorPath,
polarToCartesian,
getDelegationObject,
getTooltipItems,
getMappingValue,
getPath,
getPathPoints
};
// node_modules/@antv/g2/esm/theme/style-sheet/dark.js
var WHITE_COLORS2 = {
100: "#000",
95: "#0D0D0D",
85: "#262626",
65: "#595959",
45: "#8C8C8C",
25: "#BFBFBF",
15: "#D9D9D9",
6: "#F0F0F0"
};
var BLACK_COLORS2 = {
100: "#FFFFFF",
95: "#F2F2F2",
85: "#D9D9D9",
65: "#A6A6A6",
45: "#737373",
25: "#404040",
15: "#262626",
6: "#0F0F0F"
};
var QUALITATIVE_102 = [
"#5B8FF9",
"#5AD8A6",
"#5D7092",
"#F6BD16",
"#E86452",
"#6DC8EC",
"#945FB9",
"#FF9845",
"#1E9493",
"#FF99C3"
];
var QUALITATIVE_202 = [
"#5B8FF9",
"#CDDDFD",
"#5AD8A6",
"#CDF3E4",
"#5D7092",
"#CED4DE",
"#F6BD16",
"#FCEBB9",
"#E86452",
"#F8D0CB",
"#6DC8EC",
"#D3EEF9",
"#945FB9",
"#DECFEA",
"#FF9845",
"#FFE0C7",
"#1E9493",
"#BBDEDE",
"#FF99C3",
"#FFE0ED"
];
var SINGLE_SEQUENCE2 = [
"#B8E1FF",
"#9AC5FF",
"#7DAAFF",
"#5B8FF9",
"#3D76DD",
"#085EC0",
"#0047A5",
"#00318A",
"#001D70"
];
var createDarkStyleSheet = function(cfg) {
if (cfg === void 0) {
cfg = {};
}
var _a6 = cfg.backgroundColor, backgroundColor = _a6 === void 0 ? "#141414" : _a6, _b = cfg.subColor, subColor = _b === void 0 ? "rgba(255,255,255,0.05)" : _b, _c = cfg.paletteQualitative10, paletteQualitative10 = _c === void 0 ? QUALITATIVE_102 : _c, _d = cfg.paletteQualitative20, paletteQualitative20 = _d === void 0 ? QUALITATIVE_202 : _d, _e = cfg.paletteSemanticRed, paletteSemanticRed = _e === void 0 ? "#F4664A" : _e, _f = cfg.paletteSemanticGreen, paletteSemanticGreen = _f === void 0 ? "#30BF78" : _f, _g = cfg.paletteSemanticYellow, paletteSemanticYellow = _g === void 0 ? "#FAAD14" : _g, _h = cfg.paletteSequence, paletteSequence = _h === void 0 ? SINGLE_SEQUENCE2 : _h, _j = cfg.fontFamily, fontFamily = _j === void 0 ? '"Segoe UI", Roboto, "Helvetica Neue", Arial,\n "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",\n "Noto Color Emoji"' : _j;
var _k = cfg.brandColor, brandColor = _k === void 0 ? paletteQualitative10[0] : _k;
return {
backgroundColor,
brandColor,
subColor,
paletteQualitative10,
paletteQualitative20,
paletteSemanticRed,
paletteSemanticGreen,
paletteSemanticYellow,
paletteSequence,
fontFamily,
axisLineBorderColor: BLACK_COLORS2[25],
axisLineBorder: 1,
axisLineDash: null,
axisTitleTextFillColor: BLACK_COLORS2[65],
axisTitleTextFontSize: 12,
axisTitleTextLineHeight: 12,
axisTitleTextFontWeight: "normal",
axisTitleSpacing: 12,
axisTickLineBorderColor: BLACK_COLORS2[25],
axisTickLineLength: 4,
axisTickLineBorder: 1,
axisSubTickLineBorderColor: BLACK_COLORS2[15],
axisSubTickLineLength: 2,
axisSubTickLineBorder: 1,
axisLabelFillColor: BLACK_COLORS2[45],
axisLabelFontSize: 12,
axisLabelLineHeight: 12,
axisLabelFontWeight: "normal",
axisLabelOffset: 8,
axisGridBorderColor: BLACK_COLORS2[15],
axisGridBorder: 1,
axisGridLineDash: null,
legendTitleTextFillColor: BLACK_COLORS2[45],
legendTitleTextFontSize: 12,
legendTitleTextLineHeight: 21,
legendTitleTextFontWeight: "normal",
legendMarkerColor: QUALITATIVE_102[0],
legendMarkerSpacing: 8,
legendMarkerSize: 4,
legendCircleMarkerSize: 4,
legendSquareMarkerSize: 4,
legendLineMarkerSize: 5,
legendItemNameFillColor: BLACK_COLORS2[65],
legendItemNameFontSize: 12,
legendItemNameLineHeight: 12,
legendItemNameFontWeight: "normal",
legendItemSpacing: 24,
legendItemMarginBottom: 12,
legendSpacing: 16,
legendPadding: [8, 8, 8, 8],
legendHorizontalPadding: [8, 0, 8, 0],
legendVerticalPadding: [0, 8, 0, 8],
legendPageNavigatorMarkerSize: 12,
legendPageNavigatorMarkerInactiveFillColor: BLACK_COLORS2[45],
legendPageNavigatorMarkerInactiveFillOpacity: 0.45,
legendPageNavigatorMarkerFillColor: BLACK_COLORS2[45],
legendPageNavigatorMarkerFillOpacity: 1,
legendPageNavigatorTextFillColor: BLACK_COLORS2[65],
legendPageNavigatorTextFontSize: 12,
sliderRailFillColor: BLACK_COLORS2[15],
sliderRailBorder: 0,
sliderRailBorderColor: null,
sliderRailWidth: 100,
sliderRailHeight: 12,
sliderLabelTextFillColor: BLACK_COLORS2[45],
sliderLabelTextFontSize: 12,
sliderLabelTextLineHeight: 12,
sliderLabelTextFontWeight: "normal",
sliderHandlerFillColor: WHITE_COLORS2[6],
sliderHandlerWidth: 10,
sliderHandlerHeight: 14,
sliderHandlerBorder: 1,
sliderHandlerBorderColor: WHITE_COLORS2[25],
annotationArcBorderColor: BLACK_COLORS2[15],
annotationArcBorder: 1,
annotationLineBorderColor: BLACK_COLORS2[25],
annotationLineBorder: 1,
annotationLineDash: null,
annotationTextFillColor: BLACK_COLORS2[65],
annotationTextFontSize: 12,
annotationTextLineHeight: 12,
annotationTextFontWeight: "normal",
annotationTextBorderColor: null,
annotationTextBorder: 0,
annotationRegionFillColor: BLACK_COLORS2[100],
annotationRegionFillOpacity: 0.06,
annotationRegionBorder: 0,
annotationRegionBorderColor: null,
annotationDataMarkerLineLength: 16,
tooltipCrosshairsBorderColor: BLACK_COLORS2[25],
tooltipCrosshairsBorder: 1,
tooltipCrosshairsLineDash: null,
tooltipContainerFillColor: "#1f1f1f",
tooltipContainerFillOpacity: 0.95,
tooltipContainerShadow: "0px 2px 4px rgba(0,0,0,.5)",
tooltipContainerBorderRadius: 3,
tooltipTextFillColor: BLACK_COLORS2[65],
tooltipTextFontSize: 12,
tooltipTextLineHeight: 12,
tooltipTextFontWeight: "bold",
labelFillColor: BLACK_COLORS2[65],
labelFillColorDark: "#2c3542",
labelFillColorLight: "#ffffff",
labelFontSize: 12,
labelLineHeight: 12,
labelFontWeight: "normal",
labelBorderColor: null,
labelBorder: 0,
innerLabelFillColor: WHITE_COLORS2[100],
innerLabelFontSize: 12,
innerLabelLineHeight: 12,
innerLabelFontWeight: "normal",
innerLabelBorderColor: null,
innerLabelBorder: 0,
overflowLabelFillColor: BLACK_COLORS2[65],
overflowLabelFillColorDark: "#2c3542",
overflowLabelFillColorLight: "#ffffff",
overflowLabelFontSize: 12,
overflowLabelLineHeight: 12,
overflowLabelFontWeight: "normal",
overflowLabelBorderColor: WHITE_COLORS2[100],
overflowLabelBorder: 1,
labelLineBorder: 1,
labelLineBorderColor: BLACK_COLORS2[25],
cSliderRailHieght: 16,
cSliderBackgroundFillColor: "#416180",
cSliderBackgroundFillOpacity: 0.05,
cSliderForegroundFillColor: "#5B8FF9",
cSliderForegroundFillOpacity: 0.15,
cSliderHandlerHeight: 24,
cSliderHandlerWidth: 10,
cSliderHandlerFillColor: "#F7F7F7",
cSliderHandlerFillOpacity: 1,
cSliderHandlerHighlightFillColor: "#FFF",
cSliderHandlerBorderColor: "#BFBFBF",
cSliderHandlerBorder: 1,
cSliderHandlerBorderRadius: 2,
cSliderTextFillColor: "#fff",
cSliderTextFillOpacity: 0.45,
cSliderTextFontSize: 12,
cSliderTextLineHeight: 12,
cSliderTextFontWeight: "normal",
cSliderTextBorderColor: null,
cSliderTextBorder: 0,
scrollbarTrackFillColor: "rgba(255,255,255,0.65)",
scrollbarThumbFillColor: "rgba(0,0,0,0.35)",
scrollbarThumbHighlightFillColor: "rgba(0,0,0,0.45)",
pointFillColor: QUALITATIVE_102[0],
pointFillOpacity: 0.95,
pointSize: 4,
pointBorder: 1,
pointBorderColor: WHITE_COLORS2[100],
pointBorderOpacity: 1,
pointActiveBorderColor: BLACK_COLORS2[100],
pointSelectedBorder: 2,
pointSelectedBorderColor: BLACK_COLORS2[100],
pointInactiveFillOpacity: 0.3,
pointInactiveBorderOpacity: 0.3,
hollowPointSize: 4,
hollowPointBorder: 1,
hollowPointBorderColor: QUALITATIVE_102[0],
hollowPointBorderOpacity: 0.95,
hollowPointFillColor: WHITE_COLORS2[100],
hollowPointActiveBorder: 1,
hollowPointActiveBorderColor: BLACK_COLORS2[100],
hollowPointActiveBorderOpacity: 1,
hollowPointSelectedBorder: 2,
hollowPointSelectedBorderColor: BLACK_COLORS2[100],
hollowPointSelectedBorderOpacity: 1,
hollowPointInactiveBorderOpacity: 0.3,
lineBorder: 2,
lineBorderColor: QUALITATIVE_102[0],
lineBorderOpacity: 1,
lineActiveBorder: 3,
lineSelectedBorder: 3,
lineInactiveBorderOpacity: 0.3,
areaFillColor: QUALITATIVE_102[0],
areaFillOpacity: 0.25,
areaActiveFillColor: QUALITATIVE_102[0],
areaActiveFillOpacity: 0.5,
areaSelectedFillColor: QUALITATIVE_102[0],
areaSelectedFillOpacity: 0.5,
areaInactiveFillOpacity: 0.3,
hollowAreaBorderColor: QUALITATIVE_102[0],
hollowAreaBorder: 2,
hollowAreaBorderOpacity: 1,
hollowAreaActiveBorder: 3,
hollowAreaActiveBorderColor: BLACK_COLORS2[100],
hollowAreaSelectedBorder: 3,
hollowAreaSelectedBorderColor: BLACK_COLORS2[100],
hollowAreaInactiveBorderOpacity: 0.3,
intervalFillColor: QUALITATIVE_102[0],
intervalFillOpacity: 0.95,
intervalActiveBorder: 1,
intervalActiveBorderColor: BLACK_COLORS2[100],
intervalActiveBorderOpacity: 1,
intervalSelectedBorder: 2,
intervalSelectedBorderColor: BLACK_COLORS2[100],
intervalSelectedBorderOpacity: 1,
intervalInactiveBorderOpacity: 0.3,
intervalInactiveFillOpacity: 0.3,
hollowIntervalBorder: 2,
hollowIntervalBorderColor: QUALITATIVE_102[0],
hollowIntervalBorderOpacity: 1,
hollowIntervalFillColor: WHITE_COLORS2[100],
hollowIntervalActiveBorder: 2,
hollowIntervalActiveBorderColor: BLACK_COLORS2[100],
hollowIntervalSelectedBorder: 3,
hollowIntervalSelectedBorderColor: BLACK_COLORS2[100],
hollowIntervalSelectedBorderOpacity: 1,
hollowIntervalInactiveBorderOpacity: 0.3
};
};
var antvDark = createDarkStyleSheet();
// node_modules/@antv/g-canvas/esm/index.js
var esm_exports = {};
__export(esm_exports, {
AbstractCanvas: () => canvas_default,
AbstractGroup: () => group_default2,
AbstractShape: () => shape_default,
Base: () => base_default2,
Canvas: () => canvas_default2,
Event: () => graph_event_default,
Group: () => group_default3,
PathUtil: () => path_exports,
Shape: () => shape_exports,
assembleFont: () => assembleFont,
getArcParams: () => getArcParams2,
getBBoxMethod: () => getMethod,
getOffScreenContext: () => getOffScreenContext,
getTextHeight: () => getTextHeight,
invert: () => invert4,
isAllowCapture: () => isAllowCapture,
multiplyVec2: () => multiplyVec2,
version: () => version
});
// node_modules/@antv/g-canvas/esm/shape/index.js
var shape_exports = {};
__export(shape_exports, {
Base: () => base_default15,
Circle: () => circle_default5,
Ellipse: () => ellipse_default3,
Image: () => image_default2,
Line: () => line_default7,
Marker: () => marker_default,
Path: () => path_default2,
Polygon: () => polygon_default3,
Polyline: () => polyline_default3,
Rect: () => rect_default2,
Text: () => text_default3
});
// node_modules/@antv/g-canvas/esm/util/util.js
function getPixelRatio() {
return window ? window.devicePixelRatio : 1;
}
function distance8(x1, y1, x22, y22) {
var dx = x1 - x22;
var dy = y1 - y22;
return Math.sqrt(dx * dx + dy * dy);
}
function inBox(minX, minY, width2, height, x6, y5) {
return x6 >= minX && x6 <= minX + width2 && y5 >= minY && y5 <= minY + height;
}
function intersectRect2(box1, box2) {
return !(box2.minX > box1.maxX || box2.maxX < box1.minX || box2.minY > box1.maxY || box2.maxY < box1.minY);
}
function mergeRegion(region1, region2) {
if (!region1 || !region2) {
return region1 || region2;
}
return {
minX: Math.min(region1.minX, region2.minX),
minY: Math.min(region1.minY, region2.minY),
maxX: Math.max(region1.maxX, region2.maxX),
maxY: Math.max(region1.maxY, region2.maxY)
};
}
function isSamePoint2(point1, point2) {
return point1[0] === point2[0] && point1[1] === point2[1];
}
// node_modules/@antv/g-canvas/esm/util/parse.js
var regexLG2 = /^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i;
var regexRG2 = /^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i;
var regexPR = /^p\s*\(\s*([axyn])\s*\)\s*(.*)/i;
var regexColorStop2 = /[\d.]+:(#[^\s]+|[^\)]+\))/gi;
function addStop(steps, gradient2) {
var arr = steps.match(regexColorStop2);
each_default(arr, function(item) {
var itemArr = item.split(":");
gradient2.addColorStop(itemArr[0], itemArr[1]);
});
}
function parseLineGradient(context, element, gradientStr) {
var arr = regexLG2.exec(gradientStr);
var angle3 = parseFloat(arr[1]) % 360 * (Math.PI / 180);
var steps = arr[2];
var box2 = element.getBBox();
var start;
var end2;
if (angle3 >= 0 && angle3 < 1 / 2 * Math.PI) {
start = {
x: box2.minX,
y: box2.minY
};
end2 = {
x: box2.maxX,
y: box2.maxY
};
} else if (1 / 2 * Math.PI <= angle3 && angle3 < Math.PI) {
start = {
x: box2.maxX,
y: box2.minY
};
end2 = {
x: box2.minX,
y: box2.maxY
};
} else if (Math.PI <= angle3 && angle3 < 3 / 2 * Math.PI) {
start = {
x: box2.maxX,
y: box2.maxY
};
end2 = {
x: box2.minX,
y: box2.minY
};
} else {
start = {
x: box2.minX,
y: box2.maxY
};
end2 = {
x: box2.maxX,
y: box2.minY
};
}
var tanTheta = Math.tan(angle3);
var tanTheta2 = tanTheta * tanTheta;
var x6 = (end2.x - start.x + tanTheta * (end2.y - start.y)) / (tanTheta2 + 1) + start.x;
var y5 = tanTheta * (end2.x - start.x + tanTheta * (end2.y - start.y)) / (tanTheta2 + 1) + start.y;
var gradient2 = context.createLinearGradient(start.x, start.y, x6, y5);
addStop(steps, gradient2);
return gradient2;
}
function parseRadialGradient(context, element, gradientStr) {
var arr = regexRG2.exec(gradientStr);
var fx = parseFloat(arr[1]);
var fy = parseFloat(arr[2]);
var fr = parseFloat(arr[3]);
var steps = arr[4];
if (fr === 0) {
var colors = steps.match(regexColorStop2);
return colors[colors.length - 1].split(":")[1];
}
var box2 = element.getBBox();
var width2 = box2.maxX - box2.minX;
var height = box2.maxY - box2.minY;
var r4 = Math.sqrt(width2 * width2 + height * height) / 2;
var gradient2 = context.createRadialGradient(box2.minX + width2 * fx, box2.minY + height * fy, 0, box2.minX + width2 / 2, box2.minY + height / 2, fr * r4);
addStop(steps, gradient2);
return gradient2;
}
function parsePattern(context, element, patternStr) {
if (element.get("patternSource") && element.get("patternSource") === patternStr) {
return element.get("pattern");
}
var pattern2;
var img;
var arr = regexPR.exec(patternStr);
var repeat2 = arr[1];
var source = arr[2];
function onload() {
pattern2 = context.createPattern(img, repeat2);
element.set("pattern", pattern2);
element.set("patternSource", patternStr);
}
switch (repeat2) {
case "a":
repeat2 = "repeat";
break;
case "x":
repeat2 = "repeat-x";
break;
case "y":
repeat2 = "repeat-y";
break;
case "n":
repeat2 = "no-repeat";
break;
default:
repeat2 = "no-repeat";
}
img = new Image();
if (!source.match(/^data:/i)) {
img.crossOrigin = "Anonymous";
}
img.src = source;
if (img.complete) {
onload();
} else {
img.onload = onload;
img.src = img.src;
}
return pattern2;
}
function parseStyle(context, element, color4) {
var bbox = element.getBBox();
if (isNaN(bbox.x) || isNaN(bbox.y) || isNaN(bbox.width) || isNaN(bbox.height)) {
return color4;
}
if (is_string_default(color4)) {
if (color4[1] === "(" || color4[2] === "(") {
if (color4[0] === "l") {
return parseLineGradient(context, element, color4);
}
if (color4[0] === "r") {
return parseRadialGradient(context, element, color4);
}
if (color4[0] === "p") {
return parsePattern(context, element, color4);
}
}
return color4;
}
if (color4 instanceof CanvasPattern) {
return color4;
}
}
function parseRadius(radius) {
var r1 = 0;
var r22 = 0;
var r32 = 0;
var r4 = 0;
if (is_array_default(radius)) {
if (radius.length === 1) {
r1 = r22 = r32 = r4 = radius[0];
} else if (radius.length === 2) {
r1 = r32 = radius[0];
r22 = r4 = radius[1];
} else if (radius.length === 3) {
r1 = radius[0];
r22 = r4 = radius[1];
r32 = radius[2];
} else {
r1 = radius[0];
r22 = radius[1];
r32 = radius[2];
r4 = radius[3];
}
} else {
r1 = r22 = r32 = r4 = radius;
}
return [r1, r22, r32, r4];
}
// node_modules/@antv/g-canvas/esm/util/arc-params.js
function vMag2(v3) {
return Math.sqrt(v3[0] * v3[0] + v3[1] * v3[1]);
}
function vRatio2(u3, v3) {
return vMag2(u3) * vMag2(v3) ? (u3[0] * v3[0] + u3[1] * v3[1]) / (vMag2(u3) * vMag2(v3)) : 1;
}
function vAngle2(u3, v3) {
return (u3[0] * v3[1] < u3[1] * v3[0] ? -1 : 1) * Math.acos(vRatio2(u3, v3));
}
function getArcParams2(startPoint, params) {
var rx = params[1];
var ry = params[2];
var xRotation = mod_default(to_radian_default(params[3]), Math.PI * 2);
var arcFlag = params[4];
var sweepFlag = params[5];
var x1 = startPoint[0];
var y1 = startPoint[1];
var x22 = params[6];
var y22 = params[7];
var xp = Math.cos(xRotation) * (x1 - x22) / 2 + Math.sin(xRotation) * (y1 - y22) / 2;
var yp = -1 * Math.sin(xRotation) * (x1 - x22) / 2 + Math.cos(xRotation) * (y1 - y22) / 2;
var lambda = xp * xp / (rx * rx) + yp * yp / (ry * ry);
if (lambda > 1) {
rx *= Math.sqrt(lambda);
ry *= Math.sqrt(lambda);
}
var diff2 = rx * rx * (yp * yp) + ry * ry * (xp * xp);
var f3 = diff2 ? Math.sqrt((rx * rx * (ry * ry) - diff2) / diff2) : 1;
if (arcFlag === sweepFlag) {
f3 *= -1;
}
if (isNaN(f3)) {
f3 = 0;
}
var cxp = ry ? f3 * rx * yp / ry : 0;
var cyp = rx ? f3 * -ry * xp / rx : 0;
var cx = (x1 + x22) / 2 + Math.cos(xRotation) * cxp - Math.sin(xRotation) * cyp;
var cy = (y1 + y22) / 2 + Math.sin(xRotation) * cxp + Math.cos(xRotation) * cyp;
var u3 = [(xp - cxp) / rx, (yp - cyp) / ry];
var v3 = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry];
var theta = vAngle2([1, 0], u3);
var dTheta = vAngle2(u3, v3);
if (vRatio2(u3, v3) <= -1) {
dTheta = Math.PI;
}
if (vRatio2(u3, v3) >= 1) {
dTheta = 0;
}
if (sweepFlag === 0 && dTheta > 0) {
dTheta = dTheta - 2 * Math.PI;
}
if (sweepFlag === 1 && dTheta < 0) {
dTheta = dTheta + 2 * Math.PI;
}
return {
cx,
cy,
rx: isSamePoint2(startPoint, [x22, y22]) ? 0 : rx,
ry: isSamePoint2(startPoint, [x22, y22]) ? 0 : ry,
startAngle: theta,
endAngle: theta + dTheta,
xRotation,
arcFlag,
sweepFlag
};
}
// node_modules/@antv/g-canvas/esm/util/arrow.js
var sin = Math.sin;
var cos = Math.cos;
var atan2 = Math.atan2;
var PI = Math.PI;
function _addDefaultArrow(shape, attrs, x1, y1, x22, y22, isStart) {
var stroke = attrs.stroke, lineWidth = attrs.lineWidth;
var x6 = x1 - x22;
var y5 = y1 - y22;
var rad = atan2(y5, x6);
var arrowShape = new path_default2({
type: "path",
canvas: shape.get("canvas"),
isArrowShape: true,
attrs: {
path: "M" + 10 * cos(PI / 6) + "," + 10 * sin(PI / 6) + " L0,0 L" + 10 * cos(PI / 6) + ",-" + 10 * sin(PI / 6),
stroke,
lineWidth
}
});
arrowShape.translate(x22, y22);
arrowShape.rotateAtPoint(x22, y22, rad);
shape.set(isStart ? "startArrowShape" : "endArrowShape", arrowShape);
}
function _addCustomizedArrow(shape, attrs, x1, y1, x22, y22, isStart) {
var startArrow = attrs.startArrow, endArrow = attrs.endArrow, stroke = attrs.stroke, lineWidth = attrs.lineWidth;
var arrowAttrs = isStart ? startArrow : endArrow;
var d3 = arrowAttrs.d, arrowFill = arrowAttrs.fill, arrowStroke = arrowAttrs.stroke, arrowLineWidth = arrowAttrs.lineWidth, restAttrs = __rest(arrowAttrs, ["d", "fill", "stroke", "lineWidth"]);
var x6 = x1 - x22;
var y5 = y1 - y22;
var rad = atan2(y5, x6);
if (d3) {
x22 = x22 - cos(rad) * d3;
y22 = y22 - sin(rad) * d3;
}
var arrowShape = new path_default2({
type: "path",
canvas: shape.get("canvas"),
isArrowShape: true,
attrs: __assign(__assign({}, restAttrs), {
stroke: arrowStroke || stroke,
lineWidth: arrowLineWidth || lineWidth,
fill: arrowFill
})
});
arrowShape.translate(x22, y22);
arrowShape.rotateAtPoint(x22, y22, rad);
shape.set(isStart ? "startArrowShape" : "endArrowShape", arrowShape);
}
function getShortenOffset(x1, y1, x22, y22, d3) {
var rad = atan2(y22 - y1, x22 - x1);
return {
dx: cos(rad) * d3,
dy: sin(rad) * d3
};
}
function addStartArrow(shape, attrs, x1, y1, x22, y22) {
if (typeof attrs.startArrow === "object") {
_addCustomizedArrow(shape, attrs, x1, y1, x22, y22, true);
} else if (attrs.startArrow) {
_addDefaultArrow(shape, attrs, x1, y1, x22, y22, true);
} else {
shape.set("startArrowShape", null);
}
}
function addEndArrow(shape, attrs, x1, y1, x22, y22) {
if (typeof attrs.endArrow === "object") {
_addCustomizedArrow(shape, attrs, x1, y1, x22, y22, false);
} else if (attrs.endArrow) {
_addDefaultArrow(shape, attrs, x1, y1, x22, y22, false);
} else {
shape.set("startArrowShape", null);
}
}
// node_modules/@antv/g-canvas/esm/util/draw.js
var SHAPE_ATTRS_MAP = {
fill: "fillStyle",
stroke: "strokeStyle",
opacity: "globalAlpha"
};
function applyAttrsToContext(context, element) {
var attrs = element.attr();
for (var k4 in attrs) {
var v3 = attrs[k4];
var name_1 = SHAPE_ATTRS_MAP[k4] ? SHAPE_ATTRS_MAP[k4] : k4;
if (name_1 === "matrix" && v3) {
context.transform(v3[0], v3[1], v3[3], v3[4], v3[6], v3[7]);
} else if (name_1 === "lineDash" && context.setLineDash) {
is_array_default(v3) && context.setLineDash(v3);
} else {
if (name_1 === "strokeStyle" || name_1 === "fillStyle") {
v3 = parseStyle(context, element, v3);
} else if (name_1 === "globalAlpha") {
v3 = v3 * context.globalAlpha;
}
context[name_1] = v3;
}
}
}
function drawChildren(context, children, region) {
for (var i4 = 0; i4 < children.length; i4++) {
var child = children[i4];
if (child.cfg.visible) {
child.draw(context, region);
} else {
child.skipDraw();
}
}
}
function checkRefresh(canvas, children, region) {
var refreshElements = canvas.get("refreshElements");
each_default(refreshElements, function(el) {
if (el !== canvas) {
var parent_1 = el.cfg.parent;
while (parent_1 && parent_1 !== canvas && !parent_1.cfg.refresh) {
parent_1.cfg.refresh = true;
parent_1 = parent_1.cfg.parent;
}
}
});
if (refreshElements[0] === canvas) {
setChildrenRefresh(children, region);
} else {
checkChildrenRefresh(children, region);
}
}
function checkChildrenRefresh(children, region) {
for (var i4 = 0; i4 < children.length; i4++) {
var child = children[i4];
if (child.cfg.visible) {
if (child.cfg.hasChanged) {
child.cfg.refresh = true;
if (child.isGroup()) {
setChildrenRefresh(child.cfg.children, region);
}
} else if (child.cfg.refresh) {
if (child.isGroup()) {
checkChildrenRefresh(child.cfg.children, region);
}
} else {
var refresh = checkElementRefresh(child, region);
child.cfg.refresh = refresh;
if (refresh && child.isGroup()) {
checkChildrenRefresh(child.cfg.children, region);
}
}
}
}
}
function clearChanged(elements) {
for (var i4 = 0; i4 < elements.length; i4++) {
var el = elements[i4];
el.cfg.hasChanged = false;
if (el.isGroup() && !el.destroyed) {
clearChanged(el.cfg.children);
}
}
}
function setChildrenRefresh(children, region) {
for (var i4 = 0; i4 < children.length; i4++) {
var child = children[i4];
child.cfg.refresh = true;
if (child.isGroup()) {
setChildrenRefresh(child.get("children"), region);
}
}
}
function checkElementRefresh(shape, region) {
var bbox = shape.cfg.cacheCanvasBBox;
var isAllow = shape.cfg.isInView && bbox && intersectRect2(bbox, region);
return isAllow;
}
function drawPath(shape, context, attrs, arcParamsCache) {
var path = attrs.path, startArrow = attrs.startArrow, endArrow = attrs.endArrow;
if (!path) {
return;
}
var currentPoint = [0, 0];
var startMovePoint = [0, 0];
var distance15 = {
dx: 0,
dy: 0
};
context.beginPath();
for (var i4 = 0; i4 < path.length; i4++) {
var params = path[i4];
var command = params[0];
if (i4 === 0 && startArrow && startArrow.d) {
var tangent = shape.getStartTangent();
distance15 = getShortenOffset(tangent[0][0], tangent[0][1], tangent[1][0], tangent[1][1], startArrow.d);
} else if (i4 === path.length - 2 && path[i4 + 1][0] === "Z" && endArrow && endArrow.d) {
var lastPath = path[i4 + 1];
if (lastPath[0] === "Z") {
var tangent = shape.getEndTangent();
distance15 = getShortenOffset(tangent[0][0], tangent[0][1], tangent[1][0], tangent[1][1], endArrow.d);
}
} else if (i4 === path.length - 1 && endArrow && endArrow.d) {
if (path[0] !== "Z") {
var tangent = shape.getEndTangent();
distance15 = getShortenOffset(tangent[0][0], tangent[0][1], tangent[1][0], tangent[1][1], endArrow.d);
}
}
var dx = distance15.dx, dy = distance15.dy;
switch (command) {
case "M":
context.moveTo(params[1] - dx, params[2] - dy);
startMovePoint = [params[1], params[2]];
break;
case "L":
context.lineTo(params[1] - dx, params[2] - dy);
break;
case "Q":
context.quadraticCurveTo(params[1], params[2], params[3] - dx, params[4] - dy);
break;
case "C":
context.bezierCurveTo(params[1], params[2], params[3], params[4], params[5] - dx, params[6] - dy);
break;
case "A": {
var arcParams = void 0;
if (arcParamsCache) {
arcParams = arcParamsCache[i4];
if (!arcParams) {
arcParams = getArcParams2(currentPoint, params);
arcParamsCache[i4] = arcParams;
}
} else {
arcParams = getArcParams2(currentPoint, params);
}
var cx = arcParams.cx, cy = arcParams.cy, rx = arcParams.rx, ry = arcParams.ry, startAngle = arcParams.startAngle, endAngle = arcParams.endAngle, xRotation = arcParams.xRotation, sweepFlag = arcParams.sweepFlag;
if (context.ellipse) {
context.ellipse(cx, cy, rx, ry, xRotation, startAngle, endAngle, 1 - sweepFlag);
} else {
var r4 = rx > ry ? rx : ry;
var scaleX = rx > ry ? 1 : rx / ry;
var scaleY = rx > ry ? ry / rx : 1;
context.translate(cx, cy);
context.rotate(xRotation);
context.scale(scaleX, scaleY);
context.arc(0, 0, r4, startAngle, endAngle, 1 - sweepFlag);
context.scale(1 / scaleX, 1 / scaleY);
context.rotate(-xRotation);
context.translate(-cx, -cy);
}
break;
}
case "Z":
context.closePath();
break;
default:
break;
}
if (command === "Z") {
currentPoint = startMovePoint;
} else {
var len5 = params.length;
currentPoint = [params[len5 - 2], params[len5 - 1]];
}
}
}
function refreshElement(element, changeType) {
var canvas = element.get("canvas");
if (canvas) {
if (changeType === "remove") {
element._cacheCanvasBBox = element.get("cacheCanvasBBox");
}
if (!element.get("hasChanged")) {
element.set("hasChanged", true);
if (!(element.cfg.parent && element.cfg.parent.get("hasChanged"))) {
canvas.refreshElement(element, changeType, canvas);
if (canvas.get("autoDraw")) {
canvas.draw();
}
}
}
}
}
function getRefreshRegion(element) {
var region;
if (!element.destroyed) {
var cacheBox = element.get("cacheCanvasBBox");
var validCache = cacheBox && !!(cacheBox.width && cacheBox.height);
var bbox = element.getCanvasBBox();
var validBBox = bbox && !!(bbox.width && bbox.height);
if (validCache && validBBox) {
region = mergeRegion(cacheBox, bbox);
} else if (validCache) {
region = cacheBox;
} else if (validBBox) {
region = bbox;
}
} else {
region = element["_cacheCanvasBBox"];
}
return region;
}
function getMergedRegion(elements) {
if (!elements.length) {
return null;
}
var minXArr = [];
var minYArr = [];
var maxXArr = [];
var maxYArr = [];
each_default(elements, function(el) {
var region = getRefreshRegion(el);
if (region) {
minXArr.push(region.minX);
minYArr.push(region.minY);
maxXArr.push(region.maxX);
maxYArr.push(region.maxY);
}
});
return {
minX: min_default(minXArr),
minY: min_default(minYArr),
maxX: max_default(maxXArr),
maxY: max_default(maxYArr)
};
}
function mergeView(region, viewRegion) {
if (!region || !viewRegion) {
return null;
}
if (!intersectRect2(region, viewRegion)) {
return null;
}
return {
minX: Math.max(region.minX, viewRegion.minX),
minY: Math.max(region.minY, viewRegion.minY),
maxX: Math.min(region.maxX, viewRegion.maxX),
maxY: Math.min(region.maxY, viewRegion.maxY)
};
}
// node_modules/@antv/g-canvas/esm/group.js
var Group = function(_super) {
__extends(Group3, _super);
function Group3() {
return _super !== null && _super.apply(this, arguments) || this;
}
Group3.prototype.onCanvasChange = function(changeType) {
refreshElement(this, changeType);
};
Group3.prototype.getShapeBase = function() {
return shape_exports;
};
Group3.prototype.getGroupBase = function() {
return Group3;
};
Group3.prototype._applyClip = function(context, clip) {
if (clip) {
context.save();
applyAttrsToContext(context, clip);
clip.createPath(context);
context.restore();
context.clip();
clip._afterDraw();
}
};
Group3.prototype.cacheCanvasBBox = function() {
var children = this.cfg.children;
var xArr = [];
var yArr = [];
each_default(children, function(child) {
var bbox2 = child.cfg.cacheCanvasBBox;
if (bbox2 && child.cfg.isInView) {
xArr.push(bbox2.minX, bbox2.maxX);
yArr.push(bbox2.minY, bbox2.maxY);
}
});
var bbox = null;
if (xArr.length) {
var minX = min_default(xArr);
var maxX = max_default(xArr);
var minY = min_default(yArr);
var maxY2 = max_default(yArr);
bbox = {
minX,
minY,
x: minX,
y: minY,
maxX,
maxY: maxY2,
width: maxX - minX,
height: maxY2 - minY
};
var canvas = this.cfg.canvas;
if (canvas) {
var viewRange = canvas.getViewRange();
this.set("isInView", intersectRect2(bbox, viewRange));
}
} else {
this.set("isInView", false);
}
this.set("cacheCanvasBBox", bbox);
};
Group3.prototype.draw = function(context, region) {
var children = this.cfg.children;
var allowDraw = region ? this.cfg.refresh : true;
if (children.length && allowDraw) {
context.save();
applyAttrsToContext(context, this);
this._applyClip(context, this.getClip());
drawChildren(context, children, region);
context.restore();
this.cacheCanvasBBox();
}
this.cfg.refresh = null;
this.set("hasChanged", false);
};
Group3.prototype.skipDraw = function() {
this.set("cacheCanvasBBox", null);
this.set("hasChanged", false);
};
return Group3;
}(group_default2);
var group_default3 = Group;
// node_modules/@antv/g-canvas/esm/shape/base.js
var ShapeBase2 = function(_super) {
__extends(ShapeBase4, _super);
function ShapeBase4() {
return _super !== null && _super.apply(this, arguments) || this;
}
ShapeBase4.prototype.getDefaultAttrs = function() {
var attrs = _super.prototype.getDefaultAttrs.call(this);
return __assign(__assign({}, attrs), { lineWidth: 1, lineAppendWidth: 0, strokeOpacity: 1, fillOpacity: 1 });
};
ShapeBase4.prototype.getShapeBase = function() {
return shape_exports;
};
ShapeBase4.prototype.getGroupBase = function() {
return group_default3;
};
ShapeBase4.prototype.onCanvasChange = function(changeType) {
refreshElement(this, changeType);
};
ShapeBase4.prototype.calculateBBox = function() {
var type2 = this.get("type");
var lineWidth = this.getHitLineWidth();
var bboxMethod = getMethod(type2);
var box2 = bboxMethod(this);
var halfLineWidth = lineWidth / 2;
var minX = box2.x - halfLineWidth;
var minY = box2.y - halfLineWidth;
var maxX = box2.x + box2.width + halfLineWidth;
var maxY2 = box2.y + box2.height + halfLineWidth;
return {
x: minX,
minX,
y: minY,
minY,
width: box2.width + lineWidth,
height: box2.height + lineWidth,
maxX,
maxY: maxY2
};
};
ShapeBase4.prototype.isFill = function() {
return !!this.attrs["fill"] || this.isClipShape();
};
ShapeBase4.prototype.isStroke = function() {
return !!this.attrs["stroke"];
};
ShapeBase4.prototype._applyClip = function(context, clip) {
if (clip) {
context.save();
applyAttrsToContext(context, clip);
clip.createPath(context);
context.restore();
context.clip();
clip._afterDraw();
}
};
ShapeBase4.prototype.draw = function(context, region) {
var clip = this.cfg.clipShape;
if (region) {
if (this.cfg.refresh === false) {
this.set("hasChanged", false);
return;
}
var bbox = this.getCanvasBBox();
if (!intersectRect2(region, bbox)) {
this.set("hasChanged", false);
if (this.cfg.isInView) {
this._afterDraw();
}
return;
}
}
context.save();
applyAttrsToContext(context, this);
this._applyClip(context, clip);
this.drawPath(context);
context.restore();
this._afterDraw();
};
ShapeBase4.prototype.getCanvasViewBox = function() {
var canvas = this.cfg.canvas;
if (canvas) {
return canvas.getViewRange();
}
return null;
};
ShapeBase4.prototype.cacheCanvasBBox = function() {
var canvasBBox = this.getCanvasViewBox();
if (canvasBBox) {
var bbox = this.getCanvasBBox();
var isInView = intersectRect2(bbox, canvasBBox);
this.set("isInView", isInView);
if (isInView) {
this.set("cacheCanvasBBox", bbox);
} else {
this.set("cacheCanvasBBox", null);
}
}
};
ShapeBase4.prototype._afterDraw = function() {
this.cacheCanvasBBox();
this.set("hasChanged", false);
this.set("refresh", null);
};
ShapeBase4.prototype.skipDraw = function() {
this.set("cacheCanvasBBox", null);
this.set("isInView", null);
this.set("hasChanged", false);
};
ShapeBase4.prototype.drawPath = function(context) {
this.createPath(context);
this.strokeAndFill(context);
this.afterDrawPath(context);
};
ShapeBase4.prototype.fill = function(context) {
context.fill();
};
ShapeBase4.prototype.stroke = function(context) {
context.stroke();
};
ShapeBase4.prototype.strokeAndFill = function(context) {
var _a6 = this.attrs, lineWidth = _a6.lineWidth, opacity = _a6.opacity, strokeOpacity = _a6.strokeOpacity, fillOpacity = _a6.fillOpacity;
if (this.isFill()) {
if (!is_nil_default(fillOpacity) && fillOpacity !== 1) {
context.globalAlpha = fillOpacity;
this.fill(context);
context.globalAlpha = opacity;
} else {
this.fill(context);
}
}
if (this.isStroke()) {
if (lineWidth > 0) {
if (!is_nil_default(strokeOpacity) && strokeOpacity !== 1) {
context.globalAlpha = strokeOpacity;
}
this.stroke(context);
}
}
this.afterDrawPath(context);
};
ShapeBase4.prototype.createPath = function(context) {
};
ShapeBase4.prototype.afterDrawPath = function(context) {
};
ShapeBase4.prototype.isInShape = function(refX, refY) {
var isStroke = this.isStroke();
var isFill = this.isFill();
var lineWidth = this.getHitLineWidth();
return this.isInStrokeOrPath(refX, refY, isStroke, isFill, lineWidth);
};
ShapeBase4.prototype.isInStrokeOrPath = function(x6, y5, isStroke, isFill, lineWidth) {
return false;
};
ShapeBase4.prototype.getHitLineWidth = function() {
if (!this.isStroke()) {
return 0;
}
var attrs = this.attrs;
return attrs["lineWidth"] + attrs["lineAppendWidth"];
};
return ShapeBase4;
}(shape_default);
var base_default15 = ShapeBase2;
// node_modules/@antv/g-canvas/esm/shape/circle.js
var Circle3 = function(_super) {
__extends(Circle6, _super);
function Circle6() {
return _super !== null && _super.apply(this, arguments) || this;
}
Circle6.prototype.getDefaultAttrs = function() {
var attrs = _super.prototype.getDefaultAttrs.call(this);
return __assign(__assign({}, attrs), { x: 0, y: 0, r: 0 });
};
Circle6.prototype.isInStrokeOrPath = function(x6, y5, isStroke, isFill, lineWidth) {
var attrs = this.attr();
var cx = attrs.x;
var cy = attrs.y;
var r4 = attrs.r;
var halfLineWidth = lineWidth / 2;
var absDistance = distance8(cx, cy, x6, y5);
if (isFill && isStroke) {
return absDistance <= r4 + halfLineWidth;
}
if (isFill) {
return absDistance <= r4;
}
if (isStroke) {
return absDistance >= r4 - halfLineWidth && absDistance <= r4 + halfLineWidth;
}
return false;
};
Circle6.prototype.createPath = function(context) {
var attrs = this.attr();
var cx = attrs.x;
var cy = attrs.y;
var r4 = attrs.r;
context.beginPath();
context.arc(cx, cy, r4, 0, Math.PI * 2, false);
context.closePath();
};
return Circle6;
}(base_default15);
var circle_default5 = Circle3;
// node_modules/@antv/g-canvas/esm/shape/ellipse.js
function ellipseDistance(squareX, squareY, rx, ry) {
return squareX / (rx * rx) + squareY / (ry * ry);
}
var Ellipse = function(_super) {
__extends(Ellipse3, _super);
function Ellipse3() {
return _super !== null && _super.apply(this, arguments) || this;
}
Ellipse3.prototype.getDefaultAttrs = function() {
var attrs = _super.prototype.getDefaultAttrs.call(this);
return __assign(__assign({}, attrs), { x: 0, y: 0, rx: 0, ry: 0 });
};
Ellipse3.prototype.isInStrokeOrPath = function(x6, y5, isStroke, isFill, lineWidth) {
var attrs = this.attr();
var halfLineWith = lineWidth / 2;
var cx = attrs.x;
var cy = attrs.y;
var rx = attrs.rx, ry = attrs.ry;
var squareX = (x6 - cx) * (x6 - cx);
var squareY = (y5 - cy) * (y5 - cy);
if (isFill && isStroke) {
return ellipseDistance(squareX, squareY, rx + halfLineWith, ry + halfLineWith) <= 1;
}
if (isFill) {
return ellipseDistance(squareX, squareY, rx, ry) <= 1;
}
if (isStroke) {
return ellipseDistance(squareX, squareY, rx - halfLineWith, ry - halfLineWith) >= 1 && ellipseDistance(squareX, squareY, rx + halfLineWith, ry + halfLineWith) <= 1;
}
return false;
};
Ellipse3.prototype.createPath = function(context) {
var attrs = this.attr();
var cx = attrs.x;
var cy = attrs.y;
var rx = attrs.rx;
var ry = attrs.ry;
context.beginPath();
if (context.ellipse) {
context.ellipse(cx, cy, rx, ry, 0, 0, Math.PI * 2, false);
} else {
var r4 = rx > ry ? rx : ry;
var scaleX = rx > ry ? 1 : rx / ry;
var scaleY = rx > ry ? ry / rx : 1;
context.save();
context.translate(cx, cy);
context.scale(scaleX, scaleY);
context.arc(0, 0, r4, 0, Math.PI * 2);
context.restore();
context.closePath();
}
};
return Ellipse3;
}(base_default15);
var ellipse_default3 = Ellipse;
// node_modules/@antv/g-canvas/esm/shape/image.js
function isCanvas(dom) {
return dom instanceof HTMLElement && is_string_default(dom.nodeName) && dom.nodeName.toUpperCase() === "CANVAS";
}
var ImageShape = function(_super) {
__extends(ImageShape2, _super);
function ImageShape2() {
return _super !== null && _super.apply(this, arguments) || this;
}
ImageShape2.prototype.getDefaultAttrs = function() {
var attrs = _super.prototype.getDefaultAttrs.call(this);
return __assign(__assign({}, attrs), { x: 0, y: 0, width: 0, height: 0 });
};
ImageShape2.prototype.initAttrs = function(attrs) {
this._setImage(attrs.img);
};
ImageShape2.prototype.isStroke = function() {
return false;
};
ImageShape2.prototype.isOnlyHitBox = function() {
return true;
};
ImageShape2.prototype._afterLoading = function() {
if (this.get("toDraw") === true) {
var canvas = this.get("canvas");
if (canvas) {
canvas.draw();
} else {
this.createPath(this.get("context"));
}
}
};
ImageShape2.prototype._setImage = function(img) {
var _this = this;
var attrs = this.attrs;
if (is_string_default(img)) {
var image_1 = new Image();
image_1.onload = function() {
if (_this.destroyed) {
return false;
}
_this.attr("img", image_1);
_this.set("loading", false);
_this._afterLoading();
var callback = _this.get("callback");
if (callback) {
callback.call(_this);
}
};
image_1.crossOrigin = "Anonymous";
image_1.src = img;
this.set("loading", true);
} else if (img instanceof Image) {
if (!attrs.width) {
attrs.width = img.width;
}
if (!attrs.height) {
attrs.height = img.height;
}
} else if (isCanvas(img)) {
if (!attrs.width) {
attrs.width = Number(img.getAttribute("width"));
}
if (!attrs.height) {
attrs.height, Number(img.getAttribute("height"));
}
}
};
ImageShape2.prototype.onAttrChange = function(name, value2, originValue) {
_super.prototype.onAttrChange.call(this, name, value2, originValue);
if (name === "img") {
this._setImage(value2);
}
};
ImageShape2.prototype.createPath = function(context) {
if (this.get("loading")) {
this.set("toDraw", true);
this.set("context", context);
return;
}
var attrs = this.attr();
var x6 = attrs.x, y5 = attrs.y, width2 = attrs.width, height = attrs.height, sx = attrs.sx, sy = attrs.sy, swidth = attrs.swidth, sheight = attrs.sheight;
var img = attrs.img;
if (img instanceof Image || isCanvas(img)) {
if (!is_nil_default(sx) && !is_nil_default(sy) && !is_nil_default(swidth) && !is_nil_default(sheight)) {
context.drawImage(img, sx, sy, swidth, sheight, x6, y5, width2, height);
} else {
context.drawImage(img, x6, y5, width2, height);
}
}
};
return ImageShape2;
}(base_default15);
var image_default2 = ImageShape;
// node_modules/@antv/g-canvas/esm/util/in-stroke/line.js
function inLine(x1, y1, x22, y22, lineWidth, x6, y5) {
var minX = Math.min(x1, x22);
var maxX = Math.max(x1, x22);
var minY = Math.min(y1, y22);
var maxY2 = Math.max(y1, y22);
var halfWidth = lineWidth / 2;
if (!(x6 >= minX - halfWidth && x6 <= maxX + halfWidth && y5 >= minY - halfWidth && y5 <= maxY2 + halfWidth)) {
return false;
}
return line_default.pointToLine(x1, y1, x22, y22, x6, y5) <= lineWidth / 2;
}
// node_modules/@antv/g-canvas/esm/shape/line.js
var Line3 = function(_super) {
__extends(Line9, _super);
function Line9() {
return _super !== null && _super.apply(this, arguments) || this;
}
Line9.prototype.getDefaultAttrs = function() {
var attrs = _super.prototype.getDefaultAttrs.call(this);
return __assign(__assign({}, attrs), { x1: 0, y1: 0, x2: 0, y2: 0, startArrow: false, endArrow: false });
};
Line9.prototype.initAttrs = function(attrs) {
this.setArrow();
};
Line9.prototype.onAttrChange = function(name, value2, originValue) {
_super.prototype.onAttrChange.call(this, name, value2, originValue);
this.setArrow();
};
Line9.prototype.setArrow = function() {
var attrs = this.attr();
var x1 = attrs.x1, y1 = attrs.y1, x22 = attrs.x2, y22 = attrs.y2, startArrow = attrs.startArrow, endArrow = attrs.endArrow;
if (startArrow) {
addStartArrow(this, attrs, x22, y22, x1, y1);
}
if (endArrow) {
addEndArrow(this, attrs, x1, y1, x22, y22);
}
};
Line9.prototype.isInStrokeOrPath = function(x6, y5, isStroke, isFill, lineWidth) {
if (!isStroke || !lineWidth) {
return false;
}
var _a6 = this.attr(), x1 = _a6.x1, y1 = _a6.y1, x22 = _a6.x2, y22 = _a6.y2;
return inLine(x1, y1, x22, y22, lineWidth, x6, y5);
};
Line9.prototype.createPath = function(context) {
var attrs = this.attr();
var x1 = attrs.x1, y1 = attrs.y1, x22 = attrs.x2, y22 = attrs.y2, startArrow = attrs.startArrow, endArrow = attrs.endArrow;
var startArrowDistance = {
dx: 0,
dy: 0
};
var endArrowDistance = {
dx: 0,
dy: 0
};
if (startArrow && startArrow.d) {
startArrowDistance = getShortenOffset(x1, y1, x22, y22, attrs.startArrow.d);
}
if (endArrow && endArrow.d) {
endArrowDistance = getShortenOffset(x1, y1, x22, y22, attrs.endArrow.d);
}
context.beginPath();
context.moveTo(x1 + startArrowDistance.dx, y1 + startArrowDistance.dy);
context.lineTo(x22 - endArrowDistance.dx, y22 - endArrowDistance.dy);
};
Line9.prototype.afterDrawPath = function(context) {
var startArrowShape = this.get("startArrowShape");
var endArrowShape = this.get("endArrowShape");
if (startArrowShape) {
startArrowShape.draw(context);
}
if (endArrowShape) {
endArrowShape.draw(context);
}
};
Line9.prototype.getTotalLength = function() {
var _a6 = this.attr(), x1 = _a6.x1, y1 = _a6.y1, x22 = _a6.x2, y22 = _a6.y2;
return line_default.length(x1, y1, x22, y22);
};
Line9.prototype.getPoint = function(ratio) {
var _a6 = this.attr(), x1 = _a6.x1, y1 = _a6.y1, x22 = _a6.x2, y22 = _a6.y2;
return line_default.pointAt(x1, y1, x22, y22, ratio);
};
return Line9;
}(base_default15);
var line_default7 = Line3;
// node_modules/@antv/g-canvas/esm/shape/marker.js
var Symbols = {
circle: function(x6, y5, r4) {
return [
["M", x6 - r4, y5],
["A", r4, r4, 0, 1, 0, x6 + r4, y5],
["A", r4, r4, 0, 1, 0, x6 - r4, y5]
];
},
square: function(x6, y5, r4) {
return [["M", x6 - r4, y5 - r4], ["L", x6 + r4, y5 - r4], ["L", x6 + r4, y5 + r4], ["L", x6 - r4, y5 + r4], ["Z"]];
},
diamond: function(x6, y5, r4) {
return [["M", x6 - r4, y5], ["L", x6, y5 - r4], ["L", x6 + r4, y5], ["L", x6, y5 + r4], ["Z"]];
},
triangle: function(x6, y5, r4) {
var diffY = r4 * Math.sin(1 / 3 * Math.PI);
return [["M", x6 - r4, y5 + diffY], ["L", x6, y5 - diffY], ["L", x6 + r4, y5 + diffY], ["Z"]];
},
"triangle-down": function(x6, y5, r4) {
var diffY = r4 * Math.sin(1 / 3 * Math.PI);
return [["M", x6 - r4, y5 - diffY], ["L", x6 + r4, y5 - diffY], ["L", x6, y5 + diffY], ["Z"]];
}
};
var Marker = function(_super) {
__extends(Marker3, _super);
function Marker3() {
return _super !== null && _super.apply(this, arguments) || this;
}
Marker3.prototype.initAttrs = function(attrs) {
this._resetParamsCache();
};
Marker3.prototype._resetParamsCache = function() {
this.set("paramsCache", {});
};
Marker3.prototype.onAttrChange = function(name, value2, originValue) {
_super.prototype.onAttrChange.call(this, name, value2, originValue);
if (["symbol", "x", "y", "r", "radius"].indexOf(name) !== -1) {
this._resetParamsCache();
}
};
Marker3.prototype.isOnlyHitBox = function() {
return true;
};
Marker3.prototype._getR = function(attrs) {
return is_nil_default(attrs.r) ? attrs.radius : attrs.r;
};
Marker3.prototype._getPath = function() {
var attrs = this.attr();
var x6 = attrs.x, y5 = attrs.y;
var symbol = attrs.symbol || "circle";
var r4 = this._getR(attrs);
var method;
var path;
if (is_function_default(symbol)) {
method = symbol;
path = method(x6, y5, r4);
path = pathToAbsolute2(path);
} else {
method = Marker3.Symbols[symbol];
if (!method) {
console.warn(symbol + " marker is not supported.");
return null;
}
path = method(x6, y5, r4);
}
return path;
};
Marker3.prototype.createPath = function(context) {
var path = this._getPath();
var paramsCache = this.get("paramsCache");
drawPath(this, context, { path }, paramsCache);
};
Marker3.Symbols = Symbols;
return Marker3;
}(base_default15);
var marker_default = Marker;
// node_modules/@antv/g-canvas/esm/util/in-path/point-in-path.js
function isPointInPath(shape, x6, y5) {
var ctx4 = getOffScreenContext();
shape.createPath(ctx4);
return ctx4.isPointInPath(x6, y5);
}
// node_modules/@antv/g-canvas/esm/util/in-path/polygon.js
var tolerance2 = 1e-6;
function dcmp2(x6) {
if (Math.abs(x6) < tolerance2) {
return 0;
}
return x6 < 0 ? -1 : 1;
}
function onSegment2(p1, p22, q4) {
if ((q4[0] - p1[0]) * (p22[1] - p1[1]) === (p22[0] - p1[0]) * (q4[1] - p1[1]) && Math.min(p1[0], p22[0]) <= q4[0] && q4[0] <= Math.max(p1[0], p22[0]) && Math.min(p1[1], p22[1]) <= q4[1] && q4[1] <= Math.max(p1[1], p22[1])) {
return true;
}
return false;
}
function isInPolygon2(points, x6, y5) {
var isHit = false;
var n3 = points.length;
if (n3 <= 2) {
return false;
}
for (var i4 = 0; i4 < n3; i4++) {
var p1 = points[i4];
var p22 = points[(i4 + 1) % n3];
if (onSegment2(p1, p22, [x6, y5])) {
return true;
}
if (dcmp2(p1[1] - y5) > 0 !== dcmp2(p22[1] - y5) > 0 && dcmp2(x6 - (y5 - p1[1]) * (p1[0] - p22[0]) / (p1[1] - p22[1]) - p1[0]) < 0) {
isHit = !isHit;
}
}
return isHit;
}
// node_modules/@antv/g-canvas/esm/util/in-stroke/arc.js
function arc(cx, cy, r4, startAngle, endAngle, lineWidth, x6, y5) {
var angle3 = (Math.atan2(y5 - cy, x6 - cx) + Math.PI * 2) % (Math.PI * 2);
if (angle3 < startAngle || angle3 > endAngle) {
return false;
}
var point2 = {
x: cx + r4 * Math.cos(angle3),
y: cy + r4 * Math.sin(angle3)
};
return distance8(point2.x, point2.y, x6, y5) <= lineWidth / 2;
}
// node_modules/@antv/g-canvas/esm/util/path.js
var transform4 = ext_exports.transform;
function hasArc(path) {
var hasArc2 = false;
var count2 = path.length;
for (var i4 = 0; i4 < count2; i4++) {
var params = path[i4];
var cmd = params[0];
if (cmd === "C" || cmd === "A" || cmd === "Q") {
hasArc2 = true;
break;
}
}
return hasArc2;
}
function isPointInStroke(segments, lineWidth, x6, y5, length5) {
var isHit = false;
var halfWidth = lineWidth / 2;
for (var i4 = 0; i4 < segments.length; i4++) {
var segment = segments[i4];
var currentPoint = segment.currentPoint, params = segment.params, prePoint = segment.prePoint, box2 = segment.box;
if (box2 && !inBox(box2.x - halfWidth, box2.y - halfWidth, box2.width + lineWidth, box2.height + lineWidth, x6, y5)) {
continue;
}
switch (segment.command) {
case "L":
case "Z":
isHit = inLine(prePoint[0], prePoint[1], currentPoint[0], currentPoint[1], lineWidth, x6, y5);
break;
case "Q":
var qDistance = quadratic_default.pointDistance(prePoint[0], prePoint[1], params[1], params[2], params[3], params[4], x6, y5);
isHit = qDistance <= lineWidth / 2;
break;
case "C":
var cDistance = cubic_default.pointDistance(prePoint[0], prePoint[1], params[1], params[2], params[3], params[4], params[5], params[6], x6, y5, length5);
isHit = cDistance <= lineWidth / 2;
break;
case "A":
var arcParams = segment.arcParams;
var cx = arcParams.cx, cy = arcParams.cy, rx = arcParams.rx, ry = arcParams.ry, startAngle = arcParams.startAngle, endAngle = arcParams.endAngle, xRotation = arcParams.xRotation;
var p4 = [x6, y5, 1];
var r4 = rx > ry ? rx : ry;
var scaleX = rx > ry ? 1 : rx / ry;
var scaleY = rx > ry ? ry / rx : 1;
var m4 = transform4(null, [
["t", -cx, -cy],
["r", -xRotation],
["s", 1 / scaleX, 1 / scaleY]
]);
transformMat3(p4, p4, m4);
isHit = arc(0, 0, r4, startAngle, endAngle, lineWidth, p4[0], p4[1]);
break;
default:
break;
}
if (isHit) {
break;
}
}
return isHit;
}
function extractPolygons(path) {
var count2 = path.length;
var polygons = [];
var polylines = [];
var points = [];
for (var i4 = 0; i4 < count2; i4++) {
var params = path[i4];
var cmd = params[0];
if (cmd === "M") {
if (points.length) {
polylines.push(points);
points = [];
}
points.push([params[1], params[2]]);
} else if (cmd === "Z") {
if (points.length) {
polygons.push(points);
points = [];
}
} else {
points.push([params[1], params[2]]);
}
}
if (points.length > 0) {
polylines.push(points);
}
return {
polygons,
polylines
};
}
var path_default3 = __assign({ hasArc, extractPolygons, isPointInStroke }, path_exports);
// node_modules/@antv/g-canvas/esm/shape/path.js
function isInPolygons(polygons, x6, y5) {
var isHit = false;
for (var i4 = 0; i4 < polygons.length; i4++) {
var points = polygons[i4];
isHit = isInPolygon2(points, x6, y5);
if (isHit) {
break;
}
}
return isHit;
}
var Path = function(_super) {
__extends(Path4, _super);
function Path4() {
return _super !== null && _super.apply(this, arguments) || this;
}
Path4.prototype.getDefaultAttrs = function() {
var attrs = _super.prototype.getDefaultAttrs.call(this);
return __assign(__assign({}, attrs), { startArrow: false, endArrow: false });
};
Path4.prototype.initAttrs = function(attrs) {
this._setPathArr(attrs.path);
this.setArrow();
};
Path4.prototype.onAttrChange = function(name, value2, originValue) {
_super.prototype.onAttrChange.call(this, name, value2, originValue);
if (name === "path") {
this._setPathArr(value2);
}
this.setArrow();
};
Path4.prototype._setPathArr = function(path) {
this.attrs.path = pathToAbsolute2(path);
var hasArc2 = path_default3.hasArc(path);
this.set("hasArc", hasArc2);
this.set("paramsCache", {});
this.set("segments", null);
this.set("curve", null);
this.set("tCache", null);
this.set("totalLength", null);
};
Path4.prototype.getSegments = function() {
var segments = this.get("segements");
if (!segments) {
segments = getSegments(this.attr("path"));
this.set("segments", segments);
}
return segments;
};
Path4.prototype.setArrow = function() {
var attrs = this.attr();
var startArrow = attrs.startArrow, endArrow = attrs.endArrow;
if (startArrow) {
var tangent = this.getStartTangent();
addStartArrow(this, attrs, tangent[0][0], tangent[0][1], tangent[1][0], tangent[1][1]);
}
if (endArrow) {
var tangent = this.getEndTangent();
addEndArrow(this, attrs, tangent[0][0], tangent[0][1], tangent[1][0], tangent[1][1]);
}
};
Path4.prototype.isInStrokeOrPath = function(x6, y5, isStroke, isFill, lineWidth) {
var segments = this.getSegments();
var hasArc2 = this.get("hasArc");
var isHit = false;
if (isStroke) {
var length_1 = this.getTotalLength();
isHit = path_default3.isPointInStroke(segments, lineWidth, x6, y5, length_1);
}
if (!isHit && isFill) {
if (hasArc2) {
isHit = isPointInPath(this, x6, y5);
} else {
var path = this.attr("path");
var extractResutl = path_default3.extractPolygons(path);
isHit = isInPolygons(extractResutl.polygons, x6, y5) || isInPolygons(extractResutl.polylines, x6, y5);
}
}
return isHit;
};
Path4.prototype.createPath = function(context) {
var attrs = this.attr();
var paramsCache = this.get("paramsCache");
drawPath(this, context, attrs, paramsCache);
};
Path4.prototype.afterDrawPath = function(context) {
var startArrowShape = this.get("startArrowShape");
var endArrowShape = this.get("endArrowShape");
if (startArrowShape) {
startArrowShape.draw(context);
}
if (endArrowShape) {
endArrowShape.draw(context);
}
};
Path4.prototype.getTotalLength = function() {
var totalLength = this.get("totalLength");
if (!is_nil_default(totalLength)) {
return totalLength;
}
this._calculateCurve();
this._setTcache();
return this.get("totalLength");
};
Path4.prototype.getPoint = function(ratio) {
var tCache = this.get("tCache");
if (!tCache) {
this._calculateCurve();
this._setTcache();
tCache = this.get("tCache");
}
var subt;
var index2;
var curve = this.get("curve");
if (!tCache || tCache.length === 0) {
if (curve) {
return {
x: curve[0][1],
y: curve[0][2]
};
}
return null;
}
each_default(tCache, function(v3, i4) {
if (ratio >= v3[0] && ratio <= v3[1]) {
subt = (ratio - v3[0]) / (v3[1] - v3[0]);
index2 = i4;
}
});
var seg = curve[index2];
if (is_nil_default(seg) || is_nil_default(index2)) {
return null;
}
var l4 = seg.length;
var nextSeg = curve[index2 + 1];
return cubic_default.pointAt(seg[l4 - 2], seg[l4 - 1], nextSeg[1], nextSeg[2], nextSeg[3], nextSeg[4], nextSeg[5], nextSeg[6], subt);
};
Path4.prototype._calculateCurve = function() {
var path = this.attr().path;
this.set("curve", path_default3.pathToCurve(path));
};
Path4.prototype._setTcache = function() {
var totalLength = 0;
var tempLength = 0;
var tCache = [];
var segmentT;
var segmentL;
var segmentN;
var l4;
var curve = this.get("curve");
if (!curve) {
return;
}
each_default(curve, function(segment, i4) {
segmentN = curve[i4 + 1];
l4 = segment.length;
if (segmentN) {
totalLength += cubic_default.length(segment[l4 - 2], segment[l4 - 1], segmentN[1], segmentN[2], segmentN[3], segmentN[4], segmentN[5], segmentN[6]) || 0;
}
});
this.set("totalLength", totalLength);
if (totalLength === 0) {
this.set("tCache", []);
return;
}
each_default(curve, function(segment, i4) {
segmentN = curve[i4 + 1];
l4 = segment.length;
if (segmentN) {
segmentT = [];
segmentT[0] = tempLength / totalLength;
segmentL = cubic_default.length(segment[l4 - 2], segment[l4 - 1], segmentN[1], segmentN[2], segmentN[3], segmentN[4], segmentN[5], segmentN[6]);
tempLength += segmentL || 0;
segmentT[1] = tempLength / totalLength;
tCache.push(segmentT);
}
});
this.set("tCache", tCache);
};
Path4.prototype.getStartTangent = function() {
var segments = this.getSegments();
var result;
if (segments.length > 1) {
var startPoint = segments[0].currentPoint;
var endPoint = segments[1].currentPoint;
var tangent = segments[1].startTangent;
result = [];
if (tangent) {
result.push([startPoint[0] - tangent[0], startPoint[1] - tangent[1]]);
result.push([startPoint[0], startPoint[1]]);
} else {
result.push([endPoint[0], endPoint[1]]);
result.push([startPoint[0], startPoint[1]]);
}
}
return result;
};
Path4.prototype.getEndTangent = function() {
var segments = this.getSegments();
var length5 = segments.length;
var result;
if (length5 > 1) {
var startPoint = segments[length5 - 2].currentPoint;
var endPoint = segments[length5 - 1].currentPoint;
var tangent = segments[length5 - 1].endTangent;
result = [];
if (tangent) {
result.push([endPoint[0] - tangent[0], endPoint[1] - tangent[1]]);
result.push([endPoint[0], endPoint[1]]);
} else {
result.push([startPoint[0], startPoint[1]]);
result.push([endPoint[0], endPoint[1]]);
}
}
return result;
};
return Path4;
}(base_default15);
var path_default2 = Path;
// node_modules/@antv/g-canvas/esm/util/in-stroke/polyline.js
function inPolyline(points, lineWidth, x6, y5, isClose) {
var count2 = points.length;
if (count2 < 2) {
return false;
}
for (var i4 = 0; i4 < count2 - 1; i4++) {
var x1 = points[i4][0];
var y1 = points[i4][1];
var x22 = points[i4 + 1][0];
var y22 = points[i4 + 1][1];
if (inLine(x1, y1, x22, y22, lineWidth, x6, y5)) {
return true;
}
}
if (isClose) {
var first = points[0];
var last2 = points[count2 - 1];
if (inLine(first[0], first[1], last2[0], last2[1], lineWidth, x6, y5)) {
return true;
}
}
return false;
}
// node_modules/@antv/g-canvas/esm/shape/polygon.js
var Polygon = function(_super) {
__extends(Polygon4, _super);
function Polygon4() {
return _super !== null && _super.apply(this, arguments) || this;
}
Polygon4.prototype.isInStrokeOrPath = function(x6, y5, isStroke, isFill, lineWidth) {
var points = this.attr().points;
var isHit = false;
if (isStroke) {
isHit = inPolyline(points, lineWidth, x6, y5, true);
}
if (!isHit && isFill) {
isHit = isInPolygon2(points, x6, y5);
}
return isHit;
};
Polygon4.prototype.createPath = function(context) {
var attrs = this.attr();
var points = attrs.points;
if (points.length < 2) {
return;
}
context.beginPath();
for (var i4 = 0; i4 < points.length; i4++) {
var point2 = points[i4];
if (i4 === 0) {
context.moveTo(point2[0], point2[1]);
} else {
context.lineTo(point2[0], point2[1]);
}
}
context.closePath();
};
return Polygon4;
}(base_default15);
var polygon_default3 = Polygon;
// node_modules/@antv/g-canvas/esm/shape/polyline.js
var PolyLine = function(_super) {
__extends(PolyLine2, _super);
function PolyLine2() {
return _super !== null && _super.apply(this, arguments) || this;
}
PolyLine2.prototype.getDefaultAttrs = function() {
var attrs = _super.prototype.getDefaultAttrs.call(this);
return __assign(__assign({}, attrs), { startArrow: false, endArrow: false });
};
PolyLine2.prototype.initAttrs = function(attrs) {
this.setArrow();
};
PolyLine2.prototype.onAttrChange = function(name, value2, originValue) {
_super.prototype.onAttrChange.call(this, name, value2, originValue);
this.setArrow();
if (["points"].indexOf(name) !== -1) {
this._resetCache();
}
};
PolyLine2.prototype._resetCache = function() {
this.set("totalLength", null);
this.set("tCache", null);
};
PolyLine2.prototype.setArrow = function() {
var attrs = this.attr();
var _a6 = this.attrs, points = _a6.points, startArrow = _a6.startArrow, endArrow = _a6.endArrow;
var length5 = points.length;
var x1 = points[0][0];
var y1 = points[0][1];
var x22 = points[length5 - 1][0];
var y22 = points[length5 - 1][1];
if (startArrow) {
addStartArrow(this, attrs, points[1][0], points[1][1], x1, y1);
}
if (endArrow) {
addEndArrow(this, attrs, points[length5 - 2][0], points[length5 - 2][1], x22, y22);
}
};
PolyLine2.prototype.isFill = function() {
return false;
};
PolyLine2.prototype.isInStrokeOrPath = function(x6, y5, isStroke, isFill, lineWidth) {
if (!isStroke || !lineWidth) {
return false;
}
var points = this.attr().points;
return inPolyline(points, lineWidth, x6, y5, false);
};
PolyLine2.prototype.isStroke = function() {
return true;
};
PolyLine2.prototype.createPath = function(context) {
var _a6 = this.attr(), points = _a6.points, startArrow = _a6.startArrow, endArrow = _a6.endArrow;
var length5 = points.length;
if (points.length < 2) {
return;
}
var x1 = points[0][0];
var y1 = points[0][1];
var x22 = points[length5 - 1][0];
var y22 = points[length5 - 1][1];
if (startArrow && startArrow.d) {
var distance15 = getShortenOffset(x1, y1, points[1][0], points[1][1], startArrow.d);
x1 += distance15.dx;
y1 += distance15.dy;
}
if (endArrow && endArrow.d) {
var distance15 = getShortenOffset(points[length5 - 2][0], points[length5 - 2][1], x22, y22, endArrow.d);
x22 -= distance15.dx;
y22 -= distance15.dy;
}
context.beginPath();
context.moveTo(x1, y1);
for (var i4 = 0; i4 < length5 - 1; i4++) {
var point2 = points[i4];
context.lineTo(point2[0], point2[1]);
}
context.lineTo(x22, y22);
};
PolyLine2.prototype.afterDrawPath = function(context) {
var startArrowShape = this.get("startArrowShape");
var endArrowShape = this.get("endArrowShape");
if (startArrowShape) {
startArrowShape.draw(context);
}
if (endArrowShape) {
endArrowShape.draw(context);
}
};
PolyLine2.prototype.getTotalLength = function() {
var points = this.attr().points;
var totalLength = this.get("totalLength");
if (!is_nil_default(totalLength)) {
return totalLength;
}
this.set("totalLength", polyline_default.length(points));
return this.get("totalLength");
};
PolyLine2.prototype.getPoint = function(ratio) {
var points = this.attr().points;
var tCache = this.get("tCache");
if (!tCache) {
this._setTcache();
tCache = this.get("tCache");
}
var subt;
var index2;
each_default(tCache, function(v3, i4) {
if (ratio >= v3[0] && ratio <= v3[1]) {
subt = (ratio - v3[0]) / (v3[1] - v3[0]);
index2 = i4;
}
});
return line_default.pointAt(points[index2][0], points[index2][1], points[index2 + 1][0], points[index2 + 1][1], subt);
};
PolyLine2.prototype._setTcache = function() {
var points = this.attr().points;
if (!points || points.length === 0) {
return;
}
var totalLength = this.getTotalLength();
if (totalLength <= 0) {
return;
}
var tempLength = 0;
var tCache = [];
var segmentT;
var segmentL;
each_default(points, function(p4, i4) {
if (points[i4 + 1]) {
segmentT = [];
segmentT[0] = tempLength / totalLength;
segmentL = line_default.length(p4[0], p4[1], points[i4 + 1][0], points[i4 + 1][1]);
tempLength += segmentL;
segmentT[1] = tempLength / totalLength;
tCache.push(segmentT);
}
});
this.set("tCache", tCache);
};
PolyLine2.prototype.getStartTangent = function() {
var points = this.attr().points;
var result = [];
result.push([points[1][0], points[1][1]]);
result.push([points[0][0], points[0][1]]);
return result;
};
PolyLine2.prototype.getEndTangent = function() {
var points = this.attr().points;
var l4 = points.length - 1;
var result = [];
result.push([points[l4 - 1][0], points[l4 - 1][1]]);
result.push([points[l4][0], points[l4][1]]);
return result;
};
return PolyLine2;
}(base_default15);
var polyline_default3 = PolyLine;
// node_modules/@antv/g-canvas/esm/util/in-stroke/rect.js
function inRect(minX, minY, width2, height, lineWidth, x6, y5) {
var halfWidth = lineWidth / 2;
return inBox(minX - halfWidth, minY - halfWidth, width2, lineWidth, x6, y5) || inBox(minX + width2 - halfWidth, minY - halfWidth, lineWidth, height, x6, y5) || inBox(minX + halfWidth, minY + height - halfWidth, width2, lineWidth, x6, y5) || inBox(minX - halfWidth, minY + halfWidth, lineWidth, height, x6, y5);
}
// node_modules/@antv/g-canvas/esm/util/in-stroke/rect-radius.js
function rectWithRadius(minX, minY, width2, height, radius, lineWidth, x6, y5) {
var halfWidth = lineWidth / 2;
return inLine(minX + radius, minY, minX + width2 - radius, minY, lineWidth, x6, y5) || inLine(minX + width2, minY + radius, minX + width2, minY + height - radius, lineWidth, x6, y5) || inLine(minX + width2 - radius, minY + height, minX + radius, minY + height, lineWidth, x6, y5) || inLine(minX, minY + height - radius, minX, minY + radius, lineWidth, x6, y5) || arc(minX + width2 - radius, minY + radius, radius, 1.5 * Math.PI, 2 * Math.PI, lineWidth, x6, y5) || arc(minX + width2 - radius, minY + height - radius, radius, 0, 0.5 * Math.PI, lineWidth, x6, y5) || arc(minX + radius, minY + height - radius, radius, 0.5 * Math.PI, Math.PI, lineWidth, x6, y5) || arc(minX + radius, minY + radius, radius, Math.PI, 1.5 * Math.PI, lineWidth, x6, y5);
}
// node_modules/@antv/g-canvas/esm/shape/rect.js
var Rect = function(_super) {
__extends(Rect4, _super);
function Rect4() {
return _super !== null && _super.apply(this, arguments) || this;
}
Rect4.prototype.getDefaultAttrs = function() {
var attrs = _super.prototype.getDefaultAttrs.call(this);
return __assign(__assign({}, attrs), { x: 0, y: 0, width: 0, height: 0, radius: 0 });
};
Rect4.prototype.isInStrokeOrPath = function(x6, y5, isStroke, isFill, lineWidth) {
var attrs = this.attr();
var minX = attrs.x;
var minY = attrs.y;
var width2 = attrs.width;
var height = attrs.height;
var radius = attrs.radius;
if (!radius) {
var halfWidth = lineWidth / 2;
if (isFill && isStroke) {
return inBox(minX - halfWidth, minY - halfWidth, width2 + halfWidth, height + halfWidth, x6, y5);
}
if (isFill) {
return inBox(minX, minY, width2, height, x6, y5);
}
if (isStroke) {
return inRect(minX, minY, width2, height, lineWidth, x6, y5);
}
} else {
var isHit = false;
if (isStroke) {
isHit = rectWithRadius(minX, minY, width2, height, radius, lineWidth, x6, y5);
}
if (!isHit && isFill) {
isHit = isPointInPath(this, x6, y5);
}
return isHit;
}
};
Rect4.prototype.createPath = function(context) {
var attrs = this.attr();
var x6 = attrs.x;
var y5 = attrs.y;
var width2 = attrs.width;
var height = attrs.height;
var radius = attrs.radius;
context.beginPath();
if (radius === 0) {
context.rect(x6, y5, width2, height);
} else {
var _a6 = parseRadius(radius), r1 = _a6[0], r22 = _a6[1], r32 = _a6[2], r4 = _a6[3];
context.moveTo(x6 + r1, y5);
context.lineTo(x6 + width2 - r22, y5);
r22 !== 0 && context.arc(x6 + width2 - r22, y5 + r22, r22, -Math.PI / 2, 0);
context.lineTo(x6 + width2, y5 + height - r32);
r32 !== 0 && context.arc(x6 + width2 - r32, y5 + height - r32, r32, 0, Math.PI / 2);
context.lineTo(x6 + r4, y5 + height);
r4 !== 0 && context.arc(x6 + r4, y5 + height - r4, r4, Math.PI / 2, Math.PI);
context.lineTo(x6, y5 + r1);
r1 !== 0 && context.arc(x6 + r1, y5 + r1, r1, Math.PI, Math.PI * 1.5);
context.closePath();
}
};
return Rect4;
}(base_default15);
var rect_default2 = Rect;
// node_modules/@antv/g-canvas/esm/shape/text.js
var Text = function(_super) {
__extends(Text3, _super);
function Text3() {
return _super !== null && _super.apply(this, arguments) || this;
}
Text3.prototype.getDefaultAttrs = function() {
var attrs = _super.prototype.getDefaultAttrs.call(this);
return __assign(__assign({}, attrs), { x: 0, y: 0, text: null, fontSize: 12, fontFamily: "sans-serif", fontStyle: "normal", fontWeight: "normal", fontVariant: "normal", textAlign: "start", textBaseline: "bottom" });
};
Text3.prototype.isOnlyHitBox = function() {
return true;
};
Text3.prototype.initAttrs = function(attrs) {
this._assembleFont();
if (attrs.text) {
this._setText(attrs.text);
}
};
Text3.prototype._assembleFont = function() {
var attrs = this.attrs;
attrs.font = assembleFont(attrs);
};
Text3.prototype._setText = function(text) {
var textArr = null;
if (is_string_default(text) && text.indexOf("\n") !== -1) {
textArr = text.split("\n");
}
this.set("textArr", textArr);
};
Text3.prototype.onAttrChange = function(name, value2, originValue) {
_super.prototype.onAttrChange.call(this, name, value2, originValue);
if (name.startsWith("font")) {
this._assembleFont();
}
if (name === "text") {
this._setText(value2);
}
};
Text3.prototype._getSpaceingY = function() {
var attrs = this.attrs;
var lineHeight = attrs.lineHeight;
var fontSize = attrs.fontSize * 1;
return lineHeight ? lineHeight - fontSize : fontSize * 0.14;
};
Text3.prototype._drawTextArr = function(context, textArr, isFill) {
var attrs = this.attrs;
var textBaseline = attrs.textBaseline;
var x6 = attrs.x;
var y5 = attrs.y;
var fontSize = attrs.fontSize * 1;
var spaceingY = this._getSpaceingY();
var height = getTextHeight(attrs.text, attrs.fontSize, attrs.lineHeight);
var subY;
each_default(textArr, function(subText, index2) {
subY = y5 + index2 * (spaceingY + fontSize) - height + fontSize;
if (textBaseline === "middle")
subY += height - fontSize - (height - fontSize) / 2;
if (textBaseline === "top")
subY += height - fontSize;
if (!is_nil_default(subText)) {
if (isFill) {
context.fillText(subText, x6, subY);
} else {
context.strokeText(subText, x6, subY);
}
}
});
};
Text3.prototype._drawText = function(context, isFill) {
var attrs = this.attr();
var x6 = attrs.x;
var y5 = attrs.y;
var textArr = this.get("textArr");
if (textArr) {
this._drawTextArr(context, textArr, isFill);
} else {
var text = attrs.text;
if (!is_nil_default(text)) {
if (isFill) {
context.fillText(text, x6, y5);
} else {
context.strokeText(text, x6, y5);
}
}
}
};
Text3.prototype.strokeAndFill = function(context) {
var _a6 = this.attrs, lineWidth = _a6.lineWidth, opacity = _a6.opacity, strokeOpacity = _a6.strokeOpacity, fillOpacity = _a6.fillOpacity;
if (this.isStroke()) {
if (lineWidth > 0) {
if (!is_nil_default(strokeOpacity) && strokeOpacity !== 1) {
context.globalAlpha = opacity;
}
this.stroke(context);
}
}
if (this.isFill()) {
if (!is_nil_default(fillOpacity) && fillOpacity !== 1) {
context.globalAlpha = fillOpacity;
this.fill(context);
context.globalAlpha = opacity;
} else {
this.fill(context);
}
}
this.afterDrawPath(context);
};
Text3.prototype.fill = function(context) {
this._drawText(context, true);
};
Text3.prototype.stroke = function(context) {
this._drawText(context, false);
};
return Text3;
}(base_default15);
var text_default3 = Text;
// node_modules/@antv/g-canvas/esm/util/hit.js
function invertFromMatrix(v3, matrix) {
if (matrix) {
var invertMatrix3 = invert4(matrix);
return multiplyVec2(invertMatrix3, v3);
}
return v3;
}
function getRefXY(element, x6, y5) {
var totalMatrix = element.getTotalMatrix();
if (totalMatrix) {
var _a6 = invertFromMatrix([x6, y5, 1], totalMatrix), refX = _a6[0], refY = _a6[1];
return [refX, refY];
}
return [x6, y5];
}
function preTest(element, x6, y5) {
if (element.isCanvas && element.isCanvas()) {
return true;
}
if (!isAllowCapture(element) || element.cfg.isInView === false) {
return false;
}
if (element.cfg.clipShape) {
var _a6 = getRefXY(element, x6, y5), refX = _a6[0], refY = _a6[1];
if (element.isClipped(refX, refY)) {
return false;
}
}
var bbox = element.cfg.cacheCanvasBBox || element.getCanvasBBox();
if (!(x6 >= bbox.minX && x6 <= bbox.maxX && y5 >= bbox.minY && y5 <= bbox.maxY)) {
return false;
}
return true;
}
function getShape(container2, x6, y5) {
if (!preTest(container2, x6, y5)) {
return null;
}
var shape = null;
var children = container2.getChildren();
var count2 = children.length;
for (var i4 = count2 - 1; i4 >= 0; i4--) {
var child = children[i4];
if (child.isGroup()) {
shape = getShape(child, x6, y5);
} else if (preTest(child, x6, y5)) {
var curShape = child;
var _a6 = getRefXY(child, x6, y5), refX = _a6[0], refY = _a6[1];
if (curShape.isInShape(refX, refY)) {
shape = child;
}
}
if (shape) {
break;
}
}
return shape;
}
// node_modules/@antv/g-canvas/esm/canvas.js
var Canvas2 = function(_super) {
__extends(Canvas4, _super);
function Canvas4() {
return _super !== null && _super.apply(this, arguments) || this;
}
Canvas4.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
cfg["renderer"] = "canvas";
cfg["autoDraw"] = true;
cfg["localRefresh"] = true;
cfg["refreshElements"] = [];
cfg["clipView"] = true;
cfg["quickHit"] = false;
return cfg;
};
Canvas4.prototype.onCanvasChange = function(changeType) {
if (changeType === "attr" || changeType === "sort" || changeType === "changeSize") {
this.set("refreshElements", [this]);
this.draw();
}
};
Canvas4.prototype.getShapeBase = function() {
return shape_exports;
};
Canvas4.prototype.getGroupBase = function() {
return group_default3;
};
Canvas4.prototype.getPixelRatio = function() {
var pixelRatio = this.get("pixelRatio") || getPixelRatio();
return pixelRatio >= 1 ? Math.ceil(pixelRatio) : 1;
};
Canvas4.prototype.getViewRange = function() {
return {
minX: 0,
minY: 0,
maxX: this.cfg.width,
maxY: this.cfg.height
};
};
Canvas4.prototype.createDom = function() {
var element = document.createElement("canvas");
var context = element.getContext("2d");
this.set("context", context);
return element;
};
Canvas4.prototype.setDOMSize = function(width2, height) {
_super.prototype.setDOMSize.call(this, width2, height);
var context = this.get("context");
var el = this.get("el");
var pixelRatio = this.getPixelRatio();
el.width = pixelRatio * width2;
el.height = pixelRatio * height;
if (pixelRatio > 1) {
context.scale(pixelRatio, pixelRatio);
}
};
Canvas4.prototype.clear = function() {
_super.prototype.clear.call(this);
this._clearFrame();
var context = this.get("context");
var element = this.get("el");
context.clearRect(0, 0, element.width, element.height);
};
Canvas4.prototype.getShape = function(x6, y5) {
var shape;
if (this.get("quickHit")) {
shape = getShape(this, x6, y5);
} else {
shape = _super.prototype.getShape.call(this, x6, y5, null);
}
return shape;
};
Canvas4.prototype._getRefreshRegion = function() {
var elements = this.get("refreshElements");
var viewRegion = this.getViewRange();
var region;
if (elements.length && elements[0] === this) {
region = viewRegion;
} else {
region = getMergedRegion(elements);
if (region) {
region.minX = Math.floor(region.minX);
region.minY = Math.floor(region.minY);
region.maxX = Math.ceil(region.maxX);
region.maxY = Math.ceil(region.maxY);
region.maxY += 1;
var clipView = this.get("clipView");
if (clipView) {
region = mergeView(region, viewRegion);
}
}
}
return region;
};
Canvas4.prototype.refreshElement = function(element) {
var refreshElements = this.get("refreshElements");
refreshElements.push(element);
};
Canvas4.prototype._clearFrame = function() {
var drawFrame = this.get("drawFrame");
if (drawFrame) {
cancelAnimationFrame2(drawFrame);
this.set("drawFrame", null);
this.set("refreshElements", []);
}
};
Canvas4.prototype.draw = function() {
var drawFrame = this.get("drawFrame");
if (this.get("autoDraw") && drawFrame) {
return;
}
this._startDraw();
};
Canvas4.prototype._drawAll = function() {
var context = this.get("context");
var element = this.get("el");
var children = this.getChildren();
context.clearRect(0, 0, element.width, element.height);
applyAttrsToContext(context, this);
drawChildren(context, children);
this.set("refreshElements", []);
};
Canvas4.prototype._drawRegion = function() {
var context = this.get("context");
var refreshElements = this.get("refreshElements");
var children = this.getChildren();
var region = this._getRefreshRegion();
if (region) {
context.clearRect(region.minX, region.minY, region.maxX - region.minX, region.maxY - region.minY);
context.save();
context.beginPath();
context.rect(region.minX, region.minY, region.maxX - region.minX, region.maxY - region.minY);
context.clip();
applyAttrsToContext(context, this);
checkRefresh(this, children, region);
drawChildren(context, children, region);
context.restore();
} else if (refreshElements.length) {
clearChanged(refreshElements);
}
each_default(refreshElements, function(element) {
if (element.get("hasChanged")) {
element.set("hasChanged", false);
}
});
this.set("refreshElements", []);
};
Canvas4.prototype._startDraw = function() {
var _this = this;
var drawFrame = this.get("drawFrame");
if (!drawFrame) {
drawFrame = requestAnimationFrame2(function() {
if (_this.get("localRefresh")) {
_this._drawRegion();
} else {
_this._drawAll();
}
_this.set("drawFrame", null);
});
this.set("drawFrame", drawFrame);
}
};
Canvas4.prototype.skipDraw = function() {
};
Canvas4.prototype.removeDom = function() {
var el = this.get("el");
el.width = 0;
el.height = 0;
el.parentNode.removeChild(el);
};
return Canvas4;
}(canvas_default);
var canvas_default2 = Canvas2;
// node_modules/@antv/g-canvas/esm/index.js
var version = "0.5.12";
// node_modules/@antv/g-svg/esm/index.js
var esm_exports2 = {};
__export(esm_exports2, {
AbstractCanvas: () => canvas_default,
AbstractGroup: () => group_default2,
AbstractShape: () => shape_default,
Base: () => base_default2,
Canvas: () => canvas_default3,
Event: () => graph_event_default,
Group: () => group_default4,
PathUtil: () => path_exports,
Shape: () => shape_exports2,
assembleFont: () => assembleFont,
getBBoxMethod: () => getMethod,
getOffScreenContext: () => getOffScreenContext,
getTextHeight: () => getTextHeight,
invert: () => invert4,
isAllowCapture: () => isAllowCapture,
multiplyVec2: () => multiplyVec2,
version: () => version2
});
// node_modules/@antv/g-svg/esm/shape/index.js
var shape_exports2 = {};
__export(shape_exports2, {
Base: () => base_default16,
Circle: () => circle_default6,
Dom: () => dom_default,
Ellipse: () => ellipse_default4,
Image: () => image_default3,
Line: () => line_default8,
Marker: () => marker_default2,
Path: () => path_default4,
Polygon: () => polygon_default4,
Polyline: () => polyline_default4,
Rect: () => rect_default3,
Text: () => text_default4
});
// node_modules/@antv/g-svg/esm/constant.js
var SHAPE_TO_TAGS = {
rect: "path",
circle: "circle",
line: "line",
path: "path",
marker: "path",
text: "text",
polyline: "polyline",
polygon: "polygon",
image: "image",
ellipse: "ellipse",
dom: "foreignObject"
};
var SVG_ATTR_MAP = {
opacity: "opacity",
fillStyle: "fill",
fill: "fill",
fillOpacity: "fill-opacity",
strokeStyle: "stroke",
strokeOpacity: "stroke-opacity",
stroke: "stroke",
x: "x",
y: "y",
r: "r",
rx: "rx",
ry: "ry",
width: "width",
height: "height",
x1: "x1",
x2: "x2",
y1: "y1",
y2: "y2",
lineCap: "stroke-linecap",
lineJoin: "stroke-linejoin",
lineWidth: "stroke-width",
lineDash: "stroke-dasharray",
lineDashOffset: "stroke-dashoffset",
miterLimit: "stroke-miterlimit",
font: "font",
fontSize: "font-size",
fontStyle: "font-style",
fontVariant: "font-variant",
fontWeight: "font-weight",
fontFamily: "font-family",
startArrow: "marker-start",
endArrow: "marker-end",
path: "d",
class: "class",
id: "id",
style: "style",
preserveAspectRatio: "preserveAspectRatio"
};
// node_modules/@antv/g-svg/esm/util/dom.js
function createSVGElement(type2) {
return document.createElementNS("http://www.w3.org/2000/svg", type2);
}
function createDom2(shape) {
var type2 = SHAPE_TO_TAGS[shape.type];
var parent = shape.getParent();
if (!type2) {
throw new Error("the type " + shape.type + " is not supported by svg");
}
var element = createSVGElement(type2);
if (shape.get("id")) {
element.id = shape.get("id");
}
shape.set("el", element);
shape.set("attrs", {});
if (parent) {
var parentNode = parent.get("el");
if (parentNode) {
parentNode.appendChild(element);
} else {
parentNode = parent.createDom();
parent.set("el", parentNode);
parentNode.appendChild(element);
}
}
return element;
}
function sortDom(element, sorter) {
var el = element.get("el");
var childList = to_array_default(el.children).sort(sorter);
var fragment = document.createDocumentFragment();
childList.forEach(function(child) {
fragment.appendChild(child);
});
el.appendChild(fragment);
}
function moveTo(element, targetIndex) {
var parentNode = element.parentNode;
var siblings = Array.from(parentNode.childNodes).filter(function(node) {
return node.nodeType === 1 && node.nodeName.toLowerCase() !== "defs";
});
var target = siblings[targetIndex];
var currentIndex = siblings.indexOf(element);
if (target) {
if (currentIndex > targetIndex) {
parentNode.insertBefore(element, target);
} else if (currentIndex < targetIndex) {
var targetNext = siblings[targetIndex + 1];
if (targetNext) {
parentNode.insertBefore(element, targetNext);
} else {
parentNode.appendChild(element);
}
}
} else {
parentNode.appendChild(element);
}
}
// node_modules/@antv/g-svg/esm/util/svg.js
function setShadow(model, context) {
var el = model.cfg.el;
var attrs = model.attr();
var cfg = {
dx: attrs.shadowOffsetX,
dy: attrs.shadowOffsetY,
blur: attrs.shadowBlur,
color: attrs.shadowColor
};
if (!cfg.dx && !cfg.dy && !cfg.blur && !cfg.color) {
el.removeAttribute("filter");
} else {
var id = context.find("filter", cfg);
if (!id) {
id = context.addShadow(cfg);
}
el.setAttribute("filter", "url(#" + id + ")");
}
}
function setTransform(model) {
var matrix = model.attr().matrix;
if (matrix) {
var el = model.cfg.el;
var transform18 = [];
for (var i4 = 0; i4 < 9; i4 += 3) {
transform18.push(matrix[i4] + "," + matrix[i4 + 1]);
}
transform18 = transform18.join(",");
if (transform18.indexOf("NaN") === -1) {
el.setAttribute("transform", "matrix(" + transform18 + ")");
} else {
console.warn("invalid matrix:", matrix);
}
}
}
function setClip(model, context) {
var clip = model.getClip();
var el = model.get("el");
if (!clip) {
el.removeAttribute("clip-path");
} else if (clip && !el.hasAttribute("clip-path")) {
createDom2(clip);
clip.createPath(context);
var id = context.addClip(clip);
el.setAttribute("clip-path", "url(#" + id + ")");
}
}
// node_modules/@antv/g-svg/esm/util/draw.js
function drawChildren2(context, children) {
children.forEach(function(child) {
child.draw(context);
});
}
function refreshElement2(element, changeType) {
var canvas = element.get("canvas");
if (canvas && canvas.get("autoDraw")) {
var context = canvas.get("context");
var parent_1 = element.getParent();
var parentChildren = parent_1 ? parent_1.getChildren() : [canvas];
var el = element.get("el");
if (changeType === "remove") {
var isClipShape = element.get("isClipShape");
if (isClipShape) {
var clipPathEl = el && el.parentNode;
var defsEl = clipPathEl && clipPathEl.parentNode;
if (clipPathEl && defsEl) {
defsEl.removeChild(clipPathEl);
}
} else if (el && el.parentNode) {
el.parentNode.removeChild(el);
}
} else if (changeType === "show") {
el.setAttribute("visibility", "visible");
} else if (changeType === "hide") {
el.setAttribute("visibility", "hidden");
} else if (changeType === "zIndex") {
moveTo(el, parentChildren.indexOf(element));
} else if (changeType === "sort") {
var children_1 = element.get("children");
if (children_1 && children_1.length) {
sortDom(element, function(a4, b10) {
return children_1.indexOf(a4) - children_1.indexOf(b10) ? 1 : 0;
});
}
} else if (changeType === "clear") {
if (el) {
el.innerHTML = "";
}
} else if (changeType === "matrix") {
setTransform(element);
} else if (changeType === "clip") {
setClip(element, context);
} else if (changeType === "attr") {
} else if (changeType === "add") {
element.draw(context);
}
}
}
// node_modules/@antv/g-svg/esm/group.js
var Group2 = function(_super) {
__extends(Group3, _super);
function Group3() {
return _super !== null && _super.apply(this, arguments) || this;
}
Group3.prototype.isEntityGroup = function() {
return true;
};
Group3.prototype.createDom = function() {
var element = createSVGElement("g");
this.set("el", element);
var parent = this.getParent();
if (parent) {
var parentNode = parent.get("el");
if (parentNode) {
parentNode.appendChild(element);
} else {
parentNode = parent.createDom();
parent.set("el", parentNode);
parentNode.appendChild(element);
}
}
return element;
};
Group3.prototype.afterAttrsChange = function(targetAttrs) {
_super.prototype.afterAttrsChange.call(this, targetAttrs);
var canvas = this.get("canvas");
if (canvas && canvas.get("autoDraw")) {
var context = canvas.get("context");
this.createPath(context, targetAttrs);
}
};
Group3.prototype.onCanvasChange = function(changeType) {
refreshElement2(this, changeType);
};
Group3.prototype.getShapeBase = function() {
return shape_exports2;
};
Group3.prototype.getGroupBase = function() {
return Group3;
};
Group3.prototype.draw = function(context) {
var children = this.getChildren();
var el = this.get("el");
if (this.get("destroyed")) {
if (el) {
el.parentNode.removeChild(el);
}
} else {
if (!el) {
this.createDom();
}
setClip(this, context);
this.createPath(context);
if (children.length) {
drawChildren2(context, children);
}
}
};
Group3.prototype.createPath = function(context, targetAttrs) {
var attrs = this.attr();
var el = this.get("el");
each_default(targetAttrs || attrs, function(value2, attr) {
if (SVG_ATTR_MAP[attr]) {
el.setAttribute(SVG_ATTR_MAP[attr], value2);
}
});
setTransform(this);
};
return Group3;
}(group_default2);
var group_default4 = Group2;
// node_modules/@antv/g-svg/esm/shape/base.js
var ShapeBase3 = function(_super) {
__extends(ShapeBase4, _super);
function ShapeBase4() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "svg";
_this.canFill = false;
_this.canStroke = false;
return _this;
}
ShapeBase4.prototype.getDefaultAttrs = function() {
var attrs = _super.prototype.getDefaultAttrs.call(this);
return __assign(__assign({}, attrs), { lineWidth: 1, lineAppendWidth: 0, strokeOpacity: 1, fillOpacity: 1 });
};
ShapeBase4.prototype.afterAttrsChange = function(targetAttrs) {
_super.prototype.afterAttrsChange.call(this, targetAttrs);
var canvas = this.get("canvas");
if (canvas && canvas.get("autoDraw")) {
var context = canvas.get("context");
this.draw(context, targetAttrs);
}
};
ShapeBase4.prototype.getShapeBase = function() {
return shape_exports2;
};
ShapeBase4.prototype.getGroupBase = function() {
return group_default4;
};
ShapeBase4.prototype.onCanvasChange = function(changeType) {
refreshElement2(this, changeType);
};
ShapeBase4.prototype.calculateBBox = function() {
var el = this.get("el");
var bbox = null;
if (el) {
bbox = el.getBBox();
} else {
var bboxMethod = getMethod(this.get("type"));
if (bboxMethod) {
bbox = bboxMethod(this);
}
}
if (bbox) {
var x6 = bbox.x, y5 = bbox.y, width2 = bbox.width, height = bbox.height;
var lineWidth = this.getHitLineWidth();
var halfWidth = lineWidth / 2;
var minX = x6 - halfWidth;
var minY = y5 - halfWidth;
var maxX = x6 + width2 + halfWidth;
var maxY2 = y5 + height + halfWidth;
return {
x: minX,
y: minY,
minX,
minY,
maxX,
maxY: maxY2,
width: width2 + lineWidth,
height: height + lineWidth
};
}
return {
x: 0,
y: 0,
minX: 0,
minY: 0,
maxX: 0,
maxY: 0,
width: 0,
height: 0
};
};
ShapeBase4.prototype.isFill = function() {
var _a6 = this.attr(), fill = _a6.fill, fillStyle = _a6.fillStyle;
return (fill || fillStyle || this.isClipShape()) && this.canFill;
};
ShapeBase4.prototype.isStroke = function() {
var _a6 = this.attr(), stroke = _a6.stroke, strokeStyle = _a6.strokeStyle;
return (stroke || strokeStyle) && this.canStroke;
};
ShapeBase4.prototype.draw = function(context, targetAttrs) {
var el = this.get("el");
if (this.get("destroyed")) {
if (el) {
el.parentNode.removeChild(el);
}
} else {
if (!el) {
createDom2(this);
}
setClip(this, context);
this.createPath(context, targetAttrs);
this.shadow(context, targetAttrs);
this.strokeAndFill(context, targetAttrs);
this.transform(targetAttrs);
}
};
ShapeBase4.prototype.createPath = function(context, targetAttrs) {
};
ShapeBase4.prototype.strokeAndFill = function(context, targetAttrs) {
var attrs = targetAttrs || this.attr();
var fill = attrs.fill, fillStyle = attrs.fillStyle, stroke = attrs.stroke, strokeStyle = attrs.strokeStyle, fillOpacity = attrs.fillOpacity, strokeOpacity = attrs.strokeOpacity, lineWidth = attrs.lineWidth;
var el = this.get("el");
if (this.canFill) {
if (!targetAttrs) {
this._setColor(context, "fill", fill || fillStyle);
} else if ("fill" in attrs) {
this._setColor(context, "fill", fill);
} else if ("fillStyle" in attrs) {
this._setColor(context, "fill", fillStyle);
}
if (fillOpacity) {
el.setAttribute(SVG_ATTR_MAP["fillOpacity"], fillOpacity);
}
}
if (this.canStroke && lineWidth > 0) {
if (!targetAttrs) {
this._setColor(context, "stroke", stroke || strokeStyle);
} else if ("stroke" in attrs) {
this._setColor(context, "stroke", stroke);
} else if ("strokeStyle" in attrs) {
this._setColor(context, "stroke", strokeStyle);
}
if (strokeOpacity) {
el.setAttribute(SVG_ATTR_MAP["strokeOpacity"], strokeOpacity);
}
if (lineWidth) {
el.setAttribute(SVG_ATTR_MAP["lineWidth"], lineWidth);
}
}
};
ShapeBase4.prototype._setColor = function(context, attr, value2) {
var el = this.get("el");
if (!value2) {
el.setAttribute(SVG_ATTR_MAP[attr], "none");
return;
}
value2 = value2.trim();
if (/^[r,R,L,l]{1}[\s]*\(/.test(value2)) {
var id = context.find("gradient", value2);
if (!id) {
id = context.addGradient(value2);
}
el.setAttribute(SVG_ATTR_MAP[attr], "url(#" + id + ")");
} else if (/^[p,P]{1}[\s]*\(/.test(value2)) {
var id = context.find("pattern", value2);
if (!id) {
id = context.addPattern(value2);
}
el.setAttribute(SVG_ATTR_MAP[attr], "url(#" + id + ")");
} else {
el.setAttribute(SVG_ATTR_MAP[attr], value2);
}
};
ShapeBase4.prototype.shadow = function(context, targetAttrs) {
var attrs = this.attr();
var _a6 = targetAttrs || attrs, shadowOffsetX = _a6.shadowOffsetX, shadowOffsetY = _a6.shadowOffsetY, shadowBlur = _a6.shadowBlur, shadowColor = _a6.shadowColor;
if (shadowOffsetX || shadowOffsetY || shadowBlur || shadowColor) {
setShadow(this, context);
}
};
ShapeBase4.prototype.transform = function(targetAttrs) {
var attrs = this.attr();
var matrix = (targetAttrs || attrs).matrix;
if (matrix) {
setTransform(this);
}
};
ShapeBase4.prototype.isInShape = function(refX, refY) {
return this.isPointInPath(refX, refY);
};
ShapeBase4.prototype.isPointInPath = function(refX, refY) {
var el = this.get("el");
var canvas = this.get("canvas");
var bbox = canvas.get("el").getBoundingClientRect();
var clientX = refX + bbox.left;
var clientY = refY + bbox.top;
var element = document.elementFromPoint(clientX, clientY);
if (element && element.isEqualNode(el)) {
return true;
}
return false;
};
ShapeBase4.prototype.getHitLineWidth = function() {
var _a6 = this.attrs, lineWidth = _a6.lineWidth, lineAppendWidth = _a6.lineAppendWidth;
if (this.isStroke()) {
return lineWidth + lineAppendWidth;
}
return 0;
};
return ShapeBase4;
}(shape_default);
var base_default16 = ShapeBase3;
// node_modules/@antv/g-svg/esm/shape/circle.js
var Circle4 = function(_super) {
__extends(Circle6, _super);
function Circle6() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "circle";
_this.canFill = true;
_this.canStroke = true;
return _this;
}
Circle6.prototype.getDefaultAttrs = function() {
var attrs = _super.prototype.getDefaultAttrs.call(this);
return __assign(__assign({}, attrs), { x: 0, y: 0, r: 0 });
};
Circle6.prototype.createPath = function(context, targetAttrs) {
var attrs = this.attr();
var el = this.get("el");
each_default(targetAttrs || attrs, function(value2, attr) {
if (attr === "x" || attr === "y") {
el.setAttribute("c" + attr, value2);
} else if (SVG_ATTR_MAP[attr]) {
el.setAttribute(SVG_ATTR_MAP[attr], value2);
}
});
};
return Circle6;
}(base_default16);
var circle_default6 = Circle4;
// node_modules/@antv/g-svg/esm/shape/dom.js
var Dom = function(_super) {
__extends(Dom2, _super);
function Dom2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "dom";
_this.canFill = false;
_this.canStroke = false;
return _this;
}
Dom2.prototype.createPath = function(context, targetAttrs) {
var attrs = this.attr();
var el = this.get("el");
each_default(targetAttrs || attrs, function(value2, attr) {
if (SVG_ATTR_MAP[attr]) {
el.setAttribute(SVG_ATTR_MAP[attr], value2);
}
});
if (typeof attrs["html"] === "function") {
var element = attrs["html"].call(this, attrs);
if (element instanceof Element || element instanceof HTMLDocument) {
var children = el.childNodes;
for (var i4 = children.length - 1; i4 >= 0; i4--) {
el.removeChild(children[i4]);
}
el.appendChild(element);
} else {
el.innerHTML = element;
}
} else {
el.innerHTML = attrs["html"];
}
};
return Dom2;
}(base_default16);
var dom_default = Dom;
// node_modules/@antv/g-svg/esm/shape/ellipse.js
var Ellipse2 = function(_super) {
__extends(Ellipse3, _super);
function Ellipse3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "ellipse";
_this.canFill = true;
_this.canStroke = true;
return _this;
}
Ellipse3.prototype.getDefaultAttrs = function() {
var attrs = _super.prototype.getDefaultAttrs.call(this);
return __assign(__assign({}, attrs), { x: 0, y: 0, rx: 0, ry: 0 });
};
Ellipse3.prototype.createPath = function(context, targetAttrs) {
var attrs = this.attr();
var el = this.get("el");
each_default(targetAttrs || attrs, function(value2, attr) {
if (attr === "x" || attr === "y") {
el.setAttribute("c" + attr, value2);
} else if (SVG_ATTR_MAP[attr]) {
el.setAttribute(SVG_ATTR_MAP[attr], value2);
}
});
};
return Ellipse3;
}(base_default16);
var ellipse_default4 = Ellipse2;
// node_modules/@antv/g-svg/esm/shape/image.js
var Image2 = function(_super) {
__extends(Image3, _super);
function Image3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "image";
_this.canFill = false;
_this.canStroke = false;
return _this;
}
Image3.prototype.getDefaultAttrs = function() {
var attrs = _super.prototype.getDefaultAttrs.call(this);
return __assign(__assign({}, attrs), { x: 0, y: 0, width: 0, height: 0 });
};
Image3.prototype.createPath = function(context, targetAttrs) {
var _this = this;
var attrs = this.attr();
var el = this.get("el");
each_default(targetAttrs || attrs, function(value2, attr) {
if (attr === "img") {
_this._setImage(attrs.img);
} else if (SVG_ATTR_MAP[attr]) {
el.setAttribute(SVG_ATTR_MAP[attr], value2);
}
});
};
Image3.prototype.setAttr = function(name, value2) {
this.attrs[name] = value2;
if (name === "img") {
this._setImage(value2);
}
};
Image3.prototype._setImage = function(img) {
var attrs = this.attr();
var el = this.get("el");
if (is_string_default(img)) {
el.setAttribute("href", img);
} else if (img instanceof window.Image) {
if (!attrs.width) {
el.setAttribute("width", img.width);
this.attr("width", img.width);
}
if (!attrs.height) {
el.setAttribute("height", img.height);
this.attr("height", img.height);
}
el.setAttribute("href", img.src);
} else if (img instanceof HTMLElement && is_string_default(img.nodeName) && img.nodeName.toUpperCase() === "CANVAS") {
el.setAttribute("href", img.toDataURL());
} else if (img instanceof ImageData) {
var canvas = document.createElement("canvas");
canvas.setAttribute("width", "" + img.width);
canvas.setAttribute("height", "" + img.height);
canvas.getContext("2d").putImageData(img, 0, 0);
if (!attrs.width) {
el.setAttribute("width", "" + img.width);
this.attr("width", img.width);
}
if (!attrs.height) {
el.setAttribute("height", "" + img.height);
this.attr("height", img.height);
}
el.setAttribute("href", canvas.toDataURL());
}
};
return Image3;
}(base_default16);
var image_default3 = Image2;
// node_modules/@antv/g-svg/esm/shape/line.js
var Line4 = function(_super) {
__extends(Line9, _super);
function Line9() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "line";
_this.canFill = false;
_this.canStroke = true;
return _this;
}
Line9.prototype.getDefaultAttrs = function() {
var attrs = _super.prototype.getDefaultAttrs.call(this);
return __assign(__assign({}, attrs), { x1: 0, y1: 0, x2: 0, y2: 0, startArrow: false, endArrow: false });
};
Line9.prototype.createPath = function(context, targetAttrs) {
var attrs = this.attr();
var el = this.get("el");
each_default(targetAttrs || attrs, function(value2, attr) {
if (attr === "startArrow" || attr === "endArrow") {
if (value2) {
var id = is_object_default(value2) ? context.addArrow(attrs, SVG_ATTR_MAP[attr]) : context.getDefaultArrow(attrs, SVG_ATTR_MAP[attr]);
el.setAttribute(SVG_ATTR_MAP[attr], "url(#" + id + ")");
} else {
el.removeAttribute(SVG_ATTR_MAP[attr]);
}
} else if (SVG_ATTR_MAP[attr]) {
el.setAttribute(SVG_ATTR_MAP[attr], value2);
}
});
};
Line9.prototype.getTotalLength = function() {
var _a6 = this.attr(), x1 = _a6.x1, y1 = _a6.y1, x22 = _a6.x2, y22 = _a6.y2;
return line_default.length(x1, y1, x22, y22);
};
Line9.prototype.getPoint = function(ratio) {
var _a6 = this.attr(), x1 = _a6.x1, y1 = _a6.y1, x22 = _a6.x2, y22 = _a6.y2;
return line_default.pointAt(x1, y1, x22, y22, ratio);
};
return Line9;
}(base_default16);
var line_default8 = Line4;
// node_modules/@antv/g-svg/esm/shape/marker/symbols.js
var Symbols2 = {
circle: function(x6, y5, r4) {
return [
["M", x6, y5],
["m", -r4, 0],
["a", r4, r4, 0, 1, 0, r4 * 2, 0],
["a", r4, r4, 0, 1, 0, -r4 * 2, 0]
];
},
square: function(x6, y5, r4) {
return [["M", x6 - r4, y5 - r4], ["L", x6 + r4, y5 - r4], ["L", x6 + r4, y5 + r4], ["L", x6 - r4, y5 + r4], ["Z"]];
},
diamond: function(x6, y5, r4) {
return [["M", x6 - r4, y5], ["L", x6, y5 - r4], ["L", x6 + r4, y5], ["L", x6, y5 + r4], ["Z"]];
},
triangle: function(x6, y5, r4) {
var diffY = r4 * Math.sin(1 / 3 * Math.PI);
return [["M", x6 - r4, y5 + diffY], ["L", x6, y5 - diffY], ["L", x6 + r4, y5 + diffY], ["z"]];
},
triangleDown: function(x6, y5, r4) {
var diffY = r4 * Math.sin(1 / 3 * Math.PI);
return [["M", x6 - r4, y5 - diffY], ["L", x6 + r4, y5 - diffY], ["L", x6, y5 + diffY], ["Z"]];
}
};
var symbols_default = {
get: function(type2) {
return Symbols2[type2];
},
register: function(type2, func) {
Symbols2[type2] = func;
},
remove: function(type2) {
delete Symbols2[type2];
},
getAll: function() {
return Symbols2;
}
};
// node_modules/@antv/g-svg/esm/shape/marker/index.js
var Marker2 = function(_super) {
__extends(Marker3, _super);
function Marker3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "marker";
_this.canFill = true;
_this.canStroke = true;
return _this;
}
Marker3.prototype.createPath = function(context) {
var el = this.get("el");
el.setAttribute("d", this._assembleMarker());
};
Marker3.prototype._assembleMarker = function() {
var d3 = this._getPath();
if (is_array_default(d3)) {
return d3.map(function(path) {
return path.join(" ");
}).join("");
}
return d3;
};
Marker3.prototype._getPath = function() {
var attrs = this.attr();
var x6 = attrs.x, y5 = attrs.y;
var r4 = attrs.r || attrs.radius;
var symbol = attrs.symbol || "circle";
var method;
if (is_function_default(symbol)) {
method = symbol;
} else {
method = symbols_default.get(symbol);
}
if (!method) {
console.warn(method + " symbol is not exist.");
return null;
}
return method(x6, y5, r4);
};
Marker3.symbolsFactory = symbols_default;
return Marker3;
}(base_default16);
var marker_default2 = Marker2;
// node_modules/@antv/g-svg/esm/shape/path.js
var Path2 = function(_super) {
__extends(Path4, _super);
function Path4() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "path";
_this.canFill = true;
_this.canStroke = true;
return _this;
}
Path4.prototype.getDefaultAttrs = function() {
var attrs = _super.prototype.getDefaultAttrs.call(this);
return __assign(__assign({}, attrs), { startArrow: false, endArrow: false });
};
Path4.prototype.createPath = function(context, targetAttrs) {
var _this = this;
var attrs = this.attr();
var el = this.get("el");
each_default(targetAttrs || attrs, function(value2, attr) {
if (attr === "path" && is_array_default(value2)) {
el.setAttribute("d", _this._formatPath(value2));
} else if (attr === "startArrow" || attr === "endArrow") {
if (value2) {
var id = is_object_default(value2) ? context.addArrow(attrs, SVG_ATTR_MAP[attr]) : context.getDefaultArrow(attrs, SVG_ATTR_MAP[attr]);
el.setAttribute(SVG_ATTR_MAP[attr], "url(#" + id + ")");
} else {
el.removeAttribute(SVG_ATTR_MAP[attr]);
}
} else if (SVG_ATTR_MAP[attr]) {
el.setAttribute(SVG_ATTR_MAP[attr], value2);
}
});
};
Path4.prototype._formatPath = function(value2) {
var newValue = value2.map(function(path) {
return path.join(" ");
}).join("");
if (~newValue.indexOf("NaN")) {
return "";
}
return newValue;
};
Path4.prototype.getTotalLength = function() {
var el = this.get("el");
return el ? el.getTotalLength() : null;
};
Path4.prototype.getPoint = function(ratio) {
var el = this.get("el");
var totalLength = this.getTotalLength();
if (totalLength === 0) {
return null;
}
var point2 = el ? el.getPointAtLength(ratio * totalLength) : null;
return point2 ? {
x: point2.x,
y: point2.y
} : null;
};
return Path4;
}(base_default16);
var path_default4 = Path2;
// node_modules/@antv/g-svg/esm/shape/polygon.js
var Polygon2 = function(_super) {
__extends(Polygon4, _super);
function Polygon4() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "polygon";
_this.canFill = true;
_this.canStroke = true;
return _this;
}
Polygon4.prototype.createPath = function(context, targetAttrs) {
var attrs = this.attr();
var el = this.get("el");
each_default(targetAttrs || attrs, function(value2, attr) {
if (attr === "points" && is_array_default(value2) && value2.length >= 2) {
el.setAttribute("points", value2.map(function(point2) {
return point2[0] + "," + point2[1];
}).join(" "));
} else if (SVG_ATTR_MAP[attr]) {
el.setAttribute(SVG_ATTR_MAP[attr], value2);
}
});
};
return Polygon4;
}(base_default16);
var polygon_default4 = Polygon2;
// node_modules/@antv/g-svg/esm/shape/polyline.js
var Polyline = function(_super) {
__extends(Polyline2, _super);
function Polyline2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "polyline";
_this.canFill = true;
_this.canStroke = true;
return _this;
}
Polyline2.prototype.getDefaultAttrs = function() {
var attrs = _super.prototype.getDefaultAttrs.call(this);
return __assign(__assign({}, attrs), { startArrow: false, endArrow: false });
};
Polyline2.prototype.onAttrChange = function(name, value2, originValue) {
_super.prototype.onAttrChange.call(this, name, value2, originValue);
if (["points"].indexOf(name) !== -1) {
this._resetCache();
}
};
Polyline2.prototype._resetCache = function() {
this.set("totalLength", null);
this.set("tCache", null);
};
Polyline2.prototype.createPath = function(context, targetAttrs) {
var attrs = this.attr();
var el = this.get("el");
each_default(targetAttrs || attrs, function(value2, attr) {
if (attr === "points" && is_array_default(value2) && value2.length >= 2) {
el.setAttribute("points", value2.map(function(point2) {
return point2[0] + "," + point2[1];
}).join(" "));
} else if (SVG_ATTR_MAP[attr]) {
el.setAttribute(SVG_ATTR_MAP[attr], value2);
}
});
};
Polyline2.prototype.getTotalLength = function() {
var points = this.attr().points;
var totalLength = this.get("totalLength");
if (!is_nil_default(totalLength)) {
return totalLength;
}
this.set("totalLength", polyline_default.length(points));
return this.get("totalLength");
};
Polyline2.prototype.getPoint = function(ratio) {
var points = this.attr().points;
var tCache = this.get("tCache");
if (!tCache) {
this._setTcache();
tCache = this.get("tCache");
}
var subt;
var index2;
each_default(tCache, function(v3, i4) {
if (ratio >= v3[0] && ratio <= v3[1]) {
subt = (ratio - v3[0]) / (v3[1] - v3[0]);
index2 = i4;
}
});
return line_default.pointAt(points[index2][0], points[index2][1], points[index2 + 1][0], points[index2 + 1][1], subt);
};
Polyline2.prototype._setTcache = function() {
var points = this.attr().points;
if (!points || points.length === 0) {
return;
}
var totalLength = this.getTotalLength();
if (totalLength <= 0) {
return;
}
var tempLength = 0;
var tCache = [];
var segmentT;
var segmentL;
each_default(points, function(p4, i4) {
if (points[i4 + 1]) {
segmentT = [];
segmentT[0] = tempLength / totalLength;
segmentL = line_default.length(p4[0], p4[1], points[i4 + 1][0], points[i4 + 1][1]);
tempLength += segmentL;
segmentT[1] = tempLength / totalLength;
tCache.push(segmentT);
}
});
this.set("tCache", tCache);
};
Polyline2.prototype.getStartTangent = function() {
var points = this.attr().points;
var result = [];
result.push([points[1][0], points[1][1]]);
result.push([points[0][0], points[0][1]]);
return result;
};
Polyline2.prototype.getEndTangent = function() {
var points = this.attr().points;
var l4 = points.length - 1;
var result = [];
result.push([points[l4 - 1][0], points[l4 - 1][1]]);
result.push([points[l4][0], points[l4][1]]);
return result;
};
return Polyline2;
}(base_default16);
var polyline_default4 = Polyline;
// node_modules/@antv/g-svg/esm/util/format.js
function parseRadius2(radius) {
var r1 = 0;
var r22 = 0;
var r32 = 0;
var r4 = 0;
if (is_array_default(radius)) {
if (radius.length === 1) {
r1 = r22 = r32 = r4 = radius[0];
} else if (radius.length === 2) {
r1 = r32 = radius[0];
r22 = r4 = radius[1];
} else if (radius.length === 3) {
r1 = radius[0];
r22 = r4 = radius[1];
r32 = radius[2];
} else {
r1 = radius[0];
r22 = radius[1];
r32 = radius[2];
r4 = radius[3];
}
} else {
r1 = r22 = r32 = r4 = radius;
}
return {
r1,
r2: r22,
r3: r32,
r4
};
}
// node_modules/@antv/g-svg/esm/shape/rect.js
var Rect2 = function(_super) {
__extends(Rect4, _super);
function Rect4() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "rect";
_this.canFill = true;
_this.canStroke = true;
return _this;
}
Rect4.prototype.getDefaultAttrs = function() {
var attrs = _super.prototype.getDefaultAttrs.call(this);
return __assign(__assign({}, attrs), { x: 0, y: 0, width: 0, height: 0, radius: 0 });
};
Rect4.prototype.createPath = function(context, targetAttrs) {
var _this = this;
var attrs = this.attr();
var el = this.get("el");
var completed = false;
var pathRelatedAttrs = ["x", "y", "width", "height", "radius"];
each_default(targetAttrs || attrs, function(value2, attr) {
if (pathRelatedAttrs.indexOf(attr) !== -1 && !completed) {
el.setAttribute("d", _this._assembleRect(attrs));
completed = true;
} else if (pathRelatedAttrs.indexOf(attr) === -1 && SVG_ATTR_MAP[attr]) {
el.setAttribute(SVG_ATTR_MAP[attr], value2);
}
});
};
Rect4.prototype._assembleRect = function(attrs) {
var x6 = attrs.x;
var y5 = attrs.y;
var w4 = attrs.width;
var h3 = attrs.height;
var radius = attrs.radius;
if (!radius) {
return "M " + x6 + "," + y5 + " l " + w4 + ",0 l 0," + h3 + " l" + -w4 + " 0 z";
}
var r4 = parseRadius2(radius);
if (is_array_default(radius)) {
if (radius.length === 1) {
r4.r1 = r4.r2 = r4.r3 = r4.r4 = radius[0];
} else if (radius.length === 2) {
r4.r1 = r4.r3 = radius[0];
r4.r2 = r4.r4 = radius[1];
} else if (radius.length === 3) {
r4.r1 = radius[0];
r4.r2 = r4.r4 = radius[1];
r4.r3 = radius[2];
} else {
r4.r1 = radius[0];
r4.r2 = radius[1];
r4.r3 = radius[2];
r4.r4 = radius[3];
}
} else {
r4.r1 = r4.r2 = r4.r3 = r4.r4 = radius;
}
var d3 = [
["M " + (x6 + r4.r1) + "," + y5],
["l " + (w4 - r4.r1 - r4.r2) + ",0"],
["a " + r4.r2 + "," + r4.r2 + ",0,0,1," + r4.r2 + "," + r4.r2],
["l 0," + (h3 - r4.r2 - r4.r3)],
["a " + r4.r3 + "," + r4.r3 + ",0,0,1," + -r4.r3 + "," + r4.r3],
["l " + (r4.r3 + r4.r4 - w4) + ",0"],
["a " + r4.r4 + "," + r4.r4 + ",0,0,1," + -r4.r4 + "," + -r4.r4],
["l 0," + (r4.r4 + r4.r1 - h3)],
["a " + r4.r1 + "," + r4.r1 + ",0,0,1," + r4.r1 + "," + -r4.r1],
["z"]
];
return d3.join(" ");
};
return Rect4;
}(base_default16);
var rect_default3 = Rect2;
// node_modules/@antv/g-svg/esm/shape/text.js
var LETTER_SPACING = 0.3;
var BASELINE_MAP = {
top: "before-edge",
middle: "central",
bottom: "after-edge",
alphabetic: "baseline",
hanging: "hanging"
};
var BASELINE_MAP_FOR_FIREFOX = {
top: "text-before-edge",
middle: "central",
bottom: "text-after-edge",
alphabetic: "alphabetic",
hanging: "hanging"
};
var ANCHOR_MAP = {
left: "left",
start: "left",
center: "middle",
right: "end",
end: "end"
};
var Text2 = function(_super) {
__extends(Text3, _super);
function Text3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "text";
_this.canFill = true;
_this.canStroke = true;
return _this;
}
Text3.prototype.getDefaultAttrs = function() {
var attrs = _super.prototype.getDefaultAttrs.call(this);
return __assign(__assign({}, attrs), { x: 0, y: 0, text: null, fontSize: 12, fontFamily: "sans-serif", fontStyle: "normal", fontWeight: "normal", fontVariant: "normal", textAlign: "start", textBaseline: "bottom" });
};
Text3.prototype.createPath = function(context, targetAttrs) {
var _this = this;
var attrs = this.attr();
var el = this.get("el");
this._setFont();
each_default(targetAttrs || attrs, function(value2, attr) {
if (attr === "text") {
_this._setText("" + value2);
} else if (attr === "matrix" && value2) {
setTransform(_this);
} else if (SVG_ATTR_MAP[attr]) {
el.setAttribute(SVG_ATTR_MAP[attr], value2);
}
});
el.setAttribute("paint-order", "stroke");
el.setAttribute("style", "stroke-linecap:butt; stroke-linejoin:miter;");
};
Text3.prototype._setFont = function() {
var el = this.get("el");
var _a6 = this.attr(), textBaseline = _a6.textBaseline, textAlign = _a6.textAlign;
var browser2 = detect();
if (browser2 && browser2.name === "firefox") {
el.setAttribute("dominant-baseline", BASELINE_MAP_FOR_FIREFOX[textBaseline] || "alphabetic");
} else {
el.setAttribute("alignment-baseline", BASELINE_MAP[textBaseline] || "baseline");
}
el.setAttribute("text-anchor", ANCHOR_MAP[textAlign] || "left");
};
Text3.prototype._setText = function(text) {
var el = this.get("el");
var _a6 = this.attr(), x6 = _a6.x, _b = _a6.textBaseline, baseline = _b === void 0 ? "bottom" : _b;
if (!text) {
el.innerHTML = "";
} else if (~text.indexOf("\n")) {
var textArr = text.split("\n");
var textLen_1 = textArr.length - 1;
var arr_1 = "";
each_default(textArr, function(segment, i4) {
if (i4 === 0) {
if (baseline === "alphabetic") {
arr_1 += '' + segment + "";
} else if (baseline === "top") {
arr_1 += '' + segment + "";
} else if (baseline === "middle") {
arr_1 += '' + segment + "";
} else if (baseline === "bottom") {
arr_1 += '' + segment + "";
} else if (baseline === "hanging") {
arr_1 += '' + segment + "";
}
} else {
arr_1 += '' + segment + "";
}
});
el.innerHTML = arr_1;
} else {
el.innerHTML = text;
}
};
return Text3;
}(base_default16);
var text_default4 = Text2;
// node_modules/@antv/g-svg/esm/defs/gradient.js
var regexLG3 = /^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i;
var regexRG3 = /^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i;
var regexColorStop3 = /[\d.]+:(#[^\s]+|[^)]+\))/gi;
function addStop2(steps) {
var arr = steps.match(regexColorStop3);
if (!arr) {
return "";
}
var stops = "";
arr.sort(function(a4, b10) {
a4 = a4.split(":");
b10 = b10.split(":");
return Number(a4[0]) - Number(b10[0]);
});
each_default(arr, function(item) {
item = item.split(":");
stops += '';
});
return stops;
}
function parseLineGradient2(color4, el) {
var arr = regexLG3.exec(color4);
var angle3 = mod_default(to_radian_default(parseFloat(arr[1])), Math.PI * 2);
var steps = arr[2];
var start;
var end2;
if (angle3 >= 0 && angle3 < 0.5 * Math.PI) {
start = {
x: 0,
y: 0
};
end2 = {
x: 1,
y: 1
};
} else if (0.5 * Math.PI <= angle3 && angle3 < Math.PI) {
start = {
x: 1,
y: 0
};
end2 = {
x: 0,
y: 1
};
} else if (Math.PI <= angle3 && angle3 < 1.5 * Math.PI) {
start = {
x: 1,
y: 1
};
end2 = {
x: 0,
y: 0
};
} else {
start = {
x: 0,
y: 1
};
end2 = {
x: 1,
y: 0
};
}
var tanTheta = Math.tan(angle3);
var tanTheta2 = tanTheta * tanTheta;
var x6 = (end2.x - start.x + tanTheta * (end2.y - start.y)) / (tanTheta2 + 1) + start.x;
var y5 = tanTheta * (end2.x - start.x + tanTheta * (end2.y - start.y)) / (tanTheta2 + 1) + start.y;
el.setAttribute("x1", start.x);
el.setAttribute("y1", start.y);
el.setAttribute("x2", x6);
el.setAttribute("y2", y5);
el.innerHTML = addStop2(steps);
}
function parseRadialGradient2(color4, self2) {
var arr = regexRG3.exec(color4);
var cx = parseFloat(arr[1]);
var cy = parseFloat(arr[2]);
var r4 = parseFloat(arr[3]);
var steps = arr[4];
self2.setAttribute("cx", cx);
self2.setAttribute("cy", cy);
self2.setAttribute("r", r4);
self2.innerHTML = addStop2(steps);
}
var Gradient = function() {
function Gradient2(cfg) {
this.cfg = {};
var el = null;
var id = unique_id_default("gradient_");
if (cfg.toLowerCase()[0] === "l") {
el = createSVGElement("linearGradient");
parseLineGradient2(cfg, el);
} else {
el = createSVGElement("radialGradient");
parseRadialGradient2(cfg, el);
}
el.setAttribute("id", id);
this.el = el;
this.id = id;
this.cfg = cfg;
return this;
}
Gradient2.prototype.match = function(type2, attr) {
return this.cfg === attr;
};
return Gradient2;
}();
var gradient_default = Gradient;
// node_modules/@antv/g-svg/esm/defs/shadow.js
var ATTR_MAP = {
shadowColor: "color",
shadowOpacity: "opacity",
shadowBlur: "blur",
shadowOffsetX: "dx",
shadowOffsetY: "dy"
};
var SHADOW_DIMENSION = {
x: "-40%",
y: "-40%",
width: "200%",
height: "200%"
};
var Shadow = function() {
function Shadow2(cfg) {
this.type = "filter";
this.cfg = {};
this.type = "filter";
var el = createSVGElement("filter");
each_default(SHADOW_DIMENSION, function(v3, k4) {
el.setAttribute(k4, v3);
});
this.el = el;
this.id = unique_id_default("filter_");
this.el.id = this.id;
this.cfg = cfg;
this._parseShadow(cfg, el);
return this;
}
Shadow2.prototype.match = function(type2, cfg) {
if (this.type !== type2) {
return false;
}
var flag = true;
var config = this.cfg;
each_default(Object.keys(config), function(attr) {
if (config[attr] !== cfg[attr]) {
flag = false;
return false;
}
});
return flag;
};
Shadow2.prototype.update = function(name, value2) {
var config = this.cfg;
config[ATTR_MAP[name]] = value2;
this._parseShadow(config, this.el);
return this;
};
Shadow2.prototype._parseShadow = function(config, el) {
var child = '';
el.innerHTML = child;
};
return Shadow2;
}();
var shadow_default = Shadow;
// node_modules/@antv/g-svg/esm/defs/arrow.js
var Arrow = function() {
function Arrow2(attrs, type2) {
this.cfg = {};
var el = createSVGElement("marker");
var id = unique_id_default("marker_");
el.setAttribute("id", id);
var shape = createSVGElement("path");
shape.setAttribute("stroke", attrs.stroke || "none");
shape.setAttribute("fill", attrs.fill || "none");
el.appendChild(shape);
el.setAttribute("overflow", "visible");
el.setAttribute("orient", "auto-start-reverse");
this.el = el;
this.child = shape;
this.id = id;
var cfg = attrs[type2 === "marker-start" ? "startArrow" : "endArrow"];
this.stroke = attrs.stroke || "#000";
if (cfg === true) {
this._setDefaultPath(type2, shape);
} else {
this.cfg = cfg;
this._setMarker(attrs.lineWidth, shape);
}
return this;
}
Arrow2.prototype.match = function() {
return false;
};
Arrow2.prototype._setDefaultPath = function(type2, el) {
var parent = this.el;
el.setAttribute("d", "M0,0 L" + 10 * Math.cos(Math.PI / 6) + ",5 L0,10");
parent.setAttribute("refX", "" + 10 * Math.cos(Math.PI / 6));
parent.setAttribute("refY", "" + 5);
};
Arrow2.prototype._setMarker = function(r4, el) {
var parent = this.el;
var path = this.cfg.path;
var d3 = this.cfg.d;
if (is_array_default(path)) {
path = path.map(function(segment) {
return segment.join(" ");
}).join("");
}
el.setAttribute("d", path);
parent.appendChild(el);
if (d3) {
parent.setAttribute("refX", "" + d3 / r4);
}
};
Arrow2.prototype.update = function(fill) {
var child = this.child;
if (child.attr) {
child.attr("fill", fill);
} else {
child.setAttribute("fill", fill);
}
};
return Arrow2;
}();
var arrow_default = Arrow;
// node_modules/@antv/g-svg/esm/defs/clip.js
var Clip = function() {
function Clip2(cfg) {
this.type = "clip";
this.cfg = {};
var el = createSVGElement("clipPath");
this.el = el;
this.id = unique_id_default("clip_");
el.id = this.id;
var shapeEl = cfg.cfg.el;
el.appendChild(shapeEl);
this.cfg = cfg;
return this;
}
Clip2.prototype.match = function() {
return false;
};
Clip2.prototype.remove = function() {
var el = this.el;
el.parentNode.removeChild(el);
};
return Clip2;
}();
var clip_default = Clip;
// node_modules/@antv/g-svg/esm/defs/pattern.js
var regexPR2 = /^p\s*\(\s*([axyn])\s*\)\s*(.*)/i;
var Pattern = function() {
function Pattern2(cfg) {
this.cfg = {};
var el = createSVGElement("pattern");
el.setAttribute("patternUnits", "userSpaceOnUse");
var child = createSVGElement("image");
el.appendChild(child);
var id = unique_id_default("pattern_");
el.id = id;
this.el = el;
this.id = id;
this.cfg = cfg;
var arr = regexPR2.exec(cfg);
var source = arr[2];
child.setAttribute("href", source);
var img = new Image();
if (!source.match(/^data:/i)) {
img.crossOrigin = "Anonymous";
}
img.src = source;
function onload() {
el.setAttribute("width", "" + img.width);
el.setAttribute("height", "" + img.height);
}
if (img.complete) {
onload();
} else {
img.onload = onload;
img.src = img.src;
}
return this;
}
Pattern2.prototype.match = function(type2, attr) {
return this.cfg === attr;
};
return Pattern2;
}();
var pattern_default = Pattern;
// node_modules/@antv/g-svg/esm/defs/index.js
var Defs = function() {
function Defs2(canvas) {
var el = createSVGElement("defs");
var id = unique_id_default("defs_");
el.id = id;
canvas.appendChild(el);
this.children = [];
this.defaultArrow = {};
this.el = el;
this.canvas = canvas;
}
Defs2.prototype.find = function(type2, attr) {
var children = this.children;
var result = null;
for (var i4 = 0; i4 < children.length; i4++) {
if (children[i4].match(type2, attr)) {
result = children[i4].id;
break;
}
}
return result;
};
Defs2.prototype.findById = function(id) {
var children = this.children;
var flag = null;
for (var i4 = 0; i4 < children.length; i4++) {
if (children[i4].id === id) {
flag = children[i4];
break;
}
}
return flag;
};
Defs2.prototype.add = function(item) {
this.children.push(item);
item.canvas = this.canvas;
item.parent = this;
};
Defs2.prototype.getDefaultArrow = function(attrs, name) {
var stroke = attrs.stroke || attrs.strokeStyle;
if (this.defaultArrow[stroke]) {
return this.defaultArrow[stroke].id;
}
var arrow = new arrow_default(attrs, name);
this.defaultArrow[stroke] = arrow;
this.el.appendChild(arrow.el);
this.add(arrow);
return arrow.id;
};
Defs2.prototype.addGradient = function(cfg) {
var gradient2 = new gradient_default(cfg);
this.el.appendChild(gradient2.el);
this.add(gradient2);
return gradient2.id;
};
Defs2.prototype.addArrow = function(attrs, name) {
var arrow = new arrow_default(attrs, name);
this.el.appendChild(arrow.el);
this.add(arrow);
return arrow.id;
};
Defs2.prototype.addShadow = function(cfg) {
var shadow = new shadow_default(cfg);
this.el.appendChild(shadow.el);
this.add(shadow);
return shadow.id;
};
Defs2.prototype.addPattern = function(cfg) {
var pattern2 = new pattern_default(cfg);
this.el.appendChild(pattern2.el);
this.add(pattern2);
return pattern2.id;
};
Defs2.prototype.addClip = function(cfg) {
var clip = new clip_default(cfg);
this.el.appendChild(clip.el);
this.add(clip);
return clip.id;
};
return Defs2;
}();
var defs_default = Defs;
// node_modules/@antv/g-svg/esm/canvas.js
var Canvas3 = function(_super) {
__extends(Canvas4, _super);
function Canvas4(cfg) {
return _super.call(this, __assign(__assign({}, cfg), {
autoDraw: true,
renderer: "svg"
})) || this;
}
Canvas4.prototype.getShapeBase = function() {
return shape_exports2;
};
Canvas4.prototype.getGroupBase = function() {
return group_default4;
};
Canvas4.prototype.getShape = function(x6, y5, ev) {
var target = ev.target || ev.srcElement;
if (!SHAPE_TO_TAGS[target.tagName]) {
var parent_1 = target.parentNode;
while (parent_1 && !SHAPE_TO_TAGS[parent_1.tagName]) {
parent_1 = parent_1.parentNode;
}
target = parent_1;
}
return this.find(function(child) {
return child.get("el") === target;
});
};
Canvas4.prototype.createDom = function() {
var element = createSVGElement("svg");
var context = new defs_default(element);
element.setAttribute("width", "" + this.get("width"));
element.setAttribute("height", "" + this.get("height"));
this.set("context", context);
return element;
};
Canvas4.prototype.onCanvasChange = function(changeType) {
var context = this.get("context");
var el = this.get("el");
if (changeType === "sort") {
var children_1 = this.get("children");
if (children_1 && children_1.length) {
sortDom(this, function(a4, b10) {
return children_1.indexOf(a4) - children_1.indexOf(b10) ? 1 : 0;
});
}
} else if (changeType === "clear") {
if (el) {
el.innerHTML = "";
var defsEl = context.el;
defsEl.innerHTML = "";
el.appendChild(defsEl);
}
} else if (changeType === "matrix") {
setTransform(this);
} else if (changeType === "clip") {
setClip(this, context);
} else if (changeType === "changeSize") {
el.setAttribute("width", "" + this.get("width"));
el.setAttribute("height", "" + this.get("height"));
}
};
Canvas4.prototype.draw = function() {
var context = this.get("context");
var children = this.getChildren();
setClip(this, context);
if (children.length) {
drawChildren2(context, children);
}
};
return Canvas4;
}(canvas_default);
var canvas_default3 = Canvas3;
// node_modules/@antv/g-svg/esm/index.js
var version2 = "0.5.6";
// node_modules/@antv/g2/esm/geometry/path.js
var Path3 = function(_super) {
__extends(Path4, _super);
function Path4(cfg) {
var _this = _super.call(this, cfg) || this;
_this.type = "path";
_this.shapeType = "line";
var _a6 = cfg.connectNulls, connectNulls = _a6 === void 0 ? false : _a6, _b = cfg.showSinglePoint, showSinglePoint = _b === void 0 ? true : _b;
_this.connectNulls = connectNulls;
_this.showSinglePoint = showSinglePoint;
return _this;
}
Path4.prototype.updateElements = function(mappingDataArray, isUpdate) {
if (isUpdate === void 0) {
isUpdate = false;
}
var keyData = new Map();
var keyIndex = new Map();
var keys2 = [];
var index2 = 0;
for (var i4 = 0; i4 < mappingDataArray.length; i4++) {
var mappingData = mappingDataArray[i4];
var key = this.getElementId(mappingData);
keys2.push(key);
keyData.set(key, mappingData);
keyIndex.set(key, index2);
index2++;
}
this.elements = new Array(index2);
var _a6 = diff(this.lastElementsMap, keys2), added = _a6.added, updated = _a6.updated, removed = _a6.removed;
for (var _i = 0, added_1 = added; _i < added_1.length; _i++) {
var key = added_1[_i];
var mappingData = keyData.get(key);
var shapeFactory = this.getShapeFactory();
var shapeCfg = this.getShapeInfo(mappingData);
var i4 = keyIndex.get(key);
var element = new element_default2({
shapeFactory,
container: this.container,
offscreenGroup: this.getOffscreenGroup(),
elementIndex: i4
});
element.geometry = this;
element.animate = this.animateOption;
element.draw(shapeCfg, isUpdate);
this.elementsMap[key] = element;
this.elements[i4] = element;
}
for (var _b = 0, updated_1 = updated; _b < updated_1.length; _b++) {
var key = updated_1[_b];
var mappingData = keyData.get(key);
var element = this.lastElementsMap[key];
var i4 = keyIndex.get(key);
var shapeCfg = this.getShapeInfo(mappingData);
var preShapeCfg = element.getModel();
if (this.isCoordinateChanged || isModelChange(preShapeCfg, shapeCfg)) {
element.animate = this.animateOption;
element.update(shapeCfg);
}
this.elementsMap[key] = element;
this.elements[i4] = element;
}
for (var _c = 0, removed_1 = removed; _c < removed_1.length; _c++) {
var key = removed_1[_c];
var element = this.lastElementsMap[key];
element.animate = this.animateOption;
element.destroy();
}
};
Path4.prototype.getPointsAndData = function(mappingData) {
var points = [];
var data3 = [];
for (var i4 = 0, len5 = mappingData.length; i4 < len5; i4++) {
var obj = mappingData[i4];
points.push({
x: obj.x,
y: obj.y
});
data3.push(obj[FIELD_ORIGIN]);
}
return {
points,
data: data3
};
};
Path4.prototype.getShapeInfo = function(mappingData) {
var shapeCfg = this.getDrawCfg(mappingData[0]);
var _a6 = this.getPointsAndData(mappingData), points = _a6.points, data3 = _a6.data;
shapeCfg.mappingData = mappingData;
shapeCfg.data = data3;
shapeCfg.isStack = !!this.getAdjust("stack");
shapeCfg.points = points;
shapeCfg.connectNulls = this.connectNulls;
shapeCfg.showSinglePoint = this.showSinglePoint;
return shapeCfg;
};
return Path4;
}(base_default13);
var path_default5 = Path3;
// node_modules/@antv/g2/esm/geometry/shape/area/util.js
function getPath2(points, isInCircle, smooth, registeredShape, constraint) {
var path = [];
if (points.length) {
var topLinePoints_1 = [];
var bottomLinePoints_1 = [];
for (var i4 = 0, len5 = points.length; i4 < len5; i4++) {
var point2 = points[i4];
topLinePoints_1.push(point2[1]);
bottomLinePoints_1.push(point2[0]);
}
bottomLinePoints_1 = bottomLinePoints_1.reverse();
each_default([topLinePoints_1, bottomLinePoints_1], function(pointsData, index2) {
var subPath = [];
var parsedPoints = registeredShape.parsePoints(pointsData);
var p1 = parsedPoints[0];
if (topLinePoints_1.length === 1 && bottomLinePoints_1.length === 1) {
subPath = index2 === 0 ? [
["M", p1.x - 0.5, p1.y],
["L", p1.x + 0.5, p1.y]
] : [
["L", p1.x + 0.5, p1.y],
["L", p1.x - 0.5, p1.y]
];
} else {
if (isInCircle) {
parsedPoints.push({ x: p1.x, y: p1.y });
}
if (smooth) {
subPath = getSplinePath(parsedPoints, false, constraint);
} else {
subPath = getLinePath2(parsedPoints, false);
}
if (index2 > 0) {
subPath[0][0] = "L";
}
}
path = path.concat(subPath);
});
path.push(["Z"]);
}
return path;
}
function getShapeAttrs2(cfg, isStroke, smooth, registeredShape, constraint) {
var attrs = getStyle2(cfg, isStroke, !isStroke, "lineWidth");
var connectNulls = cfg.connectNulls, isInCircle = cfg.isInCircle, points = cfg.points, showSinglePoint = cfg.showSinglePoint;
var pathPoints = getPathPoints(points, connectNulls, showSinglePoint);
var path = [];
for (var i4 = 0, len5 = pathPoints.length; i4 < len5; i4++) {
var eachPoints = pathPoints[i4];
path = path.concat(getPath2(eachPoints, isInCircle, smooth, registeredShape, constraint));
}
attrs.path = path;
return attrs;
}
function getConstraint(coordinate11) {
var start = coordinate11.start, end2 = coordinate11.end;
return [
[start.x, end2.y],
[end2.x, start.y]
];
}
// node_modules/@antv/g2/esm/geometry/shape/area/index.js
var AreaShapeFactory = registerShapeFactory("area", {
defaultShapeType: "area",
getDefaultPoints: function(pointInfo) {
var x6 = pointInfo.x, y0 = pointInfo.y0;
var y5 = is_array_default(pointInfo.y) ? pointInfo.y : [y0, pointInfo.y];
return y5.map(function(yItem) {
return {
x: x6,
y: yItem
};
});
}
});
registerShape("area", "area", {
draw: function(cfg, container2) {
var attrs = getShapeAttrs2(cfg, false, false, this);
var shape = container2.addShape({
type: "path",
attrs,
name: "area"
});
return shape;
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: function(x6, y5, r4) {
if (r4 === void 0) {
r4 = 5.5;
}
return [["M", x6 - r4, y5 - 4], ["L", x6 + r4, y5 - 4], ["L", x6 + r4, y5 + 4], ["L", x6 - r4, y5 + 4], ["Z"]];
},
style: {
r: 5,
fill: color4
}
};
}
});
// node_modules/@antv/g2/esm/geometry/area.js
var Area = function(_super) {
__extends(Area3, _super);
function Area3(cfg) {
var _this = _super.call(this, cfg) || this;
_this.type = "area";
_this.shapeType = "area";
_this.generatePoints = true;
_this.startOnZero = true;
var _a6 = cfg.startOnZero, startOnZero = _a6 === void 0 ? true : _a6, _b = cfg.sortable, sortable = _b === void 0 ? false : _b, _c = cfg.showSinglePoint, showSinglePoint = _c === void 0 ? false : _c;
_this.startOnZero = startOnZero;
_this.sortable = sortable;
_this.showSinglePoint = showSinglePoint;
return _this;
}
Area3.prototype.getPointsAndData = function(mappingData) {
var points = [];
var data3 = [];
for (var i4 = 0, len5 = mappingData.length; i4 < len5; i4++) {
var obj = mappingData[i4];
points.push(obj.points);
data3.push(obj[FIELD_ORIGIN]);
}
return {
points,
data: data3
};
};
Area3.prototype.getYMinValue = function() {
if (this.startOnZero) {
return _super.prototype.getYMinValue.call(this);
}
var yScale = this.getYScale();
return yScale.min;
};
return Area3;
}(path_default5);
var area_default = Area;
// node_modules/@antv/g2/esm/geometry/shape/edge/index.js
var EdgeShapeFactory = registerShapeFactory("edge", {
defaultShapeType: "line",
getDefaultPoints: function(pointInfo) {
return splitPoints(pointInfo);
}
});
registerShape("edge", "line", {
draw: function(cfg, container2) {
var style = getStyle2(cfg, true, false, "lineWidth");
var path = getLinePath2(this.parsePoints(cfg.points), this.coordinate.isPolar);
return container2.addShape("path", {
attrs: __assign(__assign({}, style), { path })
});
},
getMarker: function(markerCfg) {
return {
symbol: "circle",
style: {
r: 4.5,
fill: markerCfg.color
}
};
}
});
// node_modules/@antv/g2/esm/geometry/edge.js
var Edge = function(_super) {
__extends(Edge4, _super);
function Edge4() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "edge";
_this.shapeType = "edge";
_this.generatePoints = true;
return _this;
}
return Edge4;
}(base_default13);
var edge_default = Edge;
// node_modules/@antv/g2/esm/geometry/heatmap.js
var Heatmap = function(_super) {
__extends(Heatmap3, _super);
function Heatmap3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "heatmap";
_this.paletteCache = {};
return _this;
}
Heatmap3.prototype.updateElements = function(mappingDataArray, isUpdate) {
if (isUpdate === void 0) {
isUpdate = false;
}
for (var i4 = 0; i4 < mappingDataArray.length; i4++) {
var mappingData = mappingDataArray[i4];
var range = this.prepareRange(mappingData);
var radius = this.prepareSize();
var blur_1 = get_default(this.styleOption, ["cfg", "shadowBlur"]);
if (!is_number_default(blur_1)) {
blur_1 = radius / 2;
}
this.prepareGreyScaleBlurredCircle(radius, blur_1);
this.drawWithRange(mappingData, range, radius, blur_1);
}
};
Heatmap3.prototype.color = function(field6, cfg) {
this.createAttrOption("color", field6, typeof cfg !== "function" ? cfg : "");
return this;
};
Heatmap3.prototype.clear = function() {
_super.prototype.clear.call(this);
this.clearShadowCanvasCtx();
this.paletteCache = {};
};
Heatmap3.prototype.prepareRange = function(data3) {
var colorAttr = this.getAttribute("color");
var colorField = colorAttr.getFields()[0];
var min7 = Infinity;
var max8 = -Infinity;
data3.forEach(function(row) {
var value2 = row[FIELD_ORIGIN][colorField];
if (value2 > max8) {
max8 = value2;
}
if (value2 < min7) {
min7 = value2;
}
});
if (min7 === max8) {
min7 = max8 - 1;
}
return [min7, max8];
};
Heatmap3.prototype.prepareSize = function() {
var radius = this.getDefaultValue("size");
if (!is_number_default(radius)) {
radius = this.getDefaultSize();
}
return radius;
};
Heatmap3.prototype.prepareGreyScaleBlurredCircle = function(radius, blur) {
var grayScaleBlurredCanvas = this.getGrayScaleBlurredCanvas();
var r22 = radius + blur;
var ctx4 = grayScaleBlurredCanvas.getContext("2d");
grayScaleBlurredCanvas.width = grayScaleBlurredCanvas.height = r22 * 2;
ctx4.clearRect(0, 0, grayScaleBlurredCanvas.width, grayScaleBlurredCanvas.height);
ctx4.shadowOffsetX = ctx4.shadowOffsetY = r22 * 2;
ctx4.shadowBlur = blur;
ctx4.shadowColor = "black";
ctx4.beginPath();
ctx4.arc(-r22, -r22, radius, 0, Math.PI * 2, true);
ctx4.closePath();
ctx4.fill();
};
Heatmap3.prototype.drawWithRange = function(data3, range, radius, blur) {
var _a6 = this.coordinate, start = _a6.start, end2 = _a6.end;
var width2 = this.coordinate.getWidth();
var height = this.coordinate.getHeight();
var colorAttr = this.getAttribute("color");
var valueField = colorAttr.getFields()[0];
this.clearShadowCanvasCtx();
var ctx4 = this.getShadowCanvasCtx();
if (range) {
data3 = data3.filter(function(row) {
return row[FIELD_ORIGIN][valueField] <= range[1] && row[FIELD_ORIGIN][valueField] >= range[0];
});
}
var scale12 = this.scales[valueField];
for (var _i = 0, data_1 = data3; _i < data_1.length; _i++) {
var obj = data_1[_i];
var _b = this.getDrawCfg(obj), x6 = _b.x, y5 = _b.y;
var alpha = scale12.scale(obj[FIELD_ORIGIN][valueField]);
this.drawGrayScaleBlurredCircle(x6 - start.x, y5 - end2.y, radius + blur, alpha, ctx4);
}
var colored = ctx4.getImageData(0, 0, width2, height);
this.clearShadowCanvasCtx();
this.colorize(colored);
ctx4.putImageData(colored, 0, 0);
var imageShape = this.getImageShape();
imageShape.attr("x", start.x);
imageShape.attr("y", end2.y);
imageShape.attr("width", width2);
imageShape.attr("height", height);
imageShape.attr("img", ctx4.canvas);
imageShape.set("origin", this.getShapeInfo(data3));
};
Heatmap3.prototype.getDefaultSize = function() {
var position2 = this.getAttribute("position");
var coordinate11 = this.coordinate;
return Math.min(coordinate11.getWidth() / (position2.scales[0].ticks.length * 4), coordinate11.getHeight() / (position2.scales[1].ticks.length * 4));
};
Heatmap3.prototype.clearShadowCanvasCtx = function() {
var ctx4 = this.getShadowCanvasCtx();
ctx4.clearRect(0, 0, ctx4.canvas.width, ctx4.canvas.height);
};
Heatmap3.prototype.getShadowCanvasCtx = function() {
var canvas = this.shadowCanvas;
if (!canvas) {
canvas = document.createElement("canvas");
this.shadowCanvas = canvas;
}
canvas.width = this.coordinate.getWidth();
canvas.height = this.coordinate.getHeight();
return canvas.getContext("2d");
};
Heatmap3.prototype.getGrayScaleBlurredCanvas = function() {
if (!this.grayScaleBlurredCanvas) {
this.grayScaleBlurredCanvas = document.createElement("canvas");
}
return this.grayScaleBlurredCanvas;
};
Heatmap3.prototype.drawGrayScaleBlurredCircle = function(x6, y5, r4, alpha, ctx4) {
var grayScaleBlurredCanvas = this.getGrayScaleBlurredCanvas();
ctx4.globalAlpha = alpha;
ctx4.drawImage(grayScaleBlurredCanvas, x6 - r4, y5 - r4);
};
Heatmap3.prototype.colorize = function(img) {
var colorAttr = this.getAttribute("color");
var pixels = img.data;
var paletteCache = this.paletteCache;
for (var i4 = 3; i4 < pixels.length; i4 += 4) {
var alpha = pixels[i4];
if (is_number_default(alpha)) {
var palette = paletteCache[alpha] ? paletteCache[alpha] : esm_default2.rgb2arr(colorAttr.gradient(alpha / 256));
pixels[i4 - 3] = palette[0];
pixels[i4 - 2] = palette[1];
pixels[i4 - 1] = palette[2];
pixels[i4] = alpha;
}
}
};
Heatmap3.prototype.getImageShape = function() {
var imageShape = this.imageShape;
if (imageShape) {
return imageShape;
}
var container2 = this.container;
imageShape = container2.addShape({
type: "image",
attrs: {}
});
this.imageShape = imageShape;
return imageShape;
};
Heatmap3.prototype.getShapeInfo = function(mappingData) {
var shapeCfg = this.getDrawCfg(mappingData[0]);
var data3 = mappingData.map(function(obj) {
return obj[FIELD_ORIGIN];
});
return __assign(__assign({}, shapeCfg), { mappingData, data: data3 });
};
return Heatmap3;
}(base_default13);
var heatmap_default = Heatmap;
// node_modules/@antv/g2/esm/geometry/shape/interval/util.js
function getRectPoints(pointInfo) {
var x6 = pointInfo.x, y5 = pointInfo.y, y0 = pointInfo.y0, size2 = pointInfo.size;
var yMin;
var yMax;
if (is_array_default(y5)) {
yMin = y5[0], yMax = y5[1];
} else {
yMin = y0;
yMax = y5;
}
var xMin;
var xMax;
if (is_array_default(x6)) {
xMin = x6[0], xMax = x6[1];
} else {
xMin = x6 - size2 / 2;
xMax = x6 + size2 / 2;
}
var points = [
{ x: xMin, y: yMin },
{ x: xMin, y: yMax }
];
points.push({ x: xMax, y: yMax }, { x: xMax, y: yMin });
return points;
}
function getRectPath(points, isClosed) {
if (isClosed === void 0) {
isClosed = true;
}
var path = [];
var firstPoint = points[0];
path.push(["M", firstPoint.x, firstPoint.y]);
for (var i4 = 1, len5 = points.length; i4 < len5; i4++) {
path.push(["L", points[i4].x, points[i4].y]);
}
if (isClosed) {
path.push(["L", firstPoint.x, firstPoint.y]);
path.push(["z"]);
}
return path;
}
function parseRadius3(radius, minLength) {
var r1 = 0;
var r22 = 0;
var r32 = 0;
var r4 = 0;
if (is_array_default(radius)) {
if (radius.length === 1) {
r1 = r22 = r32 = r4 = radius[0];
} else if (radius.length === 2) {
r1 = r32 = radius[0];
r22 = r4 = radius[1];
} else if (radius.length === 3) {
r1 = radius[0];
r22 = r4 = radius[1];
r32 = radius[2];
} else {
r1 = radius[0];
r22 = radius[1];
r32 = radius[2];
r4 = radius[3];
}
} else {
r1 = r22 = r32 = r4 = radius;
}
if (r1 + r22 > minLength) {
r1 = r1 ? minLength / (1 + r22 / r1) : 0;
r22 = minLength - r1;
}
if (r32 + r4 > minLength) {
r32 = r32 ? minLength / (1 + r4 / r32) : 0;
r4 = minLength - r32;
}
return [r1 || 0, r22 || 0, r32 || 0, r4 || 0];
}
function getBackgroundRectPath(cfg, points, coordinate11) {
var path = [];
if (coordinate11.isRect) {
var p0 = coordinate11.isTransposed ? { x: coordinate11.start.x, y: points[0].y } : { x: points[0].x, y: coordinate11.start.y };
var p1 = coordinate11.isTransposed ? { x: coordinate11.end.x, y: points[2].y } : { x: points[3].x, y: coordinate11.end.y };
var radius = get_default(cfg, ["background", "style", "radius"]);
if (radius) {
var width2 = coordinate11.isTransposed ? Math.abs(points[0].y - points[2].y) : points[2].x - points[1].x;
var height = coordinate11.isTransposed ? coordinate11.getWidth() : coordinate11.getHeight();
var _a6 = parseRadius3(radius, Math.min(width2, height)), r1 = _a6[0], r22 = _a6[1], r32 = _a6[2], r4 = _a6[3];
path.push(["M", p0.x, p1.y + r1]);
r1 !== 0 && path.push(["A", r1, r1, 0, 0, 1, p0.x + r1, p1.y]);
path.push(["L", p1.x - r22, p1.y]);
r22 !== 0 && path.push(["A", r22, r22, 0, 0, 1, p1.x, p1.y + r22]);
path.push(["L", p1.x, p0.y - r32]);
r32 !== 0 && path.push(["A", r32, r32, 0, 0, 1, p1.x - r32, p0.y]);
path.push(["L", p0.x + r4, p0.y]);
r4 !== 0 && path.push(["A", r4, r4, 0, 0, 1, p0.x, p0.y - r4]);
} else {
path.push(["M", p0.x, p0.y]);
path.push(["L", p1.x, p0.y]);
path.push(["L", p1.x, p1.y]);
path.push(["L", p0.x, p1.y]);
path.push(["L", p0.x, p0.y]);
}
path.push(["z"]);
}
if (coordinate11.isPolar) {
var center2 = coordinate11.getCenter();
var _b = getAngle3(cfg, coordinate11), startAngle = _b.startAngle, endAngle = _b.endAngle;
if (coordinate11.type !== "theta" && !coordinate11.isTransposed) {
path = getSectorPath(center2.x, center2.y, coordinate11.getRadius(), startAngle, endAngle);
} else {
var pow2 = function(v3) {
return Math.pow(v3, 2);
};
var r1 = Math.sqrt(pow2(center2.x - points[0].x) + pow2(center2.y - points[0].y));
var r22 = Math.sqrt(pow2(center2.x - points[2].x) + pow2(center2.y - points[2].y));
path = getSectorPath(center2.x, center2.y, r1, coordinate11.startAngle, coordinate11.endAngle, r22);
}
}
return path;
}
function getIntervalRectPath(points, lineCap, coor) {
var width2 = coor.getWidth();
var height = coor.getHeight();
var isRect = coor.type === "rect";
var path = [];
var r4 = (points[2].x - points[1].x) / 2;
var ry = coor.isTransposed ? r4 * height / width2 : r4 * width2 / height;
if (lineCap === "round") {
if (isRect) {
path.push(["M", points[0].x, points[0].y + ry]);
path.push(["L", points[1].x, points[1].y - ry]);
path.push(["A", r4, r4, 0, 0, 1, points[2].x, points[2].y - ry]);
path.push(["L", points[3].x, points[3].y + ry]);
path.push(["A", r4, r4, 0, 0, 1, points[0].x, points[0].y + ry]);
} else {
path.push(["M", points[0].x, points[0].y]);
path.push(["L", points[1].x, points[1].y]);
path.push(["A", r4, r4, 0, 0, 1, points[2].x, points[2].y]);
path.push(["L", points[3].x, points[3].y]);
path.push(["A", r4, r4, 0, 0, 1, points[0].x, points[0].y]);
}
path.push(["z"]);
} else {
path = getRectPath(points);
}
return path;
}
function getFunnelPath(points, nextPoints, isPyramid) {
var path = [];
if (!is_nil_default(nextPoints)) {
path.push(["M", points[0].x, points[0].y], ["L", points[1].x, points[1].y], ["L", nextPoints[1].x, nextPoints[1].y], ["L", nextPoints[0].x, nextPoints[0].y], ["Z"]);
} else if (isPyramid) {
path.push(["M", points[0].x, points[0].y], ["L", points[1].x, points[1].y], ["L", (points[2].x + points[3].x) / 2, (points[2].y + points[3].y) / 2], ["Z"]);
} else {
path.push(["M", points[0].x, points[0].y], ["L", points[1].x, points[1].y], ["L", points[2].x, points[2].y], ["L", points[3].x, points[3].y], ["Z"]);
}
return path;
}
function swap(p0, p1) {
return [p1, p0];
}
function getRectWithCornerRadius(points, coordinate11, radius) {
var _a6, _b, _c, _d, _e, _f, _g;
var _h = __spreadArray([], points, true), p0 = _h[0], p1 = _h[1], p22 = _h[2], p32 = _h[3];
var _j = typeof radius === "number" ? Array(4).fill(radius) : radius, r1 = _j[0], r22 = _j[1], r32 = _j[2], r4 = _j[3];
if (coordinate11.isTransposed) {
_a6 = swap(p1, p32), p1 = _a6[0], p32 = _a6[1];
_b = [r4, r1, r22, r32], r1 = _b[0], r22 = _b[1], r32 = _b[2], r4 = _b[3];
}
if (coordinate11.isReflect("y")) {
_c = swap(p0, p1), p0 = _c[0], p1 = _c[1];
_d = swap(p22, p32), p22 = _d[0], p32 = _d[1];
}
if (coordinate11.isReflect("x")) {
_e = swap(p0, p32), p0 = _e[0], p32 = _e[1];
_f = swap(p1, p22), p1 = _f[0], p22 = _f[1];
}
var path = [];
var abs3 = function(v3) {
return Math.abs(v3);
};
_g = parseRadius3([r1, r22, r32, r4], Math.min(abs3(p32.x - p0.x), abs3(p1.y - p0.y))).map(function(d3) {
return abs3(d3);
}), r1 = _g[0], r22 = _g[1], r32 = _g[2], r4 = _g[3];
if (p0.y < p1.y) {
path.push(["M", p32.x, p32.y + r32]);
r32 !== 0 && path.push(["A", r32, r32, 0, 0, 0, p32.x - r32, p32.y]);
path.push(["L", p0.x + r4, p0.y]);
r4 !== 0 && path.push(["A", r4, r4, 0, 0, 0, p0.x, p0.y + r4]);
path.push(["L", p1.x, p1.y - r1]);
r1 !== 0 && path.push(["A", r1, r1, 0, 0, 0, p1.x + r1, p1.y]);
path.push(["L", p22.x - r22, p22.y]);
r22 !== 0 && path.push(["A", r22, r22, 0, 0, 0, p22.x, p22.y - r22]);
path.push(["L", p32.x, p32.y + r32]);
path.push(["z"]);
} else if (p32.x < p0.x) {
path.push(["M", p22.x + r22, p22.y]);
r22 !== 0 && path.push(["A", r22, r22, 0, 0, 0, p22.x, p22.y + r22]);
path.push(["L", p32.x, p32.y - r32]);
r32 !== 0 && path.push(["A", r32, r32, 0, 0, 0, p32.x + r32, p32.y]);
path.push(["L", p0.x - r4, p0.y]);
r4 !== 0 && path.push(["A", r4, r4, 0, 0, 0, p0.x, p0.y - r4]);
path.push(["L", p1.x, p1.y + r1]);
r1 !== 0 && path.push(["A", r1, r1, 0, 0, 0, p1.x - r1, p1.y]);
path.push(["L", p22.x + r22, p22.y]);
path.push(["z"]);
} else {
path.push(["M", p1.x, p1.y + r1]);
r1 !== 0 && path.push(["A", r1, r1, 0, 0, 1, p1.x + r1, p1.y]);
path.push(["L", p22.x - r22, p22.y]);
r22 !== 0 && path.push(["A", r22, r22, 0, 0, 1, p22.x, p22.y + r22]);
path.push(["L", p32.x, p32.y - r32]);
r32 !== 0 && path.push(["A", r32, r32, 0, 0, 1, p32.x - r32, p32.y]);
path.push(["L", p0.x + r4, p0.y]);
r4 !== 0 && path.push(["A", r4, r4, 0, 0, 1, p0.x, p0.y - r4]);
path.push(["L", p1.x, p1.y + r1]);
path.push(["z"]);
}
return path;
}
// node_modules/@antv/g2/esm/geometry/shape/interval/index.js
var IntervalShapeFactory = registerShapeFactory("interval", {
defaultShapeType: "rect",
getDefaultPoints: function(pointInfo) {
return getRectPoints(pointInfo);
}
});
registerShape("interval", "rect", {
draw: function(cfg, container2) {
var style = getStyle2(cfg, false, true);
var group2 = container2;
var backgroundCfg = cfg === null || cfg === void 0 ? void 0 : cfg.background;
if (backgroundCfg) {
group2 = container2.addGroup();
var backgroundStyle = getBackgroundRectStyle(cfg);
var backgroundPath = getBackgroundRectPath(cfg, this.parsePoints(cfg.points), this.coordinate);
group2.addShape("path", {
attrs: __assign(__assign({}, backgroundStyle), { path: backgroundPath }),
zIndex: -1,
name: BACKGROUND_SHAPE
});
}
var path;
if (style.radius && this.coordinate.isRect) {
path = getRectWithCornerRadius(this.parsePoints(cfg.points), this.coordinate, style.radius);
} else {
path = this.parsePath(getIntervalRectPath(cfg.points, style.lineCap, this.coordinate));
}
var shape = group2.addShape("path", {
attrs: __assign(__assign({}, style), { path }),
name: "interval"
});
return backgroundCfg ? group2 : shape;
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color, isInPolar = markerCfg.isInPolar;
if (isInPolar) {
return {
symbol: "circle",
style: {
r: 4.5,
fill: color4
}
};
}
return {
symbol: "square",
style: {
r: 4,
fill: color4
}
};
}
});
// node_modules/@antv/g2/esm/geometry/util/shape-size.js
function findMinDistance(arr, scale12) {
var count2 = arr.length;
var sourceArr = arr;
if (is_string_default(sourceArr[0])) {
sourceArr = arr.map(function(v3) {
return scale12.translate(v3);
});
}
var distance15 = sourceArr[1] - sourceArr[0];
for (var i4 = 2; i4 < count2; i4++) {
var tmp = sourceArr[i4] - sourceArr[i4 - 1];
if (distance15 > tmp) {
distance15 = tmp;
}
}
return distance15;
}
function getDodgeCount(dataArray, dodgeBy) {
if (dodgeBy) {
var mergeData = flatten_default(dataArray);
var values2 = values_of_key_default(mergeData, dodgeBy);
return values2.length;
}
return dataArray.length;
}
function getDefaultSize(geometry35) {
var theme4 = geometry35.theme;
var coordinate11 = geometry35.coordinate;
var xScale = geometry35.getXScale();
var xValues = xScale.values;
var dataArray = geometry35.beforeMappingData;
var count2 = xValues.length;
var xDimensionLength = getXDimensionLength(geometry35.coordinate);
var intervalPadding = geometry35.intervalPadding, dodgePadding = geometry35.dodgePadding;
var maxColumnWidth = geometry35.maxColumnWidth || theme4.maxColumnWidth;
var minColumnWidth = geometry35.minColumnWidth || theme4.minColumnWidth;
var columnWidthRatio = geometry35.columnWidthRatio || theme4.columnWidthRatio;
var multiplePieWidthRatio = geometry35.multiplePieWidthRatio || theme4.multiplePieWidthRatio;
var roseWidthRatio = geometry35.roseWidthRatio || theme4.roseWidthRatio;
if (xScale.isLinear && xValues.length > 1) {
xValues.sort();
var interval3 = findMinDistance(xValues, xScale);
count2 = (xScale.max - xScale.min) / interval3;
if (xValues.length > count2) {
count2 = xValues.length;
}
}
var range = xScale.range;
var normalizedSize = 1 / count2;
var wr = 1;
if (coordinate11.isPolar) {
if (coordinate11.isTransposed && count2 > 1) {
wr = multiplePieWidthRatio;
} else {
wr = roseWidthRatio;
}
} else {
if (xScale.isLinear) {
normalizedSize *= range[1] - range[0];
}
wr = columnWidthRatio;
}
if (!is_nil_default(intervalPadding) && intervalPadding >= 0) {
var normalizedIntervalPadding = intervalPadding / xDimensionLength;
normalizedSize = (1 - (count2 - 1) * normalizedIntervalPadding) / count2;
} else {
normalizedSize *= wr;
}
if (geometry35.getAdjust("dodge")) {
var dodgeAdjust = geometry35.getAdjust("dodge");
var dodgeBy = dodgeAdjust.dodgeBy;
var dodgeCount = getDodgeCount(dataArray, dodgeBy);
if (!is_nil_default(dodgePadding) && dodgePadding >= 0) {
var normalizedDodgePadding = dodgePadding / xDimensionLength;
normalizedSize = (normalizedSize - normalizedDodgePadding * (dodgeCount - 1)) / dodgeCount;
} else if (!is_nil_default(intervalPadding) && intervalPadding >= 0) {
normalizedSize *= wr;
normalizedSize = normalizedSize / dodgeCount;
} else {
normalizedSize = normalizedSize / dodgeCount;
}
normalizedSize = normalizedSize >= 0 ? normalizedSize : 0;
}
if (!is_nil_default(maxColumnWidth) && maxColumnWidth >= 0) {
var normalizedMaxColumnWidth = maxColumnWidth / xDimensionLength;
if (normalizedSize > normalizedMaxColumnWidth) {
normalizedSize = normalizedMaxColumnWidth;
}
}
if (!is_nil_default(minColumnWidth) && minColumnWidth >= 0) {
var normalizedMinColumnWidth = minColumnWidth / xDimensionLength;
if (normalizedSize < normalizedMinColumnWidth) {
normalizedSize = normalizedMinColumnWidth;
}
}
return normalizedSize;
}
// node_modules/@antv/g2/esm/geometry/interval.js
var Interval = function(_super) {
__extends(Interval2, _super);
function Interval2(cfg) {
var _this = _super.call(this, cfg) || this;
_this.type = "interval";
_this.shapeType = "interval";
_this.generatePoints = true;
var background = cfg.background;
_this.background = background;
return _this;
}
Interval2.prototype.createShapePointsCfg = function(obj) {
var cfg = _super.prototype.createShapePointsCfg.call(this, obj);
var size2;
var sizeAttr = this.getAttribute("size");
if (sizeAttr) {
size2 = this.getAttributeValues(sizeAttr, obj)[0];
var coordinate11 = this.coordinate;
var coordinateWidth = getXDimensionLength(coordinate11);
size2 = size2 / coordinateWidth;
} else {
if (!this.defaultSize) {
this.defaultSize = getDefaultSize(this);
}
size2 = this.defaultSize;
}
cfg.size = size2;
return cfg;
};
Interval2.prototype.adjustScale = function() {
_super.prototype.adjustScale.call(this);
var yScale = this.getYScale();
if (this.coordinate.type === "theta") {
yScale.change({
nice: false,
min: 0,
max: getMaxScale(yScale)
});
} else {
var scaleDefs = this.scaleDefs;
var field6 = yScale.field, min7 = yScale.min, max8 = yScale.max, type2 = yScale.type;
if (type2 !== "time") {
if (min7 > 0 && !get_default(scaleDefs, [field6, "min"])) {
yScale.change({
min: 0
});
}
if (max8 <= 0 && !get_default(scaleDefs, [field6, "max"])) {
yScale.change({
max: 0
});
}
}
}
};
Interval2.prototype.getDrawCfg = function(mappingData) {
var shapeCfg = _super.prototype.getDrawCfg.call(this, mappingData);
shapeCfg.background = this.background;
return shapeCfg;
};
return Interval2;
}(base_default13);
var interval_default = Interval;
// node_modules/@antv/g2/esm/geometry/line.js
var Line5 = function(_super) {
__extends(Line9, _super);
function Line9(cfg) {
var _this = _super.call(this, cfg) || this;
_this.type = "line";
var _a6 = cfg.sortable, sortable = _a6 === void 0 ? false : _a6;
_this.sortable = sortable;
return _this;
}
return Line9;
}(path_default5);
var line_default9 = Line5;
// node_modules/@antv/g2/esm/geometry/shape/point/util.js
var SHAPES = ["circle", "square", "bowtie", "diamond", "hexagon", "triangle", "triangle-down"];
var HOLLOW_SHAPES = ["cross", "tick", "plus", "hyphen", "line"];
function drawPoints(shape, cfg, container2, shapeName, isStroke) {
var style = getStyle2(cfg, isStroke, !isStroke, "r");
var points = shape.parsePoints(cfg.points);
var pointPosition = points[0];
if (cfg.isStack) {
pointPosition = points[1];
} else if (points.length > 1) {
var group2 = container2.addGroup();
for (var _i = 0, points_1 = points; _i < points_1.length; _i++) {
var point2 = points_1[_i];
group2.addShape({
type: "marker",
attrs: __assign(__assign(__assign({}, style), { symbol: MarkerSymbols[shapeName] || shapeName }), point2)
});
}
return group2;
}
return container2.addShape({
type: "marker",
attrs: __assign(__assign(__assign({}, style), { symbol: MarkerSymbols[shapeName] || shapeName }), pointPosition)
});
}
// node_modules/@antv/g2/esm/geometry/shape/point/index.js
var PointShapeFactory = registerShapeFactory("point", {
defaultShapeType: "hollow-circle",
getDefaultPoints: function(pointInfo) {
return splitPoints(pointInfo);
}
});
each_default(SHAPES, function(shapeName) {
registerShape("point", "hollow-".concat(shapeName), {
draw: function(cfg, container2) {
return drawPoints(this, cfg, container2, shapeName, true);
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: MarkerSymbols[shapeName] || shapeName,
style: {
r: 4.5,
stroke: color4,
fill: null
}
};
}
});
});
// node_modules/@antv/g2/esm/geometry/point.js
var Point = function(_super) {
__extends(Point3, _super);
function Point3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "point";
_this.shapeType = "point";
_this.generatePoints = true;
return _this;
}
Point3.prototype.getDrawCfg = function(mappingDatum) {
var shapeCfg = _super.prototype.getDrawCfg.call(this, mappingDatum);
return __assign(__assign({}, shapeCfg), { isStack: !!this.getAdjust("stack") });
};
return Point3;
}(base_default13);
var point_default = Point;
// node_modules/@antv/g2/esm/geometry/shape/polygon/index.js
function getPath3(points) {
var flag = points[0];
var i4 = 1;
var path = [["M", flag.x, flag.y]];
while (i4 < points.length) {
var c5 = points[i4];
if (c5.x !== points[i4 - 1].x || c5.y !== points[i4 - 1].y) {
path.push(["L", c5.x, c5.y]);
if (c5.x === flag.x && c5.y === flag.y && i4 < points.length - 1) {
flag = points[i4 + 1];
path.push(["Z"]);
path.push(["M", flag.x, flag.y]);
i4++;
}
}
i4++;
}
if (!is_equal_default(last(path), flag)) {
path.push(["L", flag.x, flag.y]);
}
path.push(["Z"]);
return path;
}
var PolygonShapeFactory = registerShapeFactory("polygon", {
defaultShapeType: "polygon",
getDefaultPoints: function(pointInfo) {
var points = [];
each_default(pointInfo.x, function(subX, index2) {
var subY = pointInfo.y[index2];
points.push({
x: subX,
y: subY
});
});
return points;
}
});
registerShape("polygon", "polygon", {
draw: function(cfg, container2) {
if (!is_empty_default(cfg.points)) {
var shapeAttrs = getStyle2(cfg, true, true);
var path = this.parsePath(getPath3(cfg.points));
return container2.addShape("path", {
attrs: __assign(__assign({}, shapeAttrs), { path }),
name: "polygon"
});
}
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: "square",
style: {
r: 4,
fill: color4
}
};
}
});
// node_modules/@antv/g2/esm/geometry/polygon.js
var Polygon3 = function(_super) {
__extends(Polygon4, _super);
function Polygon4() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "polygon";
_this.shapeType = "polygon";
_this.generatePoints = true;
return _this;
}
Polygon4.prototype.createShapePointsCfg = function(obj) {
var cfg = _super.prototype.createShapePointsCfg.call(this, obj);
var x6 = cfg.x;
var y5 = cfg.y;
var temp;
if (!(is_array_default(x6) && is_array_default(y5))) {
var xScale = this.getXScale();
var yScale = this.getYScale();
var xCount = xScale.values.length;
var yCount = yScale.values.length;
var xOffset = 0.5 * 1 / xCount;
var yOffset = 0.5 * 1 / yCount;
if (xScale.isCategory && yScale.isCategory) {
x6 = [x6 - xOffset, x6 - xOffset, x6 + xOffset, x6 + xOffset];
y5 = [y5 - yOffset, y5 + yOffset, y5 + yOffset, y5 - yOffset];
} else if (is_array_default(x6)) {
temp = x6;
x6 = [temp[0], temp[0], temp[1], temp[1]];
y5 = [y5 - yOffset / 2, y5 + yOffset / 2, y5 + yOffset / 2, y5 - yOffset / 2];
} else if (is_array_default(y5)) {
temp = y5;
y5 = [temp[0], temp[1], temp[1], temp[0]];
x6 = [x6 - xOffset / 2, x6 - xOffset / 2, x6 + xOffset / 2, x6 + xOffset / 2];
}
cfg.x = x6;
cfg.y = y5;
}
return cfg;
};
return Polygon4;
}(base_default13);
var polygon_default5 = Polygon3;
// node_modules/@antv/g2/esm/geometry/shape/schema/index.js
var SchemaShapeFactory = registerShapeFactory("schema", {
defaultShapeType: ""
});
// node_modules/@antv/g2/esm/geometry/schema.js
var Schema2 = function(_super) {
__extends(Schema3, _super);
function Schema3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "schema";
_this.shapeType = "schema";
_this.generatePoints = true;
return _this;
}
Schema3.prototype.createShapePointsCfg = function(record) {
var cfg = _super.prototype.createShapePointsCfg.call(this, record);
var size2;
var sizeAttr = this.getAttribute("size");
if (sizeAttr) {
size2 = this.getAttributeValues(sizeAttr, record)[0];
var coordinate11 = this.coordinate;
var coordinateWidth = getXDimensionLength(coordinate11);
size2 = size2 / coordinateWidth;
} else {
if (!this.defaultSize) {
this.defaultSize = getDefaultSize(this);
}
size2 = this.defaultSize;
}
cfg.size = size2;
return cfg;
};
return Schema3;
}(base_default13);
var schema_default = Schema2;
// node_modules/@antv/g2/esm/geometry/shape/violin/index.js
function normalizeSize(arr) {
if (!is_array_default(arr)) {
return [];
}
var maxValue = max_default(arr);
return map_default(arr, function(num) {
return num / maxValue;
});
}
var ViolinShapeFactory = registerShapeFactory("violin", {
defaultShapeType: "violin",
getDefaultPoints: function(pointInfo) {
var radius = pointInfo.size / 2;
var points = [];
var sizeArr = normalizeSize(pointInfo._size);
each_default(pointInfo.y, function(y5, index2) {
var offset = sizeArr[index2] * radius;
var isMin = index2 === 0;
var isMax = index2 === pointInfo.y.length - 1;
points.push({
isMin,
isMax,
x: pointInfo.x - offset,
y: y5
});
points.unshift({
isMin,
isMax,
x: pointInfo.x + offset,
y: y5
});
});
return points;
}
});
registerShape("violin", "violin", {
draw: function(cfg, container2) {
var shapeAttrs = getStyle2(cfg, true, true);
var path = this.parsePath(getViolinPath(cfg.points));
return container2.addShape("path", {
attrs: __assign(__assign({}, shapeAttrs), { path }),
name: "violin"
});
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: "circle",
style: {
r: 4,
fill: color4
}
};
}
});
// node_modules/@antv/g2/esm/geometry/violin.js
var Violin = function(_super) {
__extends(Violin3, _super);
function Violin3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "violin";
_this.shapeType = "violin";
_this.generatePoints = true;
return _this;
}
Violin3.prototype.createShapePointsCfg = function(record) {
var cfg = _super.prototype.createShapePointsCfg.call(this, record);
var size2;
var sizeAttr = this.getAttribute("size");
if (sizeAttr) {
size2 = this.getAttributeValues(sizeAttr, record)[0];
var coordinate11 = this.coordinate;
var coordinateWidth = getXDimensionLength(coordinate11);
size2 = size2 / coordinateWidth;
} else {
if (!this.defaultSize) {
this.defaultSize = getDefaultSize(this);
}
size2 = this.defaultSize;
}
cfg.size = size2;
cfg._size = get_default(record[FIELD_ORIGIN], [this._sizeField]);
return cfg;
};
Violin3.prototype.initAttributes = function() {
var attributeOption = this.attributeOption;
var sizeField = attributeOption.size ? attributeOption.size.fields[0] : this._sizeField ? this._sizeField : "size";
this._sizeField = sizeField;
delete attributeOption.size;
_super.prototype.initAttributes.call(this);
};
return Violin3;
}(base_default13);
var violin_default = Violin;
// node_modules/@antv/g2/esm/geometry/shape/area/line.js
registerShape("area", "line", {
draw: function(cfg, container2) {
var attrs = getShapeAttrs2(cfg, true, false, this);
var shape = container2.addShape({
type: "path",
attrs,
name: "area"
});
return shape;
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: function(x6, y5, r4) {
if (r4 === void 0) {
r4 = 5.5;
}
return [["M", x6 - r4, y5 - 4], ["L", x6 + r4, y5 - 4], ["L", x6 + r4, y5 + 4], ["L", x6 - r4, y5 + 4], ["Z"]];
},
style: {
r: 5,
stroke: color4,
fill: null
}
};
}
});
// node_modules/@antv/g2/esm/geometry/shape/area/smooth.js
registerShape("area", "smooth", {
draw: function(cfg, container2) {
var coordinate11 = this.coordinate;
var attrs = getShapeAttrs2(cfg, false, true, this, getConstraint(coordinate11));
var shape = container2.addShape({
type: "path",
attrs,
name: "area"
});
return shape;
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: function(x6, y5, r4) {
if (r4 === void 0) {
r4 = 5.5;
}
return [["M", x6 - r4, y5 - 4], ["L", x6 + r4, y5 - 4], ["L", x6 + r4, y5 + 4], ["L", x6 - r4, y5 + 4], ["Z"]];
},
style: {
r: 5,
fill: color4
}
};
}
});
// node_modules/@antv/g2/esm/geometry/shape/area/smooth-line.js
registerShape("area", "smooth-line", {
draw: function(cfg, container2) {
var coordinate11 = this.coordinate;
var attrs = getShapeAttrs2(cfg, true, true, this, getConstraint(coordinate11));
var shape = container2.addShape({
type: "path",
attrs,
name: "area"
});
return shape;
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: function(x6, y5, r4) {
if (r4 === void 0) {
r4 = 5.5;
}
return [["M", x6 - r4, y5 - 4], ["L", x6 + r4, y5 - 4], ["L", x6 + r4, y5 + 4], ["L", x6 - r4, y5 + 4], ["Z"]];
},
style: {
r: 5,
stroke: color4,
fill: null
}
};
}
});
// node_modules/@antv/g2/esm/geometry/shape/edge/util.js
function getCPath(from, to) {
return ["C", from.x * 1 / 2 + to.x * 1 / 2, from.y, from.x * 1 / 2 + to.x * 1 / 2, to.y, to.x, to.y];
}
function getQPath(to, center2) {
var points = [];
points.push({
x: center2.x,
y: center2.y
});
points.push(to);
var sub6 = ["Q"];
each_default(points, function(point2) {
sub6.push(point2.x, point2.y);
});
return sub6;
}
// node_modules/@antv/g2/esm/geometry/shape/edge/arc.js
function getArcShapePath(from, to, center2) {
var sub6 = getQPath(to, center2);
var path = [["M", from.x, from.y]];
path.push(sub6);
return path;
}
function getArcShapeWeightPath(points, center2) {
var arc1 = getQPath(points[1], center2);
var arc2 = getQPath(points[3], center2);
var path = [["M", points[0].x, points[0].y]];
path.push(arc2);
path.push(["L", points[3].x, points[3].y]);
path.push(["L", points[2].x, points[2].y]);
path.push(arc1);
path.push(["L", points[1].x, points[1].y]);
path.push(["L", points[0].x, points[0].y]);
path.push(["Z"]);
return path;
}
registerShape("edge", "arc", {
draw: function(cfg, container2) {
var style = getStyle2(cfg, true, false, "lineWidth");
var points = cfg.points;
var type2 = points.length > 2 ? "weight" : "normal";
var path;
if (cfg.isInCircle) {
var center2 = { x: 0, y: 1 };
if (type2 === "normal") {
path = getArcShapePath(points[0], points[1], center2);
} else {
style.fill = style.stroke;
path = getArcShapeWeightPath(points, center2);
}
path = this.parsePath(path);
return container2.addShape("path", {
attrs: __assign(__assign({}, style), { path })
});
} else {
if (type2 === "normal") {
points = this.parsePoints(points);
path = getArcPath((points[1].x + points[0].x) / 2, points[0].y, Math.abs(points[1].x - points[0].x) / 2, Math.PI, Math.PI * 2);
return container2.addShape("path", {
attrs: __assign(__assign({}, style), { path })
});
} else {
var c1 = getCPath(points[1], points[3]);
var c22 = getCPath(points[2], points[0]);
path = [
["M", points[0].x, points[0].y],
["L", points[1].x, points[1].y],
c1,
["L", points[3].x, points[3].y],
["L", points[2].x, points[2].y],
c22,
["Z"]
];
path = this.parsePath(path);
style.fill = style.stroke;
return container2.addShape("path", {
attrs: __assign(__assign({}, style), { path })
});
}
}
},
getMarker: function(markerCfg) {
return {
symbol: "circle",
style: {
r: 4.5,
fill: markerCfg.color
}
};
}
});
// node_modules/@antv/g2/esm/geometry/shape/edge/smooth.js
function getSmoothPath(from, to) {
var sub6 = getCPath(from, to);
var path = [["M", from.x, from.y]];
path.push(sub6);
return path;
}
registerShape("edge", "smooth", {
draw: function(cfg, container2) {
var style = getStyle2(cfg, true, false, "lineWidth");
var points = cfg.points;
var path = this.parsePath(getSmoothPath(points[0], points[1]));
return container2.addShape("path", {
attrs: __assign(__assign({}, style), { path })
});
},
getMarker: function(markerCfg) {
return {
symbol: "circle",
style: {
r: 4.5,
fill: markerCfg.color
}
};
}
});
// node_modules/@antv/g2/esm/geometry/shape/edge/vhv.js
var CORNER_PERCENT = 1 / 3;
function getVHVPath(from, to) {
var points = [];
points.push({
x: from.x,
y: from.y * (1 - CORNER_PERCENT) + to.y * CORNER_PERCENT
});
points.push({
x: to.x,
y: from.y * (1 - CORNER_PERCENT) + to.y * CORNER_PERCENT
});
points.push(to);
var path = [["M", from.x, from.y]];
each_default(points, function(point2) {
path.push(["L", point2.x, point2.y]);
});
return path;
}
registerShape("edge", "vhv", {
draw: function(cfg, container2) {
var style = getStyle2(cfg, true, false, "lineWidth");
var points = cfg.points;
var path = this.parsePath(getVHVPath(points[0], points[1]));
return container2.addShape("path", {
attrs: __assign(__assign({}, style), { path })
});
},
getMarker: function(markerCfg) {
return {
symbol: "circle",
style: {
r: 4.5,
fill: markerCfg.color
}
};
}
});
// node_modules/@antv/g2/esm/geometry/shape/interval/funnel.js
registerShape("interval", "funnel", {
getPoints: function(shapePoint) {
shapePoint.size = shapePoint.size * 2;
return getRectPoints(shapePoint);
},
draw: function(cfg, container2) {
var style = getStyle2(cfg, false, true);
var path = this.parsePath(getFunnelPath(cfg.points, cfg.nextPoints, false));
var shape = container2.addShape("path", {
attrs: __assign(__assign({}, style), { path }),
name: "interval"
});
return shape;
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: "square",
style: {
r: 4,
fill: color4
}
};
}
});
// node_modules/@antv/g2/esm/geometry/shape/interval/hollow-rect.js
registerShape("interval", "hollow-rect", {
draw: function(cfg, container2) {
var style = getStyle2(cfg, true, false);
var group2 = container2;
var backgroundCfg = cfg === null || cfg === void 0 ? void 0 : cfg.background;
if (backgroundCfg) {
group2 = container2.addGroup();
var backgroundStyle = getBackgroundRectStyle(cfg);
var backgroundPath = getBackgroundRectPath(cfg, this.parsePoints(cfg.points), this.coordinate);
group2.addShape("path", {
attrs: __assign(__assign({}, backgroundStyle), { path: backgroundPath }),
zIndex: -1,
name: BACKGROUND_SHAPE
});
}
var path = this.parsePath(getRectPath(cfg.points));
var shape = group2.addShape("path", {
attrs: __assign(__assign({}, style), { path }),
name: "interval"
});
return backgroundCfg ? group2 : shape;
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color, isInPolar = markerCfg.isInPolar;
if (isInPolar) {
return {
symbol: "circle",
style: {
r: 4.5,
stroke: color4,
fill: null
}
};
}
return {
symbol: "square",
style: {
r: 4,
stroke: color4,
fill: null
}
};
}
});
// node_modules/@antv/g2/esm/geometry/shape/interval/line.js
function getLinePoints(pointInfo) {
var x6 = pointInfo.x, y5 = pointInfo.y, y0 = pointInfo.y0;
if (is_array_default(y5)) {
return y5.map(function(yItem, idx) {
return {
x: is_array_default(x6) ? x6[idx] : x6,
y: yItem
};
});
}
return [
{ x: x6, y: y0 },
{ x: x6, y: y5 }
];
}
registerShape("interval", "line", {
getPoints: function(shapePoint) {
return getLinePoints(shapePoint);
},
draw: function(cfg, container2) {
var style = getStyle2(cfg, true, false, "lineWidth");
var newStyle = omit(__assign({}, style), ["fill"]);
var path = this.parsePath(getRectPath(cfg.points, false));
var shape = container2.addShape("path", {
attrs: __assign(__assign({}, newStyle), { path }),
name: "interval"
});
return shape;
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: function(x6, y5, r4) {
return [
["M", x6, y5 - r4],
["L", x6, y5 + r4]
];
},
style: {
r: 5,
stroke: color4
}
};
}
});
// node_modules/@antv/g2/esm/geometry/shape/interval/pyramid.js
registerShape("interval", "pyramid", {
getPoints: function(shapePoint) {
shapePoint.size = shapePoint.size * 2;
return getRectPoints(shapePoint);
},
draw: function(cfg, container2) {
var style = getStyle2(cfg, false, true);
var path = this.parsePath(getFunnelPath(cfg.points, cfg.nextPoints, true));
var shape = container2.addShape("path", {
attrs: __assign(__assign({}, style), { path }),
name: "interval"
});
return shape;
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: "square",
style: {
r: 4,
fill: color4
}
};
}
});
// node_modules/@antv/g2/esm/geometry/shape/interval/tick.js
function getTickPoints(pointInfo) {
var x6 = pointInfo.x, y5 = pointInfo.y, y0 = pointInfo.y0, size2 = pointInfo.size;
var yMin;
var yMax;
if (is_array_default(y5)) {
yMin = y5[0], yMax = y5[1];
} else {
yMin = y0;
yMax = y5;
}
var xMax = x6 + size2 / 2;
var xMin = x6 - size2 / 2;
return [
{ x: x6, y: yMin },
{ x: x6, y: yMax },
{ x: xMin, y: yMin },
{ x: xMax, y: yMin },
{ x: xMin, y: yMax },
{ x: xMax, y: yMax }
];
}
function getTickPath(points) {
return [
["M", points[0].x, points[0].y],
["L", points[1].x, points[1].y],
["M", points[2].x, points[2].y],
["L", points[3].x, points[3].y],
["M", points[4].x, points[4].y],
["L", points[5].x, points[5].y]
];
}
registerShape("interval", "tick", {
getPoints: function(shapePoint) {
return getTickPoints(shapePoint);
},
draw: function(cfg, container2) {
var style = getStyle2(cfg, true, false);
var path = this.parsePath(getTickPath(cfg.points));
var shape = container2.addShape("path", {
attrs: __assign(__assign({}, style), { path }),
name: "interval"
});
return shape;
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: function(x6, y5, r4) {
return [
["M", x6 - r4 / 2, y5 - r4],
["L", x6 + r4 / 2, y5 - r4],
["M", x6, y5 - r4],
["L", x6, y5 + r4],
["M", x6 - r4 / 2, y5 + r4],
["L", x6 + r4 / 2, y5 + r4]
];
},
style: {
r: 5,
stroke: color4
}
};
}
});
// node_modules/@antv/g2/esm/geometry/shape/line/step.js
var interpolateCallback = function(point2, nextPoint, shapeType) {
var x6 = point2.x;
var y5 = point2.y;
var nextX = nextPoint.x;
var nextY = nextPoint.y;
var result;
switch (shapeType) {
case "hv":
result = [{ x: nextX, y: y5 }];
break;
case "vh":
result = [{ x: x6, y: nextY }];
break;
case "hvh":
var middleX = (nextX + x6) / 2;
result = [
{ x: middleX, y: y5 },
{ x: middleX, y: nextY }
];
break;
case "vhv":
var middleY = (y5 + nextY) / 2;
result = [
{ x: x6, y: middleY },
{ x: nextX, y: middleY }
];
break;
default:
break;
}
return result;
};
function getInterpolatePoints(points, shapeType) {
var result = [];
each_default(points, function(point2, index2) {
var nextPoint = points[index2 + 1];
result.push(point2);
if (nextPoint) {
var interpolatePoint = interpolateCallback(point2, nextPoint, shapeType);
result = result.concat(interpolatePoint);
}
});
return result;
}
function getInterpolatePath(points) {
return points.map(function(point2, index2) {
return index2 === 0 ? ["M", point2.x, point2.y] : ["L", point2.x, point2.y];
});
}
function getInterpolateShapeAttrs(cfg, shapeType) {
var points = getPathPoints(cfg.points, cfg.connectNulls, cfg.showSinglePoint);
var path = [];
each_default(points, function(eachLinePoints) {
var interpolatePoints = getInterpolatePoints(eachLinePoints, shapeType);
path = path.concat(getInterpolatePath(interpolatePoints));
});
return __assign(__assign({}, getStyle2(cfg, true, false, "lineWidth")), { path });
}
each_default(["hv", "vh", "hvh", "vhv"], function(shapeType) {
registerShape("line", shapeType, {
draw: function(cfg, container2) {
var attrs = getInterpolateShapeAttrs(cfg, shapeType);
var shape = container2.addShape({
type: "path",
attrs,
name: "line"
});
return shape;
},
getMarker: function(markerCfg) {
return getLineMarker(markerCfg, shapeType);
}
});
});
// node_modules/@antv/g2/esm/geometry/shape/point/hollow.js
each_default(HOLLOW_SHAPES, function(shapeName) {
registerShape("point", shapeName, {
draw: function(cfg, container2) {
return drawPoints(this, cfg, container2, shapeName, true);
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: MarkerSymbols[shapeName],
style: {
r: 4.5,
stroke: color4,
fill: null
}
};
}
});
});
// node_modules/@antv/g2/esm/geometry/shape/point/image.js
registerShape("point", "image", {
draw: function(cfg, container2) {
var size2 = getStyle2(cfg, false, false, "r").r;
var points = this.parsePoints(cfg.points);
var pointPosition = points[0];
if (cfg.isStack) {
pointPosition = points[1];
} else if (points.length > 1) {
var group2 = container2.addGroup();
for (var _i = 0, points_1 = points; _i < points_1.length; _i++) {
var point2 = points_1[_i];
group2.addShape("image", {
attrs: {
x: point2.x - size2 / 2,
y: point2.y - size2,
width: size2,
height: size2,
img: cfg.shape[1]
}
});
}
return group2;
}
return container2.addShape("image", {
attrs: {
x: pointPosition.x - size2 / 2,
y: pointPosition.y - size2,
width: size2,
height: size2,
img: cfg.shape[1]
}
});
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: "circle",
style: {
r: 4.5,
fill: color4
}
};
}
});
// node_modules/@antv/g2/esm/geometry/shape/point/solid.js
each_default(SHAPES, function(shapeName) {
registerShape("point", shapeName, {
draw: function(cfg, container2) {
return drawPoints(this, cfg, container2, shapeName, false);
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: MarkerSymbols[shapeName] || shapeName,
style: {
r: 4.5,
fill: color4
}
};
}
});
});
// node_modules/@antv/g2/esm/geometry/shape/schema/box.js
function parseValue(value2) {
var array = !is_array_default(value2) ? [value2] : value2;
var min7 = array[0];
var max8 = array[array.length - 1];
var min1 = array.length > 1 ? array[1] : min7;
var max1 = array.length > 3 ? array[3] : max8;
var median = array.length > 2 ? array[2] : min1;
return {
min: min7,
max: max8,
min1,
max1,
median
};
}
function getBoxPoints(x6, y5, size2) {
var halfSize = size2 / 2;
var pointsArray;
if (is_array_default(y5)) {
var _a6 = parseValue(y5), min7 = _a6.min, max8 = _a6.max, median = _a6.median, min1 = _a6.min1, max1 = _a6.max1;
var minX = x6 - halfSize;
var maxX = x6 + halfSize;
pointsArray = [
[minX, max8],
[maxX, max8],
[x6, max8],
[x6, max1],
[minX, min1],
[minX, max1],
[maxX, max1],
[maxX, min1],
[x6, min1],
[x6, min7],
[minX, min7],
[maxX, min7],
[minX, median],
[maxX, median]
];
} else {
y5 = is_nil_default(y5) ? 0.5 : y5;
var _b = parseValue(x6), min7 = _b.min, max8 = _b.max, median = _b.median, min1 = _b.min1, max1 = _b.max1;
var minY = y5 - halfSize;
var maxY2 = y5 + halfSize;
pointsArray = [
[min7, minY],
[min7, maxY2],
[min7, y5],
[min1, y5],
[min1, minY],
[min1, maxY2],
[max1, maxY2],
[max1, minY],
[max1, y5],
[max8, y5],
[max8, minY],
[max8, maxY2],
[median, minY],
[median, maxY2]
];
}
return pointsArray.map(function(arr) {
return {
x: arr[0],
y: arr[1]
};
});
}
function getBoxPath(points) {
return [
["M", points[0].x, points[0].y],
["L", points[1].x, points[1].y],
["M", points[2].x, points[2].y],
["L", points[3].x, points[3].y],
["M", points[4].x, points[4].y],
["L", points[5].x, points[5].y],
["L", points[6].x, points[6].y],
["L", points[7].x, points[7].y],
["L", points[4].x, points[4].y],
["Z"],
["M", points[8].x, points[8].y],
["L", points[9].x, points[9].y],
["M", points[10].x, points[10].y],
["L", points[11].x, points[11].y],
["M", points[12].x, points[12].y],
["L", points[13].x, points[13].y]
];
}
registerShape("schema", "box", {
getPoints: function(shapePoint) {
var x6 = shapePoint.x, y5 = shapePoint.y, size2 = shapePoint.size;
return getBoxPoints(x6, y5, size2);
},
draw: function(cfg, container2) {
var style = getStyle2(cfg, true, false);
var path = this.parsePath(getBoxPath(cfg.points));
var shape = container2.addShape("path", {
attrs: __assign(__assign({}, style), { path, name: "schema" })
});
return shape;
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: function(x6, y5, r4) {
var yValues = [y5 - 6, y5 - 3, y5, y5 + 3, y5 + 6];
var points = getBoxPoints(x6, yValues, r4);
return [
["M", points[0].x + 1, points[0].y],
["L", points[1].x - 1, points[1].y],
["M", points[2].x, points[2].y],
["L", points[3].x, points[3].y],
["M", points[4].x, points[4].y],
["L", points[5].x, points[5].y],
["L", points[6].x, points[6].y],
["L", points[7].x, points[7].y],
["L", points[4].x, points[4].y],
["Z"],
["M", points[8].x, points[8].y],
["L", points[9].x, points[9].y],
["M", points[10].x + 1, points[10].y],
["L", points[11].x - 1, points[11].y],
["M", points[12].x, points[12].y],
["L", points[13].x, points[13].y]
];
},
style: {
r: 6,
lineWidth: 1,
stroke: color4
}
};
}
});
// node_modules/@antv/g2/esm/geometry/shape/schema/candle.js
function getCandleYValues(value2) {
var array = !is_array_default(value2) ? [value2] : value2;
var sorted = array.sort(function(a4, b10) {
return b10 - a4;
});
return padEnd(sorted, 4, sorted[sorted.length - 1]);
}
function getCandlePoints(x6, y5, size2) {
var yValues = getCandleYValues(y5);
return [
{ x: x6, y: yValues[0] },
{ x: x6, y: yValues[1] },
{ x: x6 - size2 / 2, y: yValues[2] },
{ x: x6 - size2 / 2, y: yValues[1] },
{ x: x6 + size2 / 2, y: yValues[1] },
{ x: x6 + size2 / 2, y: yValues[2] },
{ x: x6, y: yValues[2] },
{ x: x6, y: yValues[3] }
];
}
function getCandlePath(points) {
return [
["M", points[0].x, points[0].y],
["L", points[1].x, points[1].y],
["M", points[2].x, points[2].y],
["L", points[3].x, points[3].y],
["L", points[4].x, points[4].y],
["L", points[5].x, points[5].y],
["Z"],
["M", points[6].x, points[6].y],
["L", points[7].x, points[7].y]
];
}
registerShape("schema", "candle", {
getPoints: function(shapePoint) {
var x6 = shapePoint.x, y5 = shapePoint.y, size2 = shapePoint.size;
return getCandlePoints(x6, y5, size2);
},
draw: function(cfg, container2) {
var style = getStyle2(cfg, true, true);
var path = this.parsePath(getCandlePath(cfg.points));
var shape = container2.addShape("path", {
attrs: __assign(__assign({}, style), { path, name: "schema" })
});
return shape;
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: function(x6, y5, r4) {
var yValues = [y5 + 7.5, y5 + 3, y5 - 3, y5 - 7.5];
var points = getCandlePoints(x6, yValues, r4);
return [
["M", points[0].x, points[0].y],
["L", points[1].x, points[1].y],
["M", points[2].x, points[2].y],
["L", points[3].x, points[3].y],
["L", points[4].x, points[4].y],
["L", points[5].x, points[5].y],
["Z"],
["M", points[6].x, points[6].y],
["L", points[7].x, points[7].y]
];
},
style: {
lineWidth: 1,
stroke: color4,
fill: color4,
r: 6
}
};
}
});
// node_modules/@antv/g2/esm/geometry/shape/polygon/square.js
function getRectAttrs(points, size2) {
var width2 = Math.abs(points[0].x - points[2].x);
var height = Math.abs(points[0].y - points[2].y);
var len5 = Math.min(width2, height);
if (size2) {
len5 = clamp_default(size2, 0, Math.min(width2, height));
}
len5 = len5 / 2;
var centerX = (points[0].x + points[2].x) / 2;
var centerY = (points[0].y + points[2].y) / 2;
return {
x: centerX - len5,
y: centerY - len5,
width: len5 * 2,
height: len5 * 2
};
}
registerShape("polygon", "square", {
draw: function(cfg, container2) {
if (!is_empty_default(cfg.points)) {
var shapeAttrs = getStyle2(cfg, true, true);
var points = this.parsePoints(cfg.points);
return container2.addShape("rect", {
attrs: __assign(__assign({}, shapeAttrs), getRectAttrs(points, cfg.size)),
name: "polygon"
});
}
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: "square",
style: {
r: 4,
fill: color4
}
};
}
});
// node_modules/@antv/g2/esm/geometry/shape/violin/smooth.js
registerShape("violin", "smooth", {
draw: function(cfg, container2) {
var attrs = getStyle2(cfg, true, true);
var path = this.parsePath(getSmoothViolinPath(cfg.points));
return container2.addShape("path", {
attrs: __assign(__assign({}, attrs), { path })
});
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: "circle",
style: {
stroke: null,
r: 4,
fill: color4
}
};
}
});
// node_modules/@antv/g2/esm/geometry/shape/violin/hollow.js
registerShape("violin", "hollow", {
draw: function(cfg, container2) {
var attrs = getStyle2(cfg, true, false);
var path = this.parsePath(getViolinPath(cfg.points));
return container2.addShape("path", {
attrs: __assign(__assign({}, attrs), { path })
});
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: "circle",
style: {
r: 4,
fill: null,
stroke: color4
}
};
}
});
registerShape("violin", "hollow-smooth", {
draw: function(cfg, container2) {
var attrs = getStyle2(cfg, true, false);
var path = this.parsePath(getSmoothViolinPath(cfg.points));
return container2.addShape("path", {
attrs: __assign(__assign({}, attrs), { path })
});
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: "circle",
style: {
r: 4,
fill: null,
stroke: color4
}
};
}
});
// node_modules/@antv/g2/esm/geometry/label/interval.js
var IntervalLabel = function(_super) {
__extends(IntervalLabel2, _super);
function IntervalLabel2() {
return _super !== null && _super.apply(this, arguments) || this;
}
IntervalLabel2.prototype.getLabelValueDir = function(mappingData) {
var dim = "y";
var points = mappingData.points;
return points[0][dim] <= points[2][dim] ? 1 : -1;
};
IntervalLabel2.prototype.getLabelOffsetPoint = function(labelCfg, index2, total, position2) {
var _a6;
var point2 = _super.prototype.getLabelOffsetPoint.call(this, labelCfg, index2, total);
var coordinate11 = this.getCoordinate();
var transposed = coordinate11.isTransposed;
var dim = transposed ? "x" : "y";
var dir = this.getLabelValueDir(labelCfg.mappingData);
point2 = __assign(__assign({}, point2), (_a6 = {}, _a6[dim] = point2[dim] * dir, _a6));
if (coordinate11.isReflect("x")) {
point2 = __assign(__assign({}, point2), { x: point2.x * -1 });
}
if (coordinate11.isReflect("y")) {
point2 = __assign(__assign({}, point2), { y: point2.y * -1 });
}
return point2;
};
IntervalLabel2.prototype.getThemedLabelCfg = function(labelCfg) {
var geometry35 = this.geometry;
var defaultLabelCfg3 = this.getDefaultLabelCfg();
var theme4 = geometry35.theme;
return deep_mix_default({}, defaultLabelCfg3, theme4.labels, labelCfg.position === "middle" ? { offset: 0 } : {}, labelCfg);
};
IntervalLabel2.prototype.setLabelPosition = function(labelPointCfg, mappingData, index2, position2) {
var coordinate11 = this.getCoordinate();
var transposed = coordinate11.isTransposed;
var shapePoints = mappingData.points;
var point0 = coordinate11.convert(shapePoints[0]);
var point2 = coordinate11.convert(shapePoints[2]);
var dir = this.getLabelValueDir(mappingData);
var top;
var right2;
var bottom;
var left2;
var shape = is_array_default(mappingData.shape) ? mappingData.shape[0] : mappingData.shape;
if (shape === "funnel" || shape === "pyramid") {
var nextPoints = get_default(mappingData, "nextPoints");
var points = get_default(mappingData, "points");
if (nextPoints) {
var p0 = coordinate11.convert(points[0]);
var p1 = coordinate11.convert(points[1]);
var nextP0 = coordinate11.convert(nextPoints[0]);
var nextP1 = coordinate11.convert(nextPoints[1]);
if (transposed) {
top = Math.min(nextP0.y, p0.y);
bottom = Math.max(nextP0.y, p0.y);
right2 = (p1.x + nextP1.x) / 2;
left2 = (p0.x + nextP0.x) / 2;
} else {
top = Math.min((p1.y + nextP1.y) / 2, (p0.y + nextP0.y) / 2);
bottom = Math.max((p1.y + nextP1.y) / 2, (p0.y + nextP0.y) / 2);
right2 = nextP1.x;
left2 = p0.x;
}
} else {
top = Math.min(point2.y, point0.y);
bottom = Math.max(point2.y, point0.y);
right2 = point2.x;
left2 = point0.x;
}
} else {
top = Math.min(point2.y, point0.y);
bottom = Math.max(point2.y, point0.y);
right2 = point2.x;
left2 = point0.x;
}
switch (position2) {
case "right":
labelPointCfg.x = right2;
labelPointCfg.y = (top + bottom) / 2;
labelPointCfg.textAlign = get_default(labelPointCfg, "textAlign", dir > 0 ? "left" : "right");
break;
case "left":
labelPointCfg.x = left2;
labelPointCfg.y = (top + bottom) / 2;
labelPointCfg.textAlign = get_default(labelPointCfg, "textAlign", dir > 0 ? "left" : "right");
break;
case "bottom":
if (transposed) {
labelPointCfg.x = (right2 + left2) / 2;
}
labelPointCfg.y = bottom;
labelPointCfg.textAlign = get_default(labelPointCfg, "textAlign", "center");
labelPointCfg.textBaseline = get_default(labelPointCfg, "textBaseline", dir > 0 ? "bottom" : "top");
break;
case "middle":
if (transposed) {
labelPointCfg.x = (right2 + left2) / 2;
}
labelPointCfg.y = (top + bottom) / 2;
labelPointCfg.textAlign = get_default(labelPointCfg, "textAlign", "center");
labelPointCfg.textBaseline = get_default(labelPointCfg, "textBaseline", "middle");
break;
case "top":
if (transposed) {
labelPointCfg.x = (right2 + left2) / 2;
}
labelPointCfg.y = top;
labelPointCfg.textAlign = get_default(labelPointCfg, "textAlign", "center");
labelPointCfg.textBaseline = get_default(labelPointCfg, "textBaseline", dir > 0 ? "bottom" : "top");
break;
default:
break;
}
};
return IntervalLabel2;
}(base_default14);
var interval_default2 = IntervalLabel;
// node_modules/@antv/g2/esm/geometry/label/polar.js
var HALF_PI = Math.PI / 2;
var PolarLabel = function(_super) {
__extends(PolarLabel2, _super);
function PolarLabel2() {
return _super !== null && _super.apply(this, arguments) || this;
}
PolarLabel2.prototype.getLabelOffset = function(offset) {
var coordinate11 = this.getCoordinate();
var actualOffset = 0;
if (is_number_default(offset)) {
actualOffset = offset;
} else if (is_string_default(offset) && offset.indexOf("%") !== -1) {
var r4 = coordinate11.getRadius();
if (coordinate11.innerRadius > 0) {
r4 = r4 * (1 - coordinate11.innerRadius);
}
actualOffset = parseFloat(offset) * 0.01 * r4;
}
return actualOffset;
};
PolarLabel2.prototype.getLabelItems = function(mapppingArray) {
var items = _super.prototype.getLabelItems.call(this, mapppingArray);
var yScale = this.geometry.getYScale();
return map_default(items, function(item) {
if (item && yScale) {
var percent2 = yScale.scale(get_default(item.data, yScale.field));
return __assign(__assign({}, item), { percent: percent2 });
}
return item;
});
};
PolarLabel2.prototype.getLabelAlign = function(point2) {
var coordinate11 = this.getCoordinate();
var align;
if (point2.labelEmit) {
align = point2.angle <= Math.PI / 2 && point2.angle >= -Math.PI / 2 ? "left" : "right";
} else if (!coordinate11.isTransposed) {
align = "center";
} else {
var center2 = coordinate11.getCenter();
var offset = point2.offset;
if (Math.abs(point2.x - center2.x) < 1) {
align = "center";
} else if (point2.angle > Math.PI || point2.angle <= 0) {
align = offset > 0 ? "left" : "right";
} else {
align = offset > 0 ? "right" : "left";
}
}
return align;
};
PolarLabel2.prototype.getLabelPoint = function(labelCfg, mappingData, index2) {
var factor = 1;
var arcPoint;
var content = labelCfg.content[index2];
if (this.isToMiddle(mappingData)) {
arcPoint = this.getMiddlePoint(mappingData.points);
} else {
if (labelCfg.content.length === 1 && index2 === 0) {
index2 = 1;
} else if (index2 === 0) {
factor = -1;
}
arcPoint = this.getArcPoint(mappingData, index2);
}
var offset = labelCfg.offset * factor;
var middleAngle = this.getPointAngle(arcPoint);
var isLabelEmit = labelCfg.labelEmit;
var labelPositionCfg = this.getCirclePoint(middleAngle, offset, arcPoint, isLabelEmit);
if (labelPositionCfg.r === 0) {
labelPositionCfg.content = "";
} else {
labelPositionCfg.content = content;
labelPositionCfg.angle = middleAngle;
labelPositionCfg.color = mappingData.color;
}
labelPositionCfg.rotate = labelCfg.autoRotate ? this.getLabelRotate(middleAngle, offset, isLabelEmit) : labelCfg.rotate;
labelPositionCfg.start = {
x: arcPoint.x,
y: arcPoint.y
};
return labelPositionCfg;
};
PolarLabel2.prototype.getArcPoint = function(mappingData, index2) {
if (index2 === void 0) {
index2 = 0;
}
if (!is_array_default(mappingData.x) && !is_array_default(mappingData.y)) {
return {
x: mappingData.x,
y: mappingData.y
};
}
return {
x: is_array_default(mappingData.x) ? mappingData.x[index2] : mappingData.x,
y: is_array_default(mappingData.y) ? mappingData.y[index2] : mappingData.y
};
};
PolarLabel2.prototype.getPointAngle = function(point2) {
return getAngleByPoint(this.getCoordinate(), point2);
};
PolarLabel2.prototype.getCirclePoint = function(angle3, offset, point2, isLabelEmit) {
var coordinate11 = this.getCoordinate();
var center2 = coordinate11.getCenter();
var r4 = getDistanceToCenter(coordinate11, point2);
if (r4 === 0) {
return __assign(__assign({}, center2), { r: r4 });
}
var labelAngle = angle3;
if (coordinate11.isTransposed && r4 > offset && !isLabelEmit) {
var appendAngle = Math.asin(offset / (2 * r4));
labelAngle = angle3 + appendAngle * 2;
} else {
r4 = r4 + offset;
}
return {
x: center2.x + r4 * Math.cos(labelAngle),
y: center2.y + r4 * Math.sin(labelAngle),
r: r4
};
};
PolarLabel2.prototype.getLabelRotate = function(angle3, offset, isLabelEmit) {
var rotate8 = angle3 + HALF_PI;
if (isLabelEmit) {
rotate8 -= HALF_PI;
}
if (rotate8) {
if (rotate8 > HALF_PI) {
rotate8 = rotate8 - Math.PI;
} else if (rotate8 < -HALF_PI) {
rotate8 = rotate8 + Math.PI;
}
}
return rotate8;
};
PolarLabel2.prototype.getMiddlePoint = function(points) {
var coordinate11 = this.getCoordinate();
var count2 = points.length;
var middlePoint = {
x: 0,
y: 0
};
each_default(points, function(point2) {
middlePoint.x += point2.x;
middlePoint.y += point2.y;
});
middlePoint.x /= count2;
middlePoint.y /= count2;
middlePoint = coordinate11.convert(middlePoint);
return middlePoint;
};
PolarLabel2.prototype.isToMiddle = function(mappingData) {
return mappingData.x.length > 2;
};
return PolarLabel2;
}(base_default14);
var polar_default2 = PolarLabel;
// node_modules/@antv/g2/esm/geometry/label/pie.js
var PieLabel = function(_super) {
__extends(PieLabel2, _super);
function PieLabel2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.defaultLayout = "distribute";
return _this;
}
PieLabel2.prototype.getDefaultLabelCfg = function(offset, position2) {
var cfg = _super.prototype.getDefaultLabelCfg.call(this, offset, position2);
return deep_mix_default({}, cfg, get_default(this.geometry.theme, "pieLabels", {}));
};
PieLabel2.prototype.getLabelOffset = function(offset) {
return _super.prototype.getLabelOffset.call(this, offset) || 0;
};
PieLabel2.prototype.getLabelRotate = function(angle3, offset, isLabelLimit) {
var rotate8;
if (offset < 0) {
rotate8 = angle3;
if (rotate8 > Math.PI / 2) {
rotate8 = rotate8 - Math.PI;
}
if (rotate8 < -Math.PI / 2) {
rotate8 = rotate8 + Math.PI;
}
}
return rotate8;
};
PieLabel2.prototype.getLabelAlign = function(point2) {
var coordinate11 = this.getCoordinate();
var center2 = coordinate11.getCenter();
var align;
if (point2.angle <= Math.PI / 2 && point2.x >= center2.x) {
align = "left";
} else {
align = "right";
}
if (point2.offset <= 0) {
if (align === "right") {
align = "left";
} else {
align = "right";
}
}
return align;
};
PieLabel2.prototype.getArcPoint = function(point2) {
return point2;
};
PieLabel2.prototype.getPointAngle = function(point2) {
var coordinate11 = this.getCoordinate();
var startPoint = {
x: is_array_default(point2.x) ? point2.x[0] : point2.x,
y: point2.y[0]
};
var endPoint = {
x: is_array_default(point2.x) ? point2.x[1] : point2.x,
y: point2.y[1]
};
var angle3;
var startAngle = getAngleByPoint(coordinate11, startPoint);
if (point2.points && point2.points[0].y === point2.points[1].y) {
angle3 = startAngle;
} else {
var endAngle = getAngleByPoint(coordinate11, endPoint);
if (startAngle >= endAngle) {
endAngle = endAngle + Math.PI * 2;
}
angle3 = startAngle + (endAngle - startAngle) / 2;
}
return angle3;
};
PieLabel2.prototype.getCirclePoint = function(angle3, offset) {
var coordinate11 = this.getCoordinate();
var center2 = coordinate11.getCenter();
var r4 = coordinate11.getRadius() + offset;
return __assign(__assign({}, polarToCartesian(center2.x, center2.y, r4, angle3)), { angle: angle3, r: r4 });
};
return PieLabel2;
}(polar_default2);
var pie_default = PieLabel;
// node_modules/@antv/g2/esm/geometry/label/layout/pie/distribute.js
var MARGIN = 4;
function antiCollision(labelShapes, labels, lineHeight, plotRange, center2, isRight) {
var overlapping = true;
var start = plotRange.start;
var end2 = plotRange.end;
var startY = Math.min(start.y, end2.y);
var totalHeight = Math.abs(start.y - end2.y);
var i4;
var maxY2 = 0;
var minY = Number.MIN_VALUE;
var boxes = labels.map(function(label17) {
if (label17.y > maxY2) {
maxY2 = label17.y;
}
if (label17.y < minY) {
minY = label17.y;
}
return {
size: lineHeight,
targets: [label17.y - startY]
};
});
minY -= startY;
if (maxY2 - startY > totalHeight) {
totalHeight = maxY2 - startY;
}
while (overlapping) {
boxes.forEach(function(box3) {
var target = (Math.min.apply(minY, box3.targets) + Math.max.apply(minY, box3.targets)) / 2;
box3.pos = Math.min(Math.max(minY, target - box3.size / 2), totalHeight - box3.size);
});
overlapping = false;
i4 = boxes.length;
while (i4--) {
if (i4 > 0) {
var previousBox = boxes[i4 - 1];
var box2 = boxes[i4];
if (previousBox.pos + previousBox.size > box2.pos) {
previousBox.size += box2.size;
previousBox.targets = previousBox.targets.concat(box2.targets);
if (previousBox.pos + previousBox.size > totalHeight) {
previousBox.pos = totalHeight - previousBox.size;
}
boxes.splice(i4, 1);
overlapping = true;
}
}
}
}
i4 = 0;
boxes.forEach(function(b10) {
var posInCompositeBox = startY + lineHeight / 2;
b10.targets.forEach(function() {
labels[i4].y = b10.pos + posInCompositeBox;
posInCompositeBox += lineHeight;
i4++;
});
});
var labelsMap = {};
for (var _i = 0, labelShapes_1 = labelShapes; _i < labelShapes_1.length; _i++) {
var labelShape = labelShapes_1[_i];
labelsMap[labelShape.get("id")] = labelShape;
}
labels.forEach(function(label17) {
var rPow2 = label17.r * label17.r;
var dyPow2 = Math.pow(Math.abs(label17.y - center2.y), 2);
if (rPow2 < dyPow2) {
label17.x = center2.x;
} else {
var dx = Math.sqrt(rPow2 - dyPow2);
if (!isRight) {
label17.x = center2.x - dx;
} else {
label17.x = center2.x + dx;
}
}
var labelShape2 = labelsMap[label17.id];
labelShape2.attr("x", label17.x);
labelShape2.attr("y", label17.y);
var textShape = find_default(labelShape2.getChildren(), function(ele) {
return ele.get("type") === "text";
});
if (textShape) {
textShape.attr("y", label17.y);
textShape.attr("x", label17.x);
}
});
}
function distribute(items, labels, shapes, region) {
if (!items.length || !labels.length) {
return;
}
var offset = items[0] ? items[0].offset : 0;
var coordinate11 = labels[0].get("coordinate");
var radius = coordinate11.getRadius();
var center2 = coordinate11.getCenter();
if (offset > 0) {
var lineHeight_1 = 14;
var totalR = radius + offset;
var totalHeight_1 = totalR * 2 + lineHeight_1 * 2;
var plotRange_1 = {
start: coordinate11.start,
end: coordinate11.end
};
var halves_1 = [
[],
[]
];
items.forEach(function(labelItem) {
if (!labelItem) {
return;
}
if (labelItem.textAlign === "right") {
halves_1[0].push(labelItem);
} else {
halves_1[1].push(labelItem);
}
});
halves_1.forEach(function(half, index2) {
var maxLabelsCountForOneSide = totalHeight_1 / lineHeight_1;
if (half.length > maxLabelsCountForOneSide) {
half.sort(function(a4, b10) {
return b10["..percent"] - a4["..percent"];
});
half.splice(maxLabelsCountForOneSide, half.length - maxLabelsCountForOneSide);
}
half.sort(function(a4, b10) {
return a4.y - b10.y;
});
antiCollision(labels, half, lineHeight_1, plotRange_1, center2, index2);
});
}
each_default(items, function(item) {
if (item && item.labelLine) {
var distance15 = item.offset;
var angle3 = item.angle;
var startPoint = polarToCartesian(center2.x, center2.y, radius, angle3);
var innerPoint = polarToCartesian(center2.x, center2.y, radius + distance15 / 2, angle3);
var itemX = item.x + get_default(item, "offsetX", 0);
var itemY = item.y + get_default(item, "offsetY", 0);
var endPoint = {
x: itemX - Math.cos(angle3) * MARGIN,
y: itemY - Math.sin(angle3) * MARGIN
};
if (!is_object_default(item.labelLine)) {
item.labelLine = {};
}
item.labelLine.path = [
"M ".concat(startPoint.x),
"".concat(startPoint.y, " Q").concat(innerPoint.x),
"".concat(innerPoint.y, " ").concat(endPoint.x),
endPoint.y
].join(",");
}
});
}
// node_modules/@antv/g2/esm/geometry/label/layout/pie/util.js
function antiCollision2(items, labelHeight, plotRange) {
var labels = items.filter(function(item) {
return !item.invisible;
});
labels.sort(function(a4, b10) {
return a4.y - b10.y;
});
var overlapping = true;
var startY = plotRange.minY;
var endY = plotRange.maxY;
var totalHeight = Math.abs(startY - endY);
var i4;
var maxY2 = 0;
var minY = Number.MIN_VALUE;
var boxes = labels.map(function(label17) {
if (label17.y > maxY2) {
maxY2 = label17.y;
}
if (label17.y < minY) {
minY = label17.y;
}
return {
content: label17.content,
size: labelHeight,
targets: [label17.y - startY],
pos: null
};
});
minY -= startY;
if (maxY2 - startY > totalHeight) {
totalHeight = maxY2 - startY;
}
while (overlapping) {
boxes.forEach(function(box3) {
var target = (Math.min.apply(minY, box3.targets) + Math.max.apply(minY, box3.targets)) / 2;
box3.pos = Math.min(Math.max(minY, target - box3.size / 2), totalHeight - box3.size);
box3.pos = Math.max(0, box3.pos);
});
overlapping = false;
i4 = boxes.length;
while (i4--) {
if (i4 > 0) {
var previousBox = boxes[i4 - 1];
var box2 = boxes[i4];
if (previousBox.pos + previousBox.size > box2.pos) {
previousBox.size += box2.size;
previousBox.targets = previousBox.targets.concat(box2.targets);
if (previousBox.pos + previousBox.size > totalHeight) {
previousBox.pos = totalHeight - previousBox.size;
}
boxes.splice(i4, 1);
overlapping = true;
}
}
}
}
i4 = 0;
boxes.forEach(function(b10) {
var posInCompositeBox = startY + labelHeight / 2;
b10.targets.forEach(function() {
labels[i4].y = b10.pos + posInCompositeBox;
posInCompositeBox += labelHeight;
i4++;
});
});
}
// node_modules/@antv/g2/esm/geometry/label/layout/pie/outer.js
var MARGIN2 = 4;
function drawLabelline(item, coordinate11) {
var center2 = coordinate11.getCenter();
var radius = coordinate11.getRadius();
if (item && item.labelLine) {
var angle3 = item.angle, labelOffset = item.offset;
var startPoint = polarToCartesian(center2.x, center2.y, radius, angle3);
var itemX = item.x + get_default(item, "offsetX", 0) * (Math.cos(angle3) > 0 ? 1 : -1);
var itemY = item.y + get_default(item, "offsetY", 0) * (Math.sin(angle3) > 0 ? 1 : -1);
var endPoint = {
x: itemX - Math.cos(angle3) * MARGIN2,
y: itemY - Math.sin(angle3) * MARGIN2
};
var smoothConnector = item.labelLine.smooth;
var path = [];
var dx = endPoint.x - center2.x;
var dy = endPoint.y - center2.y;
var endAngle = Math.atan(dy / dx);
if (dx < 0) {
endAngle += Math.PI;
}
if (smoothConnector === false) {
if (!is_object_default(item.labelLine)) {
item.labelLine = {};
}
var sweepFlag = 0;
if (angle3 < 0 && angle3 > -Math.PI / 2 || angle3 > Math.PI * 1.5) {
if (endPoint.y > startPoint.y) {
sweepFlag = 1;
}
}
if (angle3 >= 0 && angle3 < Math.PI / 2) {
if (endPoint.y > startPoint.y) {
sweepFlag = 1;
}
}
if (angle3 >= Math.PI / 2 && angle3 < Math.PI) {
if (startPoint.y > endPoint.y) {
sweepFlag = 1;
}
}
if (angle3 < -Math.PI / 2 || angle3 >= Math.PI && angle3 < Math.PI * 1.5) {
if (startPoint.y > endPoint.y) {
sweepFlag = 1;
}
}
var distance15 = labelOffset / 2 > 4 ? 4 : Math.max(labelOffset / 2 - 1, 0);
var breakPoint = polarToCartesian(center2.x, center2.y, radius + distance15, angle3);
var breakPoint3 = polarToCartesian(center2.x, center2.y, radius + labelOffset / 2, endAngle);
var largeArcFlag = 0;
path.push("M ".concat(startPoint.x, " ").concat(startPoint.y));
path.push("L ".concat(breakPoint.x, " ").concat(breakPoint.y));
path.push("A ".concat(center2.x, " ").concat(center2.y, " 0 ").concat(largeArcFlag, " ").concat(sweepFlag, " ").concat(breakPoint3.x, " ").concat(breakPoint3.y));
path.push("L ".concat(endPoint.x, " ").concat(endPoint.y));
} else {
var breakPoint = polarToCartesian(center2.x, center2.y, radius + (labelOffset / 2 > 4 ? 4 : Math.max(labelOffset / 2 - 1, 0)), angle3);
var xSign = startPoint.x < center2.x ? 1 : -1;
path.push("M ".concat(endPoint.x, " ").concat(endPoint.y));
var slope1 = (startPoint.y - center2.y) / (startPoint.x - center2.x);
var slope2 = (endPoint.y - center2.y) / (endPoint.x - center2.x);
if (Math.abs(slope1 - slope2) > Math.pow(Math.E, -16)) {
path.push.apply(path, [
"C",
endPoint.x + xSign * 4,
endPoint.y,
2 * breakPoint.x - startPoint.x,
2 * breakPoint.y - startPoint.y,
startPoint.x,
startPoint.y
]);
}
path.push("L ".concat(startPoint.x, " ").concat(startPoint.y));
}
item.labelLine.path = path.join(" ");
}
}
function pieOuterLabelLayout(originalItems, labels, shapes, region) {
var items = filter_default(originalItems, function(item) {
return !is_nil_default(item);
});
var coordinate11 = labels[0] && labels[0].get("coordinate");
if (!coordinate11) {
return;
}
var center2 = coordinate11.getCenter();
var radius = coordinate11.getRadius();
var labelsMap = {};
for (var _i = 0, labels_1 = labels; _i < labels_1.length; _i++) {
var labelShape = labels_1[_i];
labelsMap[labelShape.get("id")] = labelShape;
}
var labelHeight = get_default(items[0], "labelHeight", 14);
var labelOffset = get_default(items[0], "offset", 0);
if (labelOffset <= 0) {
return;
}
var LEFT_HALF_KEY = "left";
var RIGHT_HALF_KEY = "right";
var separateLabels = group_by_default(items, function(item) {
return item.x < center2.x ? LEFT_HALF_KEY : RIGHT_HALF_KEY;
});
var start = coordinate11.start, end2 = coordinate11.end;
var totalHeight = Math.min((radius + labelOffset + labelHeight) * 2, coordinate11.getHeight());
var totalR = totalHeight / 2;
var labelsContainerRange = {
minX: start.x,
maxX: end2.x,
minY: center2.y - totalR,
maxY: center2.y + totalR
};
each_default(separateLabels, function(half, key) {
var maxLabelsCountForOneSide = Math.floor(totalHeight / labelHeight);
if (half.length > maxLabelsCountForOneSide) {
half.sort(function(a4, b10) {
return b10.percent - a4.percent;
});
each_default(half, function(labelItem, idx) {
if (idx + 1 > maxLabelsCountForOneSide) {
labelsMap[labelItem.id].set("visible", false);
labelItem.invisible = true;
}
});
}
antiCollision2(half, labelHeight, labelsContainerRange);
});
each_default(separateLabels, function(half, key) {
each_default(half, function(item) {
var isRight = key === RIGHT_HALF_KEY;
var labelShape2 = labelsMap[item.id];
var content = labelShape2.getChildByIndex(0);
if (content) {
var r4 = radius + labelOffset;
var dy = item.y - center2.y;
var rPow2 = Math.pow(r4, 2);
var dyPow2 = Math.pow(dy, 2);
var dxPow2 = rPow2 - dyPow2 > 0 ? rPow2 - dyPow2 : 0;
var dx = Math.sqrt(dxPow2);
var dx_offset = Math.abs(Math.cos(item.angle) * r4);
if (!isRight) {
item.x = center2.x - Math.max(dx, dx_offset);
} else {
item.x = center2.x + Math.max(dx, dx_offset);
}
}
if (content) {
content.attr("y", item.y);
content.attr("x", item.x);
}
drawLabelline(item, coordinate11);
});
});
}
// node_modules/@antv/g2/esm/geometry/label/layout/pie/spider.js
var INFLECTION_OFFSET = 4;
var LABEL_OFFSET_X = 4;
var LABEL_TEXT_LINE_OFFSET = 4;
function drawLabelline2(item, coordinate11, inRight) {
var center2 = coordinate11.getCenter();
var radius = coordinate11.getRadius();
var startPoint = {
x: item.x - (inRight ? LABEL_TEXT_LINE_OFFSET : -LABEL_TEXT_LINE_OFFSET),
y: item.y
};
var inflectionPoint = polarToCartesian(center2.x, center2.y, radius + INFLECTION_OFFSET, item.angle);
var p1 = { x: startPoint.x, y: startPoint.y };
var p22 = { x: inflectionPoint.x, y: inflectionPoint.y };
var endPoint = polarToCartesian(center2.x, center2.y, radius, item.angle);
var path = "";
if (startPoint.y !== inflectionPoint.y) {
var offset = inRight ? 4 : -4;
p1.y = startPoint.y;
if (item.angle < 0 && item.angle >= -Math.PI / 2) {
p1.x = Math.max(inflectionPoint.x, startPoint.x - offset);
if (startPoint.y < inflectionPoint.y) {
p22.y = p1.y;
} else {
p22.y = inflectionPoint.y;
p22.x = Math.max(p22.x, p1.x - offset);
}
}
if (item.angle > 0 && item.angle < Math.PI / 2) {
p1.x = Math.max(inflectionPoint.x, startPoint.x - offset);
if (startPoint.y > inflectionPoint.y) {
p22.y = p1.y;
} else {
p22.y = inflectionPoint.y;
p22.x = Math.max(p22.x, p1.x - offset);
}
}
if (item.angle > Math.PI / 2) {
p1.x = Math.min(inflectionPoint.x, startPoint.x - offset);
if (startPoint.y > inflectionPoint.y) {
p22.y = p1.y;
} else {
p22.y = inflectionPoint.y;
p22.x = Math.min(p22.x, p1.x - offset);
}
}
if (item.angle < -Math.PI / 2) {
p1.x = Math.min(inflectionPoint.x, startPoint.x - offset);
if (startPoint.y < inflectionPoint.y) {
p22.y = p1.y;
} else {
p22.y = inflectionPoint.y;
p22.x = Math.min(p22.x, p1.x - offset);
}
}
}
path = [
"M ".concat(startPoint.x, ",").concat(startPoint.y),
"L ".concat(p1.x, ",").concat(p1.y),
"L ".concat(p22.x, ",").concat(p22.y),
"L ".concat(inflectionPoint.x, ",").concat(inflectionPoint.y),
"L ".concat(endPoint.x, ",").concat(endPoint.y)
].join(" ");
item.labelLine = deep_mix_default({}, item.labelLine, { path });
}
function pieSpiderLabelLayout(items, labels, shapes, region) {
var coordinate11 = labels[0] && labels[0].get("coordinate");
if (!coordinate11) {
return;
}
var center2 = coordinate11.getCenter();
var radius = coordinate11.getRadius();
var labelsMap = {};
for (var _i = 0, labels_1 = labels; _i < labels_1.length; _i++) {
var labelShape = labels_1[_i];
labelsMap[labelShape.get("id")] = labelShape;
}
var labelHeight = get_default(items[0], "labelHeight", 14);
var labelOffset = Math.max(get_default(items[0], "offset", 0), INFLECTION_OFFSET);
each_default(items, function(item) {
var label17 = get_default(labelsMap, [item.id]);
if (!label17) {
return;
}
var inRight = item.x > center2.x || item.x === center2.x && item.y > center2.y;
var offsetX = !is_nil_default(item.offsetX) ? item.offsetX : LABEL_OFFSET_X;
var inflectionPoint = polarToCartesian(center2.x, center2.y, radius + INFLECTION_OFFSET, item.angle);
var totalOffset = labelOffset + offsetX;
item.x = center2.x + (inRight ? 1 : -1) * (radius + totalOffset);
item.y = inflectionPoint.y;
});
var start = coordinate11.start, end2 = coordinate11.end;
var LEFT_HALF_KEY = "left";
var RIGHT_HALF_KEY = "right";
var seperateLabels = group_by_default(items, function(item) {
return item.x < center2.x ? LEFT_HALF_KEY : RIGHT_HALF_KEY;
});
var totalHeight = (radius + labelOffset) * 2 + labelHeight;
each_default(seperateLabels, function(half) {
var halfHeight = half.length * labelHeight;
if (halfHeight > totalHeight) {
totalHeight = Math.min(halfHeight, Math.abs(start.y - end2.y));
}
});
var labelsContainerRange = {
minX: start.x,
maxX: end2.x,
minY: center2.y - totalHeight / 2,
maxY: center2.y + totalHeight / 2
};
each_default(seperateLabels, function(half, key) {
var maxLabelsCountForOneSide = totalHeight / labelHeight;
if (half.length > maxLabelsCountForOneSide) {
half.sort(function(a4, b10) {
return b10.percent - a4.percent;
});
each_default(half, function(labelItem, idx) {
if (idx > maxLabelsCountForOneSide) {
labelsMap[labelItem.id].set("visible", false);
labelItem.invisible = true;
}
});
}
antiCollision2(half, labelHeight, labelsContainerRange);
});
var startY = labelsContainerRange.minY;
var endY = labelsContainerRange.maxY;
each_default(seperateLabels, function(half, key) {
var inRight = key === RIGHT_HALF_KEY;
each_default(half, function(item) {
var label17 = get_default(labelsMap, item && [item.id]);
if (!label17) {
return;
}
if (item.y < startY || item.y > endY) {
label17.set("visible", false);
return;
}
var labelContent = label17.getChildByIndex(0);
var box2 = labelContent.getCanvasBBox();
var originalPos = { x: inRight ? box2.x : box2.maxX, y: box2.y + box2.height / 2 };
translate3(labelContent, item.x - originalPos.x, item.y - originalPos.y);
if (item.labelLine) {
drawLabelline2(item, coordinate11, inRight);
}
});
});
}
// node_modules/@antv/g2/esm/geometry/label/layout/limit-in-canvas.js
function limitInCanvas(items, labels, shapes, region) {
each_default(labels, function(label17) {
var regionMinX = region.minX, regionMinY = region.minY, regionMaxX = region.maxX, regionMaxY = region.maxY;
var _a6 = label17.getCanvasBBox(), minX = _a6.minX, minY = _a6.minY, maxX = _a6.maxX, maxY2 = _a6.maxY, x6 = _a6.x, y5 = _a6.y, width2 = _a6.width, height = _a6.height;
var finalX = x6;
var finalY = y5;
if (minX < regionMinX || maxX < regionMinX) {
finalX = regionMinX;
}
if (minY < regionMinY || maxY2 < regionMinY) {
finalY = regionMinY;
}
if (minX > regionMaxX) {
finalX = regionMaxX - width2;
} else if (maxX > regionMaxX) {
finalX = finalX - (maxX - regionMaxX);
}
if (minY > regionMaxY) {
finalY = regionMaxY - height;
} else if (maxY2 > regionMaxY) {
finalY = finalY - (maxY2 - regionMaxY);
}
if (finalX !== x6 || finalY !== y5) {
translate3(label17, finalX - x6, finalY - y5);
}
});
}
// node_modules/@antv/g2/esm/geometry/label/layout/limit-in-shape.js
function limitInShape(items, labels, shapes, region) {
each_default(labels, function(label17, index2) {
var labelBBox = label17.getCanvasBBox();
var shapeBBox = shapes[index2].getBBox();
if (labelBBox.minX < shapeBBox.minX || labelBBox.minY < shapeBBox.minY || labelBBox.maxX > shapeBBox.maxX || labelBBox.maxY > shapeBBox.maxY) {
label17.remove(true);
}
});
}
// node_modules/@antv/g2/esm/geometry/label/layout/overlap.js
var MAX_TIMES = 100;
var Greedy = function() {
function Greedy2(cfg) {
if (cfg === void 0) {
cfg = {};
}
this.bitmap = {};
var _a6 = cfg.xGap, xGap = _a6 === void 0 ? 1 : _a6, _b = cfg.yGap, yGap = _b === void 0 ? 8 : _b;
this.xGap = xGap;
this.yGap = yGap;
}
Greedy2.prototype.hasGap = function(bbox) {
var hasGap = true;
var bitmap = this.bitmap;
var minX = Math.round(bbox.minX);
var maxX = Math.round(bbox.maxX);
var minY = Math.round(bbox.minY);
var maxY2 = Math.round(bbox.maxY);
for (var i4 = minX; i4 <= maxX; i4 += 1) {
if (!bitmap[i4]) {
bitmap[i4] = {};
continue;
}
if (i4 === minX || i4 === maxX) {
for (var j4 = minY; j4 <= maxY2; j4++) {
if (bitmap[i4][j4]) {
hasGap = false;
break;
}
}
} else {
if (bitmap[i4][minY] || bitmap[i4][maxY2]) {
hasGap = false;
break;
}
}
}
return hasGap;
};
Greedy2.prototype.fillGap = function(bbox) {
var bitmap = this.bitmap;
var minX = Math.round(bbox.minX);
var maxX = Math.round(bbox.maxX);
var minY = Math.round(bbox.minY);
var maxY2 = Math.round(bbox.maxY);
for (var i4 = minX; i4 <= maxX; i4 += 1) {
if (!bitmap[i4]) {
bitmap[i4] = {};
}
}
for (var i4 = minX; i4 <= maxX; i4 += this.xGap) {
for (var j4 = minY; j4 <= maxY2; j4 += this.yGap) {
bitmap[i4][j4] = true;
}
bitmap[i4][maxY2] = true;
}
if (this.yGap !== 1) {
for (var i4 = minY; i4 <= maxY2; i4 += 1) {
bitmap[minX][i4] = true;
bitmap[maxX][i4] = true;
}
}
if (this.xGap !== 1) {
for (var i4 = minX; i4 <= maxX; i4 += 1) {
bitmap[i4][minY] = true;
bitmap[i4][maxY2] = true;
}
}
};
Greedy2.prototype.destroy = function() {
this.bitmap = {};
};
return Greedy2;
}();
function spiralFill(label17, greedy, maxTimes) {
if (maxTimes === void 0) {
maxTimes = MAX_TIMES;
}
var dt = -1;
var _a6 = label17.attr(), x6 = _a6.x, y5 = _a6.y;
var bbox = label17.getCanvasBBox();
var maxDelta = Math.sqrt(bbox.width * bbox.width + bbox.height * bbox.height);
var dxdy;
var t4 = -dt;
var dx = 0;
var dy = 0;
var f3 = function(param) {
var nt = param * 0.1;
return [nt * Math.cos(nt), nt * Math.sin(nt)];
};
if (greedy.hasGap(bbox)) {
greedy.fillGap(bbox);
return true;
}
var canFill = false;
var times = 0;
var accessedCache = {};
while (Math.min(Math.abs(dx), Math.abs(dy)) < maxDelta && times < maxTimes) {
dxdy = f3(t4 += dt);
dx = ~~dxdy[0];
dy = ~~dxdy[1];
if (!dx && !dy || accessedCache["".concat(dx, "-").concat(dy)]) {
continue;
}
label17.attr({ x: x6 + dx, y: y5 + dy });
if (dx + dy < 0) {
label17.attr("textAlign", "right");
}
times++;
if (greedy.hasGap(label17.getCanvasBBox())) {
greedy.fillGap(label17.getCanvasBBox());
canFill = true;
accessedCache["".concat(dx, "-").concat(dy)] = true;
break;
}
}
return canFill;
}
function adjustLabelPosition(label17, x6, y5, index2) {
var _a6 = label17.getCanvasBBox(), width2 = _a6.width, height = _a6.height;
var attrs = {
x: x6,
y: y5,
textAlign: "center"
};
switch (index2) {
case 0:
attrs.y -= height + 1;
attrs.x += 1;
attrs.textAlign = "left";
break;
case 1:
attrs.y -= height + 1;
attrs.x -= 1;
attrs.textAlign = "right";
break;
case 2:
attrs.y += height + 1;
attrs.x -= 1;
attrs.textAlign = "right";
break;
case 3:
attrs.y += height + 1;
attrs.x += 1;
attrs.textAlign = "left";
break;
case 5:
attrs.y -= height * 2 + 2;
break;
case 6:
attrs.y += height * 2 + 2;
break;
case 7:
attrs.x += width2 + 1;
attrs.textAlign = "left";
break;
case 8:
attrs.x -= width2 + 1;
attrs.textAlign = "right";
break;
default:
break;
}
label17.attr(attrs);
return label17.getCanvasBBox();
}
function fixedOverlap(items, labels, shapes, region) {
var greedy = new Greedy();
each_default(labels, function(label17) {
var labelShape = label17.find(function(shape) {
return shape.get("type") === "text";
});
if (!spiralFill(labelShape, greedy)) {
label17.remove(true);
}
});
greedy.destroy();
}
function overlap(items, labels, shapes, region) {
var greedy = new Greedy();
each_default(labels, function(label17) {
var labelShape = label17.find(function(shape) {
return shape.get("type") === "text";
});
var _a6 = labelShape.attr(), x6 = _a6.x, y5 = _a6.y;
var canFill = false;
for (var i4 = 0; i4 <= 8; i4++) {
var bbox = adjustLabelPosition(labelShape, x6, y5, i4);
if (greedy.hasGap(bbox)) {
greedy.fillGap(bbox);
canFill = true;
break;
}
}
if (!canFill) {
label17.remove(true);
}
});
greedy.destroy();
}
// node_modules/@antv/g2/esm/util/collision-detect.js
var dot5 = vec2_exports.dot;
function getAxes(points) {
if (points.length > 4) {
return [];
}
var vector = function(start, end2) {
return [end2.x - start.x, end2.y - start.y];
};
var AB = vector(points[0], points[1]);
var BC = vector(points[1], points[2]);
return [AB, BC];
}
function rotateAtPoint(point2, deg, origin) {
if (deg === void 0) {
deg = 0;
}
if (origin === void 0) {
origin = { x: 0, y: 0 };
}
var x6 = point2.x, y5 = point2.y;
return {
x: (x6 - origin.x) * Math.cos(-deg) + (y5 - origin.y) * Math.sin(-deg) + origin.x,
y: (origin.x - x6) * Math.sin(-deg) + (y5 - origin.y) * Math.cos(-deg) + origin.y
};
}
function getRectPoints2(box2) {
var points = [
{ x: box2.x, y: box2.y },
{ x: box2.x + box2.width, y: box2.y },
{ x: box2.x + box2.width, y: box2.y + box2.height },
{ x: box2.x, y: box2.y + box2.height }
];
var rotation = box2.rotation;
if (rotation) {
return [
rotateAtPoint(points[0], rotation, points[0]),
rotateAtPoint(points[1], rotation, points[0]),
rotateAtPoint(points[2], rotation, points[0]),
rotateAtPoint(points[3], rotation, points[0])
];
}
return points;
}
function getProjection(points, axis22) {
if (points.length > 4) {
return { min: 0, max: 0 };
}
var scalars = [];
points.forEach(function(point2) {
scalars.push(dot5([point2.x, point2.y], axis22));
});
return { min: Math.min.apply(Math, scalars), max: Math.max.apply(Math, scalars) };
}
function isProjectionOverlap(projection1, projection2) {
return projection1.max > projection2.min && projection1.min < projection2.max;
}
function isValidNumber(d3) {
return is_number_default(d3) && !Number.isNaN(d3) && d3 !== Infinity && d3 !== -Infinity;
}
function isValidBox(box2) {
return Object.values(box2).every(isValidNumber);
}
function isIntersectRect(box1, box2, margin) {
if (margin === void 0) {
margin = 0;
}
return !(box2.x > box1.x + box1.width + margin || box2.x + box2.width < box1.x - margin || box2.y > box1.y + box1.height + margin || box2.y + box2.height < box1.y - margin);
}
function isIntersect(box1, box2) {
if (!isValidBox(box1) || !isValidBox(box2))
return false;
if (!box1.rotation && !box2.rotation) {
return isIntersectRect(box1, box2);
}
var rect1Points = getRectPoints2(box1);
var rect2Points = getRectPoints2(box2);
var axes = __spreadArray(__spreadArray([], getAxes(rect1Points), true), getAxes(rect2Points), true);
for (var i4 = 0; i4 < axes.length; i4++) {
var axis22 = axes[i4];
var projection1 = getProjection(rect1Points, axis22);
var projection2 = getProjection(rect2Points, axis22);
if (!isProjectionOverlap(projection1, projection2))
return false;
}
return true;
}
// node_modules/@antv/g2/esm/geometry/label/layout/hide-overlap.js
function hideOverlap(items, labels, shapes, region) {
for (var i4 = 0; i4 < labels.length; i4++) {
var label1 = labels[i4];
if (labels[i4].get("visible")) {
for (var j4 = i4 + 1; j4 < labels.length; j4++) {
var label22 = labels[j4];
if (label1 && label22 && label1 !== label22 && label22.get("visible")) {
var box1 = getlLabelBackgroundInfo(label1, items[i4], get_default(items[i4], "background.padding"));
var box2 = getlLabelBackgroundInfo(label22, items[j4], get_default(items[j4], "background.padding"));
if (isIntersect(box1, box2)) {
labels[j4].set("visible", false);
}
}
}
}
}
}
// node_modules/@antv/g2/esm/util/color.js
var preset = {
"#5B8FF9": true
};
var isContrastColorWhite = function(color4) {
var rgb2 = esm_default2.toRGB(color4).toUpperCase();
if (preset[rgb2]) {
return preset[rgb2];
}
var _a6 = esm_default2.rgb2arr(rgb2), r4 = _a6[0], g4 = _a6[1], b10 = _a6[2];
var isDark = (r4 * 299 + g4 * 587 + b10 * 114) / 1e3 < 128;
return isDark;
};
// node_modules/@antv/g2/esm/geometry/label/layout/adjust-color.js
function adjustColor(items, labels, shapes) {
if (shapes.length === 0) {
return;
}
var element = shapes[0].get("element");
var theme4 = element.geometry.theme;
var _a6 = theme4.labels || {}, fillColorLight = _a6.fillColorLight, fillColorDark = _a6.fillColorDark;
shapes.forEach(function(shape, index2) {
var label17 = labels[index2];
var textShape = label17.find(function(el) {
return el.get("type") === "text";
});
var shapeBBox = BBox.fromObject(shape.getBBox());
var textBBox = BBox.fromObject(textShape.getCanvasBBox());
var overflow = !shapeBBox.contains(textBBox);
var bgColor = shape.attr("fill");
var fillWhite = isContrastColorWhite(bgColor);
if (!overflow) {
if (fillWhite) {
if (fillColorLight) {
textShape.attr("fill", fillColorLight);
}
} else {
if (fillColorDark) {
textShape.attr("fill", fillColorDark);
}
}
} else {
textShape.attr(theme4.overflowLabels.style);
}
});
}
// node_modules/@antv/g2/esm/geometry/label/layout/interval/adjust-position.js
function shouldInShapeSingle(geometry35, label17, shape) {
var coordinate11 = geometry35.coordinate;
var textShape = findLabelTextShape(label17);
var textBBox = BBox.fromObject(textShape.getCanvasBBox());
var shapeBBox = BBox.fromObject(shape.getBBox());
return coordinate11.isTransposed ? shapeBBox.height >= textBBox.height : shapeBBox.width >= textBBox.width;
}
function shouldInShape(geometry35, labels, shapes) {
var isStack = !!geometry35.getAdjust("stack");
return isStack || labels.every(function(label17, index2) {
var shape = shapes[index2];
return shouldInShapeSingle(geometry35, label17, shape);
});
}
function moveInShape(geometry35, label17, shape) {
var coordinate11 = geometry35.coordinate;
var shapeBBox = BBox.fromObject(shape.getBBox());
var textShape = findLabelTextShape(label17);
if (coordinate11.isTransposed) {
textShape.attr({
x: shapeBBox.minX + shapeBBox.width / 2,
textAlign: "center"
});
} else {
textShape.attr({
y: shapeBBox.minY + shapeBBox.height / 2,
textBaseline: "middle"
});
}
}
function intervalAdjustPosition(items, labels, shapes) {
var _a6;
if (shapes.length === 0) {
return;
}
var element = (_a6 = shapes[0]) === null || _a6 === void 0 ? void 0 : _a6.get("element");
var geometry35 = element === null || element === void 0 ? void 0 : element.geometry;
if (!geometry35 || geometry35.type !== "interval") {
return;
}
var inShape = shouldInShape(geometry35, labels, shapes);
if (inShape) {
shapes.forEach(function(shape, index2) {
var label17 = labels[index2];
moveInShape(geometry35, label17, shape);
});
}
}
// node_modules/@antv/g2/esm/geometry/label/layout/interval/hide-overlap.js
function filterLabel(labels) {
var MAX_CNT = 500;
var filteredLabels = [];
var pages = Math.max(Math.floor(labels.length / MAX_CNT), 1);
each_default(labels, function(label17, idx) {
if (idx % pages === 0) {
filteredLabels.push(label17);
} else {
label17.set("visible", false);
}
});
return filteredLabels;
}
function intervalHideOverlap(items, labels, shapes) {
var _a6;
if (shapes.length === 0) {
return;
}
var element = (_a6 = shapes[0]) === null || _a6 === void 0 ? void 0 : _a6.get("element");
var geometry35 = element === null || element === void 0 ? void 0 : element.geometry;
if (!geometry35 || geometry35.type !== "interval") {
return;
}
var filteredLabels = filterLabel(labels);
var xField = geometry35.getXYFields()[0];
var dones = [];
var todo = [];
var groupedLabels = group_by_default(filteredLabels, function(label17) {
return label17.get("data")[xField];
});
var xValues = uniq(map_default(filteredLabels, function(label17) {
return label17.get("data")[xField];
}));
var xValue;
filteredLabels.forEach(function(label17) {
label17.set("visible", true);
});
var addCurrentGroup = function(curItems) {
if (curItems) {
if (curItems.length) {
todo.push(curItems.pop());
}
todo.push.apply(todo, curItems);
}
};
if (size(xValues) > 0) {
xValue = xValues.shift();
addCurrentGroup(groupedLabels[xValue]);
}
if (size(xValues) > 0) {
xValue = xValues.pop();
addCurrentGroup(groupedLabels[xValue]);
}
each_default(xValues.reverse(), function(val) {
addCurrentGroup(groupedLabels[val]);
});
while (todo.length > 0) {
var cur = todo.shift();
if (cur.get("visible")) {
if (checkShapeOverlap(cur, dones)) {
cur.set("visible", false);
} else {
dones.push(cur);
}
}
}
}
// node_modules/@antv/g2/esm/geometry/label/layout/point/adjust-position.js
function sortLabels(geometry35, labels) {
var yField = geometry35.getXYFields()[1];
var result = [];
var sortedLabels = labels.sort(function(left2, right2) {
return left2.get("data")[yField] - left2.get("data")[yField];
});
if (sortedLabels.length > 0) {
result.push(sortedLabels.shift());
}
if (sortedLabels.length > 0) {
result.push(sortedLabels.pop());
}
result.push.apply(result, sortedLabels);
return result;
}
function hasSome(dones, current, compare4) {
return dones.some(function(done) {
return compare4(done, current);
});
}
function getOverlapArea2(a4, b10, margin) {
if (margin === void 0) {
margin = 0;
}
var xOverlap = Math.max(0, Math.min(a4.x + a4.width + margin, b10.x + b10.width + margin) - Math.max(a4.x - margin, b10.x - margin));
var yOverlap = Math.max(0, Math.min(a4.y + a4.height + margin, b10.y + b10.height + margin) - Math.max(a4.y - margin, b10.y - margin));
return xOverlap * yOverlap;
}
function checkShapeOverlap2(dones, current) {
return hasSome(dones, current, function(left2, right2) {
var leftText = findLabelTextShape(left2);
var rightText = findLabelTextShape(right2);
return getOverlapArea2(leftText.getCanvasBBox(), rightText.getCanvasBBox(), 2) > 0;
});
}
function pointAdjustPosition(items, labels, shapes, region, cfg) {
var _a6, _b;
if (shapes.length === 0) {
return;
}
var element = (_a6 = shapes[0]) === null || _a6 === void 0 ? void 0 : _a6.get("element");
var geometry35 = element === null || element === void 0 ? void 0 : element.geometry;
if (!geometry35 || geometry35.type !== "point") {
return;
}
var _c = geometry35.getXYFields(), xField = _c[0], yField = _c[1];
var groupedLabels = group_by_default(labels, function(label17) {
return label17.get("data")[xField];
});
var dones = [];
var offset = cfg && cfg.offset || ((_b = items[0]) === null || _b === void 0 ? void 0 : _b.offset) || 12;
map_default(keys_default(groupedLabels).reverse(), function(xValue) {
var sortedCollections = sortLabels(geometry35, groupedLabels[xValue]);
while (sortedCollections.length) {
var current = sortedCollections.shift();
var textShape = findLabelTextShape(current);
if (hasSome(dones, current, function(left2, right2) {
return left2.get("data")[xField] === right2.get("data")[xField] && left2.get("data")[yField] === right2.get("data")[yField];
})) {
textShape.set("visible", false);
continue;
}
var upFail = checkShapeOverlap2(dones, current);
var downFail = false;
if (upFail) {
textShape.attr("y", textShape.attr("y") + 2 * offset);
downFail = checkShapeOverlap2(dones, current);
}
if (downFail) {
textShape.set("visible", false);
continue;
}
dones.push(current);
}
});
}
// node_modules/@antv/g2/esm/geometry/label/layout/path/adjust-position.js
function sortLabels2(geometry35, labels) {
var yField = geometry35.getXYFields()[1];
var result = [];
var sortedLabels = labels.sort(function(left2, right2) {
return left2.get("data")[yField] - left2.get("data")[yField];
});
if (sortedLabels.length > 0) {
result.push(sortedLabels.shift());
}
if (sortedLabels.length > 0) {
result.push(sortedLabels.pop());
}
result.push.apply(result, sortedLabels);
return result;
}
function hasSome2(dones, current, compare4) {
return dones.some(function(done) {
return compare4(done, current);
});
}
function getOverlapArea3(a4, b10, margin) {
if (margin === void 0) {
margin = 0;
}
var xOverlap = Math.max(0, Math.min(a4.x + a4.width + margin, b10.x + b10.width + margin) - Math.max(a4.x - margin, b10.x - margin));
var yOverlap = Math.max(0, Math.min(a4.y + a4.height + margin, b10.y + b10.height + margin) - Math.max(a4.y - margin, b10.y - margin));
return xOverlap * yOverlap;
}
function checkShapeOverlap3(dones, current) {
return hasSome2(dones, current, function(left2, right2) {
var leftText = findLabelTextShape(left2);
var rightText = findLabelTextShape(right2);
return getOverlapArea3(leftText.getCanvasBBox(), rightText.getCanvasBBox(), 2) > 0;
});
}
function pathAdjustPosition(items, labels, shapes, region, cfg) {
var _a6, _b;
if (shapes.length === 0) {
return;
}
var element = (_a6 = shapes[0]) === null || _a6 === void 0 ? void 0 : _a6.get("element");
var geometry35 = element === null || element === void 0 ? void 0 : element.geometry;
if (!geometry35 || ["path", "line", "area"].indexOf(geometry35.type) < 0) {
return;
}
var _c = geometry35.getXYFields(), xField = _c[0], yField = _c[1];
var groupedLabels = group_by_default(labels, function(label17) {
return label17.get("data")[xField];
});
var dones = [];
var offset = cfg && cfg.offset || ((_b = items[0]) === null || _b === void 0 ? void 0 : _b.offset) || 12;
map_default(keys_default(groupedLabels).reverse(), function(xValue) {
var sortedCollections = sortLabels2(geometry35, groupedLabels[xValue]);
while (sortedCollections.length) {
var current = sortedCollections.shift();
var textShape = findLabelTextShape(current);
if (hasSome2(dones, current, function(left2, right2) {
return left2.get("data")[xField] === right2.get("data")[xField] && left2.get("data")[yField] === right2.get("data")[yField];
})) {
textShape.set("visible", false);
continue;
}
var upFail = checkShapeOverlap3(dones, current);
var downFail = false;
if (upFail) {
textShape.attr("y", textShape.attr("y") + 2 * offset);
downFail = checkShapeOverlap3(dones, current);
}
if (downFail) {
textShape.set("visible", false);
continue;
}
dones.push(current);
}
});
}
// node_modules/@antv/g2/esm/util/context.js
var ctx2;
function getCanvasContext() {
if (!ctx2) {
ctx2 = document.createElement("canvas").getContext("2d");
}
return ctx2;
}
// node_modules/@antv/g2/esm/util/text.js
var measureTextWidth = memoize_default(function(text, font) {
if (font === void 0) {
font = {};
}
var fontSize = font.fontSize, fontFamily = font.fontFamily, fontWeight = font.fontWeight, fontStyle = font.fontStyle, fontVariant = font.fontVariant;
var ctx4 = getCanvasContext();
ctx4.font = [fontStyle, fontVariant, fontWeight, "".concat(fontSize, "px"), fontFamily].join(" ");
return ctx4.measureText(is_string_default(text) ? text : "").width;
}, function(text, font) {
if (font === void 0) {
font = {};
}
return __spreadArray([text], values_default(font), true).join("");
});
var getEllipsisText = function(text, maxWidth, font) {
var STEP = 16;
var DOT_WIDTH = measureTextWidth("...", font);
var leftText;
if (!is_string_default(text)) {
leftText = to_string_default(text);
} else {
leftText = text;
}
var leftWidth = maxWidth;
var r4 = [];
var currentText;
var currentWidth;
if (measureTextWidth(text, font) <= maxWidth) {
return text;
}
while (true) {
currentText = leftText.substr(0, STEP);
currentWidth = measureTextWidth(currentText, font);
if (currentWidth + DOT_WIDTH > leftWidth) {
if (currentWidth > leftWidth) {
break;
}
}
r4.push(currentText);
leftWidth -= currentWidth;
leftText = leftText.substr(STEP);
if (!leftText) {
return r4.join("");
}
}
while (true) {
currentText = leftText.substr(0, 1);
currentWidth = measureTextWidth(currentText, font);
if (currentWidth + DOT_WIDTH > leftWidth) {
break;
}
r4.push(currentText);
leftWidth -= currentWidth;
leftText = leftText.substr(1);
if (!leftText) {
return r4.join("");
}
}
return "".concat(r4.join(""), "...");
};
// node_modules/@antv/g2/esm/geometry/label/layout/limit-in-plot.js
function limitInPlot(items, labels, shapes, region, cfg) {
if (labels.length <= 0) {
return;
}
var direction5 = (cfg === null || cfg === void 0 ? void 0 : cfg.direction) || ["top", "right", "bottom", "left"];
var action = (cfg === null || cfg === void 0 ? void 0 : cfg.action) || "translate";
var margin = (cfg === null || cfg === void 0 ? void 0 : cfg.margin) || 0;
var coordinate11 = labels[0].get("coordinate");
if (!coordinate11) {
return;
}
var _a6 = getCoordinateBBox(coordinate11, margin), regionMinX = _a6.minX, regionMinY = _a6.minY, regionMaxX = _a6.maxX, regionMaxY = _a6.maxY;
each_default(labels, function(label17) {
var _a7 = label17.getCanvasBBox(), minX = _a7.minX, minY = _a7.minY, maxX = _a7.maxX, maxY2 = _a7.maxY, x6 = _a7.x, y5 = _a7.y, width2 = _a7.width, height = _a7.height;
var finalX = x6;
var finalY = y5;
if (direction5.indexOf("left") >= 0 && (minX < regionMinX || maxX < regionMinX)) {
finalX = regionMinX;
}
if (direction5.indexOf("top") >= 0 && (minY < regionMinY || maxY2 < regionMinY)) {
finalY = regionMinY;
}
if (direction5.indexOf("right") >= 0) {
if (minX > regionMaxX) {
finalX = regionMaxX - width2;
} else if (maxX > regionMaxX) {
finalX = finalX - (maxX - regionMaxX);
}
}
if (direction5.indexOf("bottom") >= 0) {
if (minY > regionMaxY) {
finalY = regionMaxY - height;
} else if (maxY2 > regionMaxY) {
finalY = finalY - (maxY2 - regionMaxY);
}
}
if (finalX !== x6 || finalY !== y5) {
var translateX_1 = finalX - x6;
if (action === "translate") {
translate3(label17, translateX_1, finalY - y5);
} else if (action === "ellipsis") {
var textShapes = label17.findAll(function(shape) {
return shape.get("type") === "text";
});
textShapes.forEach(function(textShape) {
var style = pick_default(textShape.attr(), ["fontSize", "fontFamily", "fontWeight", "fontStyle", "fontVariant"]);
var textBox = textShape.getCanvasBBox();
var text = getEllipsisText(textShape.attr("text"), textBox.width - Math.abs(translateX_1), style);
textShape.attr("text", text);
});
} else {
label17.hide();
}
}
});
}
// node_modules/@antv/g2/esm/animate/animation/fade.js
function fadeIn(shape, animateCfg, cfg) {
var endState = {
fillOpacity: is_nil_default(shape.attr("fillOpacity")) ? 1 : shape.attr("fillOpacity"),
strokeOpacity: is_nil_default(shape.attr("strokeOpacity")) ? 1 : shape.attr("strokeOpacity"),
opacity: is_nil_default(shape.attr("opacity")) ? 1 : shape.attr("opacity")
};
shape.attr({
fillOpacity: 0,
strokeOpacity: 0,
opacity: 0
});
shape.animate(endState, animateCfg);
}
function fadeOut(shape, animateCfg, cfg) {
var endState = {
fillOpacity: 0,
strokeOpacity: 0,
opacity: 0
};
var easing = animateCfg.easing, duration = animateCfg.duration, delay = animateCfg.delay;
shape.animate(endState, duration, easing, function() {
shape.remove(true);
}, delay);
}
// node_modules/@antv/g2/esm/animate/animation/util.js
function transformShape(shape, vector, direct) {
var scaledMatrix;
var x6 = vector[0], y5 = vector[1];
shape.applyToMatrix([x6, y5, 1]);
if (direct === "x") {
shape.setMatrix(ext_exports.transform(shape.getMatrix(), [
["t", -x6, -y5],
["s", 0.01, 1],
["t", x6, y5]
]));
scaledMatrix = ext_exports.transform(shape.getMatrix(), [
["t", -x6, -y5],
["s", 100, 1],
["t", x6, y5]
]);
} else if (direct === "y") {
shape.setMatrix(ext_exports.transform(shape.getMatrix(), [
["t", -x6, -y5],
["s", 1, 0.01],
["t", x6, y5]
]));
scaledMatrix = ext_exports.transform(shape.getMatrix(), [
["t", -x6, -y5],
["s", 1, 100],
["t", x6, y5]
]);
} else if (direct === "xy") {
shape.setMatrix(ext_exports.transform(shape.getMatrix(), [
["t", -x6, -y5],
["s", 0.01, 0.01],
["t", x6, y5]
]));
scaledMatrix = ext_exports.transform(shape.getMatrix(), [
["t", -x6, -y5],
["s", 100, 100],
["t", x6, y5]
]);
}
return scaledMatrix;
}
function doScaleAnimate(element, animateCfg, coordinate11, yMinPoint, type2) {
var start = coordinate11.start, end2 = coordinate11.end;
var width2 = coordinate11.getWidth();
var height = coordinate11.getHeight();
var x6;
var y5;
if (type2 === "y") {
x6 = start.x + width2 / 2;
y5 = yMinPoint.y < start.y ? yMinPoint.y : start.y;
} else if (type2 === "x") {
x6 = yMinPoint.x > start.x ? yMinPoint.x : start.x;
y5 = start.y + height / 2;
} else if (type2 === "xy") {
if (coordinate11.isPolar) {
x6 = coordinate11.getCenter().x;
y5 = coordinate11.getCenter().y;
} else {
x6 = (start.x + end2.x) / 2;
y5 = (start.y + end2.y) / 2;
}
}
var endMatrix = transformShape(element, [x6, y5], type2);
element.animate({
matrix: endMatrix
}, animateCfg);
}
// node_modules/@antv/g2/esm/animate/animation/grow-in.js
function growInX(element, animateCfg, cfg) {
var coordinate11 = cfg.coordinate, minYPoint = cfg.minYPoint;
doScaleAnimate(element, animateCfg, coordinate11, minYPoint, "x");
}
function growInY(element, animateCfg, cfg) {
var coordinate11 = cfg.coordinate, minYPoint = cfg.minYPoint;
doScaleAnimate(element, animateCfg, coordinate11, minYPoint, "y");
}
function growInXY(element, animateCfg, cfg) {
var coordinate11 = cfg.coordinate, minYPoint = cfg.minYPoint;
doScaleAnimate(element, animateCfg, coordinate11, minYPoint, "xy");
}
// node_modules/@antv/g2/esm/animate/animation/path-in.js
function pathIn(element, animateCfg, cfg) {
var length5 = element.getTotalLength();
element.attr("lineDash", [length5]);
element.animate(function(ratio) {
return {
lineDashOffset: (1 - ratio) * length5
};
}, animateCfg);
}
// node_modules/@antv/g2/esm/animate/animation/position-update.js
function positionUpdate(shape, animateCfg, cfg) {
var toAttrs = cfg.toAttrs;
var x6 = toAttrs.x;
var y5 = toAttrs.y;
delete toAttrs.x;
delete toAttrs.y;
shape.attr(toAttrs);
shape.animate({
x: x6,
y: y5
}, animateCfg);
}
// node_modules/@antv/g2/esm/animate/animation/scale-in.js
function scaleInX(shape, animateCfg, cfg) {
var box2 = shape.getBBox();
var mappingData = shape.get("origin").mappingData;
var points = mappingData.points;
var x6 = points[0].y - points[1].y > 0 ? box2.maxX : box2.minX;
var y5 = (box2.minY + box2.maxY) / 2;
shape.applyToMatrix([x6, y5, 1]);
var matrix = ext_exports.transform(shape.getMatrix(), [
["t", -x6, -y5],
["s", 0.01, 1],
["t", x6, y5]
]);
shape.setMatrix(matrix);
shape.animate({
matrix: ext_exports.transform(shape.getMatrix(), [
["t", -x6, -y5],
["s", 100, 1],
["t", x6, y5]
])
}, animateCfg);
}
function scaleInY(shape, animateCfg, cfg) {
var box2 = shape.getBBox();
var mappingData = shape.get("origin").mappingData;
var x6 = (box2.minX + box2.maxX) / 2;
var points = mappingData.points;
var y5 = points[0].y - points[1].y <= 0 ? box2.maxY : box2.minY;
shape.applyToMatrix([x6, y5, 1]);
var matrix = ext_exports.transform(shape.getMatrix(), [
["t", -x6, -y5],
["s", 1, 0.01],
["t", x6, y5]
]);
shape.setMatrix(matrix);
shape.animate({
matrix: ext_exports.transform(shape.getMatrix(), [
["t", -x6, -y5],
["s", 1, 100],
["t", x6, y5]
])
}, animateCfg);
}
// node_modules/@antv/g2/esm/animate/animation/sector-path-update.js
function getAngle4(startPoint, arcPath) {
var _a6;
var _b = getArcParams2(startPoint, arcPath), startAngle = _b.startAngle, endAngle = _b.endAngle;
if (!isNumberEqual(startAngle, -Math.PI * 0.5) && startAngle < -Math.PI * 0.5) {
startAngle += Math.PI * 2;
}
if (!isNumberEqual(endAngle, -Math.PI * 0.5) && endAngle < -Math.PI * 0.5) {
endAngle += Math.PI * 2;
}
if (arcPath[5] === 0) {
_a6 = [endAngle, startAngle], startAngle = _a6[0], endAngle = _a6[1];
}
if (isNumberEqual(startAngle, Math.PI * 1.5)) {
startAngle = Math.PI * -0.5;
}
if (isNumberEqual(endAngle, Math.PI * -0.5)) {
endAngle = Math.PI * 1.5;
}
return {
startAngle,
endAngle
};
}
function getArcStartPoint(path) {
var startPoint;
if (path[0] === "M" || path[0] === "L") {
startPoint = [path[1], path[2]];
} else if (path[0] === "a" || path[0] === "A" || path[0] === "C") {
startPoint = [path[path.length - 2], path[path.length - 1]];
}
return startPoint;
}
function getArcInfo(path) {
var _a6;
var startAngle;
var endAngle;
var arcPaths = path.filter(function(command) {
return command[0] === "A" || command[0] === "a";
});
if (arcPaths.length === 0) {
return {
startAngle: 0,
endAngle: 0,
radius: 0,
innerRadius: 0
};
}
var firstArcPathCommand = arcPaths[0];
var lastArcPathCommand = arcPaths.length > 1 ? arcPaths[1] : arcPaths[0];
var firstIndex = path.indexOf(firstArcPathCommand);
var lastIndex = path.indexOf(lastArcPathCommand);
var firstStartPoint = getArcStartPoint(path[firstIndex - 1]);
var lastStartPoint = getArcStartPoint(path[lastIndex - 1]);
var _b = getAngle4(firstStartPoint, firstArcPathCommand), firstStartAngle = _b.startAngle, firstEndAngle = _b.endAngle;
var _c = getAngle4(lastStartPoint, lastArcPathCommand), lastStartAngle = _c.startAngle, lastEndAngle = _c.endAngle;
if (isNumberEqual(firstStartAngle, lastStartAngle) && isNumberEqual(firstEndAngle, lastEndAngle)) {
startAngle = firstStartAngle;
endAngle = firstEndAngle;
} else {
startAngle = Math.min(firstStartAngle, lastStartAngle);
endAngle = Math.max(firstEndAngle, lastEndAngle);
}
var radius = firstArcPathCommand[1];
var innerRadius = arcPaths[arcPaths.length - 1][1];
if (radius < innerRadius) {
_a6 = [innerRadius, radius], radius = _a6[0], innerRadius = _a6[1];
} else if (radius === innerRadius) {
innerRadius = 0;
}
return {
startAngle,
endAngle,
radius,
innerRadius
};
}
function sectorPathUpdate(shape, animateCfg, cfg) {
var toAttrs = cfg.toAttrs, coordinate11 = cfg.coordinate;
var path = toAttrs.path || [];
var pathCommands = path.map(function(command) {
return command[0];
});
if (path.length < 1)
return;
var _a6 = getArcInfo(path), curStartAngle = _a6.startAngle, curEndAngle = _a6.endAngle, radius = _a6.radius, innerRadius = _a6.innerRadius;
var _b = getArcInfo(shape.attr("path")), preStartAngle = _b.startAngle, preEndAngle = _b.endAngle;
var center2 = coordinate11.getCenter();
var diffStartAngle = curStartAngle - preStartAngle;
var diffEndAngle = curEndAngle - preEndAngle;
if (diffStartAngle === 0 && diffEndAngle === 0) {
shape.attr("path", path);
return;
}
shape.animate(function(ratio) {
var onFrameStartAngle = preStartAngle + ratio * diffStartAngle;
var onFrameEndAngle = preEndAngle + ratio * diffEndAngle;
return __assign(__assign({}, toAttrs), { path: is_equal_default(pathCommands, ["M", "A", "A", "Z"]) ? getArcPath(center2.x, center2.y, radius, onFrameStartAngle, onFrameEndAngle) : getSectorPath(center2.x, center2.y, radius, onFrameStartAngle, onFrameEndAngle, innerRadius) });
}, __assign(__assign({}, animateCfg), { callback: function() {
shape.attr("path", path);
} }));
}
// node_modules/@antv/g2/esm/animate/animation/wave-in.js
function waveIn(element, animateCfg, cfg) {
var _a6 = getCoordinateClipCfg(cfg.coordinate, 20), type2 = _a6.type, startState = _a6.startState, endState = _a6.endState;
var clipShape = element.setClip({
type: type2,
attrs: startState
});
clipShape.animate(endState, __assign(__assign({}, animateCfg), { callback: function() {
if (element && !element.get("destroyed")) {
element.set("clipShape", null);
}
clipShape.remove(true);
} }));
}
// node_modules/@antv/g2/esm/animate/animation/zoom.js
function doShapeZoom(shape, animateCfg, type2) {
if (shape.isGroup()) {
each_default(shape.getChildren(), function(child) {
doShapeZoom(child, animateCfg, type2);
});
} else {
var bbox = shape.getBBox();
var x6 = (bbox.minX + bbox.maxX) / 2;
var y5 = (bbox.minY + bbox.maxY) / 2;
shape.applyToMatrix([x6, y5, 1]);
if (type2 === "zoomIn") {
var matrix = ext_exports.transform(shape.getMatrix(), [
["t", -x6, -y5],
["s", 0.01, 0.01],
["t", x6, y5]
]);
shape.setMatrix(matrix);
shape.animate({
matrix: ext_exports.transform(shape.getMatrix(), [
["t", -x6, -y5],
["s", 100, 100],
["t", x6, y5]
])
}, animateCfg);
} else {
shape.animate({
matrix: ext_exports.transform(shape.getMatrix(), [
["t", -x6, -y5],
["s", 0.01, 0.01],
["t", x6, y5]
])
}, __assign(__assign({}, animateCfg), { callback: function() {
shape.remove(true);
} }));
}
}
}
function zoomIn(shape, animateCfg, cfg) {
doShapeZoom(shape, animateCfg, "zoomIn");
}
function zoomOut(shape, animateCfg, cfg) {
doShapeZoom(shape, animateCfg, "zoomOut");
}
// node_modules/@antv/g2/esm/util/facet.js
function getFactTitleConfig(direction5) {
if ([DIRECTION.TOP, DIRECTION.BOTTOM].includes(direction5)) {
return {
offsetX: 0,
offsetY: direction5 === DIRECTION.TOP ? -8 : 8,
style: {
textAlign: "center",
textBaseline: direction5 === DIRECTION.TOP ? "bottom" : "top"
}
};
}
if ([DIRECTION.LEFT, DIRECTION.RIGHT].includes(direction5)) {
return {
offsetX: direction5 === DIRECTION.LEFT ? -8 : 8,
offsetY: 0,
style: {
textAlign: direction5 === DIRECTION.LEFT ? "right" : "left",
textBaseline: "middle",
rotate: Math.PI / 2
}
};
}
return {};
}
function getAnglePoint(center2, r4, angle3) {
return {
x: center2.x + r4 * Math.cos(angle3),
y: center2.y + r4 * Math.sin(angle3)
};
}
// node_modules/@antv/g2/esm/facet/circle.js
var Circle5 = function(_super) {
__extends(Circle6, _super);
function Circle6() {
return _super !== null && _super.apply(this, arguments) || this;
}
Circle6.prototype.getDefaultCfg = function() {
return deep_mix_default({}, _super.prototype.getDefaultCfg.call(this), {
type: "circle",
showTitle: true,
title: _super.prototype.getDefaultTitleCfg.call(this)
});
};
Circle6.prototype.render = function() {
_super.prototype.render.call(this);
if (this.cfg.showTitle) {
this.renderTitle();
}
};
Circle6.prototype.getRegion = function(count2, index2) {
var r4 = 1 / 2;
var center2 = { x: 0.5, y: 0.5 };
var avgAngle = Math.PI * 2 / count2;
var angle3 = -1 * Math.PI / 2 + avgAngle * index2;
var facetR = r4 / (1 + 1 / Math.sin(avgAngle / 2));
var middle = getAnglePoint(center2, r4 - facetR, angle3);
var startAngle = Math.PI * 5 / 4;
var endAngle = Math.PI * 1 / 4;
return {
start: getAnglePoint(middle, facetR, startAngle),
end: getAnglePoint(middle, facetR, endAngle)
};
};
Circle6.prototype.afterEachView = function(view, facet) {
this.processAxis(view, facet);
};
Circle6.prototype.beforeEachView = function(view, facet) {
};
Circle6.prototype.generateFacets = function(data3) {
var _this = this;
var _a6 = this.cfg, fields = _a6.fields, type2 = _a6.type;
var field6 = fields[0];
if (!field6) {
throw new Error("No `fields` specified!");
}
var values2 = this.getFieldValues(data3, field6);
var count2 = values2.length;
var rst = [];
values2.forEach(function(value2, index2) {
var conditions = [{ field: field6, value: value2, values: values2 }];
var facetData = filter_default(data3, _this.getFacetDataFilter(conditions));
var facet = {
type: type2,
data: facetData,
region: _this.getRegion(count2, index2),
columnValue: value2,
columnField: field6,
columnIndex: index2,
columnValuesLength: count2,
rowValue: null,
rowField: null,
rowIndex: 0,
rowValuesLength: 1
};
rst.push(facet);
});
return rst;
};
Circle6.prototype.getXAxisOption = function(x6, axes, option, facet) {
return option;
};
Circle6.prototype.getYAxisOption = function(y5, axes, option, facet) {
return option;
};
Circle6.prototype.renderTitle = function() {
var _this = this;
each_default(this.facets, function(facet) {
var columnValue = facet.columnValue, view = facet.view;
var formatter = get_default(_this.cfg.title, "formatter");
var config = deep_mix_default({
position: ["50%", "0%"],
content: formatter ? formatter(columnValue) : columnValue
}, getFactTitleConfig(DIRECTION.TOP), _this.cfg.title);
view.annotation().text(config);
});
};
return Circle6;
}(Facet);
var circle_default7 = Circle5;
// node_modules/@antv/g2/esm/facet/list.js
var List = function(_super) {
__extends(List3, _super);
function List3() {
return _super !== null && _super.apply(this, arguments) || this;
}
List3.prototype.getDefaultCfg = function() {
return deep_mix_default({}, _super.prototype.getDefaultCfg.call(this), {
type: "list",
cols: null,
showTitle: true,
title: _super.prototype.getDefaultTitleCfg.call(this)
});
};
List3.prototype.render = function() {
_super.prototype.render.call(this);
if (this.cfg.showTitle) {
this.renderTitle();
}
};
List3.prototype.afterEachView = function(view, facet) {
this.processAxis(view, facet);
};
List3.prototype.beforeEachView = function(view, facet) {
};
List3.prototype.generateFacets = function(data3) {
var _this = this;
var fields = this.cfg.fields;
var cols = this.cfg.cols;
var columnField = fields[0];
if (!columnField) {
throw new Error("No `fields` specified!");
}
var colValues = this.getFieldValues(data3, columnField);
var count2 = colValues.length;
cols = cols || count2;
var rows = this.getPageCount(count2, cols);
var rst = [];
colValues.forEach(function(val, index2) {
var _a6 = _this.getRowCol(index2, cols), row = _a6.row, col = _a6.col;
var conditions = [{ field: columnField, value: val, values: colValues }];
var facetData = filter_default(data3, _this.getFacetDataFilter(conditions));
var facet = {
type: _this.cfg.type,
data: facetData,
region: _this.getRegion(rows, cols, col, row),
columnValue: val,
rowValue: val,
columnField,
rowField: null,
columnIndex: col,
rowIndex: row,
columnValuesLength: cols,
rowValuesLength: rows,
total: count2
};
rst.push(facet);
});
return rst;
};
List3.prototype.getXAxisOption = function(x6, axes, option, facet) {
if (facet.rowIndex !== facet.rowValuesLength - 1 && facet.columnValuesLength * facet.rowIndex + facet.columnIndex + 1 + facet.columnValuesLength <= facet.total) {
return __assign(__assign({}, option), { label: null, title: null });
}
return option;
};
List3.prototype.getYAxisOption = function(y5, axes, option, facet) {
if (facet.columnIndex !== 0) {
return __assign(__assign({}, option), { title: null, label: null });
}
return option;
};
List3.prototype.renderTitle = function() {
var _this = this;
each_default(this.facets, function(facet) {
var columnValue = facet.columnValue, view = facet.view;
var formatter = get_default(_this.cfg.title, "formatter");
var config = deep_mix_default({
position: ["50%", "0%"],
content: formatter ? formatter(columnValue) : columnValue
}, getFactTitleConfig(DIRECTION.TOP), _this.cfg.title);
view.annotation().text(config);
});
};
List3.prototype.getPageCount = function(total, pageSize) {
return Math.floor((total + pageSize - 1) / pageSize);
};
List3.prototype.getRowCol = function(index2, pageSize) {
var row = Math.floor(index2 / pageSize);
var col = index2 % pageSize;
return { row, col };
};
return List3;
}(Facet);
var list_default = List;
// node_modules/@antv/g2/esm/facet/matrix.js
var Matrix = function(_super) {
__extends(Matrix3, _super);
function Matrix3() {
return _super !== null && _super.apply(this, arguments) || this;
}
Matrix3.prototype.getDefaultCfg = function() {
return deep_mix_default({}, _super.prototype.getDefaultCfg.call(this), {
type: "matrix",
showTitle: false,
columnTitle: __assign({}, _super.prototype.getDefaultTitleCfg.call(this)),
rowTitle: __assign({}, _super.prototype.getDefaultTitleCfg.call(this))
});
};
Matrix3.prototype.render = function() {
_super.prototype.render.call(this);
if (this.cfg.showTitle) {
this.renderTitle();
}
};
Matrix3.prototype.afterEachView = function(view, facet) {
this.processAxis(view, facet);
};
Matrix3.prototype.beforeEachView = function(view, facet) {
};
Matrix3.prototype.generateFacets = function(data3) {
var _a6 = this.cfg, fields = _a6.fields, type2 = _a6.type;
var rowValuesLength = fields.length;
var columnValuesLength = rowValuesLength;
var rst = [];
for (var i4 = 0; i4 < columnValuesLength; i4++) {
var columnField = fields[i4];
for (var j4 = 0; j4 < rowValuesLength; j4++) {
var rowField = fields[j4];
var facet = {
type: type2,
data: data3,
region: this.getRegion(rowValuesLength, columnValuesLength, i4, j4),
columnValue: columnField,
rowValue: rowField,
columnField,
rowField,
columnIndex: i4,
rowIndex: j4,
columnValuesLength,
rowValuesLength
};
rst.push(facet);
}
}
return rst;
};
Matrix3.prototype.getXAxisOption = function(x6, axes, option, facet) {
if (facet.rowIndex !== facet.rowValuesLength - 1) {
return __assign(__assign({}, option), { label: null, title: null });
}
return option;
};
Matrix3.prototype.getYAxisOption = function(y5, axes, option, facet) {
if (facet.columnIndex !== 0) {
return __assign(__assign({}, option), { title: null, label: null });
}
return option;
};
Matrix3.prototype.renderTitle = function() {
var _this = this;
each_default(this.facets, function(facet, facetIndex) {
var columnIndex = facet.columnIndex, rowIndex = facet.rowIndex, columnValuesLength = facet.columnValuesLength, rowValuesLength = facet.rowValuesLength, columnValue = facet.columnValue, rowValue = facet.rowValue, view = facet.view;
if (rowIndex === 0) {
var formatter = get_default(_this.cfg.columnTitle, "formatter");
var config = deep_mix_default({
position: ["50%", "0%"],
content: formatter ? formatter(columnValue) : columnValue
}, getFactTitleConfig(DIRECTION.TOP), _this.cfg.columnTitle);
view.annotation().text(config);
}
if (columnIndex === columnValuesLength - 1) {
var formatter = get_default(_this.cfg.rowTitle, "formatter");
var config = deep_mix_default({
position: ["100%", "50%"],
content: formatter ? formatter(rowValue) : rowValue
}, getFactTitleConfig(DIRECTION.RIGHT), _this.cfg.rowTitle);
view.annotation().text(config);
}
});
};
return Matrix3;
}(Facet);
var matrix_default = Matrix;
// node_modules/@antv/g2/esm/facet/mirror.js
var Mirror = function(_super) {
__extends(Mirror2, _super);
function Mirror2() {
return _super !== null && _super.apply(this, arguments) || this;
}
Mirror2.prototype.getDefaultCfg = function() {
return deep_mix_default({}, _super.prototype.getDefaultCfg.call(this), {
type: "mirror",
showTitle: true,
title: _super.prototype.getDefaultTitleCfg.call(this),
transpose: false
});
};
Mirror2.prototype.render = function() {
_super.prototype.render.call(this);
if (this.cfg.showTitle) {
this.renderTitle();
}
};
Mirror2.prototype.beforeEachView = function(view, facet) {
if (this.cfg.transpose) {
if (facet.columnIndex % 2 === 0) {
view.coordinate().transpose().reflect("x");
} else {
view.coordinate().transpose();
}
} else {
if (facet.rowIndex % 2 !== 0) {
view.coordinate().reflect("y");
}
}
};
Mirror2.prototype.afterEachView = function(view, facet) {
this.processAxis(view, facet);
};
Mirror2.prototype.generateFacets = function(data3) {
var _this = this;
var f3 = this.cfg.fields[0];
var rst = [];
var columnValuesLength = 1;
var rowValuesLength = 1;
var columnValues = [""];
var rowValues = [""];
var columnField;
var rowField;
if (this.cfg.transpose) {
columnField = f3;
columnValues = this.getFieldValues(data3, columnField).slice(0, 2);
columnValuesLength = columnValues.length;
} else {
rowField = f3;
rowValues = this.getFieldValues(data3, rowField).slice(0, 2);
rowValuesLength = rowValues.length;
}
columnValues.forEach(function(xVal, xIndex) {
rowValues.forEach(function(yVal, yIndex) {
var conditions = [
{ field: columnField, value: xVal, values: columnValues },
{ field: rowField, value: yVal, values: rowValues }
];
var facetData = filter_default(data3, _this.getFacetDataFilter(conditions));
var facet = {
type: _this.cfg.type,
data: facetData,
region: _this.getRegion(rowValuesLength, columnValuesLength, xIndex, yIndex),
columnValue: xVal,
rowValue: yVal,
columnField,
rowField,
columnIndex: xIndex,
rowIndex: yIndex,
columnValuesLength,
rowValuesLength
};
rst.push(facet);
});
});
return rst;
};
Mirror2.prototype.getXAxisOption = function(x6, axes, option, facet) {
if (facet.columnIndex === 1 || facet.rowIndex === 1) {
return __assign(__assign({}, option), { label: null, title: null });
}
return option;
};
Mirror2.prototype.getYAxisOption = function(y5, axes, option, facet) {
return option;
};
Mirror2.prototype.renderTitle = function() {
var _this = this;
each_default(this.facets, function(facet, facetIndex) {
var columnValue = facet.columnValue, rowValue = facet.rowValue, view = facet.view;
var formatter = get_default(_this.cfg.title, "formatter");
if (_this.cfg.transpose) {
var config = deep_mix_default({
position: ["50%", "0%"],
content: formatter ? formatter(columnValue) : columnValue
}, getFactTitleConfig(DIRECTION.TOP), _this.cfg.title);
view.annotation().text(config);
} else {
var config = deep_mix_default({
position: ["100%", "50%"],
content: formatter ? formatter(rowValue) : rowValue
}, getFactTitleConfig(DIRECTION.RIGHT), _this.cfg.title);
view.annotation().text(config);
}
});
};
return Mirror2;
}(Facet);
var mirror_default = Mirror;
// node_modules/@antv/g2/esm/facet/rect.js
var Rect3 = function(_super) {
__extends(Rect4, _super);
function Rect4() {
return _super !== null && _super.apply(this, arguments) || this;
}
Rect4.prototype.afterEachView = function(view, facet) {
this.processAxis(view, facet);
};
Rect4.prototype.beforeEachView = function(view, facet) {
};
Rect4.prototype.getDefaultCfg = function() {
return deep_mix_default({}, _super.prototype.getDefaultCfg.call(this), {
type: "rect",
columnTitle: __assign({}, _super.prototype.getDefaultTitleCfg.call(this)),
rowTitle: __assign({}, _super.prototype.getDefaultTitleCfg.call(this))
});
};
Rect4.prototype.render = function() {
_super.prototype.render.call(this);
if (this.cfg.showTitle) {
this.renderTitle();
}
};
Rect4.prototype.generateFacets = function(data3) {
var _this = this;
var _a6 = this.cfg.fields, columnField = _a6[0], rowField = _a6[1];
var rst = [];
var columnValuesLength = 1;
var rowValuesLength = 1;
var columnValues = [""];
var rowValues = [""];
if (columnField) {
columnValues = this.getFieldValues(data3, columnField);
columnValuesLength = columnValues.length;
}
if (rowField) {
rowValues = this.getFieldValues(data3, rowField);
rowValuesLength = rowValues.length;
}
columnValues.forEach(function(xVal, xIndex) {
rowValues.forEach(function(yVal, yIndex) {
var conditions = [
{ field: columnField, value: xVal, values: columnValues },
{ field: rowField, value: yVal, values: rowValues }
];
var facetData = filter_default(data3, _this.getFacetDataFilter(conditions));
var facet = {
type: _this.cfg.type,
data: facetData,
region: _this.getRegion(rowValuesLength, columnValuesLength, xIndex, yIndex),
columnValue: xVal,
rowValue: yVal,
columnField,
rowField,
columnIndex: xIndex,
rowIndex: yIndex,
columnValuesLength,
rowValuesLength
};
rst.push(facet);
});
});
return rst;
};
Rect4.prototype.renderTitle = function() {
var _this = this;
each_default(this.facets, function(facet, facetIndex) {
var columnIndex = facet.columnIndex, rowIndex = facet.rowIndex, columnValuesLength = facet.columnValuesLength, columnValue = facet.columnValue, rowValue = facet.rowValue, view = facet.view;
if (rowIndex === 0) {
var formatter = get_default(_this.cfg.columnTitle, "formatter");
var config = deep_mix_default({
position: ["50%", "0%"],
content: formatter ? formatter(columnValue) : columnValue
}, getFactTitleConfig(DIRECTION.TOP), _this.cfg.columnTitle);
view.annotation().text(config);
}
if (columnIndex === columnValuesLength - 1) {
var formatter = get_default(_this.cfg.rowTitle, "formatter");
var config = deep_mix_default({
position: ["100%", "50%"],
content: formatter ? formatter(rowValue) : rowValue
}, getFactTitleConfig(DIRECTION.RIGHT), _this.cfg.rowTitle);
view.annotation().text(config);
}
});
};
Rect4.prototype.getXAxisOption = function(x6, axes, option, facet) {
if (facet.rowIndex !== facet.rowValuesLength - 1) {
return __assign(__assign({}, option), { title: null, label: null });
} else if (facet.columnIndex !== Math.floor((facet.columnValuesLength - 1) / 2)) {
return __assign(__assign({}, option), { title: null });
}
return option;
};
Rect4.prototype.getYAxisOption = function(y5, axes, option, facet) {
if (facet.columnIndex !== 0) {
return __assign(__assign({}, option), { title: null, label: null });
} else if (facet.rowIndex !== Math.floor((facet.rowValuesLength - 1) / 2)) {
return __assign(__assign({}, option), { title: null });
}
return option;
};
return Rect4;
}(Facet);
var rect_default4 = Rect3;
// node_modules/@antv/g2/esm/facet/tree.js
var Tree = function(_super) {
__extends(Tree2, _super);
function Tree2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.afterChartRender = function() {
if (_this.facets && _this.cfg.line) {
_this.container.clear();
_this.drawLines(_this.facets);
}
};
return _this;
}
Tree2.prototype.afterEachView = function(view, facet) {
this.processAxis(view, facet);
};
Tree2.prototype.beforeEachView = function(view, facet) {
};
Tree2.prototype.init = function() {
_super.prototype.init.call(this);
this.view.on(VIEW_LIFE_CIRCLE.AFTER_RENDER, this.afterChartRender);
};
Tree2.prototype.getDefaultCfg = function() {
return deep_mix_default({}, _super.prototype.getDefaultCfg.call(this), {
type: "tree",
line: {
style: {
lineWidth: 1,
stroke: "#ddd"
},
smooth: false
},
showTitle: true,
title: _super.prototype.getDefaultTitleCfg.call(this)
});
};
Tree2.prototype.generateFacets = function(data3) {
var fields = this.cfg.fields;
if (!fields.length) {
throw new Error("Please specify for the fields for rootFacet!");
}
var rst = [];
var rootFacet = {
type: this.cfg.type,
data: data3,
region: null,
rowValuesLength: this.getRows(),
columnValuesLength: 1,
rowIndex: 0,
columnIndex: 0,
rowField: "",
columnField: "",
rowValue: "",
columnValue: ""
};
rst.push(rootFacet);
rootFacet.children = this.getChildFacets(data3, 1, rst);
this.setRegion(rst);
return rst;
};
Tree2.prototype.setRegion = function(facets) {
var _this = this;
this.forceColIndex(facets);
facets.forEach(function(facet) {
facet.region = _this.getRegion(facet.rowValuesLength, facet.columnValuesLength, facet.columnIndex, facet.rowIndex);
});
};
Tree2.prototype.getRegion = function(rows, cols, xIndex, yIndex) {
var xWidth = 1 / cols;
var yWidth = 1 / rows;
var start = {
x: xWidth * xIndex,
y: yWidth * yIndex
};
var end2 = {
x: start.x + xWidth,
y: start.y + yWidth * 2 / 3
};
return {
start,
end: end2
};
};
Tree2.prototype.forceColIndex = function(facets) {
var _this = this;
var leafs = [];
var index2 = 0;
facets.forEach(function(facet2) {
if (_this.isLeaf(facet2)) {
leafs.push(facet2);
facet2.columnIndex = index2;
index2++;
}
});
leafs.forEach(function(facet2) {
facet2.columnValuesLength = leafs.length;
});
var maxLevel = this.cfg.fields.length;
for (var i4 = maxLevel - 1; i4 >= 0; i4--) {
var levelFacets = this.getFacetsByLevel(facets, i4);
for (var _i = 0, levelFacets_1 = levelFacets; _i < levelFacets_1.length; _i++) {
var facet = levelFacets_1[_i];
if (!this.isLeaf(facet)) {
facet.originColIndex = facet.columnIndex;
facet.columnIndex = this.getRegionIndex(facet.children);
facet.columnValuesLength = leafs.length;
}
}
}
};
Tree2.prototype.getFacetsByLevel = function(facets, level) {
var rst = [];
facets.forEach(function(facet) {
if (facet.rowIndex === level) {
rst.push(facet);
}
});
return rst;
};
Tree2.prototype.getRegionIndex = function(children) {
var first = children[0];
var last2 = children[children.length - 1];
return (last2.columnIndex - first.columnIndex) / 2 + first.columnIndex;
};
Tree2.prototype.isLeaf = function(facet) {
return !facet.children || !facet.children.length;
};
Tree2.prototype.getRows = function() {
return this.cfg.fields.length + 1;
};
Tree2.prototype.getChildFacets = function(data3, level, arr) {
var _this = this;
var fields = this.cfg.fields;
var length5 = fields.length;
if (length5 < level) {
return;
}
var rst = [];
var field6 = fields[level - 1];
var values2 = this.getFieldValues(data3, field6);
values2.forEach(function(value2, index2) {
var conditions = [{ field: field6, value: value2, values: values2 }];
var subData = data3.filter(_this.getFacetDataFilter(conditions));
if (subData.length) {
var facet = {
type: _this.cfg.type,
data: subData,
region: null,
columnValue: value2,
rowValue: "",
columnField: field6,
rowField: "",
columnIndex: index2,
rowValuesLength: _this.getRows(),
columnValuesLength: 1,
rowIndex: level,
children: _this.getChildFacets(subData, level + 1, arr)
};
rst.push(facet);
arr.push(facet);
}
});
return rst;
};
Tree2.prototype.render = function() {
_super.prototype.render.call(this);
if (this.cfg.showTitle) {
this.renderTitle();
}
};
Tree2.prototype.renderTitle = function() {
var _this = this;
each_default(this.facets, function(facet) {
var columnValue = facet.columnValue, view = facet.view;
var formatter = get_default(_this.cfg.title, "formatter");
var config = deep_mix_default({
position: ["50%", "0%"],
content: formatter ? formatter(columnValue) : columnValue
}, getFactTitleConfig(DIRECTION.TOP), _this.cfg.title);
view.annotation().text(config);
});
};
Tree2.prototype.drawLines = function(facets) {
var _this = this;
facets.forEach(function(facet) {
if (!_this.isLeaf(facet)) {
var children = facet.children;
_this.addFacetLines(facet, children);
}
});
};
Tree2.prototype.addFacetLines = function(facet, children) {
var _this = this;
var view = facet.view;
var region = view.coordinateBBox;
var start = {
x: region.x + region.width / 2,
y: region.y + region.height
};
children.forEach(function(subFacet) {
var subRegion = subFacet.view.coordinateBBox;
var end2 = {
x: subRegion.bl.x + (subRegion.tr.x - subRegion.bl.x) / 2,
y: subRegion.tr.y
};
var middle1 = {
x: start.x,
y: start.y + (end2.y - start.y) / 2
};
var middle2 = {
x: end2.x,
y: middle1.y
};
_this.drawLine([start, middle1, middle2, end2]);
});
};
Tree2.prototype.getPath = function(points) {
var path = [];
var smooth = this.cfg.line.smooth;
if (smooth) {
path.push(["M", points[0].x, points[0].y]);
path.push(["C", points[1].x, points[1].y, points[2].x, points[2].y, points[3].x, points[3].y]);
} else {
points.forEach(function(point2, index2) {
if (index2 === 0) {
path.push(["M", point2.x, point2.y]);
} else {
path.push(["L", point2.x, point2.y]);
}
});
}
return path;
};
Tree2.prototype.drawLine = function(points) {
var path = this.getPath(points);
var line2 = this.cfg.line.style;
this.container.addShape("path", {
attrs: mix({
path
}, line2)
});
};
Tree2.prototype.getXAxisOption = function(x6, axes, option, facet) {
if (facet.rowIndex !== facet.rowValuesLength - 1) {
return __assign(__assign({}, option), { title: null, label: null });
}
return option;
};
Tree2.prototype.getYAxisOption = function(y5, axes, option, facet) {
if (facet.originColIndex !== 0 && facet.columnIndex !== 0) {
return __assign(__assign({}, option), { title: null, label: null });
}
return option;
};
return Tree2;
}(Facet);
var tree_default = Tree;
// node_modules/@antv/g2/esm/util/stat.js
function getMedian(array) {
var arr = __spreadArray([], array, true);
arr.sort(function(a4, b10) {
return a4 - b10;
});
var len5 = arr.length;
if (len5 === 0) {
return 0;
}
if (len5 % 2 === 1) {
return arr[(len5 - 1) / 2];
}
return (arr[len5 / 2] + arr[len5 / 2 - 1]) / 2;
}
function getMean(array) {
var sum = reduce_default(array, function(r4, num) {
return r4 += isNaN(num) || !is_number_default(num) ? 0 : num;
}, 0);
return array.length === 0 ? 0 : sum / array.length;
}
// node_modules/@antv/g2/esm/util/annotation.js
function getNormalizedValue(val, scale12) {
if (!scale12) {
return null;
}
var scaled;
switch (val) {
case "start":
return 0;
case "center":
return 0.5;
case "end":
return 1;
case "median": {
scaled = scale12.isCategory ? getMedian(scale12.values.map(function(_8, idx) {
return idx;
})) : getMedian(scale12.values);
break;
}
case "mean": {
scaled = scale12.isCategory ? (scale12.values.length - 1) / 2 : getMean(scale12.values);
break;
}
case "min":
scaled = scale12.isCategory ? 0 : scale12[val];
break;
case "max":
scaled = scale12.isCategory ? scale12.values.length - 1 : scale12[val];
break;
default:
scaled = val;
break;
}
return scale12.scale(scaled);
}
// node_modules/@antv/g2/esm/chart/controller/annotation.js
var ANNOTATIONS_AFTER_RENDER = ["regionFilter", "shape"];
var Annotation = function(_super) {
__extends(Annotation2, _super);
function Annotation2(view) {
var _this = _super.call(this, view) || this;
_this.cache = new Map();
_this.foregroundContainer = _this.view.getLayer(LAYER.FORE).addGroup();
_this.backgroundContainer = _this.view.getLayer(LAYER.BG).addGroup();
_this.option = [];
return _this;
}
Object.defineProperty(Annotation2.prototype, "name", {
get: function() {
return "annotation";
},
enumerable: false,
configurable: true
});
Annotation2.prototype.init = function() {
};
Annotation2.prototype.layout = function() {
this.update();
};
Annotation2.prototype.render = function() {
};
Annotation2.prototype.update = function() {
var _this = this;
this.onAfterRender(function() {
var updated = new Map();
each_default(_this.option, function(option) {
if (contains_default(ANNOTATIONS_AFTER_RENDER, option.type)) {
var co = _this.updateOrCreate(option);
if (co) {
updated.set(_this.getCacheKey(option), co);
}
}
});
_this.cache = _this.syncCache(updated);
});
var updateCache = new Map();
each_default(this.option, function(option) {
if (!contains_default(ANNOTATIONS_AFTER_RENDER, option.type)) {
var co = _this.updateOrCreate(option);
if (co) {
updateCache.set(_this.getCacheKey(option), co);
}
}
});
this.cache = this.syncCache(updateCache);
};
Annotation2.prototype.clear = function(includeOption) {
if (includeOption === void 0) {
includeOption = false;
}
_super.prototype.clear.call(this);
this.clearComponents();
this.foregroundContainer.clear();
this.backgroundContainer.clear();
if (includeOption) {
this.option = [];
}
};
Annotation2.prototype.destroy = function() {
this.clear(true);
this.foregroundContainer.remove(true);
this.backgroundContainer.remove(true);
};
Annotation2.prototype.getComponents = function() {
var co = [];
this.cache.forEach(function(value2) {
co.push(value2);
});
return co;
};
Annotation2.prototype.clearComponents = function() {
this.getComponents().forEach(function(co) {
co.component.destroy();
});
this.cache.clear();
};
Annotation2.prototype.onAfterRender = function(doWhat) {
if (this.view.getOptions().animate) {
this.view.geometries.forEach(function(g4) {
if (g4.animateOption) {
g4.once(GEOMETRY_LIFE_CIRCLE.AFTER_DRAW_ANIMATE, function() {
doWhat();
});
}
});
} else {
this.view.getRootView().once(VIEW_LIFE_CIRCLE.AFTER_RENDER, function() {
doWhat();
});
}
};
Annotation2.prototype.createAnnotation = function(option) {
var type2 = option.type;
var Ctor = annotation_exports[upper_first_default(type2)];
if (Ctor) {
var theme4 = this.getAnnotationTheme(type2);
var cfg = this.getAnnotationCfg(type2, option, theme4);
var annotation4 = new Ctor(cfg);
return {
component: annotation4,
layer: this.isTop(cfg) ? LAYER.FORE : LAYER.BG,
direction: DIRECTION.NONE,
type: COMPONENT_TYPE.ANNOTATION,
extra: option
};
}
};
Annotation2.prototype.annotation = function(option) {
this.option.push(option);
};
Annotation2.prototype.arc = function(option) {
this.annotation(__assign({ type: "arc" }, option));
return this;
};
Annotation2.prototype.image = function(option) {
this.annotation(__assign({ type: "image" }, option));
return this;
};
Annotation2.prototype.line = function(option) {
this.annotation(__assign({ type: "line" }, option));
return this;
};
Annotation2.prototype.region = function(option) {
this.annotation(__assign({ type: "region" }, option));
return this;
};
Annotation2.prototype.text = function(option) {
this.annotation(__assign({ type: "text" }, option));
return this;
};
Annotation2.prototype.dataMarker = function(option) {
this.annotation(__assign({ type: "dataMarker" }, option));
return this;
};
Annotation2.prototype.dataRegion = function(option) {
this.annotation(__assign({ type: "dataRegion" }, option));
};
Annotation2.prototype.regionFilter = function(option) {
this.annotation(__assign({ type: "regionFilter" }, option));
};
Annotation2.prototype.shape = function(option) {
this.annotation(__assign({ type: "shape" }, option));
};
Annotation2.prototype.html = function(option) {
this.annotation(__assign({ type: "html" }, option));
};
Annotation2.prototype.parsePosition = function(p4) {
var xScale = this.view.getXScale();
var yScales = this.view.getScalesByDim("y");
var position2 = is_function_default(p4) ? p4.call(null, xScale, yScales) : p4;
var x6 = 0;
var y5 = 0;
if (is_array_default(position2)) {
var xPos = position2[0], yPos = position2[1];
if (is_string_default(xPos) && xPos.indexOf("%") !== -1 && !isNaN(xPos.slice(0, -1))) {
return this.parsePercentPosition(position2);
}
x6 = getNormalizedValue(xPos, xScale);
y5 = getNormalizedValue(yPos, Object.values(yScales)[0]);
} else if (!is_nil_default(position2)) {
for (var _i = 0, _a6 = keys_default(position2); _i < _a6.length; _i++) {
var key = _a6[_i];
var value2 = position2[key];
if (key === xScale.field) {
x6 = getNormalizedValue(value2, xScale);
}
if (yScales[key]) {
y5 = getNormalizedValue(value2, yScales[key]);
}
}
}
if (isNaN(x6) || isNaN(y5)) {
return null;
}
return this.view.getCoordinate().convert({ x: x6, y: y5 });
};
Annotation2.prototype.getRegionPoints = function(start, end2) {
var _this = this;
var xScale = this.view.getXScale();
var yScales = this.view.getScalesByDim("y");
var yScale = Object.values(yScales)[0];
var xField = xScale.field;
var viewData = this.view.getData();
var startXValue = is_array_default(start) ? start[0] : start[xField];
var endXValue = is_array_default(end2) ? end2[0] : end2[xField];
var arr = [];
var startIndex;
each_default(viewData, function(item, idx) {
if (item[xField] === startXValue) {
startIndex = idx;
}
if (idx >= startIndex) {
var point2 = _this.parsePosition([item[xField], item[yScale.field]]);
if (point2) {
arr.push(point2);
}
}
if (item[xField] === endXValue) {
return false;
}
});
return arr;
};
Annotation2.prototype.parsePercentPosition = function(position2) {
var xPercent = parseFloat(position2[0]) / 100;
var yPercent = parseFloat(position2[1]) / 100;
var coordinate11 = this.view.getCoordinate();
var start = coordinate11.start, end2 = coordinate11.end;
var topLeft = {
x: Math.min(start.x, end2.x),
y: Math.min(start.y, end2.y)
};
var x6 = coordinate11.getWidth() * xPercent + topLeft.x;
var y5 = coordinate11.getHeight() * yPercent + topLeft.y;
return { x: x6, y: y5 };
};
Annotation2.prototype.getCoordinateBBox = function() {
var coordinate11 = this.view.getCoordinate();
var start = coordinate11.start, end2 = coordinate11.end;
var width2 = coordinate11.getWidth();
var height = coordinate11.getHeight();
var topLeft = {
x: Math.min(start.x, end2.x),
y: Math.min(start.y, end2.y)
};
return {
x: topLeft.x,
y: topLeft.y,
minX: topLeft.x,
minY: topLeft.y,
maxX: topLeft.x + width2,
maxY: topLeft.y + height,
width: width2,
height
};
};
Annotation2.prototype.getAnnotationCfg = function(type2, option, theme4) {
var _this = this;
var coordinate11 = this.view.getCoordinate();
var canvas = this.view.getCanvas();
var o3 = {};
if (is_nil_default(option)) {
return null;
}
var start = option.start, end2 = option.end, position2 = option.position;
;
var sp = this.parsePosition(start);
var ep = this.parsePosition(end2);
var textPoint = this.parsePosition(position2);
if (["arc", "image", "line", "region", "regionFilter"].includes(type2) && (!sp || !ep)) {
return null;
} else if (["text", "dataMarker", "html"].includes(type2) && !textPoint) {
return null;
}
if (type2 === "arc") {
var _a6 = option, start_1 = _a6.start, end_1 = _a6.end, rest = __rest(_a6, ["start", "end"]);
var startAngle = getAngleByPoint(coordinate11, sp);
var endAngle = getAngleByPoint(coordinate11, ep);
if (startAngle > endAngle) {
endAngle = Math.PI * 2 + endAngle;
}
o3 = __assign(__assign({}, rest), { center: coordinate11.getCenter(), radius: getDistanceToCenter(coordinate11, sp), startAngle, endAngle });
} else if (type2 === "image") {
var _b = option, start_2 = _b.start, end_2 = _b.end, rest = __rest(_b, ["start", "end"]);
o3 = __assign(__assign({}, rest), { start: sp, end: ep, src: option.src });
} else if (type2 === "line") {
var _c = option, start_3 = _c.start, end_3 = _c.end, rest = __rest(_c, ["start", "end"]);
o3 = __assign(__assign({}, rest), { start: sp, end: ep, text: get_default(option, "text", null) });
} else if (type2 === "region") {
var _d = option, start_4 = _d.start, end_4 = _d.end, rest = __rest(_d, ["start", "end"]);
o3 = __assign(__assign({}, rest), { start: sp, end: ep });
} else if (type2 === "text") {
var filteredData = this.view.getData();
var _e = option, position_1 = _e.position, content = _e.content, rest = __rest(_e, ["position", "content"]);
var textContent = content;
if (is_function_default(content)) {
textContent = content(filteredData);
}
o3 = __assign(__assign(__assign({}, textPoint), rest), { content: textContent });
} else if (type2 === "dataMarker") {
var _f = option, position_2 = _f.position, point2 = _f.point, line2 = _f.line, text = _f.text, autoAdjust = _f.autoAdjust, direction5 = _f.direction, rest = __rest(_f, ["position", "point", "line", "text", "autoAdjust", "direction"]);
o3 = __assign(__assign(__assign({}, rest), textPoint), { coordinateBBox: this.getCoordinateBBox(), point: point2, line: line2, text, autoAdjust, direction: direction5 });
} else if (type2 === "dataRegion") {
var _g = option, start_5 = _g.start, end_5 = _g.end, region = _g.region, text = _g.text, lineLength = _g.lineLength, rest = __rest(_g, ["start", "end", "region", "text", "lineLength"]);
o3 = __assign(__assign({}, rest), { points: this.getRegionPoints(start_5, end_5), region, text, lineLength });
} else if (type2 === "regionFilter") {
var _h = option, start_6 = _h.start, end_6 = _h.end, apply_1 = _h.apply, color4 = _h.color, rest = __rest(_h, ["start", "end", "apply", "color"]);
var geometries = this.view.geometries;
var shapes_1 = [];
var addShapes_1 = function(item) {
if (!item) {
return;
}
if (item.isGroup()) {
item.getChildren().forEach(function(child) {
return addShapes_1(child);
});
} else {
shapes_1.push(item);
}
};
each_default(geometries, function(geom) {
if (apply_1) {
if (contains_default(apply_1, geom.type)) {
each_default(geom.elements, function(elem) {
addShapes_1(elem.shape);
});
}
} else {
each_default(geom.elements, function(elem) {
addShapes_1(elem.shape);
});
}
});
o3 = __assign(__assign({}, rest), { color: color4, shapes: shapes_1, start: sp, end: ep });
} else if (type2 === "shape") {
var _j = option, render_1 = _j.render, restOptions = __rest(_j, ["render"]);
var wrappedRender = function(container2) {
if (is_function_default(option.render)) {
return render_1(container2, _this.view, { parsePosition: _this.parsePosition.bind(_this) });
}
};
o3 = __assign(__assign({}, restOptions), { render: wrappedRender });
} else if (type2 === "html") {
var _k = option, html_1 = _k.html, position_3 = _k.position, restOptions = __rest(_k, ["html", "position"]);
var wrappedHtml = function(container2) {
if (is_function_default(html_1)) {
return html_1(container2, _this.view);
}
return html_1;
};
o3 = __assign(__assign(__assign({}, restOptions), textPoint), {
parent: canvas.get("el").parentNode,
html: wrappedHtml
});
}
var cfg = deep_mix_default({}, theme4, __assign(__assign({}, o3), { top: option.top, style: option.style, offsetX: option.offsetX, offsetY: option.offsetY }));
if (type2 !== "html") {
cfg.container = this.getComponentContainer(cfg);
}
cfg.animate = this.view.getOptions().animate && cfg.animate && get_default(option, "animate", cfg.animate);
cfg.animateOption = deep_mix_default({}, DEFAULT_ANIMATE_CFG, cfg.animateOption, option.animateOption);
return cfg;
};
Annotation2.prototype.isTop = function(option) {
return get_default(option, "top", true);
};
Annotation2.prototype.getComponentContainer = function(option) {
return this.isTop(option) ? this.foregroundContainer : this.backgroundContainer;
};
Annotation2.prototype.getAnnotationTheme = function(type2) {
return get_default(this.view.getTheme(), ["components", "annotation", type2], {});
};
Annotation2.prototype.updateOrCreate = function(option) {
var co = this.cache.get(this.getCacheKey(option));
if (co) {
var type2 = option.type;
var theme4 = this.getAnnotationTheme(type2);
var cfg = this.getAnnotationCfg(type2, option, theme4);
if (cfg) {
omit(cfg, ["container"]);
}
co.component.update(__assign(__assign({}, cfg || {}), { visible: !!cfg }));
if (contains_default(ANNOTATIONS_AFTER_RENDER, option.type)) {
co.component.render();
}
} else {
co = this.createAnnotation(option);
if (co) {
co.component.init();
if (contains_default(ANNOTATIONS_AFTER_RENDER, option.type)) {
co.component.render();
}
}
}
return co;
};
Annotation2.prototype.syncCache = function(updated) {
var _this = this;
var newCache = new Map(this.cache);
updated.forEach(function(co, key) {
newCache.set(key, co);
});
newCache.forEach(function(co, key) {
if (!find_default(_this.option, function(option) {
return key === _this.getCacheKey(option);
})) {
co.component.destroy();
newCache.delete(key);
}
});
return newCache;
};
Annotation2.prototype.getCacheKey = function(option) {
return option;
};
return Annotation2;
}(Controller);
var annotation_default = Annotation;
// node_modules/@antv/g2/esm/util/grid.js
function getGridThemeCfg(theme4, direction5) {
var axisTheme = deep_mix_default({}, get_default(theme4, ["components", "axis", "common"]), get_default(theme4, ["components", "axis", direction5]));
return get_default(axisTheme, ["grid"], {});
}
function getLineGridItems(coordinate11, scale12, dim, alignTick) {
var items = [];
var ticks = scale12.getTicks();
if (coordinate11.isPolar) {
ticks.push({
value: 1,
text: "",
tickValue: ""
});
}
ticks.reduce(function(preTick, currentTick, currentIndex) {
var currentValue = currentTick.value;
if (alignTick) {
items.push({
points: [
coordinate11.convert(dim === "y" ? { x: 0, y: currentValue } : { x: currentValue, y: 0 }),
coordinate11.convert(dim === "y" ? { x: 1, y: currentValue } : { x: currentValue, y: 1 })
]
});
} else {
if (currentIndex) {
var preValue = preTick.value;
var middleValue = (preValue + currentValue) / 2;
items.push({
points: [
coordinate11.convert(dim === "y" ? { x: 0, y: middleValue } : { x: middleValue, y: 0 }),
coordinate11.convert(dim === "y" ? { x: 1, y: middleValue } : { x: middleValue, y: 1 })
]
});
}
}
return currentTick;
}, ticks[0]);
return items;
}
function getCircleGridItems(coordinate11, xScale, yScale, alignTick, dim) {
var count2 = xScale.values.length;
var items = [];
var ticks = yScale.getTicks();
ticks.reduce(function(preTick, currentTick) {
var preValue = preTick ? preTick.value : currentTick.value;
var currentValue = currentTick.value;
var middleValue = (preValue + currentValue) / 2;
if (dim === "x") {
items.push({
points: [
coordinate11.convert({
x: alignTick ? currentValue : middleValue,
y: 0
}),
coordinate11.convert({
x: alignTick ? currentValue : middleValue,
y: 1
})
]
});
} else {
items.push({
points: map_default(Array(count2 + 1), function(__, idx) {
return coordinate11.convert({
x: idx / count2,
y: alignTick ? currentValue : middleValue
});
})
});
}
return currentTick;
}, ticks[0]);
return items;
}
function showGrid(axisTheme, axisOption) {
var userGrid = get_default(axisOption, "grid");
if (userGrid === null) {
return false;
}
var themeGrid = get_default(axisTheme, "grid");
return !(userGrid === void 0 && themeGrid === null);
}
// node_modules/@antv/g2/esm/chart/controller/axis.js
var OMIT_CFG = ["container"];
var AXIS_DEFAULT_ANIMATE_CFG = __assign(__assign({}, DEFAULT_ANIMATE_CFG), { appear: null });
var Axis = function(_super) {
__extends(Axis2, _super);
function Axis2(view) {
var _this = _super.call(this, view) || this;
_this.cache = new Map();
_this.gridContainer = _this.view.getLayer(LAYER.BG).addGroup();
_this.gridForeContainer = _this.view.getLayer(LAYER.FORE).addGroup();
_this.axisContainer = _this.view.getLayer(LAYER.BG).addGroup();
_this.axisForeContainer = _this.view.getLayer(LAYER.FORE).addGroup();
return _this;
}
Object.defineProperty(Axis2.prototype, "name", {
get: function() {
return "axis";
},
enumerable: false,
configurable: true
});
Axis2.prototype.init = function() {
};
Axis2.prototype.render = function() {
this.update();
};
Axis2.prototype.layout = function() {
var _this = this;
var coordinate11 = this.view.getCoordinate();
each_default(this.getComponents(), function(co) {
var component2 = co.component, direction5 = co.direction, type2 = co.type, extra = co.extra;
var dim = extra.dim, scale12 = extra.scale, alignTick = extra.alignTick;
var updated;
if (type2 === COMPONENT_TYPE.AXIS) {
if (coordinate11.isPolar) {
if (dim === "x") {
updated = coordinate11.isTransposed ? getAxisRegion(coordinate11, direction5) : getCircleAxisCenterRadius(coordinate11);
} else if (dim === "y") {
updated = coordinate11.isTransposed ? getCircleAxisCenterRadius(coordinate11) : getAxisRegion(coordinate11, direction5);
}
} else {
updated = getAxisRegion(coordinate11, direction5);
}
} else if (type2 === COMPONENT_TYPE.GRID) {
if (coordinate11.isPolar) {
var items = void 0;
if (coordinate11.isTransposed) {
items = dim === "x" ? getCircleGridItems(coordinate11, _this.view.getYScales()[0], scale12, alignTick, dim) : getLineGridItems(coordinate11, scale12, dim, alignTick);
} else {
items = dim === "x" ? getLineGridItems(coordinate11, scale12, dim, alignTick) : getCircleGridItems(coordinate11, _this.view.getXScale(), scale12, alignTick, dim);
}
updated = {
items,
center: _this.view.getCoordinate().getCenter()
};
} else {
updated = { items: getLineGridItems(coordinate11, scale12, dim, alignTick) };
}
}
component2.update(updated);
});
};
Axis2.prototype.update = function() {
this.option = this.view.getOptions().axes;
var updatedCache = new Map();
this.updateXAxes(updatedCache);
this.updateYAxes(updatedCache);
var newCache = new Map();
this.cache.forEach(function(co, key) {
if (updatedCache.has(key)) {
newCache.set(key, co);
} else {
co.component.destroy();
}
});
this.cache = newCache;
};
Axis2.prototype.clear = function() {
_super.prototype.clear.call(this);
this.cache.clear();
this.gridContainer.clear();
this.gridForeContainer.clear();
this.axisContainer.clear();
this.axisForeContainer.clear();
};
Axis2.prototype.destroy = function() {
_super.prototype.destroy.call(this);
this.gridContainer.remove(true);
this.gridForeContainer.remove(true);
this.axisContainer.remove(true);
this.axisForeContainer.remove(true);
};
Axis2.prototype.getComponents = function() {
var co = [];
this.cache.forEach(function(value2) {
co.push(value2);
});
return co;
};
Axis2.prototype.updateXAxes = function(updatedCache) {
var scale12 = this.view.getXScale();
if (!scale12 || scale12.isIdentity) {
return;
}
var xAxisOption = getAxisOption(this.option, scale12.field);
if (xAxisOption === false) {
return;
}
var direction5 = getAxisDirection(xAxisOption, DIRECTION.BOTTOM);
var layer = LAYER.BG;
var dim = "x";
var coordinate11 = this.view.getCoordinate();
var axisId = this.getId("axis", scale12.field);
var gridId = this.getId("grid", scale12.field);
if (coordinate11.isRect) {
var axis22 = this.cache.get(axisId);
if (axis22) {
var cfg = this.getLineAxisCfg(scale12, xAxisOption, direction5);
omit(cfg, OMIT_CFG);
axis22.component.update(cfg);
updatedCache.set(axisId, axis22);
} else {
axis22 = this.createLineAxis(scale12, xAxisOption, layer, direction5, dim);
this.cache.set(axisId, axis22);
updatedCache.set(axisId, axis22);
}
var grid = this.cache.get(gridId);
if (grid) {
var cfg = this.getLineGridCfg(scale12, xAxisOption, direction5, dim);
omit(cfg, OMIT_CFG);
grid.component.update(cfg);
updatedCache.set(gridId, grid);
} else {
grid = this.createLineGrid(scale12, xAxisOption, layer, direction5, dim);
if (grid) {
this.cache.set(gridId, grid);
updatedCache.set(gridId, grid);
}
}
} else if (coordinate11.isPolar) {
var axis22 = this.cache.get(axisId);
if (axis22) {
var cfg = coordinate11.isTransposed ? this.getLineAxisCfg(scale12, xAxisOption, DIRECTION.RADIUS) : this.getCircleAxisCfg(scale12, xAxisOption, direction5);
omit(cfg, OMIT_CFG);
axis22.component.update(cfg);
updatedCache.set(axisId, axis22);
} else {
if (coordinate11.isTransposed) {
if (is_undefined_default(xAxisOption)) {
return;
} else {
axis22 = this.createLineAxis(scale12, xAxisOption, layer, DIRECTION.RADIUS, dim);
}
} else {
axis22 = this.createCircleAxis(scale12, xAxisOption, layer, direction5, dim);
}
this.cache.set(axisId, axis22);
updatedCache.set(axisId, axis22);
}
var grid = this.cache.get(gridId);
if (grid) {
var cfg = coordinate11.isTransposed ? this.getCircleGridCfg(scale12, xAxisOption, DIRECTION.RADIUS, dim) : this.getLineGridCfg(scale12, xAxisOption, DIRECTION.CIRCLE, dim);
omit(cfg, OMIT_CFG);
grid.component.update(cfg);
updatedCache.set(gridId, grid);
} else {
if (coordinate11.isTransposed) {
if (is_undefined_default(xAxisOption)) {
return;
} else {
grid = this.createCircleGrid(scale12, xAxisOption, layer, DIRECTION.RADIUS, dim);
}
} else {
grid = this.createLineGrid(scale12, xAxisOption, layer, DIRECTION.CIRCLE, dim);
}
if (grid) {
this.cache.set(gridId, grid);
updatedCache.set(gridId, grid);
}
}
} else {
}
};
Axis2.prototype.updateYAxes = function(updatedCache) {
var _this = this;
var yScales = this.view.getYScales();
each_default(yScales, function(scale12, idx) {
if (!scale12 || scale12.isIdentity) {
return;
}
var field6 = scale12.field;
var yAxisOption = getAxisOption(_this.option, field6);
if (yAxisOption !== false) {
var layer = LAYER.BG;
var dim = "y";
var axisId = _this.getId("axis", field6);
var gridId = _this.getId("grid", field6);
var coordinate11 = _this.view.getCoordinate();
if (coordinate11.isRect) {
var direction5 = getAxisDirection(yAxisOption, idx === 0 ? DIRECTION.LEFT : DIRECTION.RIGHT);
var axis22 = _this.cache.get(axisId);
if (axis22) {
var cfg = _this.getLineAxisCfg(scale12, yAxisOption, direction5);
omit(cfg, OMIT_CFG);
axis22.component.update(cfg);
updatedCache.set(axisId, axis22);
} else {
axis22 = _this.createLineAxis(scale12, yAxisOption, layer, direction5, dim);
_this.cache.set(axisId, axis22);
updatedCache.set(axisId, axis22);
}
var grid = _this.cache.get(gridId);
if (grid) {
var cfg = _this.getLineGridCfg(scale12, yAxisOption, direction5, dim);
omit(cfg, OMIT_CFG);
grid.component.update(cfg);
updatedCache.set(gridId, grid);
} else {
grid = _this.createLineGrid(scale12, yAxisOption, layer, direction5, dim);
if (grid) {
_this.cache.set(gridId, grid);
updatedCache.set(gridId, grid);
}
}
} else if (coordinate11.isPolar) {
var axis22 = _this.cache.get(axisId);
if (axis22) {
var cfg = coordinate11.isTransposed ? _this.getCircleAxisCfg(scale12, yAxisOption, DIRECTION.CIRCLE) : _this.getLineAxisCfg(scale12, yAxisOption, DIRECTION.RADIUS);
omit(cfg, OMIT_CFG);
axis22.component.update(cfg);
updatedCache.set(axisId, axis22);
} else {
if (coordinate11.isTransposed) {
if (is_undefined_default(yAxisOption)) {
return;
} else {
axis22 = _this.createCircleAxis(scale12, yAxisOption, layer, DIRECTION.CIRCLE, dim);
}
} else {
axis22 = _this.createLineAxis(scale12, yAxisOption, layer, DIRECTION.RADIUS, dim);
}
_this.cache.set(axisId, axis22);
updatedCache.set(axisId, axis22);
}
var grid = _this.cache.get(gridId);
if (grid) {
var cfg = coordinate11.isTransposed ? _this.getLineGridCfg(scale12, yAxisOption, DIRECTION.CIRCLE, dim) : _this.getCircleGridCfg(scale12, yAxisOption, DIRECTION.RADIUS, dim);
omit(cfg, OMIT_CFG);
grid.component.update(cfg);
updatedCache.set(gridId, grid);
} else {
if (coordinate11.isTransposed) {
if (is_undefined_default(yAxisOption)) {
return;
} else {
grid = _this.createLineGrid(scale12, yAxisOption, layer, DIRECTION.CIRCLE, dim);
}
} else {
grid = _this.createCircleGrid(scale12, yAxisOption, layer, DIRECTION.RADIUS, dim);
}
if (grid) {
_this.cache.set(gridId, grid);
updatedCache.set(gridId, grid);
}
}
} else {
}
}
});
};
Axis2.prototype.createLineAxis = function(scale12, option, layer, direction5, dim) {
var axis22 = {
component: new LineAxis(this.getLineAxisCfg(scale12, option, direction5)),
layer,
direction: direction5 === DIRECTION.RADIUS ? DIRECTION.NONE : direction5,
type: COMPONENT_TYPE.AXIS,
extra: { dim, scale: scale12 }
};
axis22.component.set("field", scale12.field);
axis22.component.init();
return axis22;
};
Axis2.prototype.createLineGrid = function(scale12, option, layer, direction5, dim) {
var cfg = this.getLineGridCfg(scale12, option, direction5, dim);
if (cfg) {
var grid = {
component: new LineGrid(cfg),
layer,
direction: DIRECTION.NONE,
type: COMPONENT_TYPE.GRID,
extra: {
dim,
scale: scale12,
alignTick: get_default(cfg, "alignTick", true)
}
};
grid.component.init();
return grid;
}
};
Axis2.prototype.createCircleAxis = function(scale12, option, layer, direction5, dim) {
var axis22 = {
component: new CircleAxis(this.getCircleAxisCfg(scale12, option, direction5)),
layer,
direction: direction5,
type: COMPONENT_TYPE.AXIS,
extra: { dim, scale: scale12 }
};
axis22.component.set("field", scale12.field);
axis22.component.init();
return axis22;
};
Axis2.prototype.createCircleGrid = function(scale12, option, layer, direction5, dim) {
var cfg = this.getCircleGridCfg(scale12, option, direction5, dim);
if (cfg) {
var grid = {
component: new CircleGrid(cfg),
layer,
direction: DIRECTION.NONE,
type: COMPONENT_TYPE.GRID,
extra: {
dim,
scale: scale12,
alignTick: get_default(cfg, "alignTick", true)
}
};
grid.component.init();
return grid;
}
};
Axis2.prototype.getLineAxisCfg = function(scale12, axisOption, direction5) {
var container2 = get_default(axisOption, ["top"]) ? this.axisForeContainer : this.axisContainer;
var coordinate11 = this.view.getCoordinate();
var region = getAxisRegion(coordinate11, direction5);
var titleText = getAxisTitleText(scale12, axisOption);
var axisThemeCfg = getAxisThemeCfg(this.view.getTheme(), direction5);
var optionWithTitle = get_default(axisOption, ["title"]) ? deep_mix_default({ title: { style: { text: titleText } } }, { title: getAxisTitleOptions(this.view.getTheme(), direction5, axisOption.title) }, axisOption) : axisOption;
var cfg = deep_mix_default(__assign(__assign({ container: container2 }, region), { ticks: scale12.getTicks().map(function(tick) {
return { id: "".concat(tick.tickValue), name: tick.text, value: tick.value };
}), verticalFactor: coordinate11.isPolar ? getAxisFactorByRegion(region, coordinate11.getCenter()) * -1 : getAxisFactorByRegion(region, coordinate11.getCenter()), theme: axisThemeCfg }), axisThemeCfg, optionWithTitle);
var _a6 = this.getAnimateCfg(cfg), animate = _a6.animate, animateOption = _a6.animateOption;
cfg.animateOption = animateOption;
cfg.animate = animate;
var isAxisVertical = isVertical(region);
var verticalLimitLength = get_default(cfg, "verticalLimitLength", isAxisVertical ? 1 / 3 : 1 / 2);
if (verticalLimitLength <= 1) {
var canvasWidth = this.view.getCanvas().get("width");
var canvasHeight = this.view.getCanvas().get("height");
cfg.verticalLimitLength = verticalLimitLength * (isAxisVertical ? canvasWidth : canvasHeight);
}
return cfg;
};
Axis2.prototype.getLineGridCfg = function(scale12, axisOption, direction5, dim) {
if (!showGrid(getAxisThemeCfg(this.view.getTheme(), direction5), axisOption)) {
return void 0;
}
var gridThemeCfg = getGridThemeCfg(this.view.getTheme(), direction5);
var gridCfg = deep_mix_default({
container: get_default(axisOption, ["top"]) ? this.gridForeContainer : this.gridContainer
}, gridThemeCfg, get_default(axisOption, "grid"), this.getAnimateCfg(axisOption));
gridCfg.items = getLineGridItems(this.view.getCoordinate(), scale12, dim, get_default(gridCfg, "alignTick", true));
return gridCfg;
};
Axis2.prototype.getCircleAxisCfg = function(scale12, axisOption, direction5) {
var container2 = get_default(axisOption, ["top"]) ? this.axisForeContainer : this.axisContainer;
var coordinate11 = this.view.getCoordinate();
var ticks = scale12.getTicks().map(function(tick) {
return { id: "".concat(tick.tickValue), name: tick.text, value: tick.value };
});
if (!scale12.isCategory && Math.abs(coordinate11.endAngle - coordinate11.startAngle) === Math.PI * 2) {
ticks.pop();
}
var titleText = getAxisTitleText(scale12, axisOption);
var axisThemeCfg = getAxisThemeCfg(this.view.getTheme(), DIRECTION.CIRCLE);
var optionWithTitle = get_default(axisOption, ["title"]) ? deep_mix_default({ title: { style: { text: titleText } } }, { title: getAxisTitleOptions(this.view.getTheme(), direction5, axisOption.title) }, axisOption) : axisOption;
var cfg = deep_mix_default(__assign(__assign({ container: container2 }, getCircleAxisCenterRadius(this.view.getCoordinate())), { ticks, verticalFactor: 1, theme: axisThemeCfg }), axisThemeCfg, optionWithTitle);
var _a6 = this.getAnimateCfg(cfg), animate = _a6.animate, animateOption = _a6.animateOption;
cfg.animate = animate;
cfg.animateOption = animateOption;
return cfg;
};
Axis2.prototype.getCircleGridCfg = function(scale12, axisOption, direction5, dim) {
if (!showGrid(getAxisThemeCfg(this.view.getTheme(), direction5), axisOption)) {
return void 0;
}
var gridThemeCfg = getGridThemeCfg(this.view.getTheme(), DIRECTION.RADIUS);
var gridCfg = deep_mix_default({
container: get_default(axisOption, ["top"]) ? this.gridForeContainer : this.gridContainer,
center: this.view.getCoordinate().getCenter()
}, gridThemeCfg, get_default(axisOption, "grid"), this.getAnimateCfg(axisOption));
var alignTick = get_default(gridCfg, "alignTick", true);
var verticalScale = dim === "x" ? this.view.getYScales()[0] : this.view.getXScale();
gridCfg.items = getCircleGridItems(this.view.getCoordinate(), verticalScale, scale12, alignTick, dim);
return gridCfg;
};
Axis2.prototype.getId = function(name, key) {
var coordinate11 = this.view.getCoordinate();
return "".concat(name, "-").concat(key, "-").concat(coordinate11.type);
};
Axis2.prototype.getAnimateCfg = function(cfg) {
return {
animate: this.view.getOptions().animate && get_default(cfg, "animate"),
animateOption: cfg && cfg.animateOption ? deep_mix_default({}, AXIS_DEFAULT_ANIMATE_CFG, cfg.animateOption) : AXIS_DEFAULT_ANIMATE_CFG
};
};
return Axis2;
}(Controller);
var axis_default = Axis;
// node_modules/@antv/g2/esm/util/direction.js
function directionToPosition(parentBBox, bbox, direction5) {
if (direction5 === DIRECTION.TOP) {
return [parentBBox.minX + parentBBox.width / 2 - bbox.width / 2, parentBBox.minY];
}
if (direction5 === DIRECTION.BOTTOM) {
return [parentBBox.minX + parentBBox.width / 2 - bbox.width / 2, parentBBox.maxY - bbox.height];
}
if (direction5 === DIRECTION.LEFT) {
return [parentBBox.minX, parentBBox.minY + parentBBox.height / 2 - bbox.height / 2];
}
if (direction5 === DIRECTION.RIGHT) {
return [parentBBox.maxX - bbox.width, parentBBox.minY + parentBBox.height / 2 - bbox.height / 2];
}
if (direction5 === DIRECTION.TOP_LEFT || direction5 === DIRECTION.LEFT_TOP) {
return [parentBBox.tl.x, parentBBox.tl.y];
}
if (direction5 === DIRECTION.TOP_RIGHT || direction5 === DIRECTION.RIGHT_TOP) {
return [parentBBox.tr.x - bbox.width, parentBBox.tr.y];
}
if (direction5 === DIRECTION.BOTTOM_LEFT || direction5 === DIRECTION.LEFT_BOTTOM) {
return [parentBBox.bl.x, parentBBox.bl.y - bbox.height];
}
if (direction5 === DIRECTION.BOTTOM_RIGHT || direction5 === DIRECTION.RIGHT_BOTTOM) {
return [parentBBox.br.x - bbox.width, parentBBox.br.y - bbox.height];
}
return [0, 0];
}
// node_modules/@antv/g2/esm/chart/controller/legend.js
function getLegendOption(legends, field6) {
if (is_boolean_default(legends)) {
return legends === false ? false : {};
}
return get_default(legends, [field6], legends);
}
function getDirection(legendOption) {
return get_default(legendOption, "position", DIRECTION.BOTTOM);
}
var Legend = function(_super) {
__extends(Legend2, _super);
function Legend2(view) {
var _this = _super.call(this, view) || this;
_this.container = _this.view.getLayer(LAYER.FORE).addGroup();
return _this;
}
Object.defineProperty(Legend2.prototype, "name", {
get: function() {
return "legend";
},
enumerable: false,
configurable: true
});
Legend2.prototype.init = function() {
};
Legend2.prototype.render = function() {
this.update();
};
Legend2.prototype.layout = function() {
var _this = this;
this.layoutBBox = this.view.viewBBox;
each_default(this.components, function(co) {
var component2 = co.component, direction5 = co.direction;
var layout6 = getLegendLayout(direction5);
var maxWidthRatio = component2.get("maxWidthRatio");
var maxHeightRatio = component2.get("maxHeightRatio");
var maxSize = _this.getCategoryLegendSizeCfg(layout6, maxWidthRatio, maxHeightRatio);
var maxWidth = component2.get("maxWidth");
var maxHeight = component2.get("maxHeight");
component2.update({
maxWidth: Math.min(maxSize.maxWidth, maxWidth || 0),
maxHeight: Math.min(maxSize.maxHeight, maxHeight || 0)
});
var padding3 = component2.get("padding");
var bboxObject = component2.getLayoutBBox();
var bbox = new BBox(bboxObject.x, bboxObject.y, bboxObject.width, bboxObject.height).expand(padding3);
var _a6 = directionToPosition(_this.view.viewBBox, bbox, direction5), x1 = _a6[0], y1 = _a6[1];
var _b = directionToPosition(_this.layoutBBox, bbox, direction5), x22 = _b[0], y22 = _b[1];
var x6 = 0;
var y5 = 0;
if (direction5.startsWith("top") || direction5.startsWith("bottom")) {
x6 = x1;
y5 = y22;
} else {
x6 = x22;
y5 = y1;
}
component2.setLocation({ x: x6 + padding3[3], y: y5 + padding3[0] });
_this.layoutBBox = _this.layoutBBox.cut(bbox, direction5);
});
};
Legend2.prototype.update = function() {
var _this = this;
this.option = this.view.getOptions().legends;
var updated = {};
var eachLegend = function(geometry35, attr, scale12) {
var id2 = _this.getId(scale12.field);
var existCo2 = _this.getComponentById(id2);
if (existCo2) {
var cfg = void 0;
var legendOption = getLegendOption(_this.option, scale12.field);
if (legendOption !== false) {
if (get_default(legendOption, "custom")) {
cfg = _this.getCategoryCfg(geometry35, attr, scale12, legendOption, true);
} else {
if (scale12.isLinear) {
cfg = _this.getContinuousCfg(geometry35, attr, scale12, legendOption);
} else if (scale12.isCategory) {
cfg = _this.getCategoryCfg(geometry35, attr, scale12, legendOption);
}
}
}
if (cfg) {
omit(cfg, ["container"]);
existCo2.direction = getDirection(legendOption);
existCo2.component.update(cfg);
updated[id2] = true;
}
} else {
var legend18 = _this.createFieldLegend(geometry35, attr, scale12);
if (legend18) {
legend18.component.init();
_this.components.push(legend18);
updated[id2] = true;
}
}
};
if (get_default(this.option, "custom")) {
var id = "global-custom";
var existCo = this.getComponentById(id);
if (existCo) {
var customCfg = this.getCategoryCfg(void 0, void 0, void 0, this.option, true);
omit(customCfg, ["container"]);
existCo.component.update(customCfg);
updated[id] = true;
} else {
var component2 = this.createCustomLegend(void 0, void 0, void 0, this.option);
if (component2) {
component2.init();
var layer = LAYER.FORE;
var direction5 = getDirection(this.option);
this.components.push({
id,
component: component2,
layer,
direction: direction5,
type: COMPONENT_TYPE.LEGEND,
extra: void 0
});
updated[id] = true;
}
}
} else {
this.loopLegends(eachLegend);
}
var components = [];
each_default(this.getComponents(), function(co) {
if (updated[co.id]) {
components.push(co);
} else {
co.component.destroy();
}
});
this.components = components;
};
Legend2.prototype.clear = function() {
_super.prototype.clear.call(this);
this.container.clear();
};
Legend2.prototype.destroy = function() {
_super.prototype.destroy.call(this);
this.container.remove(true);
};
Legend2.prototype.getGeometries = function(view) {
var _this = this;
var geometries = view.geometries;
each_default(view.views, function(v3) {
geometries = geometries.concat(_this.getGeometries(v3));
});
return geometries;
};
Legend2.prototype.loopLegends = function(doEach) {
var isRootView = this.view.getRootView() === this.view;
if (!isRootView) {
return;
}
var geometries = this.getGeometries(this.view);
var looped = {};
each_default(geometries, function(geometry35) {
var attributes = geometry35.getGroupAttributes();
each_default(attributes, function(attr) {
var scale12 = attr.getScale(attr.type);
if (!scale12 || scale12.type === "identity" || looped[scale12.field]) {
return;
}
doEach(geometry35, attr, scale12);
looped[scale12.field] = true;
});
});
};
Legend2.prototype.createFieldLegend = function(geometry35, attr, scale12) {
var component2;
var legendOption = getLegendOption(this.option, scale12.field);
var layer = LAYER.FORE;
var direction5 = getDirection(legendOption);
if (legendOption !== false) {
if (get_default(legendOption, "custom")) {
component2 = this.createCustomLegend(geometry35, attr, scale12, legendOption);
} else {
if (scale12.isLinear) {
component2 = this.createContinuousLegend(geometry35, attr, scale12, legendOption);
} else if (scale12.isCategory) {
component2 = this.createCategoryLegend(geometry35, attr, scale12, legendOption);
}
}
}
if (component2) {
component2.set("field", scale12.field);
return {
id: this.getId(scale12.field),
component: component2,
layer,
direction: direction5,
type: COMPONENT_TYPE.LEGEND,
extra: { scale: scale12 }
};
}
};
Legend2.prototype.createCustomLegend = function(geometry35, attr, scale12, legendOption) {
var cfg = this.getCategoryCfg(geometry35, attr, scale12, legendOption, true);
return new CategoryLegend(cfg);
};
Legend2.prototype.createContinuousLegend = function(geometry35, attr, scale12, legendOption) {
var cfg = this.getContinuousCfg(geometry35, attr, scale12, omit(legendOption, ["value"]));
return new ContinuousLegend(cfg);
};
Legend2.prototype.createCategoryLegend = function(geometry35, attr, scale12, legendOption) {
var cfg = this.getCategoryCfg(geometry35, attr, scale12, legendOption);
return new CategoryLegend(cfg);
};
Legend2.prototype.getContinuousCfg = function(geometry35, attr, scale12, legendOption) {
var ticks = scale12.getTicks();
var containMin = find_default(ticks, function(tick) {
return tick.value === 0;
});
var containMax = find_default(ticks, function(tick) {
return tick.value === 1;
});
var items = ticks.map(function(tick) {
var value2 = tick.value, tickValue = tick.tickValue;
var attrValue = attr.mapping(scale12.invert(value2)).join("");
return {
value: tickValue,
attrValue,
color: attrValue,
scaleValue: value2
};
});
if (!containMin) {
items.push({
value: scale12.min,
attrValue: attr.mapping(scale12.invert(0)).join(""),
color: attr.mapping(scale12.invert(0)).join(""),
scaleValue: 0
});
}
if (!containMax) {
items.push({
value: scale12.max,
attrValue: attr.mapping(scale12.invert(1)).join(""),
color: attr.mapping(scale12.invert(1)).join(""),
scaleValue: 1
});
}
items.sort(function(a4, b10) {
return a4.value - b10.value;
});
var attrLegendCfg = {
min: head(items).value,
max: last(items).value,
colors: [],
rail: {
type: attr.type
},
track: {}
};
if (attr.type === "size") {
attrLegendCfg.track = {
style: {
fill: attr.type === "size" ? this.view.getTheme().defaultColor : void 0
}
};
}
if (attr.type === "color") {
attrLegendCfg.colors = items.map(function(item) {
return item.attrValue;
});
}
var container2 = this.container;
var direction5 = getDirection(legendOption);
var layout6 = getLegendLayout(direction5);
var title = get_default(legendOption, "title");
if (title) {
title = deep_mix_default({
text: getName(scale12)
}, title);
}
attrLegendCfg.container = container2;
attrLegendCfg.layout = layout6;
attrLegendCfg.title = title;
attrLegendCfg.animateOption = DEFAULT_ANIMATE_CFG;
return this.mergeLegendCfg(attrLegendCfg, legendOption, "continuous");
};
Legend2.prototype.getCategoryCfg = function(geometry35, attr, scale12, legendOption, custom12) {
var container2 = this.container;
var direction5 = get_default(legendOption, "position", DIRECTION.BOTTOM);
var legendTheme = getLegendThemeCfg(this.view.getTheme(), direction5);
var themeMarker = get_default(legendTheme, ["marker"]);
var userMarker = get_default(legendOption, "marker");
var layout6 = getLegendLayout(direction5);
var themePageNavigator = get_default(legendTheme, ["pageNavigator"]);
var userPageNavigator = get_default(legendOption, "pageNavigator");
var items = custom12 ? getCustomLegendItems(themeMarker, userMarker, legendOption.items) : getLegendItems(this.view, geometry35, attr, themeMarker, userMarker);
var title = get_default(legendOption, "title");
if (title) {
title = deep_mix_default({
text: scale12 ? getName(scale12) : ""
}, title);
}
var maxWidthRatio = get_default(legendOption, "maxWidthRatio");
var maxHeightRatio = get_default(legendOption, "maxHeightRatio");
var baseCfg = this.getCategoryLegendSizeCfg(layout6, maxWidthRatio, maxHeightRatio);
baseCfg.container = container2;
baseCfg.layout = layout6;
baseCfg.items = items;
baseCfg.title = title;
baseCfg.animateOption = DEFAULT_ANIMATE_CFG;
baseCfg.pageNavigator = deep_mix_default({}, themePageNavigator, userPageNavigator);
var categoryCfg = this.mergeLegendCfg(baseCfg, legendOption, direction5);
if (categoryCfg.reversed) {
categoryCfg.items.reverse();
}
var maxItemWidth = get_default(categoryCfg, "maxItemWidth");
if (maxItemWidth && maxItemWidth <= 1) {
categoryCfg.maxItemWidth = this.view.viewBBox.width * maxItemWidth;
}
return categoryCfg;
};
Legend2.prototype.mergeLegendCfg = function(baseCfg, legendOption, direction5) {
var position2 = direction5.split("-")[0];
var themeObject = getLegendThemeCfg(this.view.getTheme(), position2);
return deep_mix_default({}, themeObject, baseCfg, legendOption);
};
Legend2.prototype.getId = function(key) {
return "".concat(this.name, "-").concat(key);
};
Legend2.prototype.getComponentById = function(id) {
return find_default(this.components, function(co) {
return co.id === id;
});
};
Legend2.prototype.getCategoryLegendSizeCfg = function(layout6, maxWidthRatio, maxHeightRatio) {
if (maxWidthRatio === void 0) {
maxWidthRatio = COMPONENT_MAX_VIEW_PERCENTAGE;
}
if (maxHeightRatio === void 0) {
maxHeightRatio = COMPONENT_MAX_VIEW_PERCENTAGE;
}
var _a6 = this.view.viewBBox, vw = _a6.width, vh = _a6.height;
return layout6 === "vertical" ? {
maxWidth: vw * maxWidthRatio,
maxHeight: vh
} : {
maxWidth: vw,
maxHeight: vh * maxHeightRatio
};
};
return Legend2;
}(Controller);
var legend_default = Legend;
// node_modules/@antv/g2/esm/chart/controller/slider.js
var Slider2 = function(_super) {
__extends(Slider3, _super);
function Slider3(view) {
var _this = _super.call(this, view) || this;
_this.onChangeFn = noop_default;
_this.resetMeasure = function() {
_this.clear();
};
_this.onValueChange = function(v3) {
var min7 = v3[0], max8 = v3[1];
_this.start = min7;
_this.end = max8;
_this.changeViewData(min7, max8);
};
_this.container = _this.view.getLayer(LAYER.FORE).addGroup();
_this.onChangeFn = throttle_default(_this.onValueChange, 20, {
leading: true
});
_this.width = 0;
_this.view.on(VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, _this.resetMeasure);
_this.view.on(VIEW_LIFE_CIRCLE.BEFORE_CHANGE_SIZE, _this.resetMeasure);
return _this;
}
Object.defineProperty(Slider3.prototype, "name", {
get: function() {
return "slider";
},
enumerable: false,
configurable: true
});
Slider3.prototype.destroy = function() {
_super.prototype.destroy.call(this);
this.view.off(VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, this.resetMeasure);
this.view.off(VIEW_LIFE_CIRCLE.BEFORE_CHANGE_SIZE, this.resetMeasure);
};
Slider3.prototype.init = function() {
};
Slider3.prototype.render = function() {
this.option = this.view.getOptions().slider;
var _a6 = this.getSliderCfg(), start = _a6.start, end2 = _a6.end;
if (is_nil_default(this.start)) {
this.start = start;
this.end = end2;
}
var viewData = this.view.getOptions().data;
if (this.option && !is_empty_default(viewData)) {
if (this.slider) {
this.slider = this.updateSlider();
} else {
this.slider = this.createSlider();
this.slider.component.on("sliderchange", this.onChangeFn);
}
} else {
if (this.slider) {
this.slider.component.destroy();
this.slider = void 0;
} else {
}
}
};
Slider3.prototype.layout = function() {
var _this = this;
if (this.option && !this.width) {
this.measureSlider();
setTimeout(function() {
if (!_this.view.destroyed) {
_this.changeViewData(_this.start, _this.end);
}
}, 0);
}
if (this.slider) {
var width2 = this.view.coordinateBBox.width;
var padding3 = this.slider.component.get("padding");
var paddingTop = padding3[0], paddingRight = padding3[1], paddingBottom = padding3[2], paddingLeft = padding3[3];
var bboxObject = this.slider.component.getLayoutBBox();
var bbox = new BBox(bboxObject.x, bboxObject.y, Math.min(bboxObject.width, width2), bboxObject.height).expand(padding3);
var _a6 = this.getMinMaxText(this.start, this.end), minText = _a6.minText, maxText = _a6.maxText;
var _b = directionToPosition(this.view.viewBBox, bbox, DIRECTION.BOTTOM), x1 = _b[0], y1 = _b[1];
var _c = directionToPosition(this.view.coordinateBBox, bbox, DIRECTION.BOTTOM), x22 = _c[0], y22 = _c[1];
this.slider.component.update(__assign(__assign({}, this.getSliderCfg()), { x: x22 + paddingLeft, y: y1 + paddingTop, width: this.width, start: this.start, end: this.end, minText, maxText }));
this.view.viewBBox = this.view.viewBBox.cut(bbox, DIRECTION.BOTTOM);
}
};
Slider3.prototype.update = function() {
this.render();
};
Slider3.prototype.createSlider = function() {
var cfg = this.getSliderCfg();
var component2 = new Slider(__assign({ container: this.container }, cfg));
component2.init();
return {
component: component2,
layer: LAYER.FORE,
direction: DIRECTION.BOTTOM,
type: COMPONENT_TYPE.SLIDER
};
};
Slider3.prototype.updateSlider = function() {
var cfg = this.getSliderCfg();
if (this.width) {
var _a6 = this.getMinMaxText(this.start, this.end), minText = _a6.minText, maxText = _a6.maxText;
cfg = __assign(__assign({}, cfg), { width: this.width, start: this.start, end: this.end, minText, maxText });
}
this.slider.component.update(cfg);
return this.slider;
};
Slider3.prototype.measureSlider = function() {
var width2 = this.getSliderCfg().width;
this.width = width2;
};
Slider3.prototype.getSliderCfg = function() {
var cfg = {
height: 16,
start: 0,
end: 1,
minText: "",
maxText: "",
x: 0,
y: 0,
width: this.view.coordinateBBox.width
};
if (is_object_default(this.option)) {
var trendCfg = __assign({ data: this.getData() }, get_default(this.option, "trendCfg", {}));
cfg = deep_mix_default({}, cfg, this.getThemeOptions(), this.option);
cfg = __assign(__assign({}, cfg), { trendCfg });
}
cfg.start = clamp_default(Math.min(is_nil_default(cfg.start) ? 0 : cfg.start, is_nil_default(cfg.end) ? 1 : cfg.end), 0, 1);
cfg.end = clamp_default(Math.max(is_nil_default(cfg.start) ? 0 : cfg.start, is_nil_default(cfg.end) ? 1 : cfg.end), 0, 1);
return cfg;
};
Slider3.prototype.getData = function() {
var data3 = this.view.getOptions().data;
var yScale = this.view.getYScales()[0];
var groupScales = this.view.getGroupScales();
if (groupScales.length) {
var _a6 = groupScales[0], field_1 = _a6.field, ticks_1 = _a6.ticks;
return data3.reduce(function(pre, cur) {
if (cur[field_1] === ticks_1[0]) {
pre.push(cur[yScale.field]);
}
return pre;
}, []);
}
return data3.map(function(datum) {
return datum[yScale.field] || 0;
});
};
Slider3.prototype.getThemeOptions = function() {
var theme4 = this.view.getTheme();
return get_default(theme4, ["components", "slider", "common"], {});
};
Slider3.prototype.getMinMaxText = function(min7, max8) {
var data3 = this.view.getOptions().data;
var xScale = this.view.getXScale();
var isHorizontal2 = true;
var values2 = values_of_key_default(data3, xScale.field);
if (xScale.isLinear) {
values2 = values2.sort();
}
var xValues = isHorizontal2 ? values2 : values2.reverse();
var dataSize = size(data3);
if (!xScale || !dataSize) {
return {};
}
var xTickCount = size(xValues);
var minIndex = Math.floor(min7 * (xTickCount - 1));
var maxIndex = Math.floor(max8 * (xTickCount - 1));
var minText = get_default(xValues, [minIndex]);
var maxText = get_default(xValues, [maxIndex]);
var formatter = this.getSliderCfg().formatter;
if (formatter) {
minText = formatter(minText, data3[minIndex], minIndex);
maxText = formatter(maxText, data3[maxIndex], maxIndex);
}
return {
minText,
maxText
};
};
Slider3.prototype.changeViewData = function(min7, max8) {
var data3 = this.view.getOptions().data;
var xScale = this.view.getXScale();
var dataSize = size(data3);
if (!xScale || !dataSize) {
return;
}
var isHorizontal2 = true;
var values2 = values_of_key_default(data3, xScale.field);
var xScaleValues = this.view.getXScale().isLinear ? values2.sort(function(a4, b10) {
return Number(a4) - Number(b10);
}) : values2;
var xValues = isHorizontal2 ? xScaleValues : xScaleValues.reverse();
var xTickCount = size(xValues);
var minIndex = Math.floor(min7 * (xTickCount - 1));
var maxIndex = Math.floor(max8 * (xTickCount - 1));
this.view.filter(xScale.field, function(value2, datum) {
var idx = xValues.indexOf(value2);
return idx > -1 ? isBetween2(idx, minIndex, maxIndex) : true;
});
this.view.render(true);
};
Slider3.prototype.getComponents = function() {
return this.slider ? [this.slider] : [];
};
Slider3.prototype.clear = function() {
if (this.slider) {
this.slider.component.destroy();
this.slider = void 0;
}
this.width = 0;
this.start = void 0;
this.end = void 0;
};
return Slider3;
}(Controller);
var slider_default = Slider2;
// node_modules/@antv/g2/esm/chart/controller/scrollbar.js
var DEFAULT_PADDING = 0;
var DEFAULT_SIZE = 8;
var DEFAULT_CATEGORY_SIZE = 32;
var MIN_THUMB_LENGTH = 20;
var Scrollbar2 = function(_super) {
__extends(Scrollbar3, _super);
function Scrollbar3(view) {
var _this = _super.call(this, view) || this;
_this.onChangeFn = noop_default;
_this.resetMeasure = function() {
_this.clear();
};
_this.onValueChange = function(_a6) {
var ratio = _a6.ratio;
var animate = _this.getValidScrollbarCfg().animate;
_this.ratio = clamp_default(ratio, 0, 1);
var originalAnimate = _this.view.getOptions().animate;
if (!animate) {
_this.view.animate(false);
}
_this.changeViewData(_this.getScrollRange(), true);
_this.view.animate(originalAnimate);
};
_this.container = _this.view.getLayer(LAYER.FORE).addGroup();
_this.onChangeFn = throttle_default(_this.onValueChange, 20, {
leading: true
});
_this.trackLen = 0;
_this.thumbLen = 0;
_this.ratio = 0;
_this.view.on(VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, _this.resetMeasure);
_this.view.on(VIEW_LIFE_CIRCLE.BEFORE_CHANGE_SIZE, _this.resetMeasure);
return _this;
}
Object.defineProperty(Scrollbar3.prototype, "name", {
get: function() {
return "scrollbar";
},
enumerable: false,
configurable: true
});
Scrollbar3.prototype.destroy = function() {
_super.prototype.destroy.call(this);
this.view.off(VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, this.resetMeasure);
this.view.off(VIEW_LIFE_CIRCLE.BEFORE_CHANGE_SIZE, this.resetMeasure);
};
Scrollbar3.prototype.init = function() {
};
Scrollbar3.prototype.render = function() {
this.option = this.view.getOptions().scrollbar;
if (this.option) {
if (this.scrollbar) {
this.scrollbar = this.updateScrollbar();
} else {
this.scrollbar = this.createScrollbar();
this.scrollbar.component.on("scrollchange", this.onChangeFn);
}
} else {
if (this.scrollbar) {
this.scrollbar.component.destroy();
this.scrollbar = void 0;
}
}
};
Scrollbar3.prototype.layout = function() {
var _this = this;
if (this.option && !this.trackLen) {
this.measureScrollbar();
setTimeout(function() {
if (!_this.view.destroyed) {
_this.changeViewData(_this.getScrollRange(), true);
}
});
}
if (this.scrollbar) {
var width2 = this.view.coordinateBBox.width;
var padding3 = this.scrollbar.component.get("padding");
var bboxObject = this.scrollbar.component.getLayoutBBox();
var bbox = new BBox(bboxObject.x, bboxObject.y, Math.min(bboxObject.width, width2), bboxObject.height).expand(padding3);
var cfg = this.getScrollbarComponentCfg();
var x6 = void 0;
var y5 = void 0;
if (cfg.isHorizontal) {
var _a6 = directionToPosition(this.view.viewBBox, bbox, DIRECTION.BOTTOM), x1 = _a6[0], y1 = _a6[1];
var _b = directionToPosition(this.view.coordinateBBox, bbox, DIRECTION.BOTTOM), x22 = _b[0], y22 = _b[1];
x6 = x22;
y5 = y1;
} else {
var _c = directionToPosition(this.view.viewBBox, bbox, DIRECTION.RIGHT), x1 = _c[0], y1 = _c[1];
var _d = directionToPosition(this.view.viewBBox, bbox, DIRECTION.RIGHT), x22 = _d[0], y22 = _d[1];
x6 = x22;
y5 = y1;
}
x6 += padding3[3];
y5 += padding3[0];
if (this.trackLen) {
this.scrollbar.component.update(__assign(__assign({}, cfg), { x: x6, y: y5, trackLen: this.trackLen, thumbLen: this.thumbLen, thumbOffset: (this.trackLen - this.thumbLen) * this.ratio }));
} else {
this.scrollbar.component.update(__assign(__assign({}, cfg), { x: x6, y: y5 }));
}
this.view.viewBBox = this.view.viewBBox.cut(bbox, cfg.isHorizontal ? DIRECTION.BOTTOM : DIRECTION.RIGHT);
}
};
Scrollbar3.prototype.update = function() {
this.render();
};
Scrollbar3.prototype.getComponents = function() {
return this.scrollbar ? [this.scrollbar] : [];
};
Scrollbar3.prototype.clear = function() {
if (this.scrollbar) {
this.scrollbar.component.destroy();
this.scrollbar = void 0;
}
this.trackLen = 0;
this.thumbLen = 0;
this.ratio = 0;
this.cnt = 0;
this.step = 0;
this.data = void 0;
this.xScaleCfg = void 0;
this.yScalesCfg = [];
};
Scrollbar3.prototype.setValue = function(ratio) {
this.onValueChange({ ratio });
};
Scrollbar3.prototype.getValue = function() {
return this.ratio;
};
Scrollbar3.prototype.getThemeOptions = function() {
var theme4 = this.view.getTheme();
return get_default(theme4, ["components", "scrollbar", "common"], {});
};
Scrollbar3.prototype.getScrollbarTheme = function(style) {
var theme4 = get_default(this.view.getTheme(), ["components", "scrollbar"]);
var _a6 = style || {}, thumbHighlightColor = _a6.thumbHighlightColor, restStyles = __rest(_a6, ["thumbHighlightColor"]);
return {
default: deep_mix_default({}, get_default(theme4, ["default", "style"], {}), restStyles),
hover: deep_mix_default({}, get_default(theme4, ["hover", "style"], {}), { thumbColor: thumbHighlightColor })
};
};
Scrollbar3.prototype.measureScrollbar = function() {
var xScale = this.view.getXScale();
var yScales = this.view.getYScales().slice();
this.data = this.getScrollbarData();
this.step = this.getStep();
this.cnt = this.getCnt();
var _a6 = this.getScrollbarComponentCfg(), trackLen = _a6.trackLen, thumbLen = _a6.thumbLen;
this.trackLen = trackLen;
this.thumbLen = thumbLen;
this.xScaleCfg = {
field: xScale.field,
values: xScale.values || []
};
this.yScalesCfg = yScales;
};
Scrollbar3.prototype.getScrollRange = function() {
var startIdx = Math.floor((this.cnt - this.step) * clamp_default(this.ratio, 0, 1));
var endIdx = Math.min(startIdx + this.step - 1, this.cnt - 1);
return [startIdx, endIdx];
};
Scrollbar3.prototype.changeViewData = function(_a6, render) {
var _this = this;
var startIdx = _a6[0], endIdx = _a6[1];
var type2 = this.getValidScrollbarCfg().type;
var isHorizontal2 = type2 !== "vertical";
var values2 = values_of_key_default(this.data, this.xScaleCfg.field);
var xScaleValues = this.view.getXScale().isLinear ? values2.sort(function(a4, b10) {
return Number(a4) - Number(b10);
}) : values2;
var xValues = isHorizontal2 ? xScaleValues : xScaleValues.reverse();
this.yScalesCfg.forEach(function(cfg) {
_this.view.scale(cfg.field, {
formatter: cfg.formatter,
type: cfg.type,
min: cfg.min,
max: cfg.max,
tickMethod: cfg.tickMethod
});
});
this.view.filter(this.xScaleCfg.field, function(val) {
var idx = xValues.indexOf(val);
return idx > -1 ? isBetween2(idx, startIdx, endIdx) : true;
});
this.view.render(true);
};
Scrollbar3.prototype.createScrollbar = function() {
var type2 = this.getValidScrollbarCfg().type;
var isHorizontal2 = type2 !== "vertical";
var component2 = new Scrollbar(__assign(__assign({ container: this.container }, this.getScrollbarComponentCfg()), { x: 0, y: 0 }));
component2.init();
return {
component: component2,
layer: LAYER.FORE,
direction: isHorizontal2 ? DIRECTION.BOTTOM : DIRECTION.RIGHT,
type: COMPONENT_TYPE.SCROLLBAR
};
};
Scrollbar3.prototype.updateScrollbar = function() {
var config = this.getScrollbarComponentCfg();
var realConfig = this.trackLen ? __assign(__assign({}, config), { trackLen: this.trackLen, thumbLen: this.thumbLen, thumbOffset: (this.trackLen - this.thumbLen) * this.ratio }) : __assign({}, config);
this.scrollbar.component.update(realConfig);
return this.scrollbar;
};
Scrollbar3.prototype.getStep = function() {
if (this.step) {
return this.step;
}
var coordinateBBox = this.view.coordinateBBox;
var _a6 = this.getValidScrollbarCfg(), type2 = _a6.type, categorySize = _a6.categorySize;
var isHorizontal2 = type2 !== "vertical";
return Math.floor((isHorizontal2 ? coordinateBBox.width : coordinateBBox.height) / categorySize);
};
Scrollbar3.prototype.getCnt = function() {
if (this.cnt) {
return this.cnt;
}
var xScale = this.view.getXScale();
var data3 = this.getScrollbarData();
var values2 = values_of_key_default(data3, xScale.field);
return size(values2);
};
Scrollbar3.prototype.getScrollbarComponentCfg = function() {
var _a6 = this.view, coordinateBBox = _a6.coordinateBBox, viewBBox = _a6.viewBBox;
var _b = this.getValidScrollbarCfg(), type2 = _b.type, padding3 = _b.padding, width2 = _b.width, height = _b.height, style = _b.style;
var isHorizontal2 = type2 !== "vertical";
var paddingTop = padding3[0], paddingRight = padding3[1], paddingBottom = padding3[2], paddingLeft = padding3[3];
var position2 = isHorizontal2 ? {
x: coordinateBBox.minX + paddingLeft,
y: viewBBox.maxY - height - paddingBottom
} : {
x: viewBBox.maxX - width2 - paddingRight,
y: coordinateBBox.minY + paddingTop
};
var step = this.getStep();
var cnt = this.getCnt();
var trackLen = isHorizontal2 ? coordinateBBox.width - paddingLeft - paddingRight : coordinateBBox.height - paddingTop - paddingBottom;
var thumbLen = Math.max(trackLen * clamp_default(step / cnt, 0, 1), MIN_THUMB_LENGTH);
return __assign(__assign({}, this.getThemeOptions()), { x: position2.x, y: position2.y, size: isHorizontal2 ? height : width2, isHorizontal: isHorizontal2, trackLen, thumbLen, thumbOffset: 0, theme: this.getScrollbarTheme(style) });
};
Scrollbar3.prototype.getValidScrollbarCfg = function() {
var cfg = {
type: "horizontal",
categorySize: DEFAULT_CATEGORY_SIZE,
width: DEFAULT_SIZE,
height: DEFAULT_SIZE,
padding: [0, 0, 0, 0],
animate: true,
style: {}
};
if (is_object_default(this.option)) {
cfg = __assign(__assign({}, cfg), this.option);
}
if (!is_object_default(this.option) || !this.option.padding) {
cfg.padding = cfg.type === "horizontal" ? [DEFAULT_PADDING, 0, DEFAULT_PADDING, 0] : [0, DEFAULT_PADDING, 0, DEFAULT_PADDING];
}
return cfg;
};
Scrollbar3.prototype.getScrollbarData = function() {
var coordinate11 = this.view.getCoordinate();
var cfg = this.getValidScrollbarCfg();
var data3 = this.view.getOptions().data || [];
if (coordinate11.isReflect("y") && cfg.type === "vertical") {
data3 = __spreadArray([], data3, true).reverse();
}
return data3;
};
return Scrollbar3;
}(Controller);
var scrollbar_default = Scrollbar2;
// node_modules/@antv/g2/esm/interaction/action/active-region.js
var DEFAULT_REGION_PATH_STYLE = {
fill: "#CCD6EC",
opacity: 0.3
};
function getItemsOfView(view, point2, tooltipCfg) {
var items = findItemsFromViewRecurisive(view, point2, tooltipCfg);
if (items.length) {
items = flatten_default(items);
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
var itemArr = items_1[_i];
for (var _a6 = 0, itemArr_1 = itemArr; _a6 < itemArr_1.length; _a6++) {
var item = itemArr_1[_a6];
var _b = item.mappingData, x6 = _b.x, y5 = _b.y;
item.x = is_array_default(x6) ? x6[x6.length - 1] : x6;
item.y = is_array_default(y5) ? y5[y5.length - 1] : y5;
}
}
var shared = tooltipCfg.shared;
if (shared === false && items.length > 1) {
var snapItem = items[0];
var min7 = Math.abs(point2.y - snapItem[0].y);
for (var _c = 0, items_2 = items; _c < items_2.length; _c++) {
var aItem = items_2[_c];
var yDistance = Math.abs(point2.y - aItem[0].y);
if (yDistance <= min7) {
snapItem = aItem;
min7 = yDistance;
}
}
items = [snapItem];
}
return uniq(flatten_default(items));
}
return [];
}
var ActiveRegion = function(_super) {
__extends(ActiveRegion2, _super);
function ActiveRegion2() {
return _super !== null && _super.apply(this, arguments) || this;
}
ActiveRegion2.prototype.show = function(args) {
var view = this.context.view;
var ev = this.context.event;
var tooltipCfg = view.getController("tooltip").getTooltipCfg();
var tooltipItems = getItemsOfView(view, {
x: ev.x,
y: ev.y
}, tooltipCfg);
if (is_equal_default(tooltipItems, this.items)) {
return;
}
this.items = tooltipItems;
if (tooltipItems.length) {
var xField_1 = view.getXScale().field;
var xValue_1 = tooltipItems[0].data[xField_1];
var elements_1 = [];
var geometries = view.geometries;
each_default(geometries, function(geometry35) {
if (geometry35.type === "interval" || geometry35.type === "schema") {
var result = geometry35.getElementsBy(function(ele) {
var eleData = ele.getData();
return eleData[xField_1] === xValue_1;
});
elements_1 = elements_1.concat(result);
}
});
if (elements_1.length) {
var coordinate_1 = view.getCoordinate();
var firstBBox_1 = elements_1[0].shape.getCanvasBBox();
var lastBBox_1 = elements_1[0].shape.getCanvasBBox();
var groupBBox_1 = firstBBox_1;
each_default(elements_1, function(ele) {
var bbox = ele.shape.getCanvasBBox();
if (coordinate_1.isTransposed) {
if (bbox.minY < firstBBox_1.minY) {
firstBBox_1 = bbox;
}
if (bbox.maxY > lastBBox_1.maxY) {
lastBBox_1 = bbox;
}
} else {
if (bbox.minX < firstBBox_1.minX) {
firstBBox_1 = bbox;
}
if (bbox.maxX > lastBBox_1.maxX) {
lastBBox_1 = bbox;
}
}
groupBBox_1.x = Math.min(bbox.minX, groupBBox_1.minX);
groupBBox_1.y = Math.min(bbox.minY, groupBBox_1.minY);
groupBBox_1.width = Math.max(bbox.maxX, groupBBox_1.maxX) - groupBBox_1.x;
groupBBox_1.height = Math.max(bbox.maxY, groupBBox_1.maxY) - groupBBox_1.y;
});
var backgroundGroup = view.backgroundGroup, coordinateBBox = view.coordinateBBox;
var path = void 0;
if (coordinate_1.isRect) {
var xScale = view.getXScale();
var _a6 = args || {}, appendRatio = _a6.appendRatio, appendWidth = _a6.appendWidth;
if (is_nil_default(appendWidth)) {
appendRatio = is_nil_default(appendRatio) ? xScale.isLinear ? 0 : 0.25 : appendRatio;
appendWidth = coordinate_1.isTransposed ? appendRatio * lastBBox_1.height : appendRatio * firstBBox_1.width;
}
var minX = void 0;
var minY = void 0;
var width2 = void 0;
var height = void 0;
if (coordinate_1.isTransposed) {
minX = coordinateBBox.minX;
minY = Math.min(lastBBox_1.minY, firstBBox_1.minY) - appendWidth;
width2 = coordinateBBox.width;
height = groupBBox_1.height + appendWidth * 2;
} else {
minX = Math.min(firstBBox_1.minX, lastBBox_1.minX) - appendWidth;
minY = coordinateBBox.minY;
width2 = groupBBox_1.width + appendWidth * 2;
height = coordinateBBox.height;
}
path = [
["M", minX, minY],
["L", minX + width2, minY],
["L", minX + width2, minY + height],
["L", minX, minY + height],
["Z"]
];
} else {
var firstElement = head(elements_1);
var lastElement = last(elements_1);
var startAngle = getAngle3(firstElement.getModel(), coordinate_1).startAngle;
var endAngle = getAngle3(lastElement.getModel(), coordinate_1).endAngle;
var center2 = coordinate_1.getCenter();
var radius = coordinate_1.getRadius();
var innterRadius = coordinate_1.innerRadius * radius;
path = getSectorPath(center2.x, center2.y, radius, startAngle, endAngle, innterRadius);
}
if (this.regionPath) {
this.regionPath.attr("path", path);
this.regionPath.show();
} else {
var style = get_default(args, "style", DEFAULT_REGION_PATH_STYLE);
this.regionPath = backgroundGroup.addShape({
type: "path",
name: "active-region",
capture: false,
attrs: __assign(__assign({}, style), { path })
});
}
}
}
};
ActiveRegion2.prototype.hide = function() {
if (this.regionPath) {
this.regionPath.hide();
}
this.items = null;
};
ActiveRegion2.prototype.destroy = function() {
this.hide();
if (this.regionPath) {
this.regionPath.remove(true);
}
_super.prototype.destroy.call(this);
};
return ActiveRegion2;
}(base_default12);
var active_region_default = ActiveRegion;
// node_modules/@antv/g2/esm/interaction/action/component/tooltip/geometry.js
var TooltipAction = function(_super) {
__extends(TooltipAction2, _super);
function TooltipAction2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.timeStamp = 0;
return _this;
}
TooltipAction2.prototype.show = function() {
var context = this.context;
var ev = context.event;
var view = context.view;
var isTooltipLocked = view.isTooltipLocked();
if (isTooltipLocked) {
return;
}
var lastTimeStamp = this.timeStamp;
var timeStamp = +new Date();
var showDelay = get_default(context.view.getOptions(), "tooltip.showDelay", 16);
if (timeStamp - lastTimeStamp > showDelay) {
var preLoc = this.location;
var curLoc = { x: ev.x, y: ev.y };
if (!preLoc || !is_equal_default(preLoc, curLoc)) {
this.showTooltip(view, curLoc);
}
this.timeStamp = timeStamp;
this.location = curLoc;
}
};
TooltipAction2.prototype.hide = function() {
var view = this.context.view;
var tooltip10 = view.getController("tooltip");
var _a6 = this.context.event, clientX = _a6.clientX, clientY = _a6.clientY;
if (tooltip10.isCursorEntered({ x: clientX, y: clientY })) {
return;
}
if (view.isTooltipLocked()) {
return;
}
this.hideTooltip(view);
this.location = null;
};
TooltipAction2.prototype.showTooltip = function(view, point2) {
view.showTooltip(point2);
};
TooltipAction2.prototype.hideTooltip = function(view) {
view.hideTooltip();
};
return TooltipAction2;
}(base_default12);
var geometry_default = TooltipAction;
// node_modules/@antv/g2/esm/interaction/action/component/tooltip/sibling.js
var SiblingTooltip = function(_super) {
__extends(SiblingTooltip2, _super);
function SiblingTooltip2() {
return _super !== null && _super.apply(this, arguments) || this;
}
SiblingTooltip2.prototype.showTooltip = function(view, point2) {
var siblings = getSilbings(view);
each_default(siblings, function(sibling) {
var siblingPoint = getSiblingPoint(view, sibling, point2);
sibling.showTooltip(siblingPoint);
});
};
SiblingTooltip2.prototype.hideTooltip = function(view) {
var siblings = getSilbings(view);
each_default(siblings, function(sibling) {
sibling.hideTooltip();
});
};
return SiblingTooltip2;
}(geometry_default);
var sibling_default = SiblingTooltip;
// node_modules/@antv/g2/esm/interaction/action/component/tooltip/ellipsis-text.js
var EllipsisText = function(_super) {
__extends(EllipsisText2, _super);
function EllipsisText2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.timeStamp = 0;
return _this;
}
EllipsisText2.prototype.destroy = function() {
_super.prototype.destroy.call(this);
this.tooltip && this.tooltip.destroy();
};
EllipsisText2.prototype.show = function() {
var context = this.context;
var ev = context.event;
var lastTimeStamp = this.timeStamp;
var timeStamp = +new Date();
if (timeStamp - lastTimeStamp > 16) {
var preLoc = this.location;
var curLoc = { x: ev.x, y: ev.y };
if (!preLoc || !is_equal_default(preLoc, curLoc)) {
this.showTooltip(curLoc);
}
this.timeStamp = timeStamp;
this.location = curLoc;
}
};
EllipsisText2.prototype.hide = function() {
this.hideTooltip();
this.location = null;
};
EllipsisText2.prototype.showTooltip = function(curLoc) {
var context = this.context;
var ev = context.event;
var target = ev.target;
if (target && target.get("tip")) {
if (!this.tooltip) {
this.renderTooltip();
}
var tipContent = target.get("tip");
this.tooltip.update(__assign({ title: tipContent }, curLoc));
this.tooltip.show();
}
};
EllipsisText2.prototype.hideTooltip = function() {
this.tooltip && this.tooltip.hide();
};
EllipsisText2.prototype.renderTooltip = function() {
var _a6;
var view = this.context.view;
var canvas = view.canvas;
var region = {
start: { x: 0, y: 0 },
end: { x: canvas.get("width"), y: canvas.get("height") }
};
var theme4 = view.getTheme();
var tooltipStyles = get_default(theme4, ["components", "tooltip", "domStyles"], {});
var tooltip10 = new HtmlTooltip({
parent: canvas.get("el").parentNode,
region,
visible: false,
crosshairs: null,
domStyles: __assign({}, deep_mix_default({}, tooltipStyles, (_a6 = {}, _a6[css_const_exports.CONTAINER_CLASS] = { "max-width": "50%" }, _a6[css_const_exports.TITLE_CLASS] = { "word-break": "break-all" }, _a6)))
});
tooltip10.init();
tooltip10.setCapture(false);
this.tooltip = tooltip10;
};
return EllipsisText2;
}(base_default12);
var ellipsis_text_default = EllipsisText;
// node_modules/@antv/g2/esm/interaction/action/element/state-base.js
var StateBase = function(_super) {
__extends(StateBase2, _super);
function StateBase2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.stateName = "";
return _this;
}
StateBase2.prototype.hasState = function(element) {
return element.hasState(this.stateName);
};
StateBase2.prototype.setElementState = function(element, enable) {
element.setState(this.stateName, enable);
};
StateBase2.prototype.setState = function() {
this.setStateEnable(true);
};
StateBase2.prototype.clear = function() {
var view = this.context.view;
this.clearViewState(view);
};
StateBase2.prototype.clearViewState = function(view) {
var _this = this;
var elements = getElementsByState(view, this.stateName);
each_default(elements, function(el) {
_this.setElementState(el, false);
});
};
return StateBase2;
}(base_default12);
var state_base_default = StateBase;
// node_modules/@antv/g2/esm/interaction/action/element/state.js
function getItem(shape) {
return get_default(shape.get("delegateObject"), "item");
}
var ElementState = function(_super) {
__extends(ElementState2, _super);
function ElementState2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.ignoreListItemStates = ["unchecked"];
return _this;
}
ElementState2.prototype.isItemIgnore = function(item, list) {
var states = this.ignoreListItemStates;
var filtered = states.filter(function(state2) {
return list.hasState(item, state2);
});
return !!filtered.length;
};
ElementState2.prototype.setStateByComponent = function(component2, item, enable) {
var view = this.context.view;
var field6 = component2.get("field");
var elements = getElements(view);
this.setElementsStateByItem(elements, field6, item, enable);
};
ElementState2.prototype.setStateByElement = function(element, enable) {
this.setElementState(element, enable);
};
ElementState2.prototype.isMathItem = function(element, field6, item) {
var view = this.context.view;
var scale12 = getScaleByField(view, field6);
var value2 = getElementValue(element, field6);
return !is_nil_default(value2) && item.name === scale12.getText(value2);
};
ElementState2.prototype.setElementsStateByItem = function(elements, field6, item, enable) {
var _this = this;
each_default(elements, function(el) {
if (_this.isMathItem(el, field6, item)) {
el.setState(_this.stateName, enable);
}
});
};
ElementState2.prototype.setStateEnable = function(enable) {
var element = getCurrentElement(this.context);
if (element) {
if (isElementChange(this.context)) {
this.setStateByElement(element, enable);
}
} else {
var delegateObject = getDelegationObject(this.context);
if (isList(delegateObject)) {
var item = delegateObject.item, component2 = delegateObject.component;
if (item && component2 && !this.isItemIgnore(item, component2)) {
var event_1 = this.context.event.gEvent;
if (event_1 && event_1.fromShape && event_1.toShape && getItem(event_1.fromShape) === getItem(event_1.toShape)) {
return;
}
this.setStateByComponent(component2, item, enable);
}
}
}
};
ElementState2.prototype.toggle = function() {
var element = getCurrentElement(this.context);
if (element) {
var hasState = element.hasState(this.stateName);
this.setElementState(element, !hasState);
}
};
ElementState2.prototype.reset = function() {
this.setStateEnable(false);
};
return ElementState2;
}(state_base_default);
var state_default = ElementState;
// node_modules/@antv/g2/esm/interaction/action/element/active.js
var ElementActive = function(_super) {
__extends(ElementActive2, _super);
function ElementActive2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.stateName = "active";
return _this;
}
ElementActive2.prototype.active = function() {
this.setState();
};
return ElementActive2;
}(state_default);
var active_default = ElementActive;
// node_modules/@antv/g2/esm/interaction/action/element/link-by-color.js
var LinkByColor = function(_super) {
__extends(LinkByColor2, _super);
function LinkByColor2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.cache = {};
return _this;
}
LinkByColor2.prototype.getColorScale = function(view, element) {
var colorAttr = element.geometry.getAttribute("color");
if (!colorAttr) {
return null;
}
var scale12 = view.getScaleByField(colorAttr.getFields()[0]);
return scale12;
};
LinkByColor2.prototype.getLinkPath = function(element, nextElement) {
var view = this.context.view;
var isTransposed = view.getCoordinate().isTransposed;
var bbox = element.shape.getCanvasBBox();
var nextBBox = nextElement.shape.getCanvasBBox();
var path = isTransposed ? [
["M", bbox.minX, bbox.minY],
["L", nextBBox.minX, nextBBox.maxY],
["L", nextBBox.maxX, nextBBox.maxY],
["L", bbox.maxX, bbox.minY],
["Z"]
] : [
["M", bbox.maxX, bbox.minY],
["L", nextBBox.minX, nextBBox.minY],
["L", nextBBox.minX, nextBBox.maxY],
["L", bbox.maxX, bbox.maxY],
["Z"]
];
return path;
};
LinkByColor2.prototype.addLinkShape = function(group2, element, nextElement, activeStyle) {
var style = {
opacity: 0.4,
fill: element.shape.attr("fill")
};
group2.addShape({
type: "path",
attrs: __assign(__assign({}, deep_mix_default({}, style, is_function_default(activeStyle) ? activeStyle(style, element) : activeStyle)), { path: this.getLinkPath(element, nextElement) })
});
};
LinkByColor2.prototype.linkByElement = function(element, activeStyle) {
var _this = this;
var view = this.context.view;
var scale12 = this.getColorScale(view, element);
if (!scale12) {
return;
}
var value2 = getElementValue(element, scale12.field);
if (!this.cache[value2]) {
var elements_1 = getElementsByField(view, scale12.field, value2);
var linkGroup = this.linkGroup;
var group_1 = linkGroup.addGroup();
this.cache[value2] = group_1;
var count_1 = elements_1.length;
each_default(elements_1, function(el, index2) {
if (index2 < count_1 - 1) {
var nextEl = elements_1[index2 + 1];
_this.addLinkShape(group_1, el, nextEl, activeStyle);
}
});
}
};
LinkByColor2.prototype.removeLink = function(element) {
var scale12 = this.getColorScale(this.context.view, element);
if (!scale12) {
return;
}
var value2 = getElementValue(element, scale12.field);
if (this.cache[value2]) {
this.cache[value2].remove();
this.cache[value2] = null;
}
};
LinkByColor2.prototype.link = function(args) {
var context = this.context;
if (!this.linkGroup) {
this.linkGroup = context.view.foregroundGroup.addGroup({
id: "link-by-color-group",
capture: false
});
}
var element = getCurrentElement(context);
if (element) {
this.linkByElement(element, args === null || args === void 0 ? void 0 : args.style);
}
};
LinkByColor2.prototype.unlink = function() {
var element = getCurrentElement(this.context);
if (element) {
this.removeLink(element);
}
};
LinkByColor2.prototype.clear = function() {
if (this.linkGroup) {
this.linkGroup.clear();
}
this.cache = {};
};
LinkByColor2.prototype.destroy = function() {
_super.prototype.destroy.call(this);
if (this.linkGroup) {
this.linkGroup.remove();
}
};
return LinkByColor2;
}(base_default12);
var link_by_color_default = LinkByColor;
// node_modules/@antv/g2/esm/interaction/action/element/range-state.js
var ElementRangeState = function(_super) {
__extends(ElementRangeState2, _super);
function ElementRangeState2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.startPoint = null;
_this.endPoint = null;
_this.isStarted = false;
_this.effectSiblings = false;
_this.effectByRecord = false;
return _this;
}
ElementRangeState2.prototype.getCurrentPoint = function() {
var event = this.context.event;
return {
x: event.x,
y: event.y
};
};
ElementRangeState2.prototype.start = function() {
this.clear();
this.startPoint = this.getCurrentPoint();
this.isStarted = true;
};
ElementRangeState2.prototype.getIntersectElements = function() {
var elements = null;
if (isMask(this.context)) {
elements = getMaskedElements(this.context, 10);
} else {
var startPoint = this.startPoint;
var endPoint = this.isStarted ? this.getCurrentPoint() : this.endPoint;
if (!startPoint || !endPoint) {
return;
}
var box2 = {
minX: Math.min(startPoint.x, endPoint.x),
minY: Math.min(startPoint.y, endPoint.y),
maxX: Math.max(startPoint.x, endPoint.x),
maxY: Math.max(startPoint.y, endPoint.y)
};
var view = this.context.view;
elements = getIntersectElements(view, box2);
}
return elements;
};
ElementRangeState2.prototype.setStateEnable = function(enable) {
if (this.effectSiblings && !this.effectByRecord) {
this.setSiblingsState(enable);
} else {
var allElements = getElements(this.context.view);
var elements = this.getIntersectElements();
if (elements && elements.length) {
if (this.effectByRecord) {
this.setSiblingsStateByRecord(elements, enable);
} else {
this.setElementsState(elements, enable, allElements);
}
} else {
this.clear();
}
}
};
ElementRangeState2.prototype.setSiblingsStateByRecord = function(elements, enable) {
var _this = this;
var view = this.context.view;
var siblings = getSilbings(view);
var records = elements.map(function(el) {
return el.getModel().data;
});
var xFiled = view.getXScale().field;
var yField = view.getYScales()[0].field;
each_default(siblings, function(sibling) {
var allElements = getElements(sibling);
var effectElements = allElements.filter(function(el) {
var record = el.getModel().data;
return isInRecords(records, record, xFiled, yField);
});
_this.setElementsState(effectElements, enable, allElements);
});
};
ElementRangeState2.prototype.setSiblingsState = function(enable) {
var _this = this;
var view = this.context.view;
var siblings = getSilbings(view);
if (isMask(this.context)) {
each_default(siblings, function(sibling) {
var allElements = getElements(sibling);
var effectElements = getSiblingMaskElements(_this.context, sibling, 10);
if (effectElements && effectElements.length) {
_this.setElementsState(effectElements, enable, allElements);
} else {
_this.clearViewState(sibling);
}
});
}
};
ElementRangeState2.prototype.setElementsState = function(elements, enable, allElements) {
var _this = this;
each_default(allElements, function(el) {
if (!elements.includes(el)) {
_this.setElementState(el, false);
} else {
_this.setElementState(el, enable);
}
});
};
ElementRangeState2.prototype.end = function() {
this.isStarted = false;
this.endPoint = this.getCurrentPoint();
};
ElementRangeState2.prototype.clear = function() {
var _this = this;
var view = this.context.view;
if (this.effectSiblings) {
var siblings = getSilbings(view);
each_default(siblings, function(sibling) {
_this.clearViewState(sibling);
});
} else {
this.clearViewState(view);
}
};
return ElementRangeState2;
}(state_base_default);
var range_state_default = ElementRangeState;
// node_modules/@antv/g2/esm/interaction/action/element/range-active.js
var ElementRangeActive = function(_super) {
__extends(ElementRangeActive2, _super);
function ElementRangeActive2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.stateName = "active";
return _this;
}
ElementRangeActive2.prototype.active = function() {
this.setState();
};
return ElementRangeActive2;
}(range_state_default);
var range_active_default = ElementRangeActive;
// node_modules/@antv/g2/esm/interaction/action/element/single-state.js
var ElementSingleState = function(_super) {
__extends(ElementSingleState2, _super);
function ElementSingleState2() {
return _super !== null && _super.apply(this, arguments) || this;
}
ElementSingleState2.prototype.setStateEnable = function(enable) {
var element = getCurrentElement(this.context);
if (element) {
if (!isElementChange(this.context)) {
return;
}
if (enable) {
this.clear();
this.setElementState(element, true);
} else if (this.hasState(element)) {
this.setElementState(element, false);
}
}
};
ElementSingleState2.prototype.toggle = function() {
var element = getCurrentElement(this.context);
if (element) {
var hasState = this.hasState(element);
if (!hasState) {
this.clear();
}
this.setElementState(element, !hasState);
}
};
ElementSingleState2.prototype.reset = function() {
this.setStateEnable(false);
};
return ElementSingleState2;
}(state_base_default);
var single_state_default = ElementSingleState;
// node_modules/@antv/g2/esm/interaction/action/element/single-active.js
var ElementSingleActive = function(_super) {
__extends(ElementSingleActive2, _super);
function ElementSingleActive2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.stateName = "active";
return _this;
}
ElementSingleActive2.prototype.active = function() {
this.setState();
};
return ElementSingleActive2;
}(single_state_default);
var single_active_default = ElementSingleActive;
// node_modules/@antv/g2/esm/interaction/action/element/highlight-util.js
var STATUS_UNACTIVE = "inactive";
var STATUS_ACTIVE = "active";
function clearHighlight(view) {
var elements = getElements(view);
each_default(elements, function(el) {
if (el.hasState(STATUS_ACTIVE)) {
el.setState(STATUS_ACTIVE, false);
}
if (el.hasState(STATUS_UNACTIVE)) {
el.setState(STATUS_UNACTIVE, false);
}
});
}
function setHighlightBy(elements, callback, enable) {
each_default(elements, function(el) {
if (callback(el)) {
if (el.hasState(STATUS_UNACTIVE)) {
el.setState(STATUS_UNACTIVE, false);
}
el.setState(STATUS_ACTIVE, enable);
} else {
if (el.hasState(STATUS_ACTIVE)) {
el.setState(STATUS_ACTIVE, false);
}
el.setState(STATUS_UNACTIVE, enable);
}
});
}
// node_modules/@antv/g2/esm/interaction/action/element/highlight.js
var STATUS_UNACTIVE2 = ELEMENT_STATE.INACTIVE;
var STATUS_ACTIVE2 = ELEMENT_STATE.ACTIVE;
var ElementHighlight = function(_super) {
__extends(ElementHighlight2, _super);
function ElementHighlight2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.stateName = STATUS_ACTIVE2;
return _this;
}
ElementHighlight2.prototype.setElementsStateByItem = function(elements, field6, item, enable) {
var _this = this;
var callback = function(el) {
return _this.isMathItem(el, field6, item);
};
this.setHighlightBy(elements, callback, enable);
};
ElementHighlight2.prototype.setElementHighlight = function(el, callback) {
if (callback(el)) {
if (el.hasState(STATUS_UNACTIVE2)) {
el.setState(STATUS_UNACTIVE2, false);
}
el.setState(STATUS_ACTIVE2, true);
} else if (!el.hasState(STATUS_ACTIVE2)) {
el.setState(STATUS_UNACTIVE2, true);
}
};
ElementHighlight2.prototype.setHighlightBy = function(elements, callback, enable) {
var _this = this;
if (enable) {
each_default(elements, function(el) {
_this.setElementHighlight(el, callback);
});
} else {
var activeElements = getElementsByState(this.context.view, STATUS_ACTIVE2);
var allCancel_1 = true;
each_default(activeElements, function(el) {
if (!callback(el)) {
allCancel_1 = false;
return false;
}
});
if (allCancel_1) {
this.clear();
} else {
each_default(elements, function(el) {
if (callback(el)) {
if (el.hasState(STATUS_ACTIVE2)) {
el.setState(STATUS_ACTIVE2, false);
}
el.setState(STATUS_UNACTIVE2, true);
}
});
}
}
};
ElementHighlight2.prototype.setElementState = function(element, enable) {
var view = this.context.view;
var elements = getElements(view);
this.setHighlightBy(elements, function(el) {
return element === el;
}, enable);
};
ElementHighlight2.prototype.highlight = function() {
this.setState();
};
ElementHighlight2.prototype.clear = function() {
var view = this.context.view;
clearHighlight(view);
};
return ElementHighlight2;
}(state_default);
var highlight_default = ElementHighlight;
// node_modules/@antv/g2/esm/interaction/action/element/highlight-by-color.js
var HighlightColor = function(_super) {
__extends(HighlightColor2, _super);
function HighlightColor2() {
return _super !== null && _super.apply(this, arguments) || this;
}
HighlightColor2.prototype.setStateByElement = function(element, enable) {
var view = this.context.view;
var colorAttr = element.geometry.getAttribute("color");
if (!colorAttr) {
return;
}
var scale12 = view.getScaleByField(colorAttr.getFields()[0]);
var value2 = getElementValue(element, scale12.field);
var elements = getElements(view);
var highlightElements = elements.filter(function(el) {
return getElementValue(el, scale12.field) === value2;
});
this.setHighlightBy(elements, function(el) {
return highlightElements.includes(el);
}, enable);
};
return HighlightColor2;
}(highlight_default);
var highlight_by_color_default = HighlightColor;
// node_modules/@antv/g2/esm/interaction/action/element/highlight-by-x.js
var HighlightX = function(_super) {
__extends(HighlightX2, _super);
function HighlightX2() {
return _super !== null && _super.apply(this, arguments) || this;
}
HighlightX2.prototype.setElementHighlight = function(el, callback) {
if (callback(el)) {
if (el.hasState(STATUS_UNACTIVE2)) {
el.setState(STATUS_UNACTIVE2, false);
}
el.setState(STATUS_ACTIVE2, true);
} else {
el.setState(STATUS_UNACTIVE2, true);
if (el.hasState(STATUS_ACTIVE2)) {
el.setState(STATUS_ACTIVE2, false);
}
}
};
HighlightX2.prototype.setStateByElement = function(element, enable) {
var view = this.context.view;
var scale12 = view.getXScale();
var value2 = getElementValue(element, scale12.field);
var elements = getElements(view);
var highlightElements = elements.filter(function(el) {
return getElementValue(el, scale12.field) === value2;
});
this.setHighlightBy(elements, function(el) {
return highlightElements.includes(el);
}, enable);
};
HighlightX2.prototype.toggle = function() {
var element = getCurrentElement(this.context);
if (element) {
var hasState = element.hasState(this.stateName);
this.setStateByElement(element, !hasState);
}
};
return HighlightX2;
}(highlight_default);
var highlight_by_x_default = HighlightX;
// node_modules/@antv/g2/esm/interaction/action/element/range-highlight.js
var EVENTS2;
(function(EVENTS4) {
EVENTS4["BEFORE_HIGHLIGHT"] = "element-range-highlight:beforehighlight";
EVENTS4["AFTER_HIGHLIGHT"] = "element-range-highlight:afterhighlight";
EVENTS4["BEFORE_CLEAR"] = "element-range-highlight:beforeclear";
EVENTS4["AFTER_CLEAR"] = "element-range-highlight:afterclear";
})(EVENTS2 || (EVENTS2 = {}));
var ElementRangeHighlight = function(_super) {
__extends(ElementRangeHighlight2, _super);
function ElementRangeHighlight2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.stateName = "active";
return _this;
}
ElementRangeHighlight2.prototype.clearViewState = function(view) {
clearHighlight(view);
};
ElementRangeHighlight2.prototype.highlight = function() {
var _a6 = this.context, view = _a6.view, event = _a6.event;
var elements = this.getIntersectElements();
var payload = { view, event, highlightElements: elements };
view.emit(EVENTS2.BEFORE_HIGHLIGHT, event_default.fromData(view, EVENTS2.BEFORE_HIGHLIGHT, payload));
this.setState();
view.emit(EVENTS2.AFTER_HIGHLIGHT, event_default.fromData(view, EVENTS2.AFTER_HIGHLIGHT, payload));
};
ElementRangeHighlight2.prototype.clear = function() {
var view = this.context.view;
view.emit(EVENTS2.BEFORE_CLEAR, event_default.fromData(view, EVENTS2.BEFORE_CLEAR, {}));
_super.prototype.clear.call(this);
view.emit(EVENTS2.AFTER_CLEAR, event_default.fromData(view, EVENTS2.AFTER_CLEAR, {}));
};
ElementRangeHighlight2.prototype.setElementsState = function(elements, enable, allElements) {
setHighlightBy(allElements, function(el) {
return elements.indexOf(el) >= 0;
}, enable);
};
return ElementRangeHighlight2;
}(range_state_default);
var range_highlight_default = ElementRangeHighlight;
// node_modules/@antv/g2/esm/interaction/action/element/single-highlight.js
var ElementSingleHighlight = function(_super) {
__extends(ElementSingleHighlight2, _super);
function ElementSingleHighlight2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.stateName = "active";
return _this;
}
ElementSingleHighlight2.prototype.highlight = function() {
this.setState();
};
ElementSingleHighlight2.prototype.setElementState = function(element, enable) {
var view = this.context.view;
var elements = getElements(view);
setHighlightBy(elements, function(el) {
return element === el;
}, enable);
};
ElementSingleHighlight2.prototype.clear = function() {
var view = this.context.view;
clearHighlight(view);
};
return ElementSingleHighlight2;
}(single_state_default);
var single_highlight_default = ElementSingleHighlight;
// node_modules/@antv/g2/esm/interaction/action/element/range-selected.js
var ElementRangeSelected = function(_super) {
__extends(ElementRangeSelected2, _super);
function ElementRangeSelected2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.stateName = "selected";
return _this;
}
ElementRangeSelected2.prototype.selected = function() {
this.setState();
};
return ElementRangeSelected2;
}(range_state_default);
var range_selected_default = ElementRangeSelected;
// node_modules/@antv/g2/esm/interaction/action/element/selected.js
var ElementMultipleSelected = function(_super) {
__extends(ElementMultipleSelected2, _super);
function ElementMultipleSelected2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.stateName = "selected";
return _this;
}
ElementMultipleSelected2.prototype.selected = function() {
this.setState();
};
return ElementMultipleSelected2;
}(state_default);
var selected_default = ElementMultipleSelected;
// node_modules/@antv/g2/esm/interaction/action/element/single-selected.js
var ElementSingleSelected = function(_super) {
__extends(ElementSingleSelected2, _super);
function ElementSingleSelected2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.stateName = "selected";
return _this;
}
ElementSingleSelected2.prototype.selected = function() {
this.setState();
};
return ElementSingleSelected2;
}(single_state_default);
var single_selected_default = ElementSingleSelected;
// node_modules/@antv/g2/esm/interaction/action/component/list-state.js
var ListState = function(_super) {
__extends(ListState2, _super);
function ListState2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.stateName = "";
_this.ignoreItemStates = [];
return _this;
}
ListState2.prototype.getTriggerListInfo = function() {
var delegateObject = getDelegationObject(this.context);
var info = null;
if (isList(delegateObject)) {
info = {
item: delegateObject.item,
list: delegateObject.component
};
}
return info;
};
ListState2.prototype.getAllowComponents = function() {
var _this = this;
var view = this.context.view;
var components = getComponents(view);
var rst = [];
each_default(components, function(component2) {
if (component2.isList() && _this.allowSetStateByElement(component2)) {
rst.push(component2);
}
});
return rst;
};
ListState2.prototype.hasState = function(list, item) {
return list.hasState(item, this.stateName);
};
ListState2.prototype.clearAllComponentsState = function() {
var _this = this;
var components = this.getAllowComponents();
each_default(components, function(component2) {
component2.clearItemsState(_this.stateName);
});
};
ListState2.prototype.allowSetStateByElement = function(component2) {
var field6 = component2.get("field");
if (!field6) {
return false;
}
if (this.cfg && this.cfg.componentNames) {
var name_1 = component2.get("name");
if (this.cfg.componentNames.indexOf(name_1) === -1) {
return false;
}
}
var view = this.context.view;
var scale12 = getScaleByField(view, field6);
return scale12 && scale12.isCategory;
};
ListState2.prototype.allowSetStateByItem = function(item, list) {
var ignoreStates = this.ignoreItemStates;
if (ignoreStates.length) {
var filterStates = ignoreStates.filter(function(state2) {
return list.hasState(item, state2);
});
return filterStates.length === 0;
}
return true;
};
ListState2.prototype.setStateByElement = function(component2, element, enable) {
var field6 = component2.get("field");
var view = this.context.view;
var scale12 = getScaleByField(view, field6);
var value2 = getElementValue(element, field6);
var text = scale12.getText(value2);
this.setItemsState(component2, text, enable);
};
ListState2.prototype.setStateEnable = function(enable) {
var _this = this;
var element = getCurrentElement(this.context);
if (element) {
var components = this.getAllowComponents();
each_default(components, function(component3) {
_this.setStateByElement(component3, element, enable);
});
} else {
var delegateObject = getDelegationObject(this.context);
if (isList(delegateObject)) {
var item = delegateObject.item, component2 = delegateObject.component;
if (this.allowSetStateByElement(component2) && this.allowSetStateByItem(item, component2)) {
this.setItemState(component2, item, enable);
}
}
}
};
ListState2.prototype.setItemsState = function(list, name, enable) {
var _this = this;
var items = list.getItems();
each_default(items, function(item) {
if (item.name === name) {
_this.setItemState(list, item, enable);
}
});
};
ListState2.prototype.setItemState = function(list, item, enable) {
list.setItemState(item, this.stateName, enable);
};
ListState2.prototype.setState = function() {
this.setStateEnable(true);
};
ListState2.prototype.reset = function() {
this.setStateEnable(false);
};
ListState2.prototype.toggle = function() {
var triggerInfo = this.getTriggerListInfo();
if (triggerInfo && triggerInfo.item) {
var list = triggerInfo.list, item = triggerInfo.item;
var enable = this.hasState(list, item);
this.setItemState(list, item, !enable);
}
};
ListState2.prototype.clear = function() {
var triggerInfo = this.getTriggerListInfo();
if (triggerInfo) {
triggerInfo.list.clearItemsState(this.stateName);
} else {
this.clearAllComponentsState();
}
};
return ListState2;
}(base_default12);
var list_state_default = ListState;
// node_modules/@antv/g2/esm/interaction/action/component/list-active.js
var ListActive = function(_super) {
__extends(ListActive2, _super);
function ListActive2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.stateName = "active";
return _this;
}
ListActive2.prototype.active = function() {
this.setState();
};
return ListActive2;
}(list_state_default);
var list_active_default = ListActive;
// node_modules/@antv/g2/esm/interaction/action/component/list-highlight-util.js
var STATUS_UNACTIVE3 = "inactive";
var STATUS_ACTIVE3 = "active";
function clearList(list) {
var items = list.getItems();
each_default(items, function(item) {
if (list.hasState(item, STATUS_ACTIVE3)) {
list.setItemState(item, STATUS_ACTIVE3, false);
}
if (list.hasState(item, STATUS_UNACTIVE3)) {
list.setItemState(item, STATUS_UNACTIVE3, false);
}
});
}
// node_modules/@antv/g2/esm/interaction/action/component/list-highlight.js
var STATUS_UNACTIVE4 = "inactive";
var STATUS_ACTIVE4 = "active";
var ListHighlight = function(_super) {
__extends(ListHighlight2, _super);
function ListHighlight2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.stateName = STATUS_ACTIVE4;
_this.ignoreItemStates = ["unchecked"];
return _this;
}
ListHighlight2.prototype.setItemsState = function(list, name, enable) {
this.setHighlightBy(list, function(item) {
return item.name === name;
}, enable);
};
ListHighlight2.prototype.setItemState = function(list, item, enable) {
var items = list.getItems();
this.setHighlightBy(list, function(el) {
return el === item;
}, enable);
};
ListHighlight2.prototype.setHighlightBy = function(list, callback, enable) {
var items = list.getItems();
if (enable) {
each_default(items, function(item) {
if (callback(item)) {
if (list.hasState(item, STATUS_UNACTIVE4)) {
list.setItemState(item, STATUS_UNACTIVE4, false);
}
list.setItemState(item, STATUS_ACTIVE4, true);
} else if (!list.hasState(item, STATUS_ACTIVE4)) {
list.setItemState(item, STATUS_UNACTIVE4, true);
}
});
} else {
var activeItems = list.getItemsByState(STATUS_ACTIVE4);
var allCancel_1 = true;
each_default(activeItems, function(item) {
if (!callback(item)) {
allCancel_1 = false;
return false;
}
});
if (allCancel_1) {
this.clear();
} else {
each_default(items, function(item) {
if (callback(item)) {
if (list.hasState(item, STATUS_ACTIVE4)) {
list.setItemState(item, STATUS_ACTIVE4, false);
}
list.setItemState(item, STATUS_UNACTIVE4, true);
}
});
}
}
};
ListHighlight2.prototype.highlight = function() {
this.setState();
};
ListHighlight2.prototype.clear = function() {
var triggerInfo = this.getTriggerListInfo();
if (triggerInfo) {
clearList(triggerInfo.list);
} else {
var components = this.getAllowComponents();
each_default(components, function(component2) {
component2.clearItemsState(STATUS_ACTIVE4);
component2.clearItemsState(STATUS_UNACTIVE4);
});
}
};
return ListHighlight2;
}(list_state_default);
var list_highlight_default = ListHighlight;
// node_modules/@antv/g2/esm/interaction/action/component/list-selected.js
var ListSelected = function(_super) {
__extends(ListSelected2, _super);
function ListSelected2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.stateName = "selected";
return _this;
}
ListSelected2.prototype.selected = function() {
this.setState();
};
return ListSelected2;
}(list_state_default);
var list_selected_default = ListSelected;
// node_modules/@antv/g2/esm/interaction/action/component/list-unchecked.js
var ListUnchecked = function(_super) {
__extends(ListUnchecked2, _super);
function ListUnchecked2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.stateName = "unchecked";
return _this;
}
ListUnchecked2.prototype.unchecked = function() {
this.setState();
};
return ListUnchecked2;
}(list_state_default);
var list_unchecked_default = ListUnchecked;
// node_modules/@antv/g2/esm/interaction/action/component/list-checked.js
var STATUS_UNCHECKED = "unchecked";
var STATUS_CHECKED = "checked";
var ListChecked = function(_super) {
__extends(ListChecked2, _super);
function ListChecked2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.stateName = STATUS_CHECKED;
return _this;
}
ListChecked2.prototype.setItemState = function(list, item, enable) {
this.setCheckedBy(list, function(el) {
return el === item;
}, enable);
};
ListChecked2.prototype.setCheckedBy = function(list, callback, enable) {
var items = list.getItems();
if (enable) {
each_default(items, function(item) {
if (callback(item)) {
if (list.hasState(item, STATUS_UNCHECKED)) {
list.setItemState(item, STATUS_UNCHECKED, false);
}
list.setItemState(item, STATUS_CHECKED, true);
} else if (!list.hasState(item, STATUS_CHECKED)) {
list.setItemState(item, STATUS_UNCHECKED, true);
}
});
}
};
ListChecked2.prototype.toggle = function() {
var triggerInfo = this.getTriggerListInfo();
if (triggerInfo && triggerInfo.item) {
var list_1 = triggerInfo.list, item = triggerInfo.item;
var allChecked = !some_default(list_1.getItems(), function(t4) {
return list_1.hasState(t4, STATUS_UNCHECKED);
});
if (allChecked || list_1.hasState(item, STATUS_UNCHECKED)) {
this.setItemState(list_1, item, true);
} else {
this.reset();
}
}
};
ListChecked2.prototype.checked = function() {
this.setState();
};
ListChecked2.prototype.reset = function() {
var components = this.getAllowComponents();
each_default(components, function(component2) {
component2.clearItemsState(STATUS_CHECKED);
component2.clearItemsState(STATUS_UNCHECKED);
});
};
return ListChecked2;
}(list_state_default);
var list_checked_default = ListChecked;
// node_modules/@antv/g2/esm/interaction/action/component/list-focus.js
var STATUS_UNCHECKED2 = "unchecked";
var ListFocus = function(_super) {
__extends(ListFocus2, _super);
function ListFocus2() {
return _super !== null && _super.apply(this, arguments) || this;
}
ListFocus2.prototype.toggle = function() {
var triggerInfo = this.getTriggerListInfo();
if (triggerInfo === null || triggerInfo === void 0 ? void 0 : triggerInfo.item) {
var list_1 = triggerInfo.list, clickedItem = triggerInfo.item;
var items = list_1.getItems();
var checkedItems = items.filter(function(t4) {
return !list_1.hasState(t4, STATUS_UNCHECKED2);
});
var uncheckedItems = items.filter(function(t4) {
return list_1.hasState(t4, STATUS_UNCHECKED2);
});
var checkedItem = checkedItems[0];
if (items.length === checkedItems.length) {
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
var item = items_1[_i];
list_1.setItemState(item, STATUS_UNCHECKED2, item.id !== clickedItem.id);
}
} else if (items.length - uncheckedItems.length === 1) {
if (checkedItem.id === clickedItem.id) {
for (var _a6 = 0, items_2 = items; _a6 < items_2.length; _a6++) {
var item = items_2[_a6];
list_1.setItemState(item, STATUS_UNCHECKED2, false);
}
} else {
for (var _b = 0, items_3 = items; _b < items_3.length; _b++) {
var item = items_3[_b];
list_1.setItemState(item, STATUS_UNCHECKED2, item.id !== clickedItem.id);
}
}
} else {
for (var _c = 0, items_4 = items; _c < items_4.length; _c++) {
var item = items_4[_c];
list_1.setItemState(item, STATUS_UNCHECKED2, item.id !== clickedItem.id);
}
}
}
};
return ListFocus2;
}(list_state_default);
var list_focus_default = ListFocus;
// node_modules/@antv/g2/esm/interaction/action/component/list-radio.js
var STATUS_SHOW = "showRadio";
var ListRadio = function(_super) {
__extends(ListRadio2, _super);
function ListRadio2() {
return _super !== null && _super.apply(this, arguments) || this;
}
ListRadio2.prototype.show = function() {
var triggerInfo = this.getTriggerListInfo();
if (triggerInfo === null || triggerInfo === void 0 ? void 0 : triggerInfo.item) {
var list = triggerInfo.list, item = triggerInfo.item;
list.setItemState(item, STATUS_SHOW, true);
}
};
ListRadio2.prototype.hide = function() {
var triggerInfo = this.getTriggerListInfo();
if (triggerInfo === null || triggerInfo === void 0 ? void 0 : triggerInfo.item) {
var list = triggerInfo.list, item = triggerInfo.item;
list.setItemState(item, STATUS_SHOW, false);
}
};
return ListRadio2;
}(list_state_default);
var list_radio_default = ListRadio;
// node_modules/@antv/g2/esm/interaction/action/mask/base.js
var MaskBase = function(_super) {
__extends(MaskBase2, _super);
function MaskBase2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.maskShape = null;
_this.points = [];
_this.starting = false;
_this.moving = false;
_this.preMovePoint = null;
_this.shapeType = "path";
return _this;
}
MaskBase2.prototype.getCurrentPoint = function() {
var event = this.context.event;
return {
x: event.x,
y: event.y
};
};
MaskBase2.prototype.emitEvent = function(type2) {
var eventName = "mask:".concat(type2);
var view = this.context.view;
var event = this.context.event;
view.emit(eventName, {
target: this.maskShape,
shape: this.maskShape,
points: this.points,
x: event.x,
y: event.y
});
};
MaskBase2.prototype.createMask = function() {
var view = this.context.view;
var maskAttrs = this.getMaskAttrs();
var maskShape = view.foregroundGroup.addShape({
type: this.shapeType,
name: "mask",
draggable: true,
attrs: __assign({ fill: "#C5D4EB", opacity: 0.3 }, maskAttrs)
});
return maskShape;
};
MaskBase2.prototype.getMaskPath = function() {
return [];
};
MaskBase2.prototype.show = function() {
if (this.maskShape) {
this.maskShape.show();
this.emitEvent("show");
}
};
MaskBase2.prototype.start = function(arg) {
this.starting = true;
this.moving = false;
this.points = [this.getCurrentPoint()];
if (!this.maskShape) {
this.maskShape = this.createMask();
this.maskShape.set("capture", false);
}
this.updateMask(arg === null || arg === void 0 ? void 0 : arg.maskStyle);
this.emitEvent("start");
};
MaskBase2.prototype.moveStart = function() {
this.moving = true;
this.preMovePoint = this.getCurrentPoint();
};
MaskBase2.prototype.move = function() {
if (!this.moving || !this.maskShape) {
return;
}
var currentPoint = this.getCurrentPoint();
var preMovePoint = this.preMovePoint;
var dx = currentPoint.x - preMovePoint.x;
var dy = currentPoint.y - preMovePoint.y;
var points = this.points;
each_default(points, function(point2) {
point2.x += dx;
point2.y += dy;
});
this.updateMask();
this.emitEvent("change");
this.preMovePoint = currentPoint;
};
MaskBase2.prototype.updateMask = function(maskStyle) {
var attrs = deep_mix_default({}, this.getMaskAttrs(), maskStyle);
this.maskShape.attr(attrs);
};
MaskBase2.prototype.moveEnd = function() {
this.moving = false;
this.preMovePoint = null;
};
MaskBase2.prototype.end = function() {
this.starting = false;
this.emitEvent("end");
if (this.maskShape) {
this.maskShape.set("capture", true);
}
};
MaskBase2.prototype.hide = function() {
if (this.maskShape) {
this.maskShape.hide();
this.emitEvent("hide");
}
};
MaskBase2.prototype.resize = function() {
if (this.starting && this.maskShape) {
this.points.push(this.getCurrentPoint());
this.updateMask();
this.emitEvent("change");
}
};
MaskBase2.prototype.destroy = function() {
this.points = [];
if (this.maskShape) {
this.maskShape.remove();
}
this.maskShape = null;
this.preMovePoint = null;
_super.prototype.destroy.call(this);
};
return MaskBase2;
}(base_default12);
var base_default17 = MaskBase;
// node_modules/@antv/g2/esm/interaction/action/mask/circle.js
var CircleMask = function(_super) {
__extends(CircleMask2, _super);
function CircleMask2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.shapeType = "circle";
return _this;
}
CircleMask2.prototype.getMaskAttrs = function() {
var points = this.points;
var currentPoint = last(this.points);
var r4 = 0;
var x6 = 0;
var y5 = 0;
if (points.length) {
var first = points[0];
r4 = distance7(first, currentPoint) / 2;
x6 = (currentPoint.x + first.x) / 2;
y5 = (currentPoint.y + first.y) / 2;
}
return {
x: x6,
y: y5,
r: r4
};
};
return CircleMask2;
}(base_default17);
var circle_default8 = CircleMask;
// node_modules/@antv/g2/esm/interaction/action/mask/rect.js
var RectMask = function(_super) {
__extends(RectMask2, _super);
function RectMask2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.shapeType = "rect";
return _this;
}
RectMask2.prototype.getRegion = function() {
var points = this.points;
return {
start: head(points),
end: last(points)
};
};
RectMask2.prototype.getMaskAttrs = function() {
var _a6 = this.getRegion(), start = _a6.start, end2 = _a6.end;
var x6 = Math.min(start.x, end2.x);
var y5 = Math.min(start.y, end2.y);
var width2 = Math.abs(end2.x - start.x);
var height = Math.abs(end2.y - start.y);
return {
x: x6,
y: y5,
width: width2,
height
};
};
return RectMask2;
}(base_default17);
var rect_default5 = RectMask;
// node_modules/@antv/g2/esm/interaction/action/mask/dim-rect.js
function clampPoint(point2) {
point2.x = clamp_default(point2.x, 0, 1);
point2.y = clamp_default(point2.y, 0, 1);
}
var DimRect = function(_super) {
__extends(DimRect2, _super);
function DimRect2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.dim = "x";
_this.inPlot = true;
return _this;
}
DimRect2.prototype.getRegion = function() {
var start = null;
var end2 = null;
var points = this.points;
var dim = this.dim;
var coord2 = this.context.view.getCoordinate();
var normalStart = coord2.invert(head(points));
var normalEnd = coord2.invert(last(points));
if (this.inPlot) {
clampPoint(normalStart);
clampPoint(normalEnd);
}
if (dim === "x") {
start = coord2.convert({
x: normalStart.x,
y: 0
});
end2 = coord2.convert({
x: normalEnd.x,
y: 1
});
} else {
start = coord2.convert({
x: 0,
y: normalStart.y
});
end2 = coord2.convert({
x: 1,
y: normalEnd.y
});
}
return {
start,
end: end2
};
};
return DimRect2;
}(rect_default5);
var dim_rect_default = DimRect;
// node_modules/@antv/g2/esm/interaction/action/mask/path.js
var PathMask = function(_super) {
__extends(PathMask2, _super);
function PathMask2() {
return _super !== null && _super.apply(this, arguments) || this;
}
PathMask2.prototype.getMaskPath = function() {
var points = this.points;
var path = [];
if (points.length) {
each_default(points, function(point2, index2) {
if (index2 === 0) {
path.push(["M", point2.x, point2.y]);
} else {
path.push(["L", point2.x, point2.y]);
}
});
path.push(["L", points[0].x, points[0].y]);
}
return path;
};
PathMask2.prototype.getMaskAttrs = function() {
return {
path: this.getMaskPath()
};
};
PathMask2.prototype.addPoint = function() {
this.resize();
};
return PathMask2;
}(base_default17);
var path_default6 = PathMask;
// node_modules/@antv/g2/esm/interaction/action/mask/smooth-path.js
var SmoothPathMask = function(_super) {
__extends(SmoothPathMask2, _super);
function SmoothPathMask2() {
return _super !== null && _super.apply(this, arguments) || this;
}
SmoothPathMask2.prototype.getMaskPath = function() {
var points = this.points;
return getSpline(points, true);
};
return SmoothPathMask2;
}(path_default6);
var smooth_path_default = SmoothPathMask;
// node_modules/@antv/g2/esm/interaction/action/cursor.js
var CursorAction = function(_super) {
__extends(CursorAction2, _super);
function CursorAction2() {
return _super !== null && _super.apply(this, arguments) || this;
}
CursorAction2.prototype.setCursor = function(cursor) {
var view = this.context.view;
view.getCanvas().setCursor(cursor);
};
CursorAction2.prototype.default = function() {
this.setCursor("default");
};
CursorAction2.prototype.pointer = function() {
this.setCursor("pointer");
};
CursorAction2.prototype.move = function() {
this.setCursor("move");
};
CursorAction2.prototype.crosshair = function() {
this.setCursor("crosshair");
};
CursorAction2.prototype.wait = function() {
this.setCursor("wait");
};
CursorAction2.prototype.help = function() {
this.setCursor("help");
};
CursorAction2.prototype.text = function() {
this.setCursor("text");
};
CursorAction2.prototype.eResize = function() {
this.setCursor("e-resize");
};
CursorAction2.prototype.wResize = function() {
this.setCursor("w-resize");
};
CursorAction2.prototype.nResize = function() {
this.setCursor("n-resize");
};
CursorAction2.prototype.sResize = function() {
this.setCursor("s-resize");
};
CursorAction2.prototype.neResize = function() {
this.setCursor("ne-resize");
};
CursorAction2.prototype.nwResize = function() {
this.setCursor("nw-resize");
};
CursorAction2.prototype.seResize = function() {
this.setCursor("se-resize");
};
CursorAction2.prototype.swResize = function() {
this.setCursor("sw-resize");
};
CursorAction2.prototype.nsResize = function() {
this.setCursor("ns-resize");
};
CursorAction2.prototype.ewResize = function() {
this.setCursor("ew-resize");
};
return CursorAction2;
}(base_default12);
var cursor_default = CursorAction;
// node_modules/@antv/g2/esm/interaction/action/data/filter.js
var DataFilter = function(_super) {
__extends(DataFilter2, _super);
function DataFilter2() {
return _super !== null && _super.apply(this, arguments) || this;
}
DataFilter2.prototype.filterView = function(view, field6, filter2) {
var _this = this;
if (view.getScaleByField(field6)) {
view.filter(field6, filter2);
}
if (view.views && view.views.length) {
each_default(view.views, function(subView) {
_this.filterView(subView, field6, filter2);
});
}
};
DataFilter2.prototype.filter = function() {
var delegateObject = getDelegationObject(this.context);
if (delegateObject) {
var view = this.context.view;
var component2 = delegateObject.component;
var field6 = component2.get("field");
if (isList(delegateObject)) {
if (field6) {
var unCheckedItems = component2.getItemsByState("unchecked");
var scale_1 = getScaleByField(view, field6);
var names_1 = unCheckedItems.map(function(item) {
return item.name;
});
if (names_1.length) {
this.filterView(view, field6, function(value2) {
var text = scale_1.getText(value2);
return !names_1.includes(text);
});
} else {
this.filterView(view, field6, null);
}
view.render(true);
}
} else if (isSlider(delegateObject)) {
var range = component2.getValue();
var min_1 = range[0], max_1 = range[1];
this.filterView(view, field6, function(value2) {
return value2 >= min_1 && value2 <= max_1;
});
view.render(true);
}
}
};
return DataFilter2;
}(base_default12);
var filter_default2 = DataFilter;
// node_modules/@antv/g2/esm/interaction/action/data/range-filter.js
function getFilter(scale12, dim, point1, point2) {
var min7 = Math.min(point1[dim], point2[dim]);
var max8 = Math.max(point1[dim], point2[dim]);
var _a6 = scale12.range, rangeMin = _a6[0], rangeMax = _a6[1];
if (min7 < rangeMin) {
min7 = rangeMin;
}
if (max8 > rangeMax) {
max8 = rangeMax;
}
if (min7 === rangeMax && max8 === rangeMax) {
return null;
}
var minValue = scale12.invert(min7);
var maxValue = scale12.invert(max8);
if (scale12.isCategory) {
var minIndex = scale12.values.indexOf(minValue);
var maxIndex = scale12.values.indexOf(maxValue);
var arr_1 = scale12.values.slice(minIndex, maxIndex + 1);
return function(value2) {
return arr_1.includes(value2);
};
} else {
return function(value2) {
return value2 >= minValue && value2 <= maxValue;
};
}
}
var EVENTS3;
(function(EVENTS4) {
EVENTS4["FILTER"] = "brush-filter-processing";
EVENTS4["RESET"] = "brush-filter-reset";
EVENTS4["BEFORE_FILTER"] = "brush-filter:beforefilter";
EVENTS4["AFTER_FILTER"] = "brush-filter:afterfilter";
EVENTS4["BEFORE_RESET"] = "brush-filter:beforereset";
EVENTS4["AFTER_RESET"] = "brush-filter:afterreset";
})(EVENTS3 || (EVENTS3 = {}));
var RangeFilter = function(_super) {
__extends(RangeFilter2, _super);
function RangeFilter2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.dims = ["x", "y"];
_this.startPoint = null;
_this.isStarted = false;
return _this;
}
RangeFilter2.prototype.hasDim = function(dim) {
return this.dims.includes(dim);
};
RangeFilter2.prototype.start = function() {
var context = this.context;
this.isStarted = true;
this.startPoint = context.getCurrentPoint();
};
RangeFilter2.prototype.filter = function() {
var startPoint;
var currentPoint;
if (isMask(this.context)) {
var maskShape = this.context.event.target;
var bbox = maskShape.getCanvasBBox();
startPoint = { x: bbox.x, y: bbox.y };
currentPoint = { x: bbox.maxX, y: bbox.maxY };
} else {
if (!this.isStarted) {
return;
}
startPoint = this.startPoint;
currentPoint = this.context.getCurrentPoint();
}
if (Math.abs(startPoint.x - currentPoint.x) < 5 || Math.abs(startPoint.x - currentPoint.y) < 5) {
return;
}
var _a6 = this.context, view = _a6.view, event = _a6.event;
var payload = { view, event, dims: this.dims };
view.emit(EVENTS3.BEFORE_FILTER, event_default.fromData(view, EVENTS3.BEFORE_FILTER, payload));
var coord2 = view.getCoordinate();
var normalCurrent = coord2.invert(currentPoint);
var normalStart = coord2.invert(startPoint);
if (this.hasDim("x")) {
var xScale = view.getXScale();
var filter2 = getFilter(xScale, "x", normalCurrent, normalStart);
this.filterView(view, xScale.field, filter2);
}
if (this.hasDim("y")) {
var yScale = view.getYScales()[0];
var filter2 = getFilter(yScale, "y", normalCurrent, normalStart);
this.filterView(view, yScale.field, filter2);
}
this.reRender(view, { source: EVENTS3.FILTER });
view.emit(EVENTS3.AFTER_FILTER, event_default.fromData(view, EVENTS3.AFTER_FILTER, payload));
};
RangeFilter2.prototype.end = function() {
this.isStarted = false;
};
RangeFilter2.prototype.reset = function() {
var view = this.context.view;
view.emit(EVENTS3.BEFORE_RESET, event_default.fromData(view, EVENTS3.BEFORE_RESET, {}));
this.isStarted = false;
if (this.hasDim("x")) {
var xScale = view.getXScale();
this.filterView(view, xScale.field, null);
}
if (this.hasDim("y")) {
var yScale = view.getYScales()[0];
this.filterView(view, yScale.field, null);
}
this.reRender(view, { source: EVENTS3.RESET });
view.emit(EVENTS3.AFTER_RESET, event_default.fromData(view, EVENTS3.AFTER_RESET, {}));
};
RangeFilter2.prototype.filterView = function(view, field6, filter2) {
view.filter(field6, filter2);
};
RangeFilter2.prototype.reRender = function(view, payload) {
view.render(true, payload);
};
return RangeFilter2;
}(base_default12);
var range_filter_default = RangeFilter;
// node_modules/@antv/g2/esm/interaction/action/data/sibling-filter.js
var SiblingFilter = function(_super) {
__extends(SiblingFilter3, _super);
function SiblingFilter3() {
return _super !== null && _super.apply(this, arguments) || this;
}
SiblingFilter3.prototype.filterView = function(view, field6, filter2) {
var siblings = getSilbings(view);
each_default(siblings, function(sibling) {
sibling.filter(field6, filter2);
});
};
SiblingFilter3.prototype.reRender = function(view) {
var siblings = getSilbings(view);
each_default(siblings, function(sibling) {
sibling.render(true);
});
};
return SiblingFilter3;
}(range_filter_default);
var sibling_filter_default = SiblingFilter;
// node_modules/@antv/g2/esm/interaction/action/element/filter.js
var ElementFilter = function(_super) {
__extends(ElementFilter2, _super);
function ElementFilter2() {
return _super !== null && _super.apply(this, arguments) || this;
}
ElementFilter2.prototype.filter = function() {
var delegateObject = getDelegationObject(this.context);
var view = this.context.view;
var elements = getElements(view);
if (isMask(this.context)) {
var maskElements_1 = getMaskedElements(this.context, 10);
if (maskElements_1) {
each_default(elements, function(el) {
if (maskElements_1.includes(el)) {
el.show();
} else {
el.hide();
}
});
}
} else if (delegateObject) {
var component2 = delegateObject.component;
var field_1 = component2.get("field");
if (isList(delegateObject)) {
if (field_1) {
var unCheckedItems = component2.getItemsByState("unchecked");
var scale_1 = getScaleByField(view, field_1);
var names_1 = unCheckedItems.map(function(item) {
return item.name;
});
each_default(elements, function(el) {
var value2 = getElementValue(el, field_1);
var text = scale_1.getText(value2);
if (names_1.indexOf(text) >= 0) {
el.hide();
} else {
el.show();
}
});
}
} else if (isSlider(delegateObject)) {
var range = component2.getValue();
var min_1 = range[0], max_1 = range[1];
each_default(elements, function(el) {
var value2 = getElementValue(el, field_1);
if (value2 >= min_1 && value2 <= max_1) {
el.show();
} else {
el.hide();
}
});
}
}
};
ElementFilter2.prototype.clear = function() {
var elements = getElements(this.context.view);
each_default(elements, function(el) {
el.show();
});
};
ElementFilter2.prototype.reset = function() {
this.clear();
};
return ElementFilter2;
}(base_default12);
var filter_default3 = ElementFilter;
// node_modules/@antv/g2/esm/interaction/action/element/sibling-filter.js
var SiblingFilter2 = function(_super) {
__extends(SiblingFilter3, _super);
function SiblingFilter3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.byRecord = false;
return _this;
}
SiblingFilter3.prototype.filter = function() {
if (isMask(this.context)) {
if (this.byRecord) {
this.filterByRecord();
} else {
this.filterByBBox();
}
}
};
SiblingFilter3.prototype.filterByRecord = function() {
var view = this.context.view;
var maskElements = getMaskedElements(this.context, 10);
if (!maskElements) {
return;
}
var xFiled = view.getXScale().field;
var yField = view.getYScales()[0].field;
var records = maskElements.map(function(el) {
return el.getModel().data;
});
var siblings = getSilbings(view);
each_default(siblings, function(sibling) {
var elements = getElements(sibling);
each_default(elements, function(el) {
var record = el.getModel().data;
if (isInRecords(records, record, xFiled, yField)) {
el.show();
} else {
el.hide();
}
});
});
};
SiblingFilter3.prototype.filterByBBox = function() {
var _this = this;
var view = this.context.view;
var siblings = getSilbings(view);
each_default(siblings, function(sibling) {
var maskElements = getSiblingMaskElements(_this.context, sibling, 10);
var elements = getElements(sibling);
if (maskElements) {
each_default(elements, function(el) {
if (maskElements.includes(el)) {
el.show();
} else {
el.hide();
}
});
}
});
};
SiblingFilter3.prototype.reset = function() {
var siblings = getSilbings(this.context.view);
each_default(siblings, function(sibling) {
var elements = getElements(sibling);
each_default(elements, function(el) {
el.show();
});
});
};
return SiblingFilter3;
}(base_default12);
var sibling_filter_default2 = SiblingFilter2;
// node_modules/@antv/g2/esm/interaction/action/view/button.js
var PADDING_RIGHT = 10;
var PADDING_TOP = 5;
var ButtonAction = function(_super) {
__extends(ButtonAction3, _super);
function ButtonAction3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.buttonGroup = null;
_this.buttonCfg = {
name: "button",
text: "button",
textStyle: {
x: 0,
y: 0,
fontSize: 12,
fill: "#333333",
cursor: "pointer"
},
padding: [8, 10],
style: {
fill: "#f7f7f7",
stroke: "#cccccc",
cursor: "pointer"
},
activeStyle: {
fill: "#e6e6e6"
}
};
return _this;
}
ButtonAction3.prototype.getButtonCfg = function() {
return deep_mix_default(this.buttonCfg, this.cfg);
};
ButtonAction3.prototype.drawButton = function() {
var config = this.getButtonCfg();
var group2 = this.context.view.foregroundGroup.addGroup({
name: config.name
});
var textShape = group2.addShape({
type: "text",
name: "button-text",
attrs: __assign({ text: config.text }, config.textStyle)
});
var textBBox = textShape.getBBox();
var padding3 = parsePadding(config.padding);
var buttonShape = group2.addShape({
type: "rect",
name: "button-rect",
attrs: __assign({ x: textBBox.x - padding3[3], y: textBBox.y - padding3[0], width: textBBox.width + padding3[1] + padding3[3], height: textBBox.height + padding3[0] + padding3[2] }, config.style)
});
buttonShape.toBack();
group2.on("mouseenter", function() {
buttonShape.attr(config.activeStyle);
});
group2.on("mouseleave", function() {
buttonShape.attr(config.style);
});
this.buttonGroup = group2;
};
ButtonAction3.prototype.resetPosition = function() {
var view = this.context.view;
var coord2 = view.getCoordinate();
var point2 = coord2.convert({ x: 1, y: 1 });
var buttonGroup = this.buttonGroup;
var bbox = buttonGroup.getBBox();
var matrix = ext_exports.transform(null, [
["t", point2.x - bbox.width - PADDING_RIGHT, point2.y + bbox.height + PADDING_TOP]
]);
buttonGroup.setMatrix(matrix);
};
ButtonAction3.prototype.show = function() {
if (!this.buttonGroup) {
this.drawButton();
}
this.resetPosition();
this.buttonGroup.show();
};
ButtonAction3.prototype.hide = function() {
if (this.buttonGroup) {
this.buttonGroup.hide();
}
};
ButtonAction3.prototype.destroy = function() {
var buttonGroup = this.buttonGroup;
if (buttonGroup) {
buttonGroup.remove();
}
_super.prototype.destroy.call(this);
};
return ButtonAction3;
}(base_default12);
var button_default = ButtonAction;
// node_modules/@antv/g2/esm/interaction/action/view/drag.js
var DISTANCE = 4;
var Drag = function(_super) {
__extends(Drag2, _super);
function Drag2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.starting = false;
_this.dragStart = false;
return _this;
}
Drag2.prototype.start = function() {
this.starting = true;
this.startPoint = this.context.getCurrentPoint();
};
Drag2.prototype.drag = function() {
if (!this.startPoint) {
return;
}
var current = this.context.getCurrentPoint();
var view = this.context.view;
var event = this.context.event;
if (!this.dragStart) {
if (distance7(current, this.startPoint) > DISTANCE) {
view.emit("dragstart", {
target: event.target,
x: event.x,
y: event.y
});
this.dragStart = true;
}
} else {
view.emit("drag", {
target: event.target,
x: event.x,
y: event.y
});
}
};
Drag2.prototype.end = function() {
if (this.dragStart) {
var view = this.context.view;
var event_1 = this.context.event;
view.emit("dragend", {
target: event_1.target,
x: event_1.x,
y: event_1.y
});
}
this.starting = false;
this.dragStart = false;
};
return Drag2;
}(base_default12);
var drag_default = Drag;
// node_modules/@antv/g2/esm/interaction/action/view/move.js
var MIN_DISTANCE = 5;
var Move = function(_super) {
__extends(Move2, _super);
function Move2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.starting = false;
_this.isMoving = false;
_this.startPoint = null;
_this.startMatrix = null;
return _this;
}
Move2.prototype.start = function() {
this.starting = true;
this.startPoint = this.context.getCurrentPoint();
this.startMatrix = this.context.view.middleGroup.getMatrix();
};
Move2.prototype.move = function() {
if (!this.starting) {
return;
}
var startPoint = this.startPoint;
var currentPoint = this.context.getCurrentPoint();
var d3 = distance7(startPoint, currentPoint);
if (d3 > MIN_DISTANCE && !this.isMoving) {
this.isMoving = true;
}
if (this.isMoving) {
var view = this.context.view;
var matrix = ext_exports.transform(this.startMatrix, [
["t", currentPoint.x - startPoint.x, currentPoint.y - startPoint.y]
]);
view.backgroundGroup.setMatrix(matrix);
view.foregroundGroup.setMatrix(matrix);
view.middleGroup.setMatrix(matrix);
}
};
Move2.prototype.end = function() {
if (this.isMoving) {
this.isMoving = false;
}
this.startMatrix = null;
this.starting = false;
this.startPoint = null;
};
Move2.prototype.reset = function() {
this.starting = false;
this.startPoint = null;
this.isMoving = false;
var view = this.context.view;
view.backgroundGroup.resetMatrix();
view.foregroundGroup.resetMatrix();
view.middleGroup.resetMatrix();
this.isMoving = false;
};
return Move2;
}(base_default12);
var move_default = Move;
// node_modules/@antv/g2/esm/interaction/action/view/scale-transform.js
var DIM_X = "x";
var DIM_Y = "y";
var ScaleTranslate = function(_super) {
__extends(ScaleTranslate4, _super);
function ScaleTranslate4() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.dims = [DIM_X, DIM_Y];
_this.cfgFields = ["dims"];
_this.cacheScaleDefs = {};
return _this;
}
ScaleTranslate4.prototype.hasDim = function(dim) {
return this.dims.includes(dim);
};
ScaleTranslate4.prototype.getScale = function(dim) {
var view = this.context.view;
if (dim === "x") {
return view.getXScale();
} else {
return view.getYScales()[0];
}
};
ScaleTranslate4.prototype.resetDim = function(dim) {
var view = this.context.view;
if (this.hasDim(dim) && this.cacheScaleDefs[dim]) {
var scale12 = this.getScale(dim);
view.scale(scale12.field, this.cacheScaleDefs[dim]);
this.cacheScaleDefs[dim] = null;
}
};
ScaleTranslate4.prototype.reset = function() {
this.resetDim(DIM_X);
this.resetDim(DIM_Y);
var view = this.context.view;
view.render(true);
};
return ScaleTranslate4;
}(base_default12);
var scale_transform_default = ScaleTranslate;
// node_modules/@antv/g2/esm/interaction/action/view/scale-translate.js
var ScaleTranslate2 = function(_super) {
__extends(ScaleTranslate4, _super);
function ScaleTranslate4() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.startPoint = null;
_this.starting = false;
_this.startCache = {};
return _this;
}
ScaleTranslate4.prototype.start = function() {
var _this = this;
this.startPoint = this.context.getCurrentPoint();
this.starting = true;
var dims = this.dims;
each_default(dims, function(dim) {
var scale12 = _this.getScale(dim);
var min7 = scale12.min, max8 = scale12.max, values2 = scale12.values;
_this.startCache[dim] = { min: min7, max: max8, values: values2 };
});
};
ScaleTranslate4.prototype.end = function() {
this.startPoint = null;
this.starting = false;
this.startCache = {};
};
ScaleTranslate4.prototype.translate = function() {
var _this = this;
if (!this.starting) {
return;
}
var startPoint = this.startPoint;
var coord2 = this.context.view.getCoordinate();
var currentPoint = this.context.getCurrentPoint();
var normalStart = coord2.invert(startPoint);
var noramlCurrent = coord2.invert(currentPoint);
var dx = noramlCurrent.x - normalStart.x;
var dy = noramlCurrent.y - normalStart.y;
var view = this.context.view;
var dims = this.dims;
each_default(dims, function(dim) {
_this.translateDim(dim, { x: dx * -1, y: dy * -1 });
});
view.render(true);
};
ScaleTranslate4.prototype.translateDim = function(dim, normalPoint) {
if (this.hasDim(dim)) {
var scale12 = this.getScale(dim);
if (scale12.isLinear) {
this.translateLinear(dim, scale12, normalPoint);
}
}
};
ScaleTranslate4.prototype.translateLinear = function(dim, scale12, normalPoint) {
var view = this.context.view;
var _a6 = this.startCache[dim], min7 = _a6.min, max8 = _a6.max;
var range = max8 - min7;
var d3 = normalPoint[dim] * range;
if (!this.cacheScaleDefs[dim]) {
this.cacheScaleDefs[dim] = {
nice: scale12.nice,
min: min7,
max: max8
};
}
view.scale(scale12.field, {
nice: false,
min: min7 + d3,
max: max8 + d3
});
};
ScaleTranslate4.prototype.reset = function() {
_super.prototype.reset.call(this);
this.startPoint = null;
this.starting = false;
};
return ScaleTranslate4;
}(scale_transform_default);
var scale_translate_default = ScaleTranslate2;
// node_modules/@antv/g2/esm/interaction/action/view/scale-zoom.js
var ScaleTranslate3 = function(_super) {
__extends(ScaleTranslate4, _super);
function ScaleTranslate4() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.zoomRatio = 0.05;
return _this;
}
ScaleTranslate4.prototype.zoomIn = function() {
this.zoom(this.zoomRatio);
};
ScaleTranslate4.prototype.zoom = function(scale12) {
var _this = this;
var dims = this.dims;
each_default(dims, function(dim) {
_this.zoomDim(dim, scale12);
});
this.context.view.render(true);
};
ScaleTranslate4.prototype.zoomOut = function() {
this.zoom(-1 * this.zoomRatio);
};
ScaleTranslate4.prototype.zoomDim = function(dim, dRatio) {
if (this.hasDim(dim)) {
var scale12 = this.getScale(dim);
if (scale12.isLinear) {
this.zoomLinear(dim, scale12, dRatio);
}
}
};
ScaleTranslate4.prototype.zoomLinear = function(dim, scale12, dRatio) {
var view = this.context.view;
if (!this.cacheScaleDefs[dim]) {
this.cacheScaleDefs[dim] = {
nice: scale12.nice,
min: scale12.min,
max: scale12.max
};
}
var scaleDef = this.cacheScaleDefs[dim];
var range = scaleDef.max - scaleDef.min;
var min7 = scale12.min, max8 = scale12.max;
var d3 = dRatio * range;
var toMin = min7 - d3;
var toMax = max8 + d3;
var curRange = toMax - toMin;
var scaled = curRange / range;
if (toMax > toMin && scaled < 100 && scaled > 0.01) {
view.scale(scale12.field, {
nice: false,
min: min7 - d3,
max: max8 + d3
});
}
};
return ScaleTranslate4;
}(scale_transform_default);
var scale_zoom_default = ScaleTranslate3;
// node_modules/@antv/g2/esm/interaction/action/view/mousewheel-scroll.js
function isWheelDown(event) {
var wheelEvent = event.gEvent.originalEvent;
return wheelEvent.deltaY > 0;
}
var DEFAULT_WHEELDELTA = 1;
var MousewheelScroll = function(_super) {
__extends(MousewheelScroll2, _super);
function MousewheelScroll2() {
return _super !== null && _super.apply(this, arguments) || this;
}
MousewheelScroll2.prototype.scroll = function(arg) {
var _a6 = this.context, view = _a6.view, event = _a6.event;
if (!view.getOptions().scrollbar) {
return;
}
var wheelDelta = (arg === null || arg === void 0 ? void 0 : arg.wheelDelta) || DEFAULT_WHEELDELTA;
var scrollbarController = view.getController("scrollbar");
var xScale = view.getXScale();
var data3 = view.getOptions().data;
var dataSize = size(values_of_key_default(data3, xScale.field));
var step = size(xScale.values);
var currentRatio = scrollbarController.getValue();
var currentStart = Math.floor((dataSize - step) * currentRatio);
var nextStart = currentStart + (isWheelDown(event) ? wheelDelta : -wheelDelta);
var correction = wheelDelta / (dataSize - step) / 1e4;
var nextRatio = clamp_default(nextStart / (dataSize - step) + correction, 0, 1);
scrollbarController.setValue(nextRatio);
};
return MousewheelScroll2;
}(base_default12);
var mousewheel_scroll_default = MousewheelScroll;
// node_modules/@antv/g2/esm/index.js
registerTheme("dark", createThemeByStyleSheet(antvDark));
registerEngine("canvas", esm_exports);
registerEngine("svg", esm_exports2);
registerGeometry("Polygon", polygon_default5);
registerGeometry("Interval", interval_default);
registerGeometry("Schema", schema_default);
registerGeometry("Path", path_default5);
registerGeometry("Point", point_default);
registerGeometry("Line", line_default9);
registerGeometry("Area", area_default);
registerGeometry("Edge", edge_default);
registerGeometry("Heatmap", heatmap_default);
registerGeometry("Violin", violin_default);
registerGeometryLabel("base", base_default14);
registerGeometryLabel("interval", interval_default2);
registerGeometryLabel("pie", pie_default);
registerGeometryLabel("polar", polar_default2);
registerGeometryLabelLayout("overlap", overlap);
registerGeometryLabelLayout("distribute", distribute);
registerGeometryLabelLayout("fixed-overlap", fixedOverlap);
registerGeometryLabelLayout("hide-overlap", hideOverlap);
registerGeometryLabelLayout("limit-in-shape", limitInShape);
registerGeometryLabelLayout("limit-in-canvas", limitInCanvas);
registerGeometryLabelLayout("limit-in-plot", limitInPlot);
registerGeometryLabelLayout("pie-outer", pieOuterLabelLayout);
registerGeometryLabelLayout("adjust-color", adjustColor);
registerGeometryLabelLayout("interval-adjust-position", intervalAdjustPosition);
registerGeometryLabelLayout("interval-hide-overlap", intervalHideOverlap);
registerGeometryLabelLayout("point-adjust-position", pointAdjustPosition);
registerGeometryLabelLayout("pie-spider", pieSpiderLabelLayout);
registerGeometryLabelLayout("path-adjust-position", pathAdjustPosition);
registerAnimation("fade-in", fadeIn);
registerAnimation("fade-out", fadeOut);
registerAnimation("grow-in-x", growInX);
registerAnimation("grow-in-xy", growInXY);
registerAnimation("grow-in-y", growInY);
registerAnimation("scale-in-x", scaleInX);
registerAnimation("scale-in-y", scaleInY);
registerAnimation("wave-in", waveIn);
registerAnimation("zoom-in", zoomIn);
registerAnimation("zoom-out", zoomOut);
registerAnimation("position-update", positionUpdate);
registerAnimation("sector-path-update", sectorPathUpdate);
registerAnimation("path-in", pathIn);
registerFacet("rect", rect_default4);
registerFacet("mirror", mirror_default);
registerFacet("list", list_default);
registerFacet("matrix", matrix_default);
registerFacet("circle", circle_default7);
registerFacet("tree", tree_default);
registerComponentController("axis", axis_default);
registerComponentController("legend", legend_default);
registerComponentController("tooltip", tooltip_default);
registerComponentController("annotation", annotation_default);
registerComponentController("slider", slider_default);
registerComponentController("scrollbar", scrollbar_default);
registerAction("tooltip", geometry_default);
registerAction("sibling-tooltip", sibling_default);
registerAction("ellipsis-text", ellipsis_text_default);
registerAction("element-active", active_default);
registerAction("element-single-active", single_active_default);
registerAction("element-range-active", range_active_default);
registerAction("element-highlight", highlight_default);
registerAction("element-highlight-by-x", highlight_by_x_default);
registerAction("element-highlight-by-color", highlight_by_color_default);
registerAction("element-single-highlight", single_highlight_default);
registerAction("element-range-highlight", range_highlight_default);
registerAction("element-sibling-highlight", range_highlight_default, {
effectSiblings: true,
effectByRecord: true
});
registerAction("element-selected", selected_default);
registerAction("element-single-selected", single_selected_default);
registerAction("element-range-selected", range_selected_default);
registerAction("element-link-by-color", link_by_color_default);
registerAction("active-region", active_region_default);
registerAction("list-active", list_active_default);
registerAction("list-selected", list_selected_default);
registerAction("list-highlight", list_highlight_default);
registerAction("list-unchecked", list_unchecked_default);
registerAction("list-checked", list_checked_default);
registerAction("list-focus", list_focus_default);
registerAction("list-radio", list_radio_default);
registerAction("legend-item-highlight", list_highlight_default, {
componentNames: ["legend"]
});
registerAction("axis-label-highlight", list_highlight_default, {
componentNames: ["axis"]
});
registerAction("rect-mask", rect_default5);
registerAction("x-rect-mask", dim_rect_default, { dim: "x" });
registerAction("y-rect-mask", dim_rect_default, { dim: "y" });
registerAction("circle-mask", circle_default8);
registerAction("path-mask", path_default6);
registerAction("smooth-path-mask", smooth_path_default);
registerAction("cursor", cursor_default);
registerAction("data-filter", filter_default2);
registerAction("brush", range_filter_default);
registerAction("brush-x", range_filter_default, { dims: ["x"] });
registerAction("brush-y", range_filter_default, { dims: ["y"] });
registerAction("sibling-filter", sibling_filter_default);
registerAction("sibling-x-filter", sibling_filter_default);
registerAction("sibling-y-filter", sibling_filter_default);
registerAction("element-filter", filter_default3);
registerAction("element-sibling-filter", sibling_filter_default2);
registerAction("element-sibling-filter-record", sibling_filter_default2, { byRecord: true });
registerAction("view-drag", drag_default);
registerAction("view-move", move_default);
registerAction("scale-translate", scale_translate_default);
registerAction("scale-zoom", scale_zoom_default);
registerAction("reset-button", button_default, {
name: "reset-button",
text: "reset"
});
registerAction("mousewheel-scroll", mousewheel_scroll_default);
function isPointInView(context) {
return context.isInPlot();
}
registerInteraction("tooltip", {
start: [
{ trigger: "plot:mousemove", action: "tooltip:show", throttle: { wait: 50, leading: true, trailing: false } },
{ trigger: "plot:touchmove", action: "tooltip:show", throttle: { wait: 50, leading: true, trailing: false } }
],
end: [
{ trigger: "plot:mouseleave", action: "tooltip:hide" },
{ trigger: "plot:leave", action: "tooltip:hide" },
{ trigger: "plot:touchend", action: "tooltip:hide" }
]
});
registerInteraction("ellipsis-text", {
start: [
{
trigger: "legend-item-name:mousemove",
action: "ellipsis-text:show",
throttle: { wait: 50, leading: true, trailing: false }
},
{
trigger: "legend-item-name:touchstart",
action: "ellipsis-text:show",
throttle: { wait: 50, leading: true, trailing: false }
},
{
trigger: "axis-label:mousemove",
action: "ellipsis-text:show",
throttle: { wait: 50, leading: true, trailing: false }
},
{
trigger: "axis-label:touchstart",
action: "ellipsis-text:show",
throttle: { wait: 50, leading: true, trailing: false }
}
],
end: [
{ trigger: "legend-item-name:mouseleave", action: "ellipsis-text:hide" },
{ trigger: "legend-item-name:touchend", action: "ellipsis-text:hide" },
{ trigger: "axis-label:mouseleave", action: "ellipsis-text:hide" },
{ trigger: "axis-label:touchend", action: "ellipsis-text:hide" }
]
});
registerInteraction("element-active", {
start: [{ trigger: "element:mouseenter", action: "element-active:active" }],
end: [{ trigger: "element:mouseleave", action: "element-active:reset" }]
});
registerInteraction("element-selected", {
start: [{ trigger: "element:click", action: "element-selected:toggle" }]
});
registerInteraction("element-highlight", {
start: [{ trigger: "element:mouseenter", action: "element-highlight:highlight" }],
end: [{ trigger: "element:mouseleave", action: "element-highlight:reset" }]
});
registerInteraction("element-highlight-by-x", {
start: [{ trigger: "element:mouseenter", action: "element-highlight-by-x:highlight" }],
end: [{ trigger: "element:mouseleave", action: "element-highlight-by-x:reset" }]
});
registerInteraction("element-highlight-by-color", {
start: [{ trigger: "element:mouseenter", action: "element-highlight-by-color:highlight" }],
end: [{ trigger: "element:mouseleave", action: "element-highlight-by-color:reset" }]
});
registerInteraction("legend-active", {
start: [{ trigger: "legend-item:mouseenter", action: ["list-active:active", "element-active:active"] }],
end: [{ trigger: "legend-item:mouseleave", action: ["list-active:reset", "element-active:reset"] }]
});
registerInteraction("legend-highlight", {
start: [
{ trigger: "legend-item:mouseenter", action: ["legend-item-highlight:highlight", "element-highlight:highlight"] }
],
end: [{ trigger: "legend-item:mouseleave", action: ["legend-item-highlight:reset", "element-highlight:reset"] }]
});
registerInteraction("axis-label-highlight", {
start: [
{ trigger: "axis-label:mouseenter", action: ["axis-label-highlight:highlight", "element-highlight:highlight"] }
],
end: [{ trigger: "axis-label:mouseleave", action: ["axis-label-highlight:reset", "element-highlight:reset"] }]
});
registerInteraction("element-list-highlight", {
start: [{ trigger: "element:mouseenter", action: ["list-highlight:highlight", "element-highlight:highlight"] }],
end: [{ trigger: "element:mouseleave", action: ["list-highlight:reset", "element-highlight:reset"] }]
});
registerInteraction("element-range-highlight", {
showEnable: [
{ trigger: "plot:mouseenter", action: "cursor:crosshair" },
{ trigger: "mask:mouseenter", action: "cursor:move" },
{ trigger: "plot:mouseleave", action: "cursor:default" },
{ trigger: "mask:mouseleave", action: "cursor:crosshair" }
],
start: [
{
trigger: "plot:mousedown",
isEnable: function(context) {
return !context.isInShape("mask");
},
action: ["rect-mask:start", "rect-mask:show"]
},
{
trigger: "mask:dragstart",
action: ["rect-mask:moveStart"]
}
],
processing: [
{
trigger: "plot:mousemove",
action: ["rect-mask:resize"]
},
{
trigger: "mask:drag",
action: ["rect-mask:move"]
},
{
trigger: "mask:change",
action: ["element-range-highlight:highlight"]
}
],
end: [
{ trigger: "plot:mouseup", action: ["rect-mask:end"] },
{ trigger: "mask:dragend", action: ["rect-mask:moveEnd"] },
{
trigger: "document:mouseup",
isEnable: function(context) {
return !context.isInPlot();
},
action: ["element-range-highlight:clear", "rect-mask:end", "rect-mask:hide"]
}
],
rollback: [{ trigger: "dblclick", action: ["element-range-highlight:clear", "rect-mask:hide"] }]
});
registerInteraction("brush", {
showEnable: [
{ trigger: "plot:mouseenter", action: "cursor:crosshair" },
{ trigger: "plot:mouseleave", action: "cursor:default" }
],
start: [
{
trigger: "mousedown",
isEnable: isPointInView,
action: ["brush:start", "rect-mask:start", "rect-mask:show"]
}
],
processing: [
{
trigger: "mousemove",
isEnable: isPointInView,
action: ["rect-mask:resize"]
}
],
end: [
{
trigger: "mouseup",
isEnable: isPointInView,
action: ["brush:filter", "brush:end", "rect-mask:end", "rect-mask:hide", "reset-button:show"]
}
],
rollback: [{ trigger: "reset-button:click", action: ["brush:reset", "reset-button:hide", "cursor:crosshair"] }]
});
registerInteraction("brush-visible", {
showEnable: [
{ trigger: "plot:mouseenter", action: "cursor:crosshair" },
{ trigger: "plot:mouseleave", action: "cursor:default" }
],
start: [
{
trigger: "plot:mousedown",
action: ["rect-mask:start", "rect-mask:show"]
}
],
processing: [
{
trigger: "plot:mousemove",
action: ["rect-mask:resize"]
},
{ trigger: "mask:change", action: ["element-range-highlight:highlight"] }
],
end: [
{
trigger: "plot:mouseup",
action: ["rect-mask:end", "rect-mask:hide", "element-filter:filter", "element-range-highlight:clear"]
}
],
rollback: [
{
trigger: "dblclick",
action: ["element-filter:clear"]
}
]
});
registerInteraction("brush-x", {
showEnable: [
{ trigger: "plot:mouseenter", action: "cursor:crosshair" },
{ trigger: "plot:mouseleave", action: "cursor:default" }
],
start: [
{
trigger: "mousedown",
isEnable: isPointInView,
action: ["brush-x:start", "x-rect-mask:start", "x-rect-mask:show"]
}
],
processing: [
{
trigger: "mousemove",
isEnable: isPointInView,
action: ["x-rect-mask:resize"]
}
],
end: [
{
trigger: "mouseup",
isEnable: isPointInView,
action: ["brush-x:filter", "brush-x:end", "x-rect-mask:end", "x-rect-mask:hide"]
}
],
rollback: [{ trigger: "dblclick", action: ["brush-x:reset"] }]
});
registerInteraction("element-path-highlight", {
showEnable: [
{ trigger: "plot:mouseenter", action: "cursor:crosshair" },
{ trigger: "plot:mouseleave", action: "cursor:default" }
],
start: [
{ trigger: "mousedown", isEnable: isPointInView, action: "path-mask:start" },
{ trigger: "mousedown", isEnable: isPointInView, action: "path-mask:show" }
],
processing: [{ trigger: "mousemove", action: "path-mask:addPoint" }],
end: [{ trigger: "mouseup", action: "path-mask:end" }],
rollback: [{ trigger: "dblclick", action: "path-mask:hide" }]
});
registerInteraction("element-single-selected", {
start: [{ trigger: "element:click", action: "element-single-selected:toggle" }]
});
registerInteraction("legend-filter", {
showEnable: [
{ trigger: "legend-item:mouseenter", action: ["cursor:pointer", "list-radio:show"] },
{ trigger: "legend-item:mouseleave", action: ["cursor:default", "list-radio:hide"] }
],
start: [
{
trigger: "legend-item:click",
isEnable: function(context) {
return !context.isInShape("legend-item-radio");
},
action: ["list-unchecked:toggle", "data-filter:filter", "list-radio:show"]
},
{
trigger: "legend-item-radio:click",
action: ["list-focus:toggle", "data-filter:filter", "list-radio:show"]
}
]
});
registerInteraction("continuous-filter", {
start: [{ trigger: "legend:valuechanged", action: "data-filter:filter" }]
});
registerInteraction("continuous-visible-filter", {
start: [{ trigger: "legend:valuechanged", action: "element-filter:filter" }]
});
registerInteraction("legend-visible-filter", {
showEnable: [
{ trigger: "legend-item:mouseenter", action: "cursor:pointer" },
{ trigger: "legend-item:mouseleave", action: "cursor:default" }
],
start: [{ trigger: "legend-item:click", action: ["list-unchecked:toggle", "element-filter:filter"] }]
});
registerInteraction("active-region", {
start: [{ trigger: "plot:mousemove", action: "active-region:show" }],
end: [{ trigger: "plot:mouseleave", action: "active-region:hide" }]
});
function isWheelDown2(event) {
event.gEvent.preventDefault();
return event.gEvent.originalEvent.deltaY > 0;
}
registerInteraction("view-zoom", {
start: [
{
trigger: "plot:mousewheel",
isEnable: function(context) {
return isWheelDown2(context.event);
},
action: "scale-zoom:zoomOut",
throttle: { wait: 100, leading: true, trailing: false }
},
{
trigger: "plot:mousewheel",
isEnable: function(context) {
return !isWheelDown2(context.event);
},
action: "scale-zoom:zoomIn",
throttle: { wait: 100, leading: true, trailing: false }
}
]
});
registerInteraction("sibling-tooltip", {
start: [{ trigger: "plot:mousemove", action: "sibling-tooltip:show" }],
end: [{ trigger: "plot:mouseleave", action: "sibling-tooltip:hide" }]
});
registerInteraction("plot-mousewheel-scroll", {
start: [{ trigger: "plot:mousewheel", action: "mousewheel-scroll:scroll" }]
});
// node_modules/@antv/g2plot/esm/utils/flow.js
function flow() {
var flows = [];
for (var _i = 0; _i < arguments.length; _i++) {
flows[_i] = arguments[_i];
}
return function(param) {
return flows.reduce(function(result, f3) {
return f3(result);
}, param);
};
}
// node_modules/@antv/g2plot/esm/utils/pick.js
function pick(obj, keys2) {
var r4 = {};
if (obj !== null && typeof obj === "object") {
keys2.forEach(function(key) {
var v3 = obj[key];
if (v3 !== void 0) {
r4[key] = v3;
}
});
}
return r4;
}
// node_modules/@antv/g2plot/esm/utils/template.js
function template(source, data3) {
if (!data3) {
return source;
}
return reduce_default(data3, function(r4, v3, k4) {
return r4.replace(new RegExp("{\\s*" + k4 + "\\s*}", "g"), v3);
}, source);
}
// node_modules/@antv/g2plot/esm/utils/invariant.js
var LEVEL;
(function(LEVEL2) {
LEVEL2["ERROR"] = "error";
LEVEL2["WARN"] = "warn";
LEVEL2["INFO"] = "log";
})(LEVEL || (LEVEL = {}));
var BRAND = "AntV/G2Plot";
function getMessage(format2) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var argIndex = 0;
return BRAND + ": " + format2.replace(/%s/g, function() {
return "" + args[argIndex++];
});
}
function log2(level, condition, format2) {
var args = [];
for (var _i = 3; _i < arguments.length; _i++) {
args[_i - 3] = arguments[_i];
}
if (!condition) {
console[level](getMessage.apply(void 0, __spreadArrays([format2], args)));
}
}
// node_modules/@antv/g2plot/esm/utils/dom.js
function getContainerSize(ele) {
if (!ele) {
return { width: 0, height: 0 };
}
var style = getComputedStyle(ele);
return {
width: (ele.clientWidth || parseInt(style.width, 10)) - parseInt(style.paddingLeft, 10) - parseInt(style.paddingRight, 10),
height: (ele.clientHeight || parseInt(style.height, 10)) - parseInt(style.paddingTop, 10) - parseInt(style.paddingBottom, 10)
};
}
// node_modules/@antv/g2plot/esm/utils/geometry.js
function findGeometry(view, type2) {
return view.geometries.find(function(g4) {
return g4.type === type2;
});
}
function getAllElements(view) {
return reduce_default(view.geometries, function(r4, geometry35) {
return r4.concat(geometry35.elements);
}, []);
}
function getAllElementsRecursively(view) {
if (get_default(view, ["views", "length"], 0) <= 0) {
return getAllElements(view);
}
return reduce_default(view.views, function(ele, subView) {
return ele.concat(getAllElementsRecursively(subView));
}, getAllElements(view));
}
function getAllGeometriesRecursively(view) {
if (get_default(view, ["views", "length"], 0) <= 0) {
return view.geometries;
}
return reduce_default(view.views, function(ele, subView) {
return ele.concat(subView.geometries);
}, view.geometries);
}
// node_modules/@antv/g2plot/esm/utils/view.js
function findViewById(chart, id) {
return chart.views.find(function(view) {
return view.id === id;
});
}
function getViews(view) {
var parent = view.parent;
return parent ? parent.views : [];
}
function getSiblingViews(view) {
return getViews(view).filter(function(sub6) {
return sub6 !== view;
});
}
// node_modules/@antv/g2plot/esm/utils/label.js
function transformLabel(labelOptions) {
if (!is_type_default(labelOptions, "Object")) {
return labelOptions;
}
var label17 = __assign({}, labelOptions);
if (label17.formatter && !label17.content) {
label17.content = label17.formatter;
}
return label17;
}
// node_modules/@antv/g2plot/esm/utils/path.js
function points2Path(points, isInCircle) {
var path = [];
if (points.length) {
path.push(["M", points[0].x, points[0].y]);
for (var i4 = 1, length_1 = points.length; i4 < length_1; i4 += 1) {
var item = points[i4];
path.push(["L", item.x, item.y]);
}
if (isInCircle) {
path.push(["Z"]);
}
}
return path;
}
var smoothBezier3 = function(points, smooth, isLoop, constraint) {
var cps = [];
var prevPoint;
var nextPoint;
var hasConstraint = !!constraint;
var min7;
var max8;
if (hasConstraint) {
min7 = [Infinity, Infinity];
max8 = [-Infinity, -Infinity];
for (var i4 = 0, l4 = points.length; i4 < l4; i4++) {
var point2 = points[i4];
min7 = vec2_exports.min([0, 0], min7, point2);
max8 = vec2_exports.max([0, 0], max8, point2);
}
min7 = vec2_exports.min([0, 0], min7, constraint[0]);
max8 = vec2_exports.max([0, 0], max8, constraint[1]);
}
for (var i4 = 0, len5 = points.length; i4 < len5; i4++) {
var point2 = points[i4];
if (isLoop) {
prevPoint = points[i4 ? i4 - 1 : len5 - 1];
nextPoint = points[(i4 + 1) % len5];
} else {
if (i4 === 0 || i4 === len5 - 1) {
cps.push(point2);
continue;
} else {
prevPoint = points[i4 - 1];
nextPoint = points[i4 + 1];
}
}
var v3 = [0, 0];
v3 = vec2_exports.sub(v3, nextPoint, prevPoint);
v3 = vec2_exports.scale(v3, v3, smooth);
var d0 = vec2_exports.distance(point2, prevPoint);
var d1 = vec2_exports.distance(point2, nextPoint);
var sum = d0 + d1;
if (sum !== 0) {
d0 /= sum;
d1 /= sum;
}
var v1 = vec2_exports.scale([0, 0], v3, -d0);
var v22 = vec2_exports.scale([0, 0], v3, d1);
var cp0 = vec2_exports.add([0, 0], point2, v1);
var cp1 = vec2_exports.add([0, 0], point2, v22);
if (hasConstraint) {
cp0 = vec2_exports.max([0, 0], cp0, min7);
cp0 = vec2_exports.min([0, 0], cp0, max8);
cp1 = vec2_exports.max([0, 0], cp1, min7);
cp1 = vec2_exports.min([0, 0], cp1, max8);
}
cps.push(cp0);
cps.push(cp1);
}
if (isLoop) {
cps.push(cps.shift());
}
return cps;
};
function catmullRom2bezier2(crp, z3, constraint) {
var isLoop = !!z3;
var pointList = [];
for (var i4 = 0, l4 = crp.length; i4 < l4; i4 += 2) {
pointList.push([crp[i4], crp[i4 + 1]]);
}
var controlPointList = smoothBezier3(pointList, 0.4, isLoop, constraint);
var len5 = pointList.length;
var d1 = [];
var cp1;
var cp2;
var p4;
for (var i4 = 0; i4 < len5 - 1; i4++) {
cp1 = controlPointList[i4 * 2];
cp2 = controlPointList[i4 * 2 + 1];
p4 = pointList[i4 + 1];
d1.push(["C", cp1[0], cp1[1], cp2[0], cp2[1], p4[0], p4[1]]);
}
if (isLoop) {
cp1 = controlPointList[len5];
cp2 = controlPointList[len5 + 1];
p4 = pointList[0];
d1.push(["C", cp1[0], cp1[1], cp2[0], cp2[1], p4[0], p4[1]]);
}
return d1;
}
function getSplinePath2(points, isInCircle, constaint) {
var data3 = [];
var first = points[0];
var prePoint = null;
if (points.length <= 2) {
return points2Path(points, isInCircle);
}
for (var i4 = 0, len5 = points.length; i4 < len5; i4++) {
var point2 = points[i4];
if (!prePoint || !(prePoint.x === point2.x && prePoint.y === point2.y)) {
data3.push(point2.x);
data3.push(point2.y);
prePoint = point2;
}
}
var constraint = constaint || [
[0, 0],
[1, 1]
];
var splinePath2 = catmullRom2bezier2(data3, isInCircle, constraint);
splinePath2.unshift(["M", first.x, first.y]);
return splinePath2;
}
// node_modules/@antv/g2plot/esm/utils/deep-assign.js
var MAX_MIX_LEVEL2 = 5;
var toString4 = {}.toString;
var isType2 = function(value2, type2) {
return toString4.call(value2) === "[object " + type2 + "]";
};
var isArray = function(value2) {
return isType2(value2, "Array");
};
var isObjectLike2 = function(value2) {
return typeof value2 === "object" && value2 !== null;
};
var isPlainObject2 = function(value2) {
if (!isObjectLike2(value2) || !isType2(value2, "Object")) {
return false;
}
var proto = value2;
while (Object.getPrototypeOf(proto) !== null) {
proto = Object.getPrototypeOf(proto);
}
return Object.getPrototypeOf(value2) === proto;
};
var deep = function(dist4, src, level, maxLevel) {
level = level || 0;
maxLevel = maxLevel || MAX_MIX_LEVEL2;
for (var key in src) {
if (Object.prototype.hasOwnProperty.call(src, key)) {
var value2 = src[key];
if (!value2) {
dist4[key] = value2;
} else {
if (isPlainObject2(value2)) {
if (!isPlainObject2(dist4[key])) {
dist4[key] = {};
}
if (level < maxLevel) {
deep(dist4[key], value2, level + 1, maxLevel);
} else {
dist4[key] = src[key];
}
} else if (isArray(value2)) {
dist4[key] = [];
dist4[key] = dist4[key].concat(value2);
} else {
dist4[key] = value2;
}
}
}
}
};
var deepAssign = function(rst) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
for (var i4 = 0; i4 < args.length; i4 += 1) {
deep(rst, args[i4]);
}
return rst;
};
// node_modules/@antv/g2plot/esm/utils/kebab-case.js
function kebabCase(word2) {
if (!word2) {
return word2;
}
var result = word2.match(/(([A-Z]{0,1}[a-z]*[^A-Z])|([A-Z]{1}))/g);
return result.map(function(s4) {
return s4.toLowerCase();
}).join("-");
}
// node_modules/@antv/g2plot/esm/utils/statistic.js
function adapteStyle(style) {
var styleObject = {
overflow: "hidden",
"white-space": "nowrap",
"text-overflow": "ellipsis",
display: "flex",
justifyContent: "center",
alignItems: "center"
};
var shapeStyleKeys = [
"stroke",
"lineWidth",
"shadowColor",
"strokeOpacity",
"shadowBlur",
"shadowOffsetX",
"shadowOffsetY",
"fill"
];
if (get_default(style, "fill")) {
styleObject["color"] = style["fill"];
}
var _a6 = pick(style, shapeStyleKeys), shadowColor = _a6.shadowColor, _b = _a6.shadowBlur, shadowBlur = _b === void 0 ? 0 : _b, _c = _a6.shadowOffsetX, shadowOffsetX = _c === void 0 ? 0 : _c, _d = _a6.shadowOffsetY, shadowOffsetY = _d === void 0 ? 0 : _d;
styleObject["text-shadow"] = "" + [shadowColor, shadowOffsetX + "px", shadowOffsetY + "px", shadowBlur + "px"].join(" ");
var _e = pick(style, shapeStyleKeys), stroke = _e.stroke, _f = _e.lineWidth, lineWidth = _f === void 0 ? 0 : _f;
styleObject["-webkit-text-stroke"] = "" + [lineWidth + "px", stroke].join(" ");
each_default(style, function(v3, k4) {
if (["fontSize"].includes(k4) && is_number_default(v3)) {
styleObject[kebabCase(k4)] = v3 + "px";
} else if (k4 && !shapeStyleKeys.includes(k4)) {
styleObject[kebabCase(k4)] = "" + v3;
}
});
return styleObject;
}
function setStatisticContainerStyle(container2, style) {
container2.style["pointer-events"] = "none";
each_default(style, function(v3, k4) {
if (k4 && v3) {
container2.style[k4] = v3;
}
});
}
var renderStatistic = function(chart, options, datum) {
var statistic4 = options.statistic, plotType = options.plotType;
var titleOpt = statistic4.title, contentOpt = statistic4.content;
[titleOpt, contentOpt].forEach(function(option, idx) {
if (!option) {
return;
}
var transform18 = "";
if (idx === 0) {
transform18 = contentOpt ? "translate(-50%, -100%)" : "translate(-50%, -50%)";
} else {
transform18 = titleOpt ? "translate(-50%, 0)" : "translate(-50%, -50%)";
}
var style = is_function_default(option.style) ? option.style(datum) : option.style;
chart.annotation().html(__assign({
position: ["50%", "50%"],
html: function(container2, view) {
var coordinate11 = view.getCoordinate();
var containerW = 0;
if (plotType === "pie" || plotType === "ring-progress") {
containerW = coordinate11.getRadius() * coordinate11.innerRadius * 2;
} else if (plotType === "liquid") {
var liquidShape = get_default(view.geometries, [0, "elements", 0, "shape"]);
if (liquidShape) {
var path = liquidShape.find(function(t4) {
return t4.get("name") === "wrap";
});
var width2 = path.getCanvasBBox().width;
containerW = width2;
}
} else if (!containerW) {
containerW = coordinate11.getWidth();
}
setStatisticContainerStyle(container2, __assign({ width: containerW + "px", transform: transform18 }, adapteStyle(style)));
var filteredData = view.getData();
if (option.customHtml) {
return option.customHtml(container2, view, datum, filteredData);
}
var text = option.content;
if (option.formatter) {
text = option.formatter(datum, filteredData);
}
return text ? is_string_default(text) ? text : "" + text : "";
},
key: (idx === 0 ? "top" : "bottom") + "-statistic"
}, pick(option, ["offsetX", "offsetY", "rotate", "style", "formatter"])));
});
};
var renderGaugeStatistic = function(chart, options, datum) {
var statistic4 = options.statistic;
var titleOpt = statistic4.title, contentOpt = statistic4.content;
[titleOpt, contentOpt].forEach(function(option) {
if (!option) {
return;
}
var style = is_function_default(option.style) ? option.style(datum) : option.style;
chart.annotation().html(__assign({ position: ["50%", "100%"], html: function(container2, view) {
var coordinate11 = view.getCoordinate();
var polarCoord = view.views[0].getCoordinate();
var polarCenter = polarCoord.getCenter();
var polarRadius = polarCoord.getRadius();
var polarMaxY = Math.max(Math.sin(polarCoord.startAngle), Math.sin(polarCoord.endAngle)) * polarRadius;
var offsetY = polarCenter.y + polarMaxY - coordinate11.y.start - parseFloat(get_default(style, "fontSize", 0));
var containerWidth = coordinate11.getRadius() * coordinate11.innerRadius * 2;
setStatisticContainerStyle(container2, __assign({ width: containerWidth + "px", transform: "translate(-50%, " + offsetY + "px)" }, adapteStyle(style)));
var filteredData = view.getData();
if (option.customHtml) {
return option.customHtml(container2, view, datum, filteredData);
}
var text = option.content;
if (option.formatter) {
text = option.formatter(datum, filteredData);
}
return text ? is_string_default(text) ? text : "" + text : "";
} }, pick(option, ["offsetX", "offsetY", "rotate", "style", "formatter"])));
});
};
// node_modules/@antv/g2plot/esm/utils/context.js
var ctx3;
function getCanvasContext2() {
if (!ctx3) {
ctx3 = document.createElement("canvas").getContext("2d");
}
return ctx3;
}
// node_modules/@antv/g2plot/esm/utils/measure-text.js
var measureTextWidth2 = memoize_default(function(text, font) {
if (font === void 0) {
font = {};
}
var fontSize = font.fontSize, _a6 = font.fontFamily, fontFamily = _a6 === void 0 ? "sans-serif" : _a6, fontWeight = font.fontWeight, fontStyle = font.fontStyle, fontVariant = font.fontVariant;
var ctx4 = getCanvasContext2();
ctx4.font = [fontStyle, fontWeight, fontVariant, fontSize + "px", fontFamily].join(" ");
var metrics = ctx4.measureText(is_string_default(text) ? text : "");
return metrics.width;
}, function(text, font) {
if (font === void 0) {
font = {};
}
return __spreadArrays([text], values_default(font)).join("");
});
// node_modules/@antv/g2plot/esm/utils/number.js
function isRealNumber(v3) {
return typeof v3 === "number" && !isNaN(v3);
}
function isBetween3(value2, start, end2) {
var min7 = Math.min(start, end2);
var max8 = Math.max(start, end2);
return value2 >= min7 && value2 <= max8;
}
// node_modules/@antv/g2plot/esm/utils/data.js
function adjustYMetaByZero(data3, field6) {
if (!data3)
return {};
var numberData = data3.filter(function(datum) {
var v3 = get_default(datum, [field6]);
return is_number_default(v3) && !isNaN(v3);
});
var gtZero = numberData.every(function(datum) {
return get_default(datum, [field6]) >= 0;
});
var ltZero = numberData.every(function(datum) {
return get_default(datum, [field6]) <= 0;
});
if (gtZero) {
return { min: 0 };
}
if (ltZero) {
return { max: 0 };
}
return {};
}
function transformDataToNodeLinkData(data3, sourceField, targetField, weightField, rawFields) {
if (rawFields === void 0) {
rawFields = [];
}
if (!Array.isArray(data3)) {
return {
nodes: [],
links: []
};
}
var links = [];
var nodesMap = {};
var nodesIndex = -1;
data3.forEach(function(datum) {
var source = datum[sourceField];
var target = datum[targetField];
var weight = datum[weightField];
var rawData = pick(datum, rawFields);
if (!nodesMap[source]) {
nodesMap[source] = __assign({ id: ++nodesIndex, name: source }, rawData);
}
if (!nodesMap[target]) {
nodesMap[target] = __assign({ id: ++nodesIndex, name: target }, rawData);
}
links.push(__assign({
source: nodesMap[source].id,
target: nodesMap[target].id,
value: weight
}, rawData));
});
return {
nodes: Object.values(nodesMap).sort(function(a4, b10) {
return a4.id - b10.id;
}),
links
};
}
function processIllegalData(data3, field6) {
var processData2 = filter_default(data3, function(d3) {
var v3 = d3[field6];
return v3 === null || typeof v3 === "number" && !isNaN(v3);
});
log2(LEVEL.WARN, processData2.length === data3.length, "illegal data existed in chart data.");
return processData2;
}
// node_modules/@antv/g2plot/esm/utils/padding.js
function normalPadding(padding3) {
if (is_number_default(padding3)) {
return [padding3, padding3, padding3, padding3];
}
if (is_array_default(padding3)) {
var length_1 = padding3.length;
if (length_1 === 1) {
return [padding3[0], padding3[0], padding3[0], padding3[0]];
}
if (length_1 === 2) {
return [padding3[0], padding3[1], padding3[0], padding3[1]];
}
if (length_1 === 3) {
return [padding3[0], padding3[1], padding3[2], padding3[1]];
}
if (length_1 === 4) {
return padding3;
}
}
return [0, 0, 0, 0];
}
function getAdjustAppendPadding(padding3, position2, append) {
if (position2 === void 0) {
position2 = "bottom";
}
if (append === void 0) {
append = 25;
}
var currentAppendPadding = normalPadding(padding3);
var PADDING2 = [
position2.startsWith("top") ? append : 0,
position2.startsWith("right") ? append : 0,
position2.startsWith("bottom") ? append : 0,
position2.startsWith("left") ? append : 0
];
return [
currentAppendPadding[0] + PADDING2[0],
currentAppendPadding[1] + PADDING2[1],
currentAppendPadding[2] + PADDING2[2],
currentAppendPadding[3] + PADDING2[3]
];
}
function resolveAllPadding(paddings) {
var normalPaddings = paddings.map(function(item) {
return normalPadding(item);
});
var finalPadding = [0, 0, 0, 0];
if (normalPaddings.length > 0) {
finalPadding = finalPadding.map(function(item, index2) {
normalPaddings.forEach(function(d3, i4) {
item += normalPaddings[i4][index2];
});
return item;
});
}
return finalPadding;
}
// node_modules/@antv/g2plot/esm/core/global.js
var GLOBAL = {
locale: "en-US"
};
// node_modules/@antv/g2plot/esm/core/locale.js
var LocaleMap = {};
function registerLocale(locale, localeObj) {
LocaleMap[locale] = localeObj;
}
function getLocale(locale) {
return {
get: function(key, obj) {
return template(get_default(LocaleMap[locale], key) || get_default(LocaleMap[GLOBAL.locale], key) || get_default(LocaleMap["en-US"], key) || key, obj);
}
};
}
// node_modules/@antv/g2plot/esm/locales/en_US.js
var EN_US_LOCALE = {
locale: "en-US",
general: {
increase: "Increase",
decrease: "Decrease",
root: "Root"
},
statistic: {
total: "Total"
},
conversionTag: {
label: "Rate"
},
legend: {},
tooltip: {},
slider: {},
scrollbar: {},
waterfall: {
total: "Total"
}
};
// node_modules/@antv/g2plot/esm/locales/zh_CN.js
var ZH_CN_LOCALE = {
locale: "zh-CN",
general: {
increase: "\u589E\u52A0",
decrease: "\u51CF\u5C11",
root: "\u521D\u59CB"
},
statistic: {
total: "\u603B\u8BA1"
},
conversionTag: {
label: "\u8F6C\u5316\u7387"
},
legend: {},
tooltip: {},
slider: {},
scrollbar: {},
waterfall: {
total: "\u603B\u8BA1"
}
};
// node_modules/@antv/g2plot/esm/core/plot.js
var import_size_sensor = __toModule(require_lib());
var SOURCE_ATTRIBUTE_NAME = "data-chart-source-type";
var PLOT_CONTAINER_OPTIONS = [
"padding",
"appendPadding",
"renderer",
"pixelRatio",
"syncViewPadding",
"supportCSSTransform",
"limitInPlot"
];
var Plot = function(_super) {
__extends(Plot2, _super);
function Plot2(container2, options) {
var _this = _super.call(this) || this;
_this.container = typeof container2 === "string" ? document.getElementById(container2) : container2;
_this.options = deepAssign({}, _this.getDefaultOptions(), options);
_this.createG2();
_this.bindEvents();
return _this;
}
Plot2.getDefaultOptions = function() {
return {
renderer: "canvas",
xAxis: {
nice: true,
label: {
autoRotate: false,
autoHide: { type: "equidistance", cfg: { minGap: 6 } }
}
},
yAxis: {
nice: true,
label: {
autoHide: true,
autoRotate: false
}
},
animation: true
};
};
Plot2.prototype.createG2 = function() {
var _a6 = this.options, width2 = _a6.width, height = _a6.height, defaultInteractions = _a6.defaultInteractions;
this.chart = new chart_default(__assign(__assign(__assign(__assign({ container: this.container, autoFit: false }, this.getChartSize(width2, height)), { localRefresh: false }), pick(this.options, PLOT_CONTAINER_OPTIONS)), { defaultInteractions }));
this.container.setAttribute(SOURCE_ATTRIBUTE_NAME, "G2Plot");
};
Plot2.prototype.getChartSize = function(width2, height) {
var chartSize = getContainerSize(this.container);
return { width: width2 || chartSize.width || 400, height: height || chartSize.height || 400 };
};
Plot2.prototype.bindEvents = function() {
var _this = this;
if (this.chart) {
this.chart.on("*", function(e4) {
if (e4 === null || e4 === void 0 ? void 0 : e4.type) {
_this.emit(e4.type, e4);
}
});
}
};
Plot2.prototype.getDefaultOptions = function() {
return Plot2.getDefaultOptions();
};
Plot2.prototype.render = function() {
this.chart.clear();
this.chart.options = {
data: [],
animate: true
};
this.chart.views = [];
this.execAdaptor();
this.chart.render();
this.bindSizeSensor();
};
Plot2.prototype.update = function(options) {
this.updateOption(options);
this.render();
};
Plot2.prototype.updateOption = function(options) {
this.options = deepAssign({}, this.options, options);
};
Plot2.prototype.setState = function(type2, condition, status) {
if (status === void 0) {
status = true;
}
var elements = getAllElementsRecursively(this.chart);
each_default(elements, function(ele) {
if (condition(ele.getData())) {
ele.setState(type2, status);
}
});
};
Plot2.prototype.getStates = function() {
var elements = getAllElementsRecursively(this.chart);
var stateObjects = [];
each_default(elements, function(element) {
var data3 = element.getData();
var states = element.getStates();
each_default(states, function(state2) {
stateObjects.push({ data: data3, state: state2, geometry: element.geometry, element });
});
});
return stateObjects;
};
Plot2.prototype.changeData = function(data3) {
this.update({ data: data3 });
};
Plot2.prototype.changeSize = function(width2, height) {
this.chart.changeSize(width2, height);
};
Plot2.prototype.addAnnotations = function(annotations) {
var incoming = __spreadArrays(annotations);
var controller = this.chart.getController("annotation");
var current = controller.getComponents().map(function(co) {
return co.extra;
});
controller.clear(true);
var _loop_1 = function(i5) {
var annotation4 = current[i5];
var findIndex2 = incoming.findIndex(function(item) {
return item.id && item.id === annotation4.id;
});
if (findIndex2 !== -1) {
annotation4 = deepAssign({}, annotation4, incoming[findIndex2]);
incoming.splice(findIndex2, 1);
}
controller.annotation(annotation4);
};
for (var i4 = 0; i4 < current.length; i4++) {
_loop_1(i4);
}
incoming.forEach(function(annotation4) {
return controller.annotation(annotation4);
});
this.chart.render(true);
};
Plot2.prototype.removeAnnotations = function(annotations) {
var controller = this.chart.getController("annotation");
var current = controller.getComponents().map(function(co) {
return co.extra;
});
controller.clear(true);
var _loop_2 = function(i5) {
var annotation4 = current[i5];
if (!annotations.find(function(item) {
return item.id && item.id === annotation4.id;
})) {
controller.annotation(annotation4);
}
};
for (var i4 = 0; i4 < current.length; i4++) {
_loop_2(i4);
}
this.chart.render(true);
};
Plot2.prototype.destroy = function() {
this.unbindSizeSensor();
this.chart.destroy();
this.off();
this.container.removeAttribute(SOURCE_ATTRIBUTE_NAME);
};
Plot2.prototype.execAdaptor = function() {
var adaptor36 = this.getSchemaAdaptor();
var _a6 = this.options, padding3 = _a6.padding, appendPadding = _a6.appendPadding;
this.chart.padding = padding3;
this.chart.appendPadding = appendPadding;
adaptor36({
chart: this.chart,
options: this.options
});
};
Plot2.prototype.triggerResize = function() {
this.chart.forceFit();
};
Plot2.prototype.bindSizeSensor = function() {
var _this = this;
if (this.unbind) {
return;
}
var _a6 = this.options.autoFit, autoFit = _a6 === void 0 ? true : _a6;
if (autoFit) {
this.unbind = (0, import_size_sensor.bind)(this.container, function() {
var _a7 = getContainerSize(_this.container), width2 = _a7.width, height = _a7.height;
if (width2 !== _this.chart.width || height !== _this.chart.height) {
_this.triggerResize();
}
});
}
};
Plot2.prototype.unbindSizeSensor = function() {
if (this.unbind) {
this.unbind();
this.unbind = void 0;
}
};
return Plot2;
}(esm_default);
// node_modules/@antv/g2plot/esm/constant.js
var AXIS_META_CONFIG_KEYS = [
"type",
"alias",
"tickCount",
"tickInterval",
"min",
"max",
"nice",
"minLimit",
"maxLimit",
"range",
"tickMethod",
"base",
"exponent",
"mask",
"sync"
];
// node_modules/@antv/g2plot/esm/utils/pattern/util.js
function getPixelRatio2() {
return typeof window === "object" ? window === null || window === void 0 ? void 0 : window.devicePixelRatio : 2;
}
function initCanvas(width2, height) {
if (height === void 0) {
height = width2;
}
var canvas = document.createElement("canvas");
var pixelRatio = getPixelRatio2();
canvas.width = width2 * pixelRatio;
canvas.height = height * pixelRatio;
canvas.style.width = width2 + "px";
canvas.style.height = height + "px";
var ctx4 = canvas.getContext("2d");
ctx4.scale(pixelRatio, pixelRatio);
return canvas;
}
function drawBackground(context, cfg, width2, height) {
if (height === void 0) {
height = width2;
}
var backgroundColor = cfg.backgroundColor, opacity = cfg.opacity;
context.globalAlpha = opacity;
context.fillStyle = backgroundColor;
context.beginPath();
context.fillRect(0, 0, width2, height);
context.closePath();
}
function getUnitPatternSize(size2, padding3, isStagger) {
var unitSize = size2 + padding3;
return isStagger ? unitSize * 2 : unitSize;
}
function getSymbolsPosition(unitSize, isStagger) {
var symbolsPos = isStagger ? [
[unitSize * (1 / 4), unitSize * (1 / 4)],
[unitSize * (3 / 4), unitSize * (3 / 4)]
] : [[unitSize * (1 / 2), unitSize * (1 / 2)]];
return symbolsPos;
}
function transformMatrix(dpr, rotation) {
var radian = rotation * Math.PI / 180;
var matrix = {
a: Math.cos(radian) * (1 / dpr),
b: Math.sin(radian) * (1 / dpr),
c: -Math.sin(radian) * (1 / dpr),
d: Math.cos(radian) * (1 / dpr),
e: 0,
f: 0
};
return matrix;
}
// node_modules/@antv/g2plot/esm/utils/pattern/dot.js
var defaultDotPatternCfg = {
size: 6,
padding: 2,
backgroundColor: "transparent",
opacity: 1,
rotation: 0,
fill: "#fff",
fillOpacity: 0.5,
stroke: "transparent",
lineWidth: 0,
isStagger: true
};
function drawDot(context, cfg, x6, y5) {
var size2 = cfg.size, fill = cfg.fill, lineWidth = cfg.lineWidth, stroke = cfg.stroke, fillOpacity = cfg.fillOpacity;
context.beginPath();
context.globalAlpha = fillOpacity;
context.fillStyle = fill;
context.strokeStyle = stroke;
context.lineWidth = lineWidth;
context.arc(x6, y5, size2 / 2, 0, 2 * Math.PI, false);
context.fill();
if (lineWidth) {
context.stroke();
}
context.closePath();
}
function createDotPattern(cfg) {
var dotCfg = deepAssign({}, defaultDotPatternCfg, cfg);
var size2 = dotCfg.size, padding3 = dotCfg.padding, isStagger = dotCfg.isStagger, rotation = dotCfg.rotation;
var unitSize = getUnitPatternSize(size2, padding3, isStagger);
var dots = getSymbolsPosition(unitSize, isStagger);
var canvas = initCanvas(unitSize, unitSize);
var ctx4 = canvas.getContext("2d");
drawBackground(ctx4, dotCfg, unitSize);
for (var _i = 0, dots_1 = dots; _i < dots_1.length; _i++) {
var _a6 = dots_1[_i], x6 = _a6[0], y5 = _a6[1];
drawDot(ctx4, dotCfg, x6, y5);
}
var pattern2 = ctx4.createPattern(canvas, "repeat");
if (pattern2) {
var dpr = getPixelRatio2();
var matrix = transformMatrix(dpr, rotation);
pattern2.setTransform(matrix);
}
return pattern2;
}
// node_modules/@antv/g2plot/esm/utils/pattern/line.js
var defaultLinePatternCfg = {
rotation: 45,
spacing: 5,
opacity: 1,
backgroundColor: "transparent",
strokeOpacity: 0.5,
stroke: "#fff",
lineWidth: 2
};
function drawLine(context, cfg, d3) {
var stroke = cfg.stroke, lineWidth = cfg.lineWidth, strokeOpacity = cfg.strokeOpacity;
var path = new Path2D(d3);
context.globalAlpha = strokeOpacity;
context.lineCap = "square";
context.strokeStyle = lineWidth ? stroke : "transparent";
context.lineWidth = lineWidth;
context.stroke(path);
}
function createLinePattern(cfg) {
var lineCfg = deepAssign({}, defaultLinePatternCfg, cfg);
var spacing = lineCfg.spacing, rotation = lineCfg.rotation, lineWidth = lineCfg.lineWidth;
var width2 = spacing + lineWidth || 1;
var height = spacing + lineWidth || 1;
var d3 = "\n M 0 0 L " + width2 + " 0\n M 0 " + height + " L " + width2 + " " + height + "\n ";
var canvas = initCanvas(width2, height);
var ctx4 = canvas.getContext("2d");
drawBackground(ctx4, lineCfg, width2, height);
drawLine(ctx4, lineCfg, d3);
var pattern2 = ctx4.createPattern(canvas, "repeat");
if (pattern2) {
var dpr = getPixelRatio2();
var matrix = transformMatrix(dpr, rotation);
pattern2.setTransform(matrix);
}
return pattern2;
}
// node_modules/@antv/g2plot/esm/utils/pattern/square.js
var defaultSquarePatternCfg = {
size: 6,
padding: 1,
isStagger: true,
backgroundColor: "transparent",
opacity: 1,
rotation: 0,
fill: "#fff",
fillOpacity: 0.5,
stroke: "transparent",
lineWidth: 0
};
function drawSquare(context, cfg, x6, y5) {
var stroke = cfg.stroke, size2 = cfg.size, fill = cfg.fill, lineWidth = cfg.lineWidth, fillOpacity = cfg.fillOpacity;
context.globalAlpha = fillOpacity;
context.strokeStyle = stroke;
context.lineWidth = lineWidth;
context.fillStyle = fill;
context.strokeRect(x6 - size2 / 2, y5 - size2 / 2, size2, size2);
context.fillRect(x6 - size2 / 2, y5 - size2 / 2, size2, size2);
}
function createSquarePattern(cfg) {
var squareCfg = deepAssign({}, defaultSquarePatternCfg, cfg);
var size2 = squareCfg.size, padding3 = squareCfg.padding, isStagger = squareCfg.isStagger, rotation = squareCfg.rotation;
var unitSize = getUnitPatternSize(size2, padding3, isStagger);
var squares = getSymbolsPosition(unitSize, isStagger);
var canvas = initCanvas(unitSize, unitSize);
var ctx4 = canvas.getContext("2d");
drawBackground(ctx4, squareCfg, unitSize);
for (var _i = 0, squares_1 = squares; _i < squares_1.length; _i++) {
var _a6 = squares_1[_i], x6 = _a6[0], y5 = _a6[1];
drawSquare(ctx4, squareCfg, x6, y5);
}
var pattern2 = ctx4.createPattern(canvas, "repeat");
if (pattern2) {
var dpr = getPixelRatio2();
var matrix = transformMatrix(dpr, rotation);
pattern2.setTransform(matrix);
}
return pattern2;
}
// node_modules/@antv/g2plot/esm/utils/pattern/index.js
function getCanvasPattern(options) {
var type2 = options.type, cfg = options.cfg;
var pattern2;
switch (type2) {
case "dot":
pattern2 = createDotPattern(cfg);
break;
case "line":
pattern2 = createLinePattern(cfg);
break;
case "square":
pattern2 = createSquarePattern(cfg);
break;
default:
break;
}
return pattern2;
}
// node_modules/@antv/g2plot/esm/adaptor/pattern.js
function pattern(key) {
var _this = this;
return function(params) {
var _a6;
var options = params.options, chart = params.chart;
var patternOption = options.pattern;
if (!patternOption) {
return params;
}
var style = function(datum) {
var _a7, _b, _c;
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var defaultColor = chart.getTheme().defaultColor;
var color4 = defaultColor;
var colorAttribute = (_b = (_a7 = chart.geometries) === null || _a7 === void 0 ? void 0 : _a7[0]) === null || _b === void 0 ? void 0 : _b.getAttribute("color");
if (colorAttribute) {
var colorField = colorAttribute.getFields()[0];
var seriesValue = get_default(datum, colorField);
color4 = Util.getMappingValue(colorAttribute, seriesValue, ((_c = colorAttribute.values) === null || _c === void 0 ? void 0 : _c[0]) || defaultColor);
}
var pattern2 = patternOption;
if (typeof patternOption === "function") {
pattern2 = patternOption.call(_this, datum, color4);
}
if (pattern2 instanceof CanvasPattern === false) {
pattern2 = getCanvasPattern(deepAssign({}, { cfg: { backgroundColor: color4 } }, pattern2));
}
var styleOption = options[key];
return __assign(__assign({}, typeof styleOption === "function" ? styleOption.call.apply(styleOption, __spreadArrays([_this, datum], args)) : styleOption || {}), { fill: pattern2 || color4 });
};
return deepAssign({}, params, { options: (_a6 = {}, _a6[key] = style, _a6) });
};
}
// node_modules/@antv/g2plot/esm/adaptor/common.js
function legend(params) {
var chart = params.chart, options = params.options;
var legend18 = options.legend, colorField = options.colorField, seriesField = options.seriesField;
if (legend18 === false) {
chart.legend(false);
} else if (colorField || seriesField) {
chart.legend(colorField || seriesField, legend18);
}
return params;
}
function tooltip(params) {
var chart = params.chart, options = params.options;
var tooltip10 = options.tooltip;
if (tooltip10 !== void 0) {
chart.tooltip(tooltip10);
}
return params;
}
function interaction(params) {
var chart = params.chart, options = params.options;
var interactions = options.interactions;
each_default(interactions, function(i4) {
if (i4.enable === false) {
chart.removeInteraction(i4.type);
} else {
chart.interaction(i4.type, i4.cfg || {});
}
});
return params;
}
function animation(params) {
var chart = params.chart, options = params.options;
var animation7 = options.animation;
if (typeof animation7 === "boolean") {
chart.animate(animation7);
} else {
chart.animate(true);
}
each_default(chart.geometries, function(g4) {
g4.animate(animation7);
});
return params;
}
function theme(params) {
var chart = params.chart, options = params.options;
var theme4 = options.theme;
if (theme4) {
chart.theme(theme4);
}
return params;
}
function state(params) {
var chart = params.chart, options = params.options;
var state2 = options.state;
if (state2) {
each_default(chart.geometries, function(geometry35) {
geometry35.state(state2);
});
}
return params;
}
function slider(params) {
var chart = params.chart, options = params.options;
var slider3 = options.slider;
chart.option("slider", slider3);
return params;
}
function scrollbar(params) {
var chart = params.chart, options = params.options;
var scrollbar2 = options.scrollbar;
chart.option("scrollbar", scrollbar2);
return params;
}
function scale7(axes, meta23) {
return function(params) {
var chart = params.chart, options = params.options;
var scales = {};
each_default(axes, function(axis22, field6) {
scales[field6] = pick(axis22, AXIS_META_CONFIG_KEYS);
});
scales = deepAssign({}, meta23, options.meta, scales);
chart.scale(scales);
return params;
};
}
function annotation(annotationOptions) {
return function(params) {
var chart = params.chart, options = params.options;
var annotationController = chart.getController("annotation");
each_default(__spreadArrays(options.annotations || [], annotationOptions || []), function(annotationOption) {
annotationController.annotation(annotationOption);
});
return params;
};
}
function limitInPlot2(params) {
var chart = params.chart, options = params.options;
var yAxis = options.yAxis, limitInPlot5 = options.limitInPlot;
var value2 = limitInPlot5;
if (is_object_default(yAxis) && is_nil_default(limitInPlot5)) {
if (Object.values(pick(yAxis, ["min", "max", "minLimit", "maxLimit"])).some(function(value3) {
return !is_nil_default(value3);
})) {
value2 = true;
} else {
value2 = false;
}
}
chart.limitInPlot = value2;
return params;
}
// node_modules/@antv/g2plot/esm/utils/tooltip.js
function getTooltipMapping(tooltip10, defaultFields) {
if (tooltip10 === false) {
return {
fields: false
};
}
var fields = get_default(tooltip10, "fields");
var formatter = get_default(tooltip10, "formatter");
if (formatter && !fields) {
fields = defaultFields;
}
return {
fields,
formatter
};
}
// node_modules/@antv/g2plot/esm/adaptor/geometries/base.js
function getMappingField(o3, field6) {
var type2 = o3.type, xField = o3.xField, yField = o3.yField, colorField = o3.colorField, shapeField = o3.shapeField, sizeField = o3.sizeField, styleField = o3.styleField, _a6 = o3.rawFields, rawFields = _a6 === void 0 ? [] : _a6;
var fields = [];
if (field6 === "color") {
fields = __spreadArrays([colorField || xField], rawFields);
} else if (field6 === "shape") {
fields = __spreadArrays([shapeField || xField], rawFields);
} else if (field6 === "size") {
fields = __spreadArrays([sizeField || xField], rawFields);
} else {
fields = __spreadArrays([xField, yField, colorField, shapeField, sizeField, styleField], rawFields);
var idx = ["x", "y", "color", "shape", "size", "style"].indexOf(field6);
var f3 = fields[idx];
fields.splice(idx, 1);
fields.unshift(f3);
}
var mappingFields = uniq(fields.filter(function(f4) {
return !!f4;
}));
var tileMappingField = type2 === "line" && [xField, yField].includes(mappingFields.join("*")) ? "" : mappingFields.join("*");
return {
mappingFields,
tileMappingField
};
}
function getMappingFunction(mappingFields, func) {
if (!func)
return void 0;
return function() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var params = {};
mappingFields.forEach(function(f3, idx) {
params[f3] = args[idx];
});
delete params["undefined"];
return func(params);
};
}
function geometry(params) {
var chart = params.chart, options = params.options;
var type2 = options.type, args = options.args, mapping = options.mapping, xField = options.xField, yField = options.yField, colorField = options.colorField, shapeField = options.shapeField, sizeField = options.sizeField, tooltipFields = options.tooltipFields, label17 = options.label, state2 = options.state, customInfo = options.customInfo;
if (!mapping) {
return params;
}
var color4 = mapping.color, shape = mapping.shape, size2 = mapping.size, style = mapping.style, tooltip10 = mapping.tooltip;
var geometry35 = chart[type2](args).position(xField + "*" + yField);
if (is_string_default(color4)) {
colorField ? geometry35.color(colorField, color4) : geometry35.color(color4);
} else if (is_function_default(color4)) {
var _a6 = getMappingField(options, "color"), mappingFields = _a6.mappingFields, tileMappingField = _a6.tileMappingField;
geometry35.color(tileMappingField, getMappingFunction(mappingFields, color4));
} else {
colorField && geometry35.color(colorField, color4);
}
if (is_string_default(shape)) {
shapeField ? geometry35.shape(shapeField, [shape]) : geometry35.shape(shape);
} else if (is_function_default(shape)) {
var _b = getMappingField(options, "shape"), mappingFields = _b.mappingFields, tileMappingField = _b.tileMappingField;
geometry35.shape(tileMappingField, getMappingFunction(mappingFields, shape));
} else {
shapeField && geometry35.shape(shapeField, shape);
}
if (is_number_default(size2)) {
sizeField ? geometry35.size(sizeField, size2) : geometry35.size(size2);
} else if (is_function_default(size2)) {
var _c = getMappingField(options, "size"), mappingFields = _c.mappingFields, tileMappingField = _c.tileMappingField;
geometry35.size(tileMappingField, getMappingFunction(mappingFields, size2));
} else {
sizeField && geometry35.size(sizeField, size2);
}
if (is_function_default(style)) {
var _d = getMappingField(options, "style"), mappingFields = _d.mappingFields, tileMappingField = _d.tileMappingField;
geometry35.style(tileMappingField, getMappingFunction(mappingFields, style));
} else if (is_object_default(style)) {
geometry35.style(style);
}
if (tooltipFields === false) {
geometry35.tooltip(false);
} else if (!is_empty_default(tooltipFields)) {
geometry35.tooltip(tooltipFields.join("*"), getMappingFunction(tooltipFields, tooltip10));
}
if (label17 === false) {
geometry35.label(false);
} else if (label17) {
var callback = label17.callback, fields = label17.fields, cfg = __rest(label17, ["callback", "fields"]);
geometry35.label({
fields: fields || [yField],
callback,
cfg: transformLabel(cfg)
});
}
if (state2) {
geometry35.state(state2);
}
if (customInfo) {
geometry35.customInfo(customInfo);
}
[xField, yField].filter(function(f3) {
return f3 !== colorField;
}).forEach(function(f3) {
chart.legend(f3, false);
});
return __assign(__assign({}, params), {
ext: { geometry: geometry35 }
});
}
// node_modules/@antv/g2plot/esm/adaptor/geometries/area.js
function area(params) {
var options = params.options;
var area2 = options.area, xField = options.xField, yField = options.yField, seriesField = options.seriesField, smooth = options.smooth, tooltip10 = options.tooltip;
var _a6 = getTooltipMapping(tooltip10, [xField, yField, seriesField]), fields = _a6.fields, formatter = _a6.formatter;
return area2 ? geometry(deepAssign({}, params, {
options: {
type: "area",
colorField: seriesField,
tooltipFields: fields,
mapping: __assign({ shape: smooth ? "smooth" : "area", tooltip: formatter }, area2)
}
})) : params;
}
// node_modules/@antv/g2plot/esm/adaptor/geometries/line.js
function line(params) {
var options = params.options;
var line2 = options.line, stepType = options.stepType, xField = options.xField, yField = options.yField, seriesField = options.seriesField, smooth = options.smooth, connectNulls = options.connectNulls, tooltip10 = options.tooltip;
var _a6 = getTooltipMapping(tooltip10, [xField, yField, seriesField]), fields = _a6.fields, formatter = _a6.formatter;
return line2 ? geometry(deepAssign({}, params, {
options: {
type: "line",
colorField: seriesField,
tooltipFields: fields,
mapping: deep_mix_default({
shape: stepType || (smooth ? "smooth" : "line"),
tooltip: formatter
}, line2),
args: { connectNulls }
}
})) : params;
}
// node_modules/@antv/g2plot/esm/adaptor/geometries/point.js
function point(params) {
var options = params.options;
var point2 = options.point, xField = options.xField, yField = options.yField, seriesField = options.seriesField, sizeField = options.sizeField, shapeField = options.shapeField, tooltip10 = options.tooltip;
var _a6 = getTooltipMapping(tooltip10, [xField, yField, seriesField, sizeField, shapeField]), fields = _a6.fields, formatter = _a6.formatter;
return point2 ? geometry(deepAssign({}, params, {
options: {
type: "point",
colorField: seriesField,
shapeField,
tooltipFields: fields,
mapping: __assign({ tooltip: formatter }, point2)
}
})) : params;
}
// node_modules/@antv/g2plot/esm/adaptor/geometries/interval.js
function otherAdaptor(params) {
var chart = params.chart, options = params.options, ext = params.ext;
var seriesField = options.seriesField, isGroup = options.isGroup, isStack = options.isStack, marginRatio = options.marginRatio, widthRatio = options.widthRatio, groupField = options.groupField, theme4 = options.theme;
var adjust4 = [];
if (seriesField) {
if (isGroup) {
adjust4.push({
type: "dodge",
dodgeBy: groupField || seriesField,
marginRatio
});
}
if (isStack) {
adjust4.push({
type: "stack",
marginRatio
});
}
}
if (adjust4.length && (ext === null || ext === void 0 ? void 0 : ext.geometry)) {
var g4 = ext === null || ext === void 0 ? void 0 : ext.geometry;
g4.adjust(adjust4);
}
if (!is_nil_default(widthRatio)) {
chart.theme(deepAssign({}, is_object_default(theme4) ? theme4 : getTheme(theme4), {
columnWidthRatio: widthRatio
}));
}
return params;
}
function interval2(params) {
var options = params.options;
var xField = options.xField, yField = options.yField, interval3 = options.interval, seriesField = options.seriesField, tooltip10 = options.tooltip, minColumnWidth = options.minColumnWidth, maxColumnWidth = options.maxColumnWidth, columnBackground = options.columnBackground, dodgePadding = options.dodgePadding, intervalPadding = options.intervalPadding;
var _a6 = getTooltipMapping(tooltip10, [xField, yField, seriesField]), fields = _a6.fields, formatter = _a6.formatter;
var ext = (interval3 ? geometry(deepAssign({}, params, {
options: {
type: "interval",
colorField: seriesField,
tooltipFields: fields,
mapping: __assign({ tooltip: formatter }, interval3),
args: { dodgePadding, intervalPadding, minColumnWidth, maxColumnWidth, background: columnBackground }
}
})) : params).ext;
return otherAdaptor(__assign(__assign({}, params), { ext }));
}
// node_modules/@antv/g2plot/esm/adaptor/geometries/polygon.js
function polygon(params) {
var options = params.options;
var polygon2 = options.polygon, xField = options.xField, yField = options.yField, seriesField = options.seriesField, tooltip10 = options.tooltip;
var _a6 = getTooltipMapping(tooltip10, [xField, yField, seriesField]), fields = _a6.fields, formatter = _a6.formatter;
return polygon2 ? geometry(deepAssign({}, params, {
options: {
type: "polygon",
colorField: seriesField,
tooltipFields: fields,
mapping: __assign({ tooltip: formatter }, polygon2)
}
})) : params;
}
// node_modules/@antv/g2plot/esm/adaptor/geometries/edge.js
function edge(params) {
var options = params.options;
var edge2 = options.edge, xField = options.xField, yField = options.yField, seriesField = options.seriesField, tooltip10 = options.tooltip;
var _a6 = getTooltipMapping(tooltip10, [xField, yField, seriesField]), fields = _a6.fields, formatter = _a6.formatter;
return edge2 ? geometry(deepAssign({}, params, {
options: {
type: "edge",
colorField: seriesField,
tooltipFields: fields,
mapping: __assign({ tooltip: formatter }, edge2)
}
})) : params;
}
// node_modules/@antv/g2plot/esm/adaptor/geometries/schema.js
function schema2(params) {
var options = params.options;
var schema3 = options.schema, xField = options.xField, yField = options.yField, seriesField = options.seriesField, tooltip10 = options.tooltip;
var _a6 = getTooltipMapping(tooltip10, [xField, yField, seriesField]), fields = _a6.fields, formatter = _a6.formatter;
return schema3 ? geometry(deepAssign({}, params, {
options: {
type: "schema",
colorField: seriesField,
tooltipFields: fields,
mapping: __assign({ tooltip: formatter }, schema3)
}
})) : params;
}
// node_modules/@antv/g2plot/esm/adaptor/geometries/violin.js
function violin(params) {
var options = params.options;
var violin2 = options.violin, xField = options.xField, yField = options.yField, seriesField = options.seriesField, sizeField = options.sizeField, tooltip10 = options.tooltip;
var _a6 = getTooltipMapping(tooltip10, [xField, yField, seriesField, sizeField]), fields = _a6.fields, formatter = _a6.formatter;
return violin2 ? geometry(deepAssign({}, params, {
options: {
type: "violin",
colorField: seriesField,
tooltipFields: fields,
mapping: __assign({ tooltip: formatter }, violin2)
}
})) : params;
}
// node_modules/@antv/g2plot/esm/plots/line/adaptor.js
function geometry2(params) {
var chart = params.chart, options = params.options;
var data3 = options.data, color4 = options.color, lineStyle = options.lineStyle, lineShape = options.lineShape, pointMapping = options.point, areaMapping = options.area, seriesField = options.seriesField;
var pointState = pointMapping === null || pointMapping === void 0 ? void 0 : pointMapping.state;
var areaState = areaMapping === null || areaMapping === void 0 ? void 0 : areaMapping.state;
chart.data(data3);
var primary = deepAssign({}, params, {
options: {
shapeField: seriesField,
line: {
color: color4,
style: lineStyle,
shape: lineShape
},
point: pointMapping && __assign({ color: color4, shape: "circle" }, pointMapping),
area: areaMapping && __assign({ color: color4 }, areaMapping),
label: void 0
}
});
var second = deepAssign({}, primary, { options: { tooltip: false, state: pointState } });
var areaParams = deepAssign({}, primary, { options: { tooltip: false, state: areaState } });
line(primary);
point(second);
area(areaParams);
return params;
}
function meta(params) {
var _a6, _b;
var options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField, data3 = options.data;
return flow(scale7((_a6 = {}, _a6[xField] = xAxis, _a6[yField] = yAxis, _a6), (_b = {}, _b[xField] = {
type: "cat"
}, _b[yField] = adjustYMetaByZero(data3, yField), _b)))(params);
}
function coordinate(params) {
var chart = params.chart, options = params.options;
var reflect = options.reflect;
if (reflect) {
var p4 = reflect;
if (!is_array_default(p4)) {
p4 = [p4];
}
var actions = p4.map(function(d3) {
return ["reflect", d3];
});
chart.coordinate({ type: "rect", actions });
}
return params;
}
function axis(params) {
var chart = params.chart, options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField;
if (xAxis === false) {
chart.axis(xField, false);
} else {
chart.axis(xField, xAxis);
}
if (yAxis === false) {
chart.axis(yField, false);
} else {
chart.axis(yField, yAxis);
}
return params;
}
function legend2(params) {
var chart = params.chart, options = params.options;
var legend18 = options.legend, seriesField = options.seriesField;
if (legend18 && seriesField) {
chart.legend(seriesField, legend18);
} else if (legend18 === false) {
chart.legend(false);
}
return params;
}
function label(params) {
var chart = params.chart, options = params.options;
var label17 = options.label, yField = options.yField;
var lineGeometry = findGeometry(chart, "line");
if (!label17) {
lineGeometry.label(false);
} else {
var callback = label17.callback, cfg = __rest(label17, ["callback"]);
lineGeometry.label({
fields: [yField],
callback,
cfg: __assign({ layout: [
{ type: "limit-in-plot" },
{ type: "path-adjust-position" },
{ type: "point-adjust-position" },
{ type: "limit-in-plot", cfg: { action: "hide" } }
] }, transformLabel(cfg))
});
}
return params;
}
function adjust(params) {
var chart = params.chart, options = params.options;
var isStack = options.isStack;
if (isStack) {
each_default(chart.geometries, function(g4) {
g4.adjust("stack");
});
}
return params;
}
function adaptor(params) {
return flow(geometry2, meta, adjust, theme, coordinate, axis, legend2, tooltip, label, slider, scrollbar, interaction, animation, annotation(), limitInPlot2)(params);
}
// node_modules/@antv/g2plot/esm/plots/line/constants.js
var DEFAULT_OPTIONS = deepAssign({}, Plot.getDefaultOptions(), {
tooltip: {
shared: true,
showMarkers: true,
showCrosshairs: true,
crosshairs: {
type: "x"
}
},
legend: {
position: "top-left",
radio: {}
},
isStack: false
});
// node_modules/@antv/g2plot/esm/plots/line/interactions/marker-active.js
var MarkerActiveAction = function(_super) {
__extends(MarkerActiveAction2, _super);
function MarkerActiveAction2() {
return _super !== null && _super.apply(this, arguments) || this;
}
MarkerActiveAction2.prototype.active = function() {
var view = this.getView();
var evt = this.context.event;
if (evt.data) {
var items_1 = evt.data.items;
var points = view.geometries.filter(function(geom) {
return geom.type === "point";
});
each_default(points, function(point2) {
each_default(point2.elements, function(element) {
var active = find_index_default(items_1, function(item) {
return item.data === element.data;
}) !== -1;
element.setState("active", active);
});
});
}
};
MarkerActiveAction2.prototype.reset = function() {
var view = this.getView();
var points = view.geometries.filter(function(geom) {
return geom.type === "point";
});
each_default(points, function(point2) {
each_default(point2.elements, function(element) {
element.setState("active", false);
});
});
};
MarkerActiveAction2.prototype.getView = function() {
return this.context.view;
};
return MarkerActiveAction2;
}(base_default12);
// node_modules/@antv/g2plot/esm/plots/line/interactions/index.js
registerAction("marker-active", MarkerActiveAction);
registerInteraction("marker-active", {
start: [
{
trigger: "tooltip:show",
action: "marker-active:active"
}
],
end: [
{
trigger: "tooltip:hide",
action: "marker-active:reset"
}
]
});
// node_modules/@antv/g2plot/esm/plots/line/index.js
var Line6 = function(_super) {
__extends(Line9, _super);
function Line9() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "line";
return _this;
}
Line9.getDefaultOptions = function() {
return DEFAULT_OPTIONS;
};
Line9.prototype.changeData = function(data3) {
this.updateOption({ data: data3 });
var _a6 = this, chart = _a6.chart, options = _a6.options;
meta({ chart, options });
this.chart.changeData(data3);
};
Line9.prototype.getDefaultOptions = function() {
return Line9.getDefaultOptions();
};
Line9.prototype.getSchemaAdaptor = function() {
return adaptor;
};
return Line9;
}(Plot);
// node_modules/@antv/g2plot/esm/utils/transform/percent.js
function percent(data3, measure, groupField, as) {
var sumMap = reduce_default(data3, function(map6, datum) {
var groupValue = datum[groupField];
var sum = map6.has(groupValue) ? map6.get(groupValue) : 0;
var v3 = datum[measure];
sum = isRealNumber(v3) ? sum + v3 : sum;
map6.set(groupValue, sum);
return map6;
}, new Map());
return map_default(data3, function(datum) {
var _a6;
var v3 = datum[measure];
var groupValue = datum[groupField];
var percentage = isRealNumber(v3) ? v3 / sumMap.get(groupValue) : 0;
return __assign(__assign({}, datum), (_a6 = {}, _a6[as] = percentage, _a6));
});
}
function getDeepPercent(data3, measure, fields, percent2) {
var sumMap = reduce_default(data3, function(map6, datum) {
var groupValue = reduce_default(fields, function(value2, field6) {
return "" + value2 + datum[field6];
}, "");
var sum = map6.has(groupValue) ? map6.get(groupValue) : 0;
var v3 = datum[measure];
sum = isRealNumber(v3) ? sum + v3 : sum;
map6.set(groupValue, sum);
return map6;
}, new Map());
return map_default(data3, function(datum) {
var _a6;
var v3 = datum[measure];
var groupValue = reduce_default(fields, function(value2, field6) {
return "" + value2 + datum[field6];
}, "");
var percentage = isRealNumber(v3) ? v3 / sumMap.get(groupValue) : 0;
return __assign(__assign({}, datum), (_a6 = {}, _a6[percent2] = percentage, _a6));
});
}
function getDataWhetherPecentage(data3, yField, groupField, asField, isPercent) {
return !isPercent ? data3 : percent(data3, yField, groupField, asField);
}
// node_modules/@antv/g2plot/esm/plots/area/adaptor.js
function geometry3(params) {
var chart = params.chart, options = params.options;
var data3 = options.data, areaStyle = options.areaStyle, color4 = options.color, pointMapping = options.point, lineMapping = options.line, isPercent = options.isPercent, xField = options.xField, yField = options.yField, tooltip10 = options.tooltip, seriesField = options.seriesField, startOnZero = options.startOnZero;
var pointState = pointMapping === null || pointMapping === void 0 ? void 0 : pointMapping.state;
var chartData = getDataWhetherPecentage(data3, yField, xField, yField, isPercent);
chart.data(chartData);
var tooltipOptions = isPercent ? __assign({ formatter: function(datum) {
return {
name: datum[seriesField] || datum[xField],
value: (Number(datum[yField]) * 100).toFixed(2) + "%"
};
} }, tooltip10) : tooltip10;
var primary = deepAssign({}, params, {
options: {
area: { color: color4, style: areaStyle },
point: pointMapping && __assign({ color: color4 }, pointMapping),
tooltip: tooltipOptions,
label: void 0,
args: {
startOnZero
}
}
});
var lineParams = {
chart,
options: deepAssign({ line: { size: 2 } }, omit_default(options, ["state"]), {
line: lineMapping && __assign({ color: color4 }, lineMapping),
sizeField: seriesField,
state: lineMapping === null || lineMapping === void 0 ? void 0 : lineMapping.state,
tooltip: false,
label: void 0,
args: {
startOnZero
}
})
};
var pointParams = deepAssign({}, primary, { options: { tooltip: false, state: pointState } });
area(primary);
line(lineParams);
point(pointParams);
return params;
}
function label2(params) {
var chart = params.chart, options = params.options;
var label17 = options.label, yField = options.yField;
var areaGeometry = findGeometry(chart, "area");
if (!label17) {
areaGeometry.label(false);
} else {
var callback = label17.callback, cfg = __rest(label17, ["callback"]);
areaGeometry.label({
fields: [yField],
callback,
cfg: __assign({ layout: [
{ type: "limit-in-plot" },
{ type: "path-adjust-position" },
{ type: "point-adjust-position" },
{ type: "limit-in-plot", cfg: { action: "hide" } }
] }, transformLabel(cfg))
});
}
return params;
}
function adjust2(params) {
var chart = params.chart, options = params.options;
var isStack = options.isStack, isPercent = options.isPercent, seriesField = options.seriesField;
if ((isPercent || isStack) && seriesField) {
each_default(chart.geometries, function(g4) {
g4.adjust("stack");
});
}
return params;
}
function adaptor2(params) {
return flow(theme, pattern("areaStyle"), geometry3, meta, adjust2, axis, legend2, tooltip, label2, slider, annotation(), interaction, animation, limitInPlot2)(params);
}
// node_modules/@antv/g2plot/esm/plots/area/constants.js
var DEFAULT_OPTIONS2 = deepAssign({}, Plot.getDefaultOptions(), {
tooltip: {
shared: true,
showMarkers: true,
showCrosshairs: true,
crosshairs: {
type: "x"
}
},
isStack: true,
line: {},
legend: {
position: "top-left",
radio: {}
}
});
// node_modules/@antv/g2plot/esm/plots/area/index.js
var Area2 = function(_super) {
__extends(Area3, _super);
function Area3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "area";
return _this;
}
Area3.getDefaultOptions = function() {
return DEFAULT_OPTIONS2;
};
Area3.prototype.getDefaultOptions = function() {
return Area3.getDefaultOptions();
};
Area3.prototype.changeData = function(data3) {
this.updateOption({ data: data3 });
var _a6 = this.options, isPercent = _a6.isPercent, xField = _a6.xField, yField = _a6.yField;
var _b = this, chart = _b.chart, options = _b.options;
meta({ chart, options });
this.chart.changeData(getDataWhetherPecentage(data3, yField, xField, yField, isPercent));
};
Area3.prototype.getSchemaAdaptor = function() {
return adaptor2;
};
return Area3;
}(Plot);
// node_modules/@antv/g2plot/esm/utils/conversion.js
function conversionTagFormatter(prev, next) {
if (!is_number_default(prev) || !is_number_default(next)) {
return "-";
}
if (prev === next) {
return "100%";
}
if (prev === 0) {
return "\u221E";
}
if (next === 0) {
return "-\u221E";
}
return (100 * next / prev).toFixed(2) + "%";
}
// node_modules/@antv/g2plot/esm/adaptor/conversion-tag.js
function getConversionTagOptionsWithDefaults(options, horizontal) {
return deepAssign({
size: horizontal ? 32 : 80,
spacing: horizontal ? 8 : 12,
offset: horizontal ? 32 : 0,
arrow: options.arrow !== false && {
headSize: 12,
style: {
fill: "rgba(0, 0, 0, 0.05)"
}
},
text: options.text !== false && {
style: {
fontSize: 12,
fill: "rgba(0, 0, 0, 0.85)",
textAlign: "center",
textBaseline: "middle"
},
formatter: conversionTagFormatter
}
}, options);
}
function parsePoints(coordinate11, element) {
return map_default(element.getModel().points, function(point2) {
return coordinate11.convertPoint(point2);
});
}
function renderArrowTag(config, elemPrev, elemNext) {
var view = config.view, geometry35 = config.geometry, group2 = config.group, options = config.options, horizontal = config.horizontal;
var offset = options.offset, size2 = options.size, arrow = options.arrow;
var coordinate11 = view.getCoordinate();
var pointPrev = parsePoints(coordinate11, elemPrev)[3];
var pointNext = parsePoints(coordinate11, elemNext)[0];
var totalHeight = pointNext.y - pointPrev.y;
var totalWidth = pointNext.x - pointPrev.x;
if (typeof arrow === "boolean") {
return;
}
var headSize = arrow.headSize;
var spacing = options.spacing;
var points;
if (horizontal) {
if ((totalWidth - headSize) / 2 < spacing) {
spacing = Math.max(1, (totalWidth - headSize) / 2);
points = [
[pointPrev.x + spacing, pointPrev.y - offset],
[pointPrev.x + spacing, pointPrev.y - offset - size2],
[pointNext.x - spacing, pointNext.y - offset - size2 / 2]
];
} else {
points = [
[pointPrev.x + spacing, pointPrev.y - offset],
[pointPrev.x + spacing, pointPrev.y - offset - size2],
[pointNext.x - spacing - headSize, pointNext.y - offset - size2],
[pointNext.x - spacing, pointNext.y - offset - size2 / 2],
[pointNext.x - spacing - headSize, pointNext.y - offset]
];
}
} else {
if ((totalHeight - headSize) / 2 < spacing) {
spacing = Math.max(1, (totalHeight - headSize) / 2);
points = [
[pointPrev.x + offset, pointPrev.y + spacing],
[pointPrev.x + offset + size2, pointPrev.y + spacing],
[pointNext.x + offset + size2 / 2, pointNext.y - spacing]
];
} else {
points = [
[pointPrev.x + offset, pointPrev.y + spacing],
[pointPrev.x + offset + size2, pointPrev.y + spacing],
[pointNext.x + offset + size2, pointNext.y - spacing - headSize],
[pointNext.x + offset + size2 / 2, pointNext.y - spacing],
[pointNext.x + offset, pointNext.y - spacing - headSize]
];
}
}
group2.addShape("polygon", {
id: view.id + "-conversion-tag-arrow-" + geometry35.getElementId(elemPrev.getModel().mappingData),
name: "conversion-tag-arrow",
origin: {
element: elemPrev,
nextElement: elemNext
},
attrs: __assign(__assign({}, arrow.style || {}), { points })
});
}
function renderTextTag(config, elemPrev, elemNext) {
var _a6, _b, _c;
var view = config.view, geometry35 = config.geometry, group2 = config.group, options = config.options, field6 = config.field, horizontal = config.horizontal;
var offset = options.offset, size2 = options.size;
if (typeof options.text === "boolean") {
return;
}
var coordinate11 = view.getCoordinate();
var text = ((_a6 = options.text) === null || _a6 === void 0 ? void 0 : _a6.formatter) && ((_b = options.text) === null || _b === void 0 ? void 0 : _b.formatter(elemPrev.getData()[field6], elemNext.getData()[field6]));
var pointPrev = parsePoints(coordinate11, elemPrev)[horizontal ? 3 : 0];
var pointNext = parsePoints(coordinate11, elemNext)[horizontal ? 0 : 3];
var textShape = group2.addShape("text", {
id: view.id + "-conversion-tag-text-" + geometry35.getElementId(elemPrev.getModel().mappingData),
name: "conversion-tag-text",
origin: {
element: elemPrev,
nextElement: elemNext
},
attrs: __assign(__assign({}, ((_c = options.text) === null || _c === void 0 ? void 0 : _c.style) || {}), { text, x: horizontal ? (pointPrev.x + pointNext.x) / 2 : pointPrev.x + offset + size2 / 2, y: horizontal ? pointPrev.y - offset - size2 / 2 : (pointPrev.y + pointNext.y) / 2 })
});
if (horizontal) {
var totalWidth = pointNext.x - pointPrev.x;
var textWidth = textShape.getBBox().width;
if (textWidth > totalWidth) {
var cWidth = textWidth / text.length;
var cEnd = Math.max(1, Math.ceil(totalWidth / cWidth) - 1);
var textAdjusted = text.slice(0, cEnd) + "...";
textShape.attr("text", textAdjusted);
}
}
}
function renderTag2(options, elemPrev, elemNext) {
renderArrowTag(options, elemPrev, elemNext);
renderTextTag(options, elemPrev, elemNext);
}
function conversionTag(field6, horizontal, disabled) {
if (horizontal === void 0) {
horizontal = true;
}
if (disabled === void 0) {
disabled = false;
}
return function(params) {
var options = params.options, chart = params.chart;
var conversionTag5 = options.conversionTag, theme4 = options.theme;
if (conversionTag5 && !disabled) {
chart.theme(deepAssign({}, is_object_default(theme4) ? theme4 : getTheme(theme4), {
columnWidthRatio: 1 / 3
}));
chart.annotation().shape({
render: function(container2, view) {
var group2 = container2.addGroup({
id: chart.id + "-conversion-tag-group",
name: "conversion-tag-group"
});
var interval3 = find_default(chart.geometries, function(geom) {
return geom.type === "interval";
});
var config = {
view,
geometry: interval3,
group: group2,
field: field6,
horizontal,
options: getConversionTagOptionsWithDefaults(conversionTag5, horizontal)
};
var elements = interval3.elements;
each_default(elements, function(elem, idx) {
if (idx > 0) {
renderTag2(config, elements[idx - 1], elem);
}
});
}
});
}
return params;
};
}
// node_modules/@antv/g2plot/esm/adaptor/connected-area.js
var INTERACTION_MAP = {
hover: "__interval-connected-area-hover__",
click: "__interval-connected-area-click__"
};
var getStartStages = function(trigger, style) {
if (trigger === "hover") {
return [
{
trigger: "interval:mouseenter",
action: ["element-highlight-by-color:highlight", "element-link-by-color:link"],
arg: [null, { style }]
}
];
}
return [
{
trigger: "interval:click",
action: [
"element-highlight-by-color:clear",
"element-highlight-by-color:highlight",
"element-link-by-color:clear",
"element-link-by-color:unlink",
"element-link-by-color:link"
],
arg: [null, null, null, null, { style }]
}
];
};
registerInteraction(INTERACTION_MAP.hover, {
start: getStartStages(INTERACTION_MAP.hover),
end: [
{
trigger: "interval:mouseleave",
action: ["element-highlight-by-color:reset", "element-link-by-color:unlink"]
}
]
});
registerInteraction(INTERACTION_MAP.click, {
start: getStartStages(INTERACTION_MAP.click),
end: [
{
trigger: "document:mousedown",
action: ["element-highlight-by-color:clear", "element-link-by-color:clear"]
}
]
});
function connectedArea(disable) {
if (disable === void 0) {
disable = false;
}
return function(params) {
var chart = params.chart, options = params.options;
var connectedArea2 = options.connectedArea;
var clear = function() {
chart.removeInteraction(INTERACTION_MAP.hover);
chart.removeInteraction(INTERACTION_MAP.click);
};
if (!disable && connectedArea2) {
var trigger = connectedArea2.trigger || "hover";
clear();
chart.interaction(INTERACTION_MAP[trigger], {
start: getStartStages(trigger, connectedArea2.style)
});
} else {
clear();
}
return params;
};
}
// node_modules/@antv/g2plot/esm/interactions/actions/reset-button.js
var PADDING_RIGHT2 = 10;
var PADDING_TOP2 = 5;
var BUTTON_ACTION_CONFIG = {
padding: [8, 10],
text: "reset",
textStyle: {
default: {
x: 0,
y: 0,
fontSize: 12,
fill: "#333333",
cursor: "pointer"
}
},
buttonStyle: {
default: {
fill: "#f7f7f7",
stroke: "#cccccc",
cursor: "pointer"
},
active: {
fill: "#e6e6e6"
}
}
};
var ButtonAction2 = function(_super) {
__extends(ButtonAction3, _super);
function ButtonAction3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.buttonGroup = null;
_this.buttonCfg = __assign({ name: "button" }, BUTTON_ACTION_CONFIG);
return _this;
}
ButtonAction3.prototype.getButtonCfg = function() {
var view = this.context.view;
var buttonCfg = get_default(view, ["interactions", "filter-action", "cfg", "buttonConfig"]);
return deepAssign(this.buttonCfg, buttonCfg, this.cfg);
};
ButtonAction3.prototype.drawButton = function() {
var config = this.getButtonCfg();
var group2 = this.context.view.foregroundGroup.addGroup({
name: config.name
});
var textShape = this.drawText(group2);
this.drawBackground(group2, textShape.getBBox());
this.buttonGroup = group2;
};
ButtonAction3.prototype.drawText = function(group2) {
var _a6;
var config = this.getButtonCfg();
return group2.addShape({
type: "text",
name: "button-text",
attrs: __assign({ text: config.text }, (_a6 = config.textStyle) === null || _a6 === void 0 ? void 0 : _a6.default)
});
};
ButtonAction3.prototype.drawBackground = function(group2, bbox) {
var _a6;
var config = this.getButtonCfg();
var padding3 = normalPadding(config.padding);
var buttonShape = group2.addShape({
type: "rect",
name: "button-rect",
attrs: __assign({ x: bbox.x - padding3[3], y: bbox.y - padding3[0], width: bbox.width + padding3[1] + padding3[3], height: bbox.height + padding3[0] + padding3[2] }, (_a6 = config.buttonStyle) === null || _a6 === void 0 ? void 0 : _a6.default)
});
buttonShape.toBack();
group2.on("mouseenter", function() {
var _a7;
buttonShape.attr((_a7 = config.buttonStyle) === null || _a7 === void 0 ? void 0 : _a7.active);
});
group2.on("mouseleave", function() {
var _a7;
buttonShape.attr((_a7 = config.buttonStyle) === null || _a7 === void 0 ? void 0 : _a7.default);
});
return buttonShape;
};
ButtonAction3.prototype.resetPosition = function() {
var view = this.context.view;
var coord2 = view.getCoordinate();
var point2 = coord2.convert({ x: 1, y: 1 });
var buttonGroup = this.buttonGroup;
var bbox = buttonGroup.getBBox();
var matrix = Util.transform(null, [
["t", point2.x - bbox.width - PADDING_RIGHT2, point2.y + bbox.height + PADDING_TOP2]
]);
buttonGroup.setMatrix(matrix);
};
ButtonAction3.prototype.show = function() {
if (!this.buttonGroup) {
this.drawButton();
}
this.resetPosition();
this.buttonGroup.show();
};
ButtonAction3.prototype.hide = function() {
if (this.buttonGroup) {
this.buttonGroup.hide();
}
};
ButtonAction3.prototype.destroy = function() {
var buttonGroup = this.buttonGroup;
if (buttonGroup) {
buttonGroup.remove();
}
_super.prototype.destroy.call(this);
};
return ButtonAction3;
}(base_default12);
// node_modules/@antv/g2plot/esm/interactions/brush.js
registerAction("brush-reset-button", ButtonAction2, {
name: "brush-reset-button"
});
registerInteraction("filter-action", {});
function isPointInView2(context) {
return context.isInPlot();
}
function getInteractionCfg(interactionType, brushType, mask) {
var maskType = brushType || "rect";
switch (interactionType) {
case "brush":
return {
showEnable: [
{ trigger: "plot:mouseenter", action: "cursor:crosshair" },
{ trigger: "plot:mouseleave", action: "cursor:default" }
],
start: [
{
trigger: "mousedown",
isEnable: isPointInView2,
action: ["brush:start", maskType + "-mask:start", maskType + "-mask:show"],
arg: [null, { maskStyle: mask === null || mask === void 0 ? void 0 : mask.style }]
}
],
processing: [
{
trigger: "mousemove",
isEnable: isPointInView2,
action: [maskType + "-mask:resize"]
}
],
end: [
{
trigger: "mouseup",
isEnable: isPointInView2,
action: [
"brush:filter",
"brush:end",
maskType + "-mask:end",
maskType + "-mask:hide",
"brush-reset-button:show"
]
}
],
rollback: [
{
trigger: "brush-reset-button:click",
action: ["brush:reset", "brush-reset-button:hide", "cursor:crosshair"]
}
]
};
case "brush-highlight":
return {
showEnable: [
{ trigger: "plot:mouseenter", action: "cursor:crosshair" },
{ trigger: "mask:mouseenter", action: "cursor:move" },
{ trigger: "plot:mouseleave", action: "cursor:default" },
{ trigger: "mask:mouseleave", action: "cursor:crosshair" }
],
start: [
{
trigger: "plot:mousedown",
isEnable: function(context) {
return !context.isInShape("mask");
},
action: [maskType + "-mask:start", maskType + "-mask:show"],
arg: [{ maskStyle: mask === null || mask === void 0 ? void 0 : mask.style }]
},
{
trigger: "mask:dragstart",
action: [maskType + "-mask:moveStart"]
}
],
processing: [
{
trigger: "plot:mousemove",
action: [maskType + "-mask:resize"]
},
{
trigger: "mask:drag",
action: [maskType + "-mask:move"]
},
{
trigger: "mask:change",
action: ["element-range-highlight:highlight"]
}
],
end: [
{ trigger: "plot:mouseup", action: [maskType + "-mask:end"] },
{ trigger: "mask:dragend", action: [maskType + "-mask:moveEnd"] },
{
trigger: "document:mouseup",
isEnable: function(context) {
return !context.isInPlot();
},
action: ["element-range-highlight:clear", maskType + "-mask:end", maskType + "-mask:hide"]
}
],
rollback: [{ trigger: "dblclick", action: ["element-range-highlight:clear", maskType + "-mask:hide"] }]
};
case "brush-x":
return {
showEnable: [
{ trigger: "plot:mouseenter", action: "cursor:crosshair" },
{ trigger: "plot:mouseleave", action: "cursor:default" }
],
start: [
{
trigger: "mousedown",
isEnable: isPointInView2,
action: ["brush-x:start", maskType + "-mask:start", maskType + "-mask:show"],
arg: [null, { maskStyle: mask === null || mask === void 0 ? void 0 : mask.style }]
}
],
processing: [
{
trigger: "mousemove",
isEnable: isPointInView2,
action: [maskType + "-mask:resize"]
}
],
end: [
{
trigger: "mouseup",
isEnable: isPointInView2,
action: ["brush-x:filter", "brush-x:end", maskType + "-mask:end", maskType + "-mask:hide"]
}
],
rollback: [{ trigger: "dblclick", action: ["brush-x:reset"] }]
};
case "brush-x-highlight":
return {
showEnable: [
{ trigger: "plot:mouseenter", action: "cursor:crosshair" },
{ trigger: "mask:mouseenter", action: "cursor:move" },
{ trigger: "plot:mouseleave", action: "cursor:default" },
{ trigger: "mask:mouseleave", action: "cursor:crosshair" }
],
start: [
{
trigger: "plot:mousedown",
isEnable: function(context) {
return !context.isInShape("mask");
},
action: [maskType + "-mask:start", maskType + "-mask:show"],
arg: [{ maskStyle: mask === null || mask === void 0 ? void 0 : mask.style }]
},
{
trigger: "mask:dragstart",
action: [maskType + "-mask:moveStart"]
}
],
processing: [
{
trigger: "plot:mousemove",
action: [maskType + "-mask:resize"]
},
{
trigger: "mask:drag",
action: [maskType + "-mask:move"]
},
{
trigger: "mask:change",
action: ["element-range-highlight:highlight"]
}
],
end: [
{ trigger: "plot:mouseup", action: [maskType + "-mask:end"] },
{ trigger: "mask:dragend", action: [maskType + "-mask:moveEnd"] },
{
trigger: "document:mouseup",
isEnable: function(context) {
return !context.isInPlot();
},
action: ["element-range-highlight:clear", maskType + "-mask:end", maskType + "-mask:hide"]
}
],
rollback: [{ trigger: "dblclick", action: ["element-range-highlight:clear", maskType + "-mask:hide"] }]
};
case "brush-y":
return {
showEnable: [
{ trigger: "plot:mouseenter", action: "cursor:crosshair" },
{ trigger: "plot:mouseleave", action: "cursor:default" }
],
start: [
{
trigger: "mousedown",
isEnable: isPointInView2,
action: ["brush-y:start", maskType + "-mask:start", maskType + "-mask:show"],
arg: [null, { maskStyle: mask === null || mask === void 0 ? void 0 : mask.style }]
}
],
processing: [
{
trigger: "mousemove",
isEnable: isPointInView2,
action: [maskType + "-mask:resize"]
}
],
end: [
{
trigger: "mouseup",
isEnable: isPointInView2,
action: ["brush-y:filter", "brush-y:end", maskType + "-mask:end", maskType + "-mask:hide"]
}
],
rollback: [{ trigger: "dblclick", action: ["brush-y:reset"] }]
};
case "brush-y-highlight":
return {
showEnable: [
{ trigger: "plot:mouseenter", action: "cursor:crosshair" },
{ trigger: "mask:mouseenter", action: "cursor:move" },
{ trigger: "plot:mouseleave", action: "cursor:default" },
{ trigger: "mask:mouseleave", action: "cursor:crosshair" }
],
start: [
{
trigger: "plot:mousedown",
isEnable: function(context) {
return !context.isInShape("mask");
},
action: [maskType + "-mask:start", maskType + "-mask:show"],
arg: [{ maskStyle: mask === null || mask === void 0 ? void 0 : mask.style }]
},
{
trigger: "mask:dragstart",
action: [maskType + "-mask:moveStart"]
}
],
processing: [
{
trigger: "plot:mousemove",
action: [maskType + "-mask:resize"]
},
{
trigger: "mask:drag",
action: [maskType + "-mask:move"]
},
{
trigger: "mask:change",
action: ["element-range-highlight:highlight"]
}
],
end: [
{ trigger: "plot:mouseup", action: [maskType + "-mask:end"] },
{ trigger: "mask:dragend", action: [maskType + "-mask:moveEnd"] },
{
trigger: "document:mouseup",
isEnable: function(context) {
return !context.isInPlot();
},
action: ["element-range-highlight:clear", maskType + "-mask:end", maskType + "-mask:hide"]
}
],
rollback: [{ trigger: "dblclick", action: ["element-range-highlight:clear", maskType + "-mask:hide"] }]
};
default:
return {};
}
}
registerInteraction("brush", getInteractionCfg("brush"));
registerInteraction("brush-highlight", getInteractionCfg("brush-highlight"));
registerInteraction("brush-x", getInteractionCfg("brush-x", "x-rect"));
registerInteraction("brush-y", getInteractionCfg("brush-y", "y-rect"));
registerInteraction("brush-x-highlight", getInteractionCfg("brush-x-highlight", "x-rect"));
registerInteraction("brush-y-highlight", getInteractionCfg("brush-y-highlight", "y-rect"));
// node_modules/@antv/g2plot/esm/adaptor/brush.js
var BRUSH_TYPES = ["brush", "brush-x", "brush-y", "brush-highlight", "brush-x-highlight", "brush-y-highlight"];
function brushInteraction(params) {
var options = params.options;
var brush = options.brush;
var interactions = filter_default(options.interactions || [], function(i4) {
return BRUSH_TYPES.indexOf(i4.type) === -1;
});
if (brush === null || brush === void 0 ? void 0 : brush.enabled) {
BRUSH_TYPES.forEach(function(type2) {
var _a6;
var enable = false;
switch (brush.type) {
case "x-rect":
enable = type2 === (brush.action === "highlight" ? "brush-x-highlight" : "brush-x");
break;
case "y-rect":
enable = type2 === (brush.action === "highlight" ? "brush-y-highlight" : "brush-y");
break;
default:
enable = type2 === (brush.action === "highlight" ? "brush-highlight" : "brush");
break;
}
var obj = { type: type2, enable };
if (((_a6 = brush.mask) === null || _a6 === void 0 ? void 0 : _a6.style) || brush.type) {
obj.cfg = getInteractionCfg(type2, brush.type, brush.mask);
}
interactions.push(obj);
});
if ((brush === null || brush === void 0 ? void 0 : brush.action) !== "highlight") {
interactions.push({
type: "filter-action",
cfg: {
buttonConfig: brush.button
}
});
}
}
return deepAssign({}, params, { options: { interactions } });
}
// node_modules/@antv/g2plot/esm/plots/column/adaptor.js
function defaultOptions(params) {
var options = params.options;
var legend18 = options.legend;
var seriesField = options.seriesField, isStack = options.isStack;
if (seriesField) {
if (legend18 !== false) {
legend18 = __assign({ position: isStack ? "right-top" : "top-left" }, legend18);
}
} else {
legend18 = false;
}
params.options.legend = legend18;
return params;
}
function geometry4(params) {
var chart = params.chart, options = params.options;
var data3 = options.data, columnStyle = options.columnStyle, color4 = options.color, columnWidthRatio = options.columnWidthRatio, isPercent = options.isPercent, isGroup = options.isGroup, isStack = options.isStack, xField = options.xField, yField = options.yField, seriesField = options.seriesField, groupField = options.groupField, tooltip10 = options.tooltip, shape = options.shape;
var percentData = isPercent && isGroup && isStack ? getDeepPercent(data3, yField, [xField, groupField], yField) : getDataWhetherPecentage(data3, yField, xField, yField, isPercent);
var chartData = [];
if (isStack && seriesField && !isGroup) {
percentData.forEach(function(item) {
var stackedItem = chartData.find(function(v3) {
return v3[xField] === item[xField] && v3[seriesField] === item[seriesField];
});
if (stackedItem) {
stackedItem[yField] += item[yField] || 0;
} else {
chartData.push(__assign({}, item));
}
});
} else {
chartData = percentData;
}
chart.data(chartData);
var tooltipOptions = isPercent ? __assign({ formatter: function(datum) {
return {
name: isGroup && isStack ? datum[seriesField] + " - " + datum[groupField] : datum[seriesField] || datum[xField],
value: (Number(datum[yField]) * 100).toFixed(2) + "%"
};
} }, tooltip10) : tooltip10;
var p4 = deepAssign({}, params, {
options: {
data: chartData,
widthRatio: columnWidthRatio,
tooltip: tooltipOptions,
interval: {
shape,
style: columnStyle,
color: color4
}
}
});
interval2(p4);
return p4;
}
function meta2(params) {
var _a6, _b;
var options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField, data3 = options.data, isPercent = options.isPercent;
var percentYMeta = isPercent ? { max: 1, min: 0, minLimit: 0, maxLimit: 1 } : {};
return flow(scale7((_a6 = {}, _a6[xField] = xAxis, _a6[yField] = yAxis, _a6), (_b = {}, _b[xField] = {
type: "cat"
}, _b[yField] = __assign(__assign({}, adjustYMetaByZero(data3, yField)), percentYMeta), _b)))(params);
}
function axis2(params) {
var chart = params.chart, options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField;
if (xAxis === false) {
chart.axis(xField, false);
} else {
chart.axis(xField, xAxis);
}
if (yAxis === false) {
chart.axis(yField, false);
} else {
chart.axis(yField, yAxis);
}
return params;
}
function legend3(params) {
var chart = params.chart, options = params.options;
var legend18 = options.legend, seriesField = options.seriesField;
if (legend18 && seriesField) {
chart.legend(seriesField, legend18);
} else if (legend18 === false) {
chart.legend(false);
}
return params;
}
function label3(params) {
var chart = params.chart, options = params.options;
var label17 = options.label, yField = options.yField, isRange = options.isRange;
var geometry35 = findGeometry(chart, "interval");
if (!label17) {
geometry35.label(false);
} else {
var callback = label17.callback, cfg = __rest(label17, ["callback"]);
geometry35.label({
fields: [yField],
callback,
cfg: __assign({
layout: (cfg === null || cfg === void 0 ? void 0 : cfg.position) ? void 0 : [
{ type: "interval-adjust-position" },
{ type: "interval-hide-overlap" },
{ type: "adjust-color" },
{ type: "limit-in-plot", cfg: { action: "hide" } }
]
}, transformLabel(isRange ? __assign({ content: function(item) {
var _a6;
return (_a6 = item[yField]) === null || _a6 === void 0 ? void 0 : _a6.join("-");
} }, cfg) : cfg))
});
}
return params;
}
function columnTooltip(params) {
var chart = params.chart, options = params.options;
var tooltip10 = options.tooltip, isGroup = options.isGroup, isStack = options.isStack, groupField = options.groupField, data3 = options.data, xField = options.xField, yField = options.yField, seriesField = options.seriesField;
if (tooltip10 === false) {
chart.tooltip(false);
} else {
var tooltipOptions = tooltip10;
if (isGroup && isStack) {
var tooltipFormatter_1 = (tooltipOptions === null || tooltipOptions === void 0 ? void 0 : tooltipOptions.formatter) || function(datum) {
return { name: datum[seriesField] + " - " + datum[groupField], value: datum[yField] };
};
tooltipOptions = __assign(__assign({}, tooltipOptions), { customItems: function(originalItems) {
var items = [];
each_default(originalItems, function(item) {
var datas = filter_default(data3, function(d3) {
return is_match_default(d3, pick(item.data, [xField, seriesField]));
});
datas.forEach(function(datum) {
items.push(__assign(__assign(__assign({}, item), { value: datum[yField], data: datum, mappingData: { _origin: datum } }), tooltipFormatter_1(datum)));
});
});
return items;
} });
}
chart.tooltip(tooltipOptions);
}
return params;
}
function adaptor3(params, isBar) {
if (isBar === void 0) {
isBar = false;
}
var options = params.options;
var seriesField = options.seriesField;
return flow(defaultOptions, theme, pattern("columnStyle"), state, geometry4, meta2, axis2, legend3, columnTooltip, slider, scrollbar, label3, brushInteraction, interaction, animation, annotation(), conversionTag(options.yField, !isBar, !!seriesField), connectedArea(!options.isStack), limitInPlot2)(params);
}
// node_modules/@antv/g2plot/esm/plots/column/constants.js
var DEFAULT_OPTIONS3 = deepAssign({}, Plot.getDefaultOptions(), {
columnWidthRatio: 0.6,
marginRatio: 1 / 32,
tooltip: {
shared: true,
showMarkers: false,
offset: 20
},
legend: {
radio: {}
},
interactions: [{ type: "active-region" }]
});
// node_modules/@antv/g2plot/esm/plots/column/index.js
var Column = function(_super) {
__extends(Column2, _super);
function Column2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "column";
return _this;
}
Column2.getDefaultOptions = function() {
return DEFAULT_OPTIONS3;
};
Column2.prototype.changeData = function(data3) {
this.updateOption({ data: data3 });
var _a6 = this.options, yField = _a6.yField, xField = _a6.xField, isPercent = _a6.isPercent;
var _b = this, chart = _b.chart, options = _b.options;
meta2({ chart, options });
this.chart.changeData(getDataWhetherPecentage(data3, yField, xField, yField, isPercent));
};
Column2.prototype.getDefaultOptions = function() {
return Column2.getDefaultOptions();
};
Column2.prototype.getSchemaAdaptor = function() {
return adaptor3;
};
return Column2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/bar/adaptor.js
function defaultOptions2(params) {
var options = params.options;
var xField = options.xField, yField = options.yField, xAxis = options.xAxis, yAxis = options.yAxis;
var position2 = {
left: "bottom",
right: "top",
top: "left",
bottom: "right"
};
var verticalAxis = yAxis !== false ? __assign({ position: position2[(yAxis === null || yAxis === void 0 ? void 0 : yAxis.position) || "left"] }, yAxis) : false;
var horizontalAxis = xAxis !== false ? __assign({ position: position2[(xAxis === null || xAxis === void 0 ? void 0 : xAxis.position) || "bottom"] }, xAxis) : false;
return __assign(__assign({}, params), { options: __assign(__assign({}, options), {
xField: yField,
yField: xField,
xAxis: verticalAxis,
yAxis: horizontalAxis
}) });
}
function label4(params) {
var options = params.options;
var label17 = options.label;
if (label17 && !label17.position) {
label17.position = "left";
if (!label17.layout) {
label17.layout = [
{ type: "interval-adjust-position" },
{ type: "interval-hide-overlap" },
{ type: "adjust-color" },
{ type: "limit-in-plot", cfg: { action: "hide" } }
];
}
}
return deepAssign({}, params, { options: { label: label17 } });
}
function legend4(params) {
var options = params.options;
var seriesField = options.seriesField, isStack = options.isStack;
var legend18 = options.legend;
if (seriesField) {
if (legend18 !== false) {
legend18 = __assign({ position: isStack ? "top-left" : "right-top" }, legend18 || {});
}
} else {
legend18 = false;
}
return deepAssign({}, params, { options: { legend: legend18 } });
}
function coordinate2(params) {
var chart = params.chart;
chart.coordinate({ actions: [["transpose"], ["reflect", "y"]] });
return params;
}
function geometry5(params) {
var chart = params.chart, options = params.options;
var barStyle = options.barStyle, barWidthRatio = options.barWidthRatio, minBarWidth = options.minBarWidth, maxBarWidth = options.maxBarWidth, barBackground = options.barBackground;
return adaptor3({
chart,
options: __assign(__assign({}, options), {
columnStyle: barStyle,
columnWidthRatio: barWidthRatio,
minColumnWidth: minBarWidth,
maxColumnWidth: maxBarWidth,
columnBackground: barBackground
})
}, true);
}
function adaptor4(params) {
return flow(defaultOptions2, label4, legend4, tooltip, coordinate2, geometry5)(params);
}
// node_modules/@antv/g2plot/esm/plots/bar/constants.js
var DEFAULT_OPTIONS4 = deepAssign({}, Plot.getDefaultOptions(), {
barWidthRatio: 0.6,
marginRatio: 1 / 32,
tooltip: {
shared: true,
showMarkers: false,
offset: 20
},
legend: {
radio: {}
},
interactions: [{ type: "active-region" }]
});
// node_modules/@antv/g2plot/esm/plots/bar/index.js
var Bar = function(_super) {
__extends(Bar2, _super);
function Bar2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "bar";
return _this;
}
Bar2.getDefaultOptions = function() {
return DEFAULT_OPTIONS4;
};
Bar2.prototype.changeData = function(data3) {
this.updateOption({ data: data3 });
var _a6 = this, chart = _a6.chart, options = _a6.options;
var xField = options.xField, yField = options.yField, isPercent = options.isPercent;
var switchedFieldOptions = __assign(__assign({}, options), { xField: yField, yField: xField });
meta2({ chart, options: switchedFieldOptions });
chart.changeData(getDataWhetherPecentage(data3, xField, yField, xField, isPercent));
};
Bar2.prototype.getDefaultOptions = function() {
return Bar2.getDefaultOptions();
};
Bar2.prototype.getSchemaAdaptor = function() {
return adaptor4;
};
return Bar2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/pie/contants.js
var DEFAULT_OPTIONS5 = deepAssign({}, Plot.getDefaultOptions(), {
legend: {
position: "right",
radio: {}
},
tooltip: {
shared: false,
showTitle: false,
showMarkers: false
},
label: {
layout: { type: "limit-in-plot", cfg: { action: "ellipsis" } }
},
pieStyle: {
stroke: "white",
lineWidth: 1
},
statistic: {
title: {
style: { fontWeight: 300, color: "#4B535E", textAlign: "center", fontSize: "20px", lineHeight: 1 }
},
content: {
style: {
fontWeight: "bold",
color: "rgba(44,53,66,0.85)",
textAlign: "center",
fontSize: "32px",
lineHeight: 1
}
}
},
theme: {
components: {
annotation: {
text: {
animate: false
}
}
}
}
});
// node_modules/@antv/g2plot/esm/plots/pie/utils.js
function getTotalValue(data3, field6) {
var total = null;
each_default(data3, function(item) {
if (typeof item[field6] === "number") {
total += item[field6];
}
});
return total;
}
function adaptOffset(type2, offset) {
var defaultOffset;
switch (type2) {
case "inner":
defaultOffset = "-30%";
if (is_string_default(offset) && offset.endsWith("%")) {
return parseFloat(offset) * 0.01 > 0 ? defaultOffset : offset;
}
return offset < 0 ? offset : defaultOffset;
case "outer":
defaultOffset = 12;
if (is_string_default(offset) && offset.endsWith("%")) {
return parseFloat(offset) * 0.01 < 0 ? defaultOffset : offset;
}
return offset > 0 ? offset : defaultOffset;
default:
return offset;
}
}
function isAllZero(data3, angleField) {
return every_default(processIllegalData(data3, angleField), function(d3) {
return d3[angleField] === 0;
});
}
// node_modules/@antv/g2plot/esm/utils/matrix.js
var ORIGIN_MATRIX = [1, 0, 0, 0, 1, 0, 0, 0, 1];
function transform5(actions, matrix) {
var ulMatrix = matrix ? __spreadArrays(matrix) : __spreadArrays(ORIGIN_MATRIX);
return Util.transform(ulMatrix, actions);
}
// node_modules/@antv/g2plot/esm/plots/pie/interactions/actions/legend-active.js
var PieLegendAction = function(_super) {
__extends(PieLegendAction2, _super);
function PieLegendAction2() {
return _super !== null && _super.apply(this, arguments) || this;
}
PieLegendAction2.prototype.getActiveElements = function() {
var delegateObject = Util.getDelegationObject(this.context);
if (delegateObject) {
var view = this.context.view;
var component2 = delegateObject.component, item_1 = delegateObject.item;
var field_1 = component2.get("field");
if (field_1) {
var elements = view.geometries[0].elements;
return elements.filter(function(ele) {
return ele.getModel().data[field_1] === item_1.value;
});
}
}
return [];
};
PieLegendAction2.prototype.getActiveElementLabels = function() {
var view = this.context.view;
var elements = this.getActiveElements();
var labels = view.geometries[0].labelsContainer.getChildren();
return labels.filter(function(label17) {
return elements.find(function(ele) {
return is_equal_default(ele.getData(), label17.get("data"));
});
});
};
PieLegendAction2.prototype.transfrom = function(offset) {
if (offset === void 0) {
offset = 7.5;
}
var elements = this.getActiveElements();
var elementLabels = this.getActiveElementLabels();
elements.forEach(function(element, idx) {
var labelShape = elementLabels[idx];
var coordinate11 = element.geometry.coordinate;
if (coordinate11.isPolar && coordinate11.isTransposed) {
var _a6 = Util.getAngle(element.getModel(), coordinate11), startAngle = _a6.startAngle, endAngle = _a6.endAngle;
var middleAngle = (startAngle + endAngle) / 2;
var r4 = offset;
var x6 = r4 * Math.cos(middleAngle);
var y5 = r4 * Math.sin(middleAngle);
element.shape.setMatrix(transform5([["t", x6, y5]]));
labelShape.setMatrix(transform5([["t", x6, y5]]));
}
});
};
PieLegendAction2.prototype.active = function() {
this.transfrom();
};
PieLegendAction2.prototype.reset = function() {
this.transfrom(0);
};
return PieLegendAction2;
}(base_default12);
// node_modules/@antv/g2plot/esm/plots/pie/interactions/util.js
function getCurrentElement2(context) {
var event = context.event;
var element;
var target = event.target;
if (target) {
element = target.get("element");
}
return element;
}
// node_modules/@antv/g2plot/esm/plots/pie/interactions/actions/statistic-active.js
var StatisticAction = function(_super) {
__extends(StatisticAction2, _super);
function StatisticAction2() {
return _super !== null && _super.apply(this, arguments) || this;
}
StatisticAction2.prototype.getAnnotations = function(_view) {
var view = _view || this.context.view;
return view.getController("annotation").option;
};
StatisticAction2.prototype.getInitialAnnotation = function() {
return this.initialAnnotation;
};
StatisticAction2.prototype.init = function() {
var _this = this;
var view = this.context.view;
view.removeInteraction("tooltip");
view.on("afterchangesize", function() {
var annotations = _this.getAnnotations(view);
_this.initialAnnotation = annotations;
});
};
StatisticAction2.prototype.change = function(arg) {
var _a6 = this.context, view = _a6.view, event = _a6.event;
if (!this.initialAnnotation) {
this.initialAnnotation = this.getAnnotations();
}
var data3 = get_default(event, ["data", "data"]);
if (event.type.match("legend-item")) {
var delegateObject = Util.getDelegationObject(this.context);
var colorField_1 = view.getGroupedFields()[0];
if (delegateObject && colorField_1) {
var item_1 = delegateObject.item;
data3 = view.getData().find(function(d3) {
return d3[colorField_1] === item_1.value;
});
}
}
if (data3) {
var annotations = get_default(arg, "annotations", []);
var statistic4 = get_default(arg, "statistic", {});
view.getController("annotation").clear(true);
each_default(annotations, function(annotation4) {
if (typeof annotation4 === "object") {
view.annotation()[annotation4.type](annotation4);
}
});
renderStatistic(view, { statistic: statistic4, plotType: "pie" }, data3);
view.render(true);
}
var ele = getCurrentElement2(this.context);
if (ele) {
ele.shape.toFront();
}
};
StatisticAction2.prototype.reset = function() {
var view = this.context.view;
var annotationController = view.getController("annotation");
annotationController.clear(true);
var initialStatistic = this.getInitialAnnotation();
each_default(initialStatistic, function(a4) {
view.annotation()[a4.type](a4);
});
view.render(true);
};
return StatisticAction2;
}(base_default12);
// node_modules/@antv/g2plot/esm/plots/pie/interactions/index.js
var PIE_STATISTIC = "pie-statistic";
registerAction(PIE_STATISTIC, StatisticAction);
registerInteraction("pie-statistic-active", {
start: [{ trigger: "element:mouseenter", action: "pie-statistic:change" }],
end: [{ trigger: "element:mouseleave", action: "pie-statistic:reset" }]
});
registerAction("pie-legend", PieLegendAction);
registerInteraction("pie-legend-active", {
start: [{ trigger: "legend-item:mouseenter", action: "pie-legend:active" }],
end: [{ trigger: "legend-item:mouseleave", action: "pie-legend:reset" }]
});
// node_modules/@antv/g2plot/esm/plots/pie/adaptor.js
function geometry6(params) {
var chart = params.chart, options = params.options;
var data3 = options.data, angleField = options.angleField, colorField = options.colorField, color4 = options.color, pieStyle = options.pieStyle;
var processData2 = processIllegalData(data3, angleField);
if (isAllZero(processData2, angleField)) {
var percentageField_1 = "$$percentage$$";
processData2 = processData2.map(function(d3) {
var _a6;
return __assign(__assign({}, d3), (_a6 = {}, _a6[percentageField_1] = 1 / processData2.length, _a6));
});
chart.data(processData2);
var p4 = deepAssign({}, params, {
options: {
xField: "1",
yField: percentageField_1,
seriesField: colorField,
isStack: true,
interval: {
color: color4,
style: pieStyle
},
args: {
zIndexReversed: true,
sortZIndex: true
}
}
});
interval2(p4);
} else {
chart.data(processData2);
var p4 = deepAssign({}, params, {
options: {
xField: "1",
yField: angleField,
seriesField: colorField,
isStack: true,
interval: {
color: color4,
style: pieStyle
},
args: {
zIndexReversed: true,
sortZIndex: true
}
}
});
interval2(p4);
}
return params;
}
function meta3(params) {
var _a6;
var chart = params.chart, options = params.options;
var meta23 = options.meta, colorField = options.colorField;
var scales = deepAssign({}, meta23);
chart.scale(scales, (_a6 = {}, _a6[colorField] = { type: "cat" }, _a6));
return params;
}
function coordinate3(params) {
var chart = params.chart, options = params.options;
var radius = options.radius, innerRadius = options.innerRadius, startAngle = options.startAngle, endAngle = options.endAngle;
chart.coordinate({
type: "theta",
cfg: {
radius,
innerRadius,
startAngle,
endAngle
}
});
return params;
}
function label5(params) {
var chart = params.chart, options = params.options;
var label17 = options.label, colorField = options.colorField, angleField = options.angleField;
var geometry35 = chart.geometries[0];
if (!label17) {
geometry35.label(false);
} else {
var callback = label17.callback, cfg = __rest(label17, ["callback"]);
var labelCfg = transformLabel(cfg);
if (labelCfg.content) {
var content_1 = labelCfg.content;
labelCfg.content = function(data3, dataum, index2) {
var name = data3[colorField];
var value2 = data3[angleField];
var angleScale = chart.getScaleByField(angleField);
var percent2 = angleScale === null || angleScale === void 0 ? void 0 : angleScale.scale(value2);
return is_function_default(content_1) ? content_1(__assign(__assign({}, data3), { percent: percent2 }), dataum, index2) : is_string_default(content_1) ? template(content_1, {
value: value2,
name,
percentage: is_number_default(percent2) && !is_nil_default(value2) ? (percent2 * 100).toFixed(2) + "%" : null
}) : content_1;
};
}
var LABEL_LAYOUT_TYPE_MAP = {
inner: "",
outer: "pie-outer",
spider: "pie-spider"
};
var labelLayoutType = labelCfg.type ? LABEL_LAYOUT_TYPE_MAP[labelCfg.type] : "pie-outer";
var labelLayoutCfg = labelCfg.layout ? !is_array_default(labelCfg.layout) ? [labelCfg.layout] : labelCfg.layout : [];
labelCfg.layout = (labelLayoutType ? [{ type: labelLayoutType }] : []).concat(labelLayoutCfg);
geometry35.label({
fields: colorField ? [angleField, colorField] : [angleField],
callback,
cfg: __assign(__assign({}, labelCfg), { offset: adaptOffset(labelCfg.type, labelCfg.offset), type: "pie" })
});
}
return params;
}
function transformStatisticOptions(options) {
var innerRadius = options.innerRadius, statistic4 = options.statistic, angleField = options.angleField, colorField = options.colorField, meta23 = options.meta, locale = options.locale;
var i18n = getLocale(locale);
if (innerRadius && statistic4) {
var _a6 = deepAssign({}, DEFAULT_OPTIONS5.statistic, statistic4), titleOpt_1 = _a6.title, contentOpt_1 = _a6.content;
if (titleOpt_1 !== false) {
titleOpt_1 = deepAssign({}, {
formatter: function(datum) {
if (datum) {
return datum[colorField];
}
return !is_nil_default(titleOpt_1.content) ? titleOpt_1.content : i18n.get(["statistic", "total"]);
}
}, titleOpt_1);
}
if (contentOpt_1 !== false) {
contentOpt_1 = deepAssign({}, {
formatter: function(datum, data3) {
var dataValue = datum ? datum[angleField] : getTotalValue(data3, angleField);
var metaFormatter = get_default(meta23, [angleField, "formatter"]) || function(v3) {
return v3;
};
if (datum) {
return metaFormatter(dataValue);
}
return !is_nil_default(contentOpt_1.content) ? contentOpt_1.content : metaFormatter(dataValue);
}
}, contentOpt_1);
}
return deepAssign({}, { statistic: { title: titleOpt_1, content: contentOpt_1 } }, options);
}
return options;
}
function pieAnnotation(params) {
var chart = params.chart, options = params.options;
var _a6 = transformStatisticOptions(options), innerRadius = _a6.innerRadius, statistic4 = _a6.statistic;
chart.getController("annotation").clear(true);
flow(annotation())(params);
if (innerRadius && statistic4) {
renderStatistic(chart, { statistic: statistic4, plotType: "pie" });
}
return params;
}
function tooltip2(params) {
var chart = params.chart, options = params.options;
var tooltip10 = options.tooltip, colorField = options.colorField, angleField = options.angleField, data3 = options.data;
if (tooltip10 === false) {
chart.tooltip(tooltip10);
} else {
chart.tooltip(deepAssign({}, tooltip10, { shared: false }));
if (isAllZero(data3, angleField)) {
var fields = get_default(tooltip10, "fields");
var formatter = get_default(tooltip10, "formatter");
if (is_empty_default(get_default(tooltip10, "fields"))) {
fields = [colorField, angleField];
formatter = formatter || function(datum) {
return { name: datum[colorField], value: to_string_default(datum[angleField]) };
};
}
chart.geometries[0].tooltip(fields.join("*"), getMappingFunction(fields, formatter));
}
}
return params;
}
function interaction2(params) {
var chart = params.chart, options = params.options;
var _a6 = transformStatisticOptions(options), interactions = _a6.interactions, statistic4 = _a6.statistic, annotations = _a6.annotations;
each_default(interactions, function(i4) {
var _a7, _b;
if (i4.enable === false) {
chart.removeInteraction(i4.type);
} else if (i4.type === "pie-statistic-active") {
var startStages_1 = [];
if (!((_a7 = i4.cfg) === null || _a7 === void 0 ? void 0 : _a7.start)) {
startStages_1 = [
{
trigger: "element:mouseenter",
action: PIE_STATISTIC + ":change",
arg: { statistic: statistic4, annotations }
}
];
}
each_default((_b = i4.cfg) === null || _b === void 0 ? void 0 : _b.start, function(stage) {
startStages_1.push(__assign(__assign({}, stage), { arg: { statistic: statistic4, annotations } }));
});
chart.interaction(i4.type, deepAssign({}, i4.cfg, { start: startStages_1 }));
} else {
chart.interaction(i4.type, i4.cfg || {});
}
});
return params;
}
function adaptor5(params) {
return flow(pattern("pieStyle"), geometry6, meta3, theme, coordinate3, legend, tooltip2, label5, state, pieAnnotation, interaction2, animation)(params);
}
// node_modules/@antv/g2plot/esm/plots/pie/index.js
var Pie = function(_super) {
__extends(Pie2, _super);
function Pie2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "pie";
return _this;
}
Pie2.getDefaultOptions = function() {
return DEFAULT_OPTIONS5;
};
Pie2.prototype.changeData = function(data3) {
this.chart.emit(VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, event_default.fromData(this.chart, VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, null));
var prevOptions = this.options;
var angleField = this.options.angleField;
var prevData = processIllegalData(prevOptions.data, angleField);
var curData = processIllegalData(data3, angleField);
if (isAllZero(prevData, angleField) || isAllZero(curData, angleField)) {
this.update({ data: data3 });
} else {
this.updateOption({ data: data3 });
this.chart.data(curData);
pieAnnotation({ chart: this.chart, options: this.options });
this.chart.render(true);
}
this.chart.emit(VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA, event_default.fromData(this.chart, VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA, null));
};
Pie2.prototype.getDefaultOptions = function() {
return Pie2.getDefaultOptions();
};
Pie2.prototype.getSchemaAdaptor = function() {
return adaptor5;
};
return Pie2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/rose/adaptor.js
function geometry7(params) {
var chart = params.chart, options = params.options;
var data3 = options.data, sectorStyle = options.sectorStyle, color4 = options.color;
chart.data(data3);
flow(interval2)(deepAssign({}, params, {
options: {
marginRatio: 1,
interval: {
style: sectorStyle,
color: color4
}
}
}));
return params;
}
function label6(params) {
var chart = params.chart, options = params.options;
var label17 = options.label, xField = options.xField;
var geometry35 = findGeometry(chart, "interval");
if (label17 === false) {
geometry35.label(false);
} else if (is_object_default(label17)) {
var callback = label17.callback, fields = label17.fields, cfg = __rest(label17, ["callback", "fields"]);
var offset = cfg.offset;
var layout6 = cfg.layout;
if (offset === void 0 || offset >= 0) {
layout6 = layout6 ? is_array_default(layout6) ? layout6 : [layout6] : [];
cfg.layout = filter_default(layout6, function(v3) {
return v3.type !== "limit-in-shape";
});
cfg.layout.length || delete cfg.layout;
}
geometry35.label({
fields: fields || [xField],
callback,
cfg: transformLabel(cfg)
});
} else {
log2(LEVEL.WARN, label17 === null, "the label option must be an Object.");
geometry35.label({ fields: [xField] });
}
return params;
}
function legend5(params) {
var chart = params.chart, options = params.options;
var legend18 = options.legend, seriesField = options.seriesField;
if (legend18 === false) {
chart.legend(false);
} else if (seriesField) {
chart.legend(seriesField, legend18);
}
return params;
}
function coordinate4(params) {
var chart = params.chart, options = params.options;
var radius = options.radius, innerRadius = options.innerRadius, startAngle = options.startAngle, endAngle = options.endAngle;
chart.coordinate({
type: "polar",
cfg: {
radius,
innerRadius,
startAngle,
endAngle
}
});
return params;
}
function meta4(params) {
var _a6;
var options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField;
return flow(scale7((_a6 = {}, _a6[xField] = xAxis, _a6[yField] = yAxis, _a6)))(params);
}
function axis3(params) {
var chart = params.chart, options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField;
if (!xAxis) {
chart.axis(xField, false);
} else {
chart.axis(xField, xAxis);
}
if (!yAxis) {
chart.axis(yField, false);
} else {
chart.axis(yField, yAxis);
}
return params;
}
function adaptor6(params) {
flow(pattern("sectorStyle"), geometry7, meta4, label6, coordinate4, axis3, legend5, tooltip, interaction, animation, theme, annotation(), state)(params);
}
// node_modules/@antv/g2plot/esm/plots/rose/constant.js
var DEFAULT_OPTIONS6 = deepAssign({}, Plot.getDefaultOptions(), {
xAxis: false,
yAxis: false,
legend: {
position: "right",
radio: {}
},
sectorStyle: {
stroke: "#fff",
lineWidth: 1
},
label: {
layout: {
type: "limit-in-shape"
}
},
tooltip: {
shared: true,
showMarkers: false
},
interactions: [{ type: "active-region" }]
});
// node_modules/@antv/g2plot/esm/plots/rose/index.js
var Rose = function(_super) {
__extends(Rose2, _super);
function Rose2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "rose";
return _this;
}
Rose2.getDefaultOptions = function() {
return DEFAULT_OPTIONS6;
};
Rose2.prototype.changeData = function(data3) {
this.updateOption({ data: data3 });
this.chart.changeData(data3);
};
Rose2.prototype.getDefaultOptions = function() {
return Rose2.getDefaultOptions();
};
Rose2.prototype.getSchemaAdaptor = function() {
return adaptor6;
};
return Rose2;
}(Plot);
// node_modules/@antv/g2plot/esm/utils/transform/word-cloud.js
var DEFAULT_OPTIONS7 = {
font: function() {
return "serif";
},
padding: 1,
size: [500, 500],
spiral: "archimedean",
timeInterval: 3e3
};
function wordCloud(words, options) {
options = mix({}, DEFAULT_OPTIONS7, options);
return transform6(words, options);
}
function transform6(words, options) {
var layout6 = tagCloud();
["font", "fontSize", "fontWeight", "padding", "rotate", "size", "spiral", "timeInterval", "random"].forEach(function(key) {
if (!is_nil_default(options[key])) {
layout6[key](options[key]);
}
});
layout6.words(words);
if (options.imageMask) {
layout6.createMask(options.imageMask);
}
var result = layout6.start();
var tags = result._tags;
tags.forEach(function(tag) {
tag.x += options.size[0] / 2;
tag.y += options.size[1] / 2;
});
var _a6 = options.size, w4 = _a6[0], h3 = _a6[1];
tags.push({
text: "",
value: 0,
x: 0,
y: 0,
opacity: 0
});
tags.push({
text: "",
value: 0,
x: w4,
y: h3,
opacity: 0
});
return tags;
}
var cloudRadians = Math.PI / 180;
var cw = 1 << 11 >> 5;
var ch = 1 << 11;
function cloudText(d3) {
return d3.text;
}
function cloudFont() {
return "serif";
}
function cloudFontNormal() {
return "normal";
}
function cloudFontSize(d3) {
return d3.value;
}
function cloudRotate() {
return ~~(Math.random() * 2) * 90;
}
function cloudPadding() {
return 1;
}
function cloudSprite(contextAndRatio, d3, data3, di) {
if (d3.sprite)
return;
var c5 = contextAndRatio.context, ratio = contextAndRatio.ratio;
c5.clearRect(0, 0, (cw << 5) / ratio, ch / ratio);
var x6 = 0, y5 = 0, maxh = 0;
var n3 = data3.length;
--di;
while (++di < n3) {
d3 = data3[di];
c5.save();
c5.font = d3.style + " " + d3.weight + " " + ~~((d3.size + 1) / ratio) + "px " + d3.font;
var w4 = c5.measureText(d3.text + "m").width * ratio, h3 = d3.size << 1;
if (d3.rotate) {
var sr = Math.sin(d3.rotate * cloudRadians), cr = Math.cos(d3.rotate * cloudRadians), wcr = w4 * cr, wsr = w4 * sr, hcr = h3 * cr, hsr = h3 * sr;
w4 = Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 31 >> 5 << 5;
h3 = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr));
} else {
w4 = w4 + 31 >> 5 << 5;
}
if (h3 > maxh)
maxh = h3;
if (x6 + w4 >= cw << 5) {
x6 = 0;
y5 += maxh;
maxh = 0;
}
if (y5 + h3 >= ch)
break;
c5.translate((x6 + (w4 >> 1)) / ratio, (y5 + (h3 >> 1)) / ratio);
if (d3.rotate)
c5.rotate(d3.rotate * cloudRadians);
c5.fillText(d3.text, 0, 0);
if (d3.padding) {
c5.lineWidth = 2 * d3.padding;
c5.strokeText(d3.text, 0, 0);
}
c5.restore();
d3.width = w4;
d3.height = h3;
d3.xoff = x6;
d3.yoff = y5;
d3.x1 = w4 >> 1;
d3.y1 = h3 >> 1;
d3.x0 = -d3.x1;
d3.y0 = -d3.y1;
d3.hasText = true;
x6 += w4;
}
var pixels = c5.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data, sprite = [];
while (--di >= 0) {
d3 = data3[di];
if (!d3.hasText)
continue;
var w4 = d3.width, w32 = w4 >> 5;
var h3 = d3.y1 - d3.y0;
for (var i4 = 0; i4 < h3 * w32; i4++)
sprite[i4] = 0;
x6 = d3.xoff;
if (x6 == null)
return;
y5 = d3.yoff;
var seen = 0, seenRow = -1;
for (var j4 = 0; j4 < h3; j4++) {
for (var i4 = 0; i4 < w4; i4++) {
var k4 = w32 * j4 + (i4 >> 5), m4 = pixels[(y5 + j4) * (cw << 5) + (x6 + i4) << 2] ? 1 << 31 - i4 % 32 : 0;
sprite[k4] |= m4;
seen |= m4;
}
if (seen)
seenRow = j4;
else {
d3.y0++;
h3--;
j4--;
y5++;
}
}
d3.y1 = d3.y0 + seenRow;
d3.sprite = sprite.slice(0, (d3.y1 - d3.y0) * w32);
}
}
function cloudCollide(tag, board, sw) {
sw >>= 5;
var sprite = tag.sprite, w4 = tag.width >> 5, lx = tag.x - (w4 << 4), sx = lx & 127, msx = 32 - sx, h3 = tag.y1 - tag.y0;
var x6 = (tag.y + tag.y0) * sw + (lx >> 5), last2;
for (var j4 = 0; j4 < h3; j4++) {
last2 = 0;
for (var i4 = 0; i4 <= w4; i4++) {
if ((last2 << msx | (i4 < w4 ? (last2 = sprite[j4 * w4 + i4]) >>> sx : 0)) & board[x6 + i4])
return true;
}
x6 += sw;
}
return false;
}
function cloudBounds(bounds, d3) {
var b02 = bounds[0], b12 = bounds[1];
if (d3.x + d3.x0 < b02.x)
b02.x = d3.x + d3.x0;
if (d3.y + d3.y0 < b02.y)
b02.y = d3.y + d3.y0;
if (d3.x + d3.x1 > b12.x)
b12.x = d3.x + d3.x1;
if (d3.y + d3.y1 > b12.y)
b12.y = d3.y + d3.y1;
}
function collideRects(a4, b10) {
return a4.x + a4.x1 > b10[0].x && a4.x + a4.x0 < b10[1].x && a4.y + a4.y1 > b10[0].y && a4.y + a4.y0 < b10[1].y;
}
function archimedeanSpiral(size2) {
var e4 = size2[0] / size2[1];
return function(t4) {
return [e4 * (t4 *= 0.1) * Math.cos(t4), t4 * Math.sin(t4)];
};
}
function rectangularSpiral(size2) {
var dy = 4, dx = dy * size2[0] / size2[1];
var x6 = 0, y5 = 0;
return function(t4) {
var sign = t4 < 0 ? -1 : 1;
switch (Math.sqrt(1 + 4 * sign * t4) - sign & 3) {
case 0:
x6 += dx;
break;
case 1:
y5 += dy;
break;
case 2:
x6 -= dx;
break;
default:
y5 -= dy;
break;
}
return [x6, y5];
};
}
function zeroArray(n3) {
var a4 = [];
var i4 = -1;
while (++i4 < n3)
a4[i4] = 0;
return a4;
}
function cloudCanvas() {
return document.createElement("canvas");
}
function functor(d3) {
return is_function_default(d3) ? d3 : function() {
return d3;
};
}
var spirals = {
archimedean: archimedeanSpiral,
rectangular: rectangularSpiral
};
function tagCloud() {
var size2 = [256, 256], font = cloudFont, fontSize = cloudFontSize, fontWeight = cloudFontNormal, rotate8 = cloudRotate, padding3 = cloudPadding, spiral = archimedeanSpiral, random5 = Math.random, words = [], timeInterval = Infinity;
var text = cloudText;
var fontStyle = cloudFontNormal;
var canvas = cloudCanvas;
var cloud = {};
cloud.start = function() {
var width2 = size2[0], height = size2[1];
var contextAndRatio = getContext(canvas()), board = cloud.board ? cloud.board : zeroArray((size2[0] >> 5) * size2[1]), n3 = words.length, tags = [], data3 = words.map(function(d3, i5, data4) {
d3.text = text.call(this, d3, i5, data4);
d3.font = font.call(this, d3, i5, data4);
d3.style = fontStyle.call(this, d3, i5, data4);
d3.weight = fontWeight.call(this, d3, i5, data4);
d3.rotate = rotate8.call(this, d3, i5, data4);
d3.size = ~~fontSize.call(this, d3, i5, data4);
d3.padding = padding3.call(this, d3, i5, data4);
return d3;
}).sort(function(a4, b10) {
return b10.size - a4.size;
});
var i4 = -1, bounds = !cloud.board ? null : [
{
x: 0,
y: 0
},
{
x: width2,
y: height
}
];
step();
function step() {
var start = Date.now();
while (Date.now() - start < timeInterval && ++i4 < n3) {
var d3 = data3[i4];
d3.x = width2 * (random5() + 0.5) >> 1;
d3.y = height * (random5() + 0.5) >> 1;
cloudSprite(contextAndRatio, d3, data3, i4);
if (d3.hasText && place2(board, d3, bounds)) {
tags.push(d3);
if (bounds) {
if (!cloud.hasImage) {
cloudBounds(bounds, d3);
}
} else {
bounds = [
{ x: d3.x + d3.x0, y: d3.y + d3.y0 },
{ x: d3.x + d3.x1, y: d3.y + d3.y1 }
];
}
d3.x -= size2[0] >> 1;
d3.y -= size2[1] >> 1;
}
}
cloud._tags = tags;
cloud._bounds = bounds;
}
return cloud;
};
function getContext(canvas2) {
canvas2.width = canvas2.height = 1;
var ratio = Math.sqrt(canvas2.getContext("2d").getImageData(0, 0, 1, 1).data.length >> 2);
canvas2.width = (cw << 5) / ratio;
canvas2.height = ch / ratio;
var context = canvas2.getContext("2d");
context.fillStyle = context.strokeStyle = "red";
context.textAlign = "center";
return { context, ratio };
}
function place2(board, tag, bounds) {
var startX = tag.x, startY = tag.y, maxDelta = Math.sqrt(size2[0] * size2[0] + size2[1] * size2[1]), s4 = spiral(size2), dt = random5() < 0.5 ? 1 : -1;
var dxdy, t4 = -dt, dx, dy;
while (dxdy = s4(t4 += dt)) {
dx = ~~dxdy[0];
dy = ~~dxdy[1];
if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta)
break;
tag.x = startX + dx;
tag.y = startY + dy;
if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || tag.x + tag.x1 > size2[0] || tag.y + tag.y1 > size2[1])
continue;
if (!bounds || !cloudCollide(tag, board, size2[0])) {
if (!bounds || collideRects(tag, bounds)) {
var sprite = tag.sprite, w4 = tag.width >> 5, sw = size2[0] >> 5, lx = tag.x - (w4 << 4), sx = lx & 127, msx = 32 - sx, h3 = tag.y1 - tag.y0;
var last2 = void 0, x6 = (tag.y + tag.y0) * sw + (lx >> 5);
for (var j4 = 0; j4 < h3; j4++) {
last2 = 0;
for (var i4 = 0; i4 <= w4; i4++) {
board[x6 + i4] |= last2 << msx | (i4 < w4 ? (last2 = sprite[j4 * w4 + i4]) >>> sx : 0);
}
x6 += sw;
}
delete tag.sprite;
return true;
}
}
}
return false;
}
cloud.createMask = function(img) {
var can = document.createElement("canvas");
var width2 = size2[0], height = size2[1];
if (!width2 || !height) {
return;
}
var w32 = width2 >> 5;
var board = zeroArray((width2 >> 5) * height);
can.width = width2;
can.height = height;
var cxt = can.getContext("2d");
cxt.drawImage(img, 0, 0, img.width, img.height, 0, 0, width2, height);
var imageData = cxt.getImageData(0, 0, width2, height).data;
for (var j4 = 0; j4 < height; j4++) {
for (var i4 = 0; i4 < width2; i4++) {
var k4 = w32 * j4 + (i4 >> 5);
var tmp = j4 * width2 + i4 << 2;
var flag = imageData[tmp] >= 250 && imageData[tmp + 1] >= 250 && imageData[tmp + 2] >= 250;
var m4 = flag ? 1 << 31 - i4 % 32 : 0;
board[k4] |= m4;
}
}
cloud.board = board;
cloud.hasImage = true;
};
cloud.timeInterval = function(_8) {
timeInterval = _8 == null ? Infinity : _8;
};
cloud.words = function(_8) {
words = _8;
};
cloud.size = function(_8) {
size2 = [+_8[0], +_8[1]];
};
cloud.font = function(_8) {
font = functor(_8);
};
cloud.fontWeight = function(_8) {
fontWeight = functor(_8);
};
cloud.rotate = function(_8) {
rotate8 = functor(_8);
};
cloud.spiral = function(_8) {
spiral = spirals[_8] || _8;
};
cloud.fontSize = function(_8) {
fontSize = functor(_8);
};
cloud.padding = function(_8) {
padding3 = functor(_8);
};
cloud.random = function(_8) {
random5 = functor(_8);
};
return cloud;
}
// node_modules/@antv/g2plot/esm/plots/word-cloud/utils.js
function transform7(params) {
var rawOptions = params.options, chart = params.chart;
var _a6 = chart, width2 = _a6.width, height = _a6.height, chartPadding = _a6.padding, appendPadding = _a6.appendPadding, ele = _a6.ele;
var data3 = rawOptions.data, imageMask = rawOptions.imageMask, wordField = rawOptions.wordField, weightField = rawOptions.weightField, colorField = rawOptions.colorField, wordStyle = rawOptions.wordStyle, timeInterval = rawOptions.timeInterval, random5 = rawOptions.random, spiral = rawOptions.spiral, _b = rawOptions.autoFit, autoFit = _b === void 0 ? true : _b, placementStrategy = rawOptions.placementStrategy;
if (!data3 || !data3.length) {
return [];
}
var fontFamily = wordStyle.fontFamily, fontWeight = wordStyle.fontWeight, padding3 = wordStyle.padding, fontSize = wordStyle.fontSize;
var arr = getSingleKeyValues(data3, weightField);
var range = [min4(arr), max4(arr)];
var words = data3.map(function(datum) {
return {
text: datum[wordField],
value: datum[weightField],
color: datum[colorField],
datum
};
});
var options = {
imageMask,
font: fontFamily,
fontSize: getFontSizeMapping(fontSize, range),
fontWeight,
size: getSize({
width: width2,
height,
padding: chartPadding,
appendPadding,
autoFit,
container: ele
}),
padding: padding3,
timeInterval,
random: random5,
spiral,
rotate: getRotate(rawOptions)
};
if (is_function_default(placementStrategy)) {
var result = words.map(function(word2, index2, words2) {
return __assign(__assign(__assign({}, word2), { hasText: !!word2.text, font: functor(options.font)(word2, index2, words2), weight: functor(options.fontWeight)(word2, index2, words2), rotate: functor(options.rotate)(word2, index2, words2), size: functor(options.fontSize)(word2, index2, words2), style: "normal" }), placementStrategy.call(chart, word2, index2, words2));
});
result.push({
text: "",
value: 0,
x: 0,
y: 0,
opacity: 0
});
result.push({
text: "",
value: 0,
x: options.size[0],
y: options.size[1],
opacity: 0
});
return result;
}
return wordCloud(words, options);
}
function getSize(options) {
var width2 = options.width, height = options.height;
var container2 = options.container, autoFit = options.autoFit, padding3 = options.padding, appendPadding = options.appendPadding;
if (autoFit) {
var containerSize = getContainerSize(container2);
width2 = containerSize.width;
height = containerSize.height;
}
width2 = width2 || 400;
height = height || 400;
var _a6 = resolvePadding({ padding: padding3, appendPadding }), top = _a6[0], right2 = _a6[1], bottom = _a6[2], left2 = _a6[3];
var result = [width2 - (left2 + right2), height - (top + bottom)];
return result;
}
function resolvePadding(options) {
var padding3 = normalPadding(options.padding);
var appendPadding = normalPadding(options.appendPadding);
var top = padding3[0] + appendPadding[0];
var right2 = padding3[1] + appendPadding[1];
var bottom = padding3[2] + appendPadding[2];
var left2 = padding3[3] + appendPadding[3];
return [top, right2, bottom, left2];
}
function processImageMask(img) {
return new Promise(function(res, rej) {
if (img instanceof HTMLImageElement) {
res(img);
return;
}
if (is_string_default(img)) {
var image_1 = new Image();
image_1.crossOrigin = "anonymous";
image_1.src = img;
image_1.onload = function() {
res(image_1);
};
image_1.onerror = function() {
log2(LEVEL.ERROR, false, "image %s load failed !!!", img);
rej();
};
return;
}
log2(LEVEL.WARN, img === void 0, "The type of imageMask option must be String or HTMLImageElement.");
rej();
});
}
function getFontSizeMapping(fontSize, range) {
if (is_function_default(fontSize)) {
return fontSize;
}
if (is_array_default(fontSize)) {
var fMin_1 = fontSize[0], fMax_1 = fontSize[1];
if (!range) {
return function() {
return (fMax_1 + fMin_1) / 2;
};
}
var min_1 = range[0], max_1 = range[1];
if (max_1 === min_1) {
return function() {
return (fMax_1 + fMin_1) / 2;
};
}
return function fontSize2(_a6) {
var value2 = _a6.value;
return (fMax_1 - fMin_1) / (max_1 - min_1) * (value2 - min_1) + fMin_1;
};
}
return function() {
return fontSize;
};
}
function getSingleKeyValues(data3, key) {
return data3.map(function(v3) {
return v3[key];
}).filter(function(v3) {
if (typeof v3 === "number" && !isNaN(v3))
return true;
return false;
});
}
function getRotate(options) {
var _a6 = resolveRotate(options), rotation = _a6.rotation, rotationSteps = _a6.rotationSteps;
if (!is_array_default(rotation))
return rotation;
var min7 = rotation[0];
var max8 = rotation[1];
var perSize = rotationSteps === 1 ? 0 : (max8 - min7) / (rotationSteps - 1);
return function rotate8() {
if (max8 === min7)
return max8;
return Math.floor(Math.random() * rotationSteps) * perSize;
};
}
function resolveRotate(options) {
var rotationSteps = options.wordStyle.rotationSteps;
if (rotationSteps < 1) {
log2(LEVEL.WARN, false, "The rotationSteps option must be greater than or equal to 1.");
rotationSteps = 1;
}
return {
rotation: options.wordStyle.rotation,
rotationSteps
};
}
function min4(numbers) {
return Math.min.apply(Math, numbers);
}
function max4(numbers) {
return Math.max.apply(Math, numbers);
}
// node_modules/@antv/g2plot/esm/plots/word-cloud/constant.js
var WORD_CLOUD_COLOR_FIELD = "color";
var DEFAULT_OPTIONS8 = deepAssign({}, Plot.getDefaultOptions(), {
timeInterval: 2e3,
legend: false,
tooltip: {
showTitle: false,
showMarkers: false,
showCrosshairs: false,
fields: ["text", "value", WORD_CLOUD_COLOR_FIELD],
formatter: function(datum) {
return { name: datum.text, value: datum.value };
}
},
wordStyle: {
fontFamily: "Verdana",
fontWeight: "normal",
padding: 1,
fontSize: [12, 60],
rotation: [0, 90],
rotationSteps: 2,
rotateRatio: 0.5
}
});
// node_modules/@antv/g2plot/esm/plots/word-cloud/adaptor.js
function geometry8(params) {
var chart = params.chart, options = params.options;
var colorField = options.colorField, color4 = options.color;
var data3 = transform7(params);
chart.data(data3);
var p4 = deepAssign({}, params, {
options: {
xField: "x",
yField: "y",
seriesField: colorField && WORD_CLOUD_COLOR_FIELD,
rawFields: is_function_default(color4) && __spreadArrays(get_default(options, "rawFields", []), ["datum"]),
point: {
color: color4,
shape: "word-cloud"
}
}
});
var ext = point(p4).ext;
ext.geometry.label(false);
chart.coordinate().reflect("y");
chart.axis(false);
return params;
}
function meta5(params) {
return flow(scale7({
x: { nice: false },
y: { nice: false }
}))(params);
}
function legend6(params) {
var chart = params.chart, options = params.options;
var legend18 = options.legend, colorField = options.colorField;
if (legend18 === false) {
chart.legend(false);
} else if (colorField) {
chart.legend(WORD_CLOUD_COLOR_FIELD, legend18);
}
return params;
}
function adaptor7(params) {
flow(geometry8, meta5, tooltip, legend6, interaction, animation, theme, state)(params);
}
// node_modules/@antv/g2plot/esm/plots/word-cloud/shapes/word-cloud.js
registerShape("point", "word-cloud", {
draw: function(cfg, group2) {
var cx = cfg.x;
var cy = cfg.y;
var shape = group2.addShape("text", {
attrs: __assign(__assign({}, getTextAttrs(cfg)), { x: cx, y: cy })
});
var rotate8 = cfg.data.rotate;
if (typeof rotate8 === "number") {
Util.rotate(shape, rotate8 * Math.PI / 180);
}
return shape;
}
});
function getTextAttrs(cfg) {
return {
fontSize: cfg.data.size,
text: cfg.data.text,
textAlign: "center",
fontFamily: cfg.data.font,
fontWeight: cfg.data.weight,
fill: cfg.color || cfg.defaultStyle.stroke,
textBaseline: "alphabetic"
};
}
// node_modules/@antv/g2plot/esm/plots/word-cloud/index.js
var WordCloud = function(_super) {
__extends(WordCloud2, _super);
function WordCloud2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "word-cloud";
return _this;
}
WordCloud2.getDefaultOptions = function() {
return DEFAULT_OPTIONS8;
};
WordCloud2.prototype.changeData = function(data3) {
this.updateOption({ data: data3 });
if (this.options.imageMask) {
this.render();
} else {
this.chart.changeData(transform7({ chart: this.chart, options: this.options }));
}
};
WordCloud2.prototype.getDefaultOptions = function() {
return WordCloud2.getDefaultOptions();
};
WordCloud2.prototype.render = function() {
var _this = this;
return new Promise(function(res) {
var imageMask = _this.options.imageMask;
if (!imageMask) {
_super.prototype.render.call(_this);
res();
return;
}
var handler = function(img) {
_this.options = __assign(__assign({}, _this.options), { imageMask: img || null });
_super.prototype.render.call(_this);
res();
};
processImageMask(imageMask).then(handler).catch(handler);
});
};
WordCloud2.prototype.getSchemaAdaptor = function() {
return adaptor7;
};
WordCloud2.prototype.triggerResize = function() {
var _this = this;
if (!this.chart.destroyed) {
this.execAdaptor();
window.setTimeout(function() {
_super.prototype.triggerResize.call(_this);
});
}
};
return WordCloud2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/scatter/util.js
var import_d3_regression = __toModule(require_d3_regression());
var REGRESSION_MAP = {
exp: import_d3_regression.regressionExp,
linear: import_d3_regression.regressionLinear,
loess: import_d3_regression.regressionLoess,
log: import_d3_regression.regressionLog,
poly: import_d3_regression.regressionPoly,
pow: import_d3_regression.regressionPow,
quad: import_d3_regression.regressionQuad
};
function getQuadrantDefaultConfig(xBaseline, yBaseline) {
var textOffset = 10;
var defaultConfig = {
regionStyle: [
{
position: {
start: [xBaseline, "max"],
end: ["max", yBaseline]
},
style: {
fill: "#d8d0c0",
opacity: 0.4
}
},
{
position: {
start: ["min", "max"],
end: [xBaseline, yBaseline]
},
style: {
fill: "#a3dda1",
opacity: 0.4
}
},
{
position: {
start: ["min", yBaseline],
end: [xBaseline, "min"]
},
style: {
fill: "#d8d0c0",
opacity: 0.4
}
},
{
position: {
start: [xBaseline, yBaseline],
end: ["max", "min"]
},
style: {
fill: "#a3dda1",
opacity: 0.4
}
}
],
lineStyle: {
stroke: "#9ba29a",
lineWidth: 1
},
labelStyle: [
{
position: ["max", yBaseline],
offsetX: -textOffset,
offsetY: -textOffset,
style: {
textAlign: "right",
textBaseline: "bottom",
fontSize: 14,
fill: "#ccc"
}
},
{
position: ["min", yBaseline],
offsetX: textOffset,
offsetY: -textOffset,
style: {
textAlign: "left",
textBaseline: "bottom",
fontSize: 14,
fill: "#ccc"
}
},
{
position: ["min", yBaseline],
offsetX: textOffset,
offsetY: textOffset,
style: {
textAlign: "left",
textBaseline: "top",
fontSize: 14,
fill: "#ccc"
}
},
{
position: ["max", yBaseline],
offsetX: -textOffset,
offsetY: textOffset,
style: {
textAlign: "right",
textBaseline: "top",
fontSize: 14,
fill: "#ccc"
}
}
]
};
return defaultConfig;
}
var splinePath = function(data3, config) {
var view = config.view, _a6 = config.options, xField = _a6.xField, yField = _a6.yField;
var xScaleView = view.getScaleByField(xField);
var yScaleView = view.getScaleByField(yField);
var pathData = data3.map(function(d3) {
return view.getCoordinate().convert({ x: xScaleView.scale(d3[0]), y: yScaleView.scale(d3[1]) });
});
return getSplinePath2(pathData, false);
};
var getPath4 = function(config) {
var options = config.options;
var xField = options.xField, yField = options.yField, data3 = options.data, regressionLine2 = options.regressionLine;
var _a6 = regressionLine2.type, type2 = _a6 === void 0 ? "linear" : _a6, algorithm = regressionLine2.algorithm;
var pathData;
if (algorithm) {
pathData = is_array_default(algorithm) ? algorithm : algorithm(data3);
} else {
var reg = REGRESSION_MAP[type2]().x(function(d3) {
return d3[xField];
}).y(function(d3) {
return d3[yField];
});
pathData = reg(data3);
}
return splinePath(pathData, config);
};
var getMeta = function(options) {
var _a6;
var _b = options.meta, meta23 = _b === void 0 ? {} : _b, xField = options.xField, yField = options.yField, data3 = options.data;
var xFieldValue = data3[0][xField];
var yFieldValue = data3[0][yField];
var xIsPositiveNumber = xFieldValue > 0;
var yIsPositiveNumber = yFieldValue > 0;
function getMetaMinMax(field6, axis22) {
var fieldMeta = get_default(meta23, [field6]);
function getCustomValue(type2) {
return get_default(fieldMeta, type2);
}
var range = {};
if (axis22 === "x") {
if (is_number_default(xFieldValue)) {
if (!is_number_default(getCustomValue("min"))) {
range["min"] = xIsPositiveNumber ? 0 : xFieldValue * 2;
}
if (!is_number_default(getCustomValue("max"))) {
range["max"] = xIsPositiveNumber ? xFieldValue * 2 : 0;
}
}
return range;
}
if (is_number_default(yFieldValue)) {
if (!is_number_default(getCustomValue("min"))) {
range["min"] = yIsPositiveNumber ? 0 : yFieldValue * 2;
}
if (!is_number_default(getCustomValue("max"))) {
range["max"] = yIsPositiveNumber ? yFieldValue * 2 : 0;
}
}
return range;
}
return __assign(__assign({}, meta23), (_a6 = {}, _a6[xField] = __assign(__assign({}, meta23[xField]), getMetaMinMax(xField, "x")), _a6[yField] = __assign(__assign({}, meta23[yField]), getMetaMinMax(yField, "y")), _a6));
};
// node_modules/@antv/g2plot/esm/plots/scatter/adaptor.js
function transformOptions(options) {
var _a6 = options.data, data3 = _a6 === void 0 ? [] : _a6, xField = options.xField, yField = options.yField;
if (data3.length) {
var isOneX = true;
var isOneY = true;
var prev = data3[0];
var curr = void 0;
for (var i4 = 1; i4 < data3.length; i4++) {
curr = data3[i4];
if (prev[xField] !== curr[xField]) {
isOneX = false;
}
if (prev[yField] !== curr[yField]) {
isOneY = false;
}
if (!isOneX && !isOneY) {
break;
}
prev = curr;
}
var keys2 = [];
isOneX && keys2.push(xField);
isOneY && keys2.push(yField);
var meta_1 = pick(getMeta(options), keys2);
return deepAssign({}, options, { meta: meta_1 });
}
return options;
}
function geometry9(params) {
var chart = params.chart, options = params.options;
var data3 = options.data, type2 = options.type, color4 = options.color, shape = options.shape, pointStyle = options.pointStyle, shapeField = options.shapeField, colorField = options.colorField, xField = options.xField, yField = options.yField, sizeField = options.sizeField;
var size2 = options.size;
var tooltip10 = options.tooltip;
if (sizeField) {
if (!size2) {
size2 = [2, 8];
}
if (is_number_default(size2)) {
size2 = [size2, size2];
}
}
if (tooltip10 && !tooltip10.fields) {
tooltip10 = __assign(__assign({}, tooltip10), { fields: [xField, yField, colorField, sizeField, shapeField] });
}
chart.data(data3);
point(deepAssign({}, params, {
options: {
seriesField: colorField,
point: {
color: color4,
shape,
size: size2,
style: pointStyle
},
tooltip: tooltip10
}
}));
var geometry35 = findGeometry(chart, "point");
if (type2) {
geometry35.adjust(type2);
}
return params;
}
function meta6(params) {
var _a6;
var options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField;
var newOptions = transformOptions(options);
return flow(scale7((_a6 = {}, _a6[xField] = xAxis, _a6[yField] = yAxis, _a6)))(deepAssign({}, params, { options: newOptions }));
}
function axis4(params) {
var chart = params.chart, options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField;
chart.axis(xField, xAxis);
chart.axis(yField, yAxis);
return params;
}
function legend7(params) {
var chart = params.chart, options = params.options;
var legend18 = options.legend, colorField = options.colorField, shapeField = options.shapeField, sizeField = options.sizeField, shapeLegend = options.shapeLegend, sizeLegend = options.sizeLegend;
var showLegend = legend18 !== false;
if (colorField) {
chart.legend(colorField, showLegend ? legend18 : false);
}
if (shapeField) {
if (shapeLegend) {
chart.legend(shapeField, shapeLegend);
} else {
chart.legend(shapeField, shapeLegend === false ? false : legend18);
}
}
if (sizeField) {
chart.legend(sizeField, sizeLegend ? sizeLegend : false);
}
if (!showLegend && !shapeLegend && !sizeLegend) {
chart.legend(false);
}
return params;
}
function label7(params) {
var chart = params.chart, options = params.options;
var label17 = options.label, yField = options.yField;
var scatterGeometry = findGeometry(chart, "point");
if (!label17) {
scatterGeometry.label(false);
} else {
var callback = label17.callback, cfg = __rest(label17, ["callback"]);
scatterGeometry.label({
fields: [yField],
callback,
cfg: transformLabel(cfg)
});
}
return params;
}
function scatterAnnotation(params) {
var options = params.options;
var quadrant = options.quadrant;
var annotationOptions = [];
if (quadrant) {
var _a6 = quadrant.xBaseline, xBaseline = _a6 === void 0 ? 0 : _a6, _b = quadrant.yBaseline, yBaseline = _b === void 0 ? 0 : _b, labels_1 = quadrant.labels, regionStyle_1 = quadrant.regionStyle, lineStyle = quadrant.lineStyle;
var defaultConfig_1 = getQuadrantDefaultConfig(xBaseline, yBaseline);
var quadrants = new Array(4).join(",").split(",");
quadrants.forEach(function(_8, index2) {
annotationOptions.push(__assign(__assign({ type: "region", top: false }, defaultConfig_1.regionStyle[index2].position), { style: deepAssign({}, defaultConfig_1.regionStyle[index2].style, regionStyle_1 === null || regionStyle_1 === void 0 ? void 0 : regionStyle_1[index2]) }), __assign({ type: "text", top: true }, deepAssign({}, defaultConfig_1.labelStyle[index2], labels_1 === null || labels_1 === void 0 ? void 0 : labels_1[index2])));
});
annotationOptions.push({
type: "line",
top: false,
start: ["min", yBaseline],
end: ["max", yBaseline],
style: deepAssign({}, defaultConfig_1.lineStyle, lineStyle)
}, {
type: "line",
top: false,
start: [xBaseline, "min"],
end: [xBaseline, "max"],
style: deepAssign({}, defaultConfig_1.lineStyle, lineStyle)
});
}
return flow(annotation(annotationOptions))(params);
}
function regressionLine(params) {
var options = params.options, chart = params.chart;
var regressionLine2 = options.regressionLine;
if (regressionLine2) {
var style_1 = regressionLine2.style, _a6 = regressionLine2.top, top_1 = _a6 === void 0 ? false : _a6;
var defaultStyle_1 = {
stroke: "#9ba29a",
lineWidth: 2,
opacity: 0.5
};
chart.annotation().shape({
top: top_1,
render: function(container2, view) {
var group2 = container2.addGroup({
id: chart.id + "-regression-line",
name: "regression-line-group"
});
var path = getPath4({
view,
options
});
group2.addShape("path", {
name: "regression-line",
attrs: __assign(__assign({ path }, defaultStyle_1), style_1)
});
}
});
}
return params;
}
function tooltip3(params) {
var chart = params.chart, options = params.options;
var tooltip10 = options.tooltip;
if (tooltip10) {
chart.tooltip(tooltip10);
} else if (tooltip10 === false) {
chart.tooltip(false);
}
return params;
}
function adaptor8(params) {
return flow(geometry9, meta6, axis4, legend7, tooltip3, label7, brushInteraction, slider, scrollbar, interaction, scatterAnnotation, animation, theme, regressionLine)(params);
}
// node_modules/@antv/g2plot/esm/plots/scatter/constant.js
var DEFAULT_OPTIONS9 = deepAssign({}, Plot.getDefaultOptions(), {
size: 4,
tooltip: {
showTitle: false,
showMarkers: false,
showCrosshairs: true,
crosshairs: {
type: "xy"
}
}
});
// node_modules/@antv/g2plot/esm/interactions/drag-move.js
registerInteraction("drag-move", {
start: [{ trigger: "plot:mousedown", action: "scale-translate:start" }],
processing: [
{
trigger: "plot:mousemove",
action: "scale-translate:translate",
throttle: { wait: 100, leading: true, trailing: false }
}
],
end: [{ trigger: "plot:mouseup", action: "scale-translate:end" }]
});
// node_modules/@antv/g2plot/esm/plots/scatter/index.js
var Scatter = function(_super) {
__extends(Scatter2, _super);
function Scatter2(container2, options) {
var _this = _super.call(this, container2, options) || this;
_this.type = "scatter";
_this.on(VIEW_LIFE_CIRCLE.BEFORE_RENDER, function(evt) {
var _a6, _b;
var _c = _this, options2 = _c.options, chart = _c.chart;
if (((_a6 = evt.data) === null || _a6 === void 0 ? void 0 : _a6.source) === EVENTS3.FILTER) {
var filteredData = _this.chart.filterData(_this.chart.getData());
meta6({ chart, options: __assign(__assign({}, options2), { data: filteredData }) });
}
if (((_b = evt.data) === null || _b === void 0 ? void 0 : _b.source) === EVENTS3.RESET) {
meta6({ chart, options: options2 });
}
});
return _this;
}
Scatter2.getDefaultOptions = function() {
return DEFAULT_OPTIONS9;
};
Scatter2.prototype.changeData = function(data3) {
this.updateOption(transformOptions(deepAssign({}, this.options, { data: data3 })));
var _a6 = this, options = _a6.options, chart = _a6.chart;
meta6({ chart, options });
this.chart.changeData(data3);
};
Scatter2.prototype.getSchemaAdaptor = function() {
return adaptor8;
};
Scatter2.prototype.getDefaultOptions = function() {
return Scatter2.getDefaultOptions();
};
return Scatter2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/radar/adaptor.js
function geometry10(params) {
var chart = params.chart, options = params.options;
var data3 = options.data, lineStyle = options.lineStyle, color4 = options.color, pointOptions = options.point, areaOptions = options.area;
chart.data(data3);
var primary = deepAssign({}, params, {
options: {
line: {
style: lineStyle,
color: color4
},
point: pointOptions ? __assign({ color: color4 }, pointOptions) : pointOptions,
area: areaOptions ? __assign({ color: color4 }, areaOptions) : areaOptions,
label: void 0
}
});
var second = deepAssign({}, primary, {
options: {
tooltip: false
}
});
var pointState = (pointOptions === null || pointOptions === void 0 ? void 0 : pointOptions.state) || options.state;
var pointParams = deepAssign({}, primary, { options: { tooltip: false, state: pointState } });
line(primary);
point(pointParams);
area(second);
return params;
}
function meta7(params) {
var _a6;
var options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField;
return flow(scale7((_a6 = {}, _a6[xField] = xAxis, _a6[yField] = yAxis, _a6)))(params);
}
function coord(params) {
var chart = params.chart, options = params.options;
var radius = options.radius, startAngle = options.startAngle, endAngle = options.endAngle;
chart.coordinate("polar", {
radius,
startAngle,
endAngle
});
return params;
}
function axis5(params) {
var chart = params.chart, options = params.options;
var xField = options.xField, xAxis = options.xAxis, yField = options.yField, yAxis = options.yAxis;
chart.axis(xField, xAxis);
chart.axis(yField, yAxis);
return params;
}
function label8(params) {
var chart = params.chart, options = params.options;
var label17 = options.label, yField = options.yField;
var geometry35 = findGeometry(chart, "line");
if (!label17) {
geometry35.label(false);
} else {
var callback = label17.callback, cfg = __rest(label17, ["callback"]);
geometry35.label({
fields: [yField],
callback,
cfg: transformLabel(cfg)
});
}
return params;
}
function adaptor9(params) {
return flow(geometry10, meta7, theme, coord, axis5, legend, tooltip, label8, interaction, animation, annotation())(params);
}
// node_modules/@antv/g2plot/esm/plots/radar/interactions/radar-tooltip-action.js
var RadarTooltipController = function(_super) {
__extends(RadarTooltipController2, _super);
function RadarTooltipController2() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(RadarTooltipController2.prototype, "name", {
get: function() {
return "radar-tooltip";
},
enumerable: false,
configurable: true
});
RadarTooltipController2.prototype.getTooltipItems = function(point2) {
var _a6 = this.getTooltipCfg(), shared = _a6.shared, cfgTitle = _a6.title;
var hintItems = _super.prototype.getTooltipItems.call(this, point2);
if (hintItems.length > 0) {
var geometry_1 = this.view.geometries[0];
var dataArray = geometry_1.dataArray;
var title_1 = hintItems[0].name;
var result_1 = [];
dataArray.forEach(function(mappingData) {
mappingData.forEach(function(d3) {
var items = Util.getTooltipItems(d3, geometry_1);
var item = items[0];
if (!shared && item && item.name === title_1) {
var displayTitle = is_nil_default(cfgTitle) ? title_1 : cfgTitle;
result_1.push(__assign(__assign({}, item), { name: item.title, title: displayTitle }));
} else if (shared && item) {
var displayTitle = is_nil_default(cfgTitle) ? item.name || title_1 : cfgTitle;
result_1.push(__assign(__assign({}, item), { name: item.title, title: displayTitle }));
}
});
});
return result_1;
}
return [];
};
return RadarTooltipController2;
}(tooltip_default);
registerComponentController("radar-tooltip", RadarTooltipController);
var RadarTooltipAction = function(_super) {
__extends(RadarTooltipAction2, _super);
function RadarTooltipAction2() {
return _super !== null && _super.apply(this, arguments) || this;
}
RadarTooltipAction2.prototype.init = function() {
var view = this.context.view;
view.removeInteraction("tooltip");
};
RadarTooltipAction2.prototype.show = function() {
var event = this.context.event;
var controller = this.getTooltipController();
controller.showTooltip({ x: event.x, y: event.y });
};
RadarTooltipAction2.prototype.hide = function() {
var controller = this.getTooltipController();
controller.hideTooltip();
};
RadarTooltipAction2.prototype.getTooltipController = function() {
var view = this.context.view;
return view.getController("radar-tooltip");
};
return RadarTooltipAction2;
}(base_default12);
// node_modules/@antv/g2plot/esm/plots/radar/interactions/index.js
registerAction("radar-tooltip", RadarTooltipAction);
registerInteraction("radar-tooltip", {
start: [{ trigger: "plot:mousemove", action: "radar-tooltip:show" }],
end: [{ trigger: "plot:mouseleave", action: "radar-tooltip:hide" }]
});
// node_modules/@antv/g2plot/esm/plots/radar/index.js
var Radar = function(_super) {
__extends(Radar2, _super);
function Radar2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "radar";
return _this;
}
Radar2.prototype.changeData = function(data3) {
this.updateOption({ data: data3 });
this.chart.changeData(data3);
};
Radar2.prototype.getDefaultOptions = function() {
return deepAssign({}, _super.prototype.getDefaultOptions.call(this), {
xAxis: {
label: {
offset: 15
},
grid: {
line: {
type: "line"
}
}
},
yAxis: {
grid: {
line: {
type: "circle"
}
}
},
legend: {
position: "top"
},
tooltip: {
shared: true,
showCrosshairs: true,
showMarkers: true,
crosshairs: {
type: "xy",
line: {
style: {
stroke: "#565656",
lineDash: [4]
}
},
follow: true
}
}
});
};
Radar2.prototype.getSchemaAdaptor = function() {
return adaptor9;
};
return Radar2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/dual-axes/types.js
var AxisType;
(function(AxisType2) {
AxisType2["Left"] = "Left";
AxisType2["Right"] = "Right";
})(AxisType || (AxisType = {}));
var DualAxesGeometry;
(function(DualAxesGeometry2) {
DualAxesGeometry2["Line"] = "line";
DualAxesGeometry2["Column"] = "column";
})(DualAxesGeometry || (DualAxesGeometry = {}));
// node_modules/@antv/g2plot/esm/plots/dual-axes/constant.js
var LEFT_AXES_VIEW = "left-axes-view";
var RIGHT_AXES_VIEW = "right-axes-view";
var DEFAULT_YAXIS_CONFIG = {
nice: true,
label: {
autoHide: true,
autoRotate: false
}
};
var DEFAULT_LEFT_YAXIS_CONFIG = __assign(__assign({}, DEFAULT_YAXIS_CONFIG), { position: "left" });
var DEFAULT_RIGHT_YAXIS_CONFIG = __assign(__assign({}, DEFAULT_YAXIS_CONFIG), { position: "right", grid: null });
// node_modules/@antv/g2plot/esm/plots/dual-axes/util/option.js
function isLine(geometryOption) {
return get_default(geometryOption, "geometry") === DualAxesGeometry.Line;
}
function isColumn(geometryOption) {
return get_default(geometryOption, "geometry") === DualAxesGeometry.Column;
}
function getGeometryOption(xField, yField, geometryOption) {
return isColumn(geometryOption) ? deepAssign({}, {
geometry: DualAxesGeometry.Column,
label: geometryOption.label && geometryOption.isRange ? {
content: function(item) {
var _a6;
return (_a6 = item[yField]) === null || _a6 === void 0 ? void 0 : _a6.join("-");
}
} : void 0
}, geometryOption) : __assign({ geometry: DualAxesGeometry.Line }, geometryOption);
}
function transformObjectToArray(yField, transformAttribute) {
var y1 = yField[0], y22 = yField[1];
if (is_array_default(transformAttribute)) {
var a1_1 = transformAttribute[0], a2_1 = transformAttribute[1];
return [a1_1, a2_1];
}
var a1 = get_default(transformAttribute, y1);
var a22 = get_default(transformAttribute, y22);
return [a1, a22];
}
function getYAxisWithDefault(yAxis, axisType) {
if (axisType === AxisType.Left) {
return yAxis === false ? false : deepAssign({}, DEFAULT_LEFT_YAXIS_CONFIG, yAxis);
} else if (axisType === AxisType.Right) {
return yAxis === false ? false : deepAssign({}, DEFAULT_RIGHT_YAXIS_CONFIG, yAxis);
}
return yAxis;
}
// node_modules/@antv/g2plot/esm/plots/dual-axes/util/legend.js
function getViewLegendItems(params) {
var view = params.view, geometryOption = params.geometryOption, yField = params.yField, legend18 = params.legend;
var userMarker = get_default(legend18, "marker");
var geometry35 = findGeometry(view, isLine(geometryOption) ? "line" : "interval");
if (!geometryOption.seriesField) {
var legendItemName = get_default(view, "options.scales." + yField + ".alias") || yField;
var colorAttribute = geometry35.getAttribute("color");
var color4 = view.getTheme().defaultColor;
if (colorAttribute) {
color4 = Util.getMappingValue(colorAttribute, legendItemName, get_default(colorAttribute, ["values", 0], color4));
}
var marker = (is_function_default(userMarker) ? userMarker : !is_empty_default(userMarker) && deepAssign({}, {
style: {
stroke: color4,
fill: color4
}
}, userMarker)) || (isLine(geometryOption) ? {
symbol: function(x6, y5, r4) {
return [
["M", x6 - r4, y5],
["L", x6 + r4, y5]
];
},
style: {
lineWidth: 2,
r: 6,
stroke: color4
}
} : {
symbol: "square",
style: {
fill: color4
}
});
return [
{
value: yField,
name: legendItemName,
marker,
isGeometry: true,
viewId: view.id
}
];
}
var attributes = geometry35.getGroupAttributes();
return reduce_default(attributes, function(items, attr) {
var attrItems = Util.getLegendItems(view, geometry35, attr, view.getTheme(), userMarker);
return items.concat(attrItems);
}, []);
}
// node_modules/@antv/g2plot/esm/plots/dual-axes/util/geometry.js
function drawSingleGeometry(params) {
var options = params.options, chart = params.chart;
var geometryOption = options.geometryOption;
var isStack = geometryOption.isStack, color4 = geometryOption.color, seriesField = geometryOption.seriesField, groupField = geometryOption.groupField, isGroup = geometryOption.isGroup;
var FIELD_KEY = ["xField", "yField"];
if (isLine(geometryOption)) {
line(deepAssign({}, params, {
options: __assign(__assign(__assign({}, pick(options, FIELD_KEY)), geometryOption), { line: {
color: geometryOption.color,
style: geometryOption.lineStyle
} })
}));
point(deepAssign({}, params, {
options: __assign(__assign(__assign({}, pick(options, FIELD_KEY)), geometryOption), { point: geometryOption.point && __assign({ color: color4, shape: "circle" }, geometryOption.point) })
}));
var adjust_1 = [];
if (isGroup) {
adjust_1.push({
type: "dodge",
dodgeBy: groupField || seriesField,
customOffset: 0
});
}
if (isStack) {
adjust_1.push({
type: "stack"
});
}
if (adjust_1.length) {
each_default(chart.geometries, function(g4) {
g4.adjust(adjust_1);
});
}
}
if (isColumn(geometryOption)) {
adaptor3(deepAssign({}, params, {
options: __assign(__assign(__assign({}, pick(options, FIELD_KEY)), geometryOption), { widthRatio: geometryOption.columnWidthRatio, interval: __assign(__assign({}, pick(geometryOption, ["color"])), { style: geometryOption.columnStyle }) })
}));
}
return params;
}
// node_modules/@antv/g2plot/esm/plots/dual-axes/util/render-sider.js
var doSliderFilter = function(view, sliderValue) {
var min7 = sliderValue[0], max8 = sliderValue[1];
var data3 = view.getOptions().data;
var xScale = view.getXScale();
var dataSize = size(data3);
if (!xScale || !dataSize) {
return;
}
var isHorizontal2 = true;
var values2 = values_of_key_default(data3, xScale.field);
var xValues = isHorizontal2 ? values2 : values2.reverse();
var xTickCount = size(xValues);
var minIndex = Math.floor(min7 * (xTickCount - 1));
var maxIndex = Math.floor(max8 * (xTickCount - 1));
view.filter(xScale.field, function(value2) {
var idx = xValues.indexOf(value2);
return idx > -1 ? isBetween3(idx, minIndex, maxIndex) : true;
});
view.render(true);
};
// node_modules/@antv/g2plot/esm/plots/dual-axes/adaptor.js
function transformOptions2(params) {
var _a6;
var options = params.options;
var _b = options.geometryOptions, geometryOptions = _b === void 0 ? [] : _b, xField = options.xField, yField = options.yField;
var allLine = every_default(geometryOptions, function(_a7) {
var geometry35 = _a7.geometry;
return geometry35 === DualAxesGeometry.Line || geometry35 === void 0;
});
return deepAssign({}, {
options: {
geometryOptions: [],
meta: (_a6 = {}, _a6[xField] = {
type: "cat",
sync: true,
range: allLine ? [0, 1] : void 0
}, _a6),
tooltip: {
showMarkers: allLine,
showCrosshairs: allLine,
shared: true,
crosshairs: {
type: "x"
}
},
interactions: !allLine ? [{ type: "legend-visible-filter" }, { type: "active-region" }] : [{ type: "legend-visible-filter" }],
legend: {
position: "top-left"
}
}
}, params, {
options: {
yAxis: transformObjectToArray(yField, options.yAxis),
geometryOptions: [
getGeometryOption(xField, yField[0], geometryOptions[0]),
getGeometryOption(xField, yField[1], geometryOptions[1])
],
annotations: transformObjectToArray(yField, options.annotations)
}
});
}
function createViews(params) {
var _a6, _b;
var chart = params.chart, options = params.options;
var geometryOptions = options.geometryOptions;
var SORT_MAP = { line: 0, column: 1 };
var geometries = [
{ type: (_a6 = geometryOptions[0]) === null || _a6 === void 0 ? void 0 : _a6.geometry, id: LEFT_AXES_VIEW },
{ type: (_b = geometryOptions[1]) === null || _b === void 0 ? void 0 : _b.geometry, id: RIGHT_AXES_VIEW }
];
geometries.sort(function(a4, b10) {
return -SORT_MAP[a4.type] + SORT_MAP[b10.type];
}).forEach(function(g4) {
return chart.createView({ id: g4.id });
});
return params;
}
function geometry11(params) {
var chart = params.chart, options = params.options;
var xField = options.xField, yField = options.yField, geometryOptions = options.geometryOptions, data3 = options.data, tooltip10 = options.tooltip;
var geometries = [
__assign(__assign({}, geometryOptions[0]), { id: LEFT_AXES_VIEW, data: data3[0], yField: yField[0] }),
__assign(__assign({}, geometryOptions[1]), { id: RIGHT_AXES_VIEW, data: data3[1], yField: yField[1] })
];
geometries.forEach(function(geometry35) {
var id = geometry35.id, data4 = geometry35.data, yField2 = geometry35.yField;
var isPercent = isColumn(geometry35) && geometry35.isPercent;
var formatData = isPercent ? percent(data4, yField2, xField, yField2) : data4;
var view = findViewById(chart, id).data(formatData);
var tooltipOptions = isPercent ? __assign({ formatter: function(datum) {
return {
name: datum[geometry35.seriesField] || yField2,
value: (Number(datum[yField2]) * 100).toFixed(2) + "%"
};
} }, tooltip10) : tooltip10;
drawSingleGeometry({
chart: view,
options: {
xField,
yField: yField2,
tooltip: tooltipOptions,
geometryOption: geometry35
}
});
});
return params;
}
function color2(params) {
var _a6;
var chart = params.chart, options = params.options;
var geometryOptions = options.geometryOptions;
var themeColor = ((_a6 = chart.getTheme()) === null || _a6 === void 0 ? void 0 : _a6.colors10) || [];
var start = 0;
chart.once("beforepaint", function() {
each_default(geometryOptions, function(geometryOption, index2) {
var view = findViewById(chart, index2 === 0 ? LEFT_AXES_VIEW : RIGHT_AXES_VIEW);
if (geometryOption.color)
return;
var groupScale = view.getGroupScales();
var count2 = get_default(groupScale, [0, "values", "length"], 1);
var color4 = themeColor.slice(start, start + count2).concat(index2 === 0 ? [] : themeColor);
view.geometries.forEach(function(geometry35) {
if (geometryOption.seriesField) {
geometry35.color(geometryOption.seriesField, color4);
} else {
geometry35.color(color4[0]);
}
});
start += count2;
});
chart.render(true);
});
return params;
}
function meta8(params) {
var _a6, _b;
var chart = params.chart, options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField;
scale7((_a6 = {}, _a6[xField] = xAxis, _a6[yField[0]] = yAxis[0], _a6))(deepAssign({}, params, { chart: findViewById(chart, LEFT_AXES_VIEW) }));
scale7((_b = {}, _b[xField] = xAxis, _b[yField[1]] = yAxis[1], _b))(deepAssign({}, params, { chart: findViewById(chart, RIGHT_AXES_VIEW) }));
return params;
}
function axis6(params) {
var chart = params.chart, options = params.options;
var leftView = findViewById(chart, LEFT_AXES_VIEW);
var rightView = findViewById(chart, RIGHT_AXES_VIEW);
var xField = options.xField, yField = options.yField, xAxis = options.xAxis, yAxis = options.yAxis;
chart.axis(xField, false);
chart.axis(yField[0], false);
chart.axis(yField[1], false);
leftView.axis(xField, xAxis);
leftView.axis(yField[0], getYAxisWithDefault(yAxis[0], AxisType.Left));
rightView.axis(xField, false);
rightView.axis(yField[1], getYAxisWithDefault(yAxis[1], AxisType.Right));
return params;
}
function tooltip4(params) {
var chart = params.chart, options = params.options;
var tooltip10 = options.tooltip;
var leftView = findViewById(chart, LEFT_AXES_VIEW);
var rightView = findViewById(chart, RIGHT_AXES_VIEW);
chart.tooltip(tooltip10);
leftView.tooltip({
shared: true
});
rightView.tooltip({
shared: true
});
return params;
}
function interaction3(params) {
var chart = params.chart;
interaction(deepAssign({}, params, { chart: findViewById(chart, LEFT_AXES_VIEW) }));
interaction(deepAssign({}, params, { chart: findViewById(chart, RIGHT_AXES_VIEW) }));
return params;
}
function annotation2(params) {
var chart = params.chart, options = params.options;
var annotations = options.annotations;
var a1 = get_default(annotations, [0]);
var a22 = get_default(annotations, [1]);
annotation(a1)(deepAssign({}, params, {
chart: findViewById(chart, LEFT_AXES_VIEW),
options: {
annotations: a1
}
}));
annotation(a22)(deepAssign({}, params, {
chart: findViewById(chart, RIGHT_AXES_VIEW),
options: {
annotations: a22
}
}));
return params;
}
function theme2(params) {
var chart = params.chart;
theme(deepAssign({}, params, { chart: findViewById(chart, LEFT_AXES_VIEW) }));
theme(deepAssign({}, params, { chart: findViewById(chart, RIGHT_AXES_VIEW) }));
theme(params);
return params;
}
function animation2(params) {
var chart = params.chart;
animation(deepAssign({}, params, { chart: findViewById(chart, LEFT_AXES_VIEW) }));
animation(deepAssign({}, params, { chart: findViewById(chart, RIGHT_AXES_VIEW) }));
return params;
}
function limitInPlot3(params) {
var chart = params.chart, options = params.options;
var yAxis = options.yAxis;
limitInPlot2(deepAssign({}, params, {
chart: findViewById(chart, LEFT_AXES_VIEW),
options: {
yAxis: yAxis[0]
}
}));
limitInPlot2(deepAssign({}, params, {
chart: findViewById(chart, RIGHT_AXES_VIEW),
options: {
yAxis: yAxis[1]
}
}));
return params;
}
function legend8(params) {
var chart = params.chart, options = params.options;
var legend18 = options.legend, geometryOptions = options.geometryOptions, yField = options.yField, data3 = options.data;
var leftView = findViewById(chart, LEFT_AXES_VIEW);
var rightView = findViewById(chart, RIGHT_AXES_VIEW);
if (legend18 === false) {
chart.legend(false);
} else if (is_object_default(legend18) && legend18.custom === true) {
chart.legend(legend18);
} else {
var leftLegend_1 = get_default(geometryOptions, [0, "legend"], legend18);
var rightLegend_1 = get_default(geometryOptions, [1, "legend"], legend18);
chart.once("beforepaint", function() {
var leftItems = data3[0].length ? getViewLegendItems({
view: leftView,
geometryOption: geometryOptions[0],
yField: yField[0],
legend: leftLegend_1
}) : [];
var rightItems = data3[1].length ? getViewLegendItems({
view: rightView,
geometryOption: geometryOptions[1],
yField: yField[1],
legend: rightLegend_1
}) : [];
chart.legend(deepAssign({}, legend18, {
custom: true,
items: leftItems.concat(rightItems)
}));
});
if (geometryOptions[0].seriesField) {
leftView.legend(geometryOptions[0].seriesField, leftLegend_1);
}
if (geometryOptions[1].seriesField) {
rightView.legend(geometryOptions[1].seriesField, rightLegend_1);
}
chart.on("legend-item:click", function(evt) {
var delegateObject = get_default(evt, "gEvent.delegateObject", {});
if (delegateObject && delegateObject.item) {
var _a6 = delegateObject.item, field_1 = _a6.value, isGeometry = _a6.isGeometry, viewId = _a6.viewId;
if (isGeometry) {
var idx = find_index_default(yField, function(yF) {
return yF === field_1;
});
if (idx > -1) {
var geometries = get_default(findViewById(chart, viewId), "geometries");
each_default(geometries, function(g4) {
g4.changeVisible(!delegateObject.item.unchecked);
});
}
} else {
var legendItem_1 = get_default(chart.getController("legend"), "option.items", []);
each_default(chart.views, function(view) {
var groupScale = view.getGroupScales();
each_default(groupScale, function(scale12) {
if (scale12.values && scale12.values.indexOf(field_1) > -1) {
view.filter(scale12.field, function(value2) {
var curLegendItem = find_default(legendItem_1, function(item) {
return item.value === value2;
});
return !curLegendItem.unchecked;
});
}
});
chart.render(true);
});
}
}
});
}
return params;
}
function slider2(params) {
var chart = params.chart, options = params.options;
var slider3 = options.slider;
var leftView = findViewById(chart, LEFT_AXES_VIEW);
var rightView = findViewById(chart, RIGHT_AXES_VIEW);
if (slider3) {
leftView.option("slider", slider3);
leftView.on("slider:valuechanged", function(evt) {
var _a6 = evt.event, value2 = _a6.value, originValue = _a6.originValue;
if (is_equal_default(value2, originValue)) {
return;
}
doSliderFilter(rightView, value2);
});
chart.once("afterpaint", function() {
if (!is_boolean_default(slider3)) {
var start = slider3.start, end2 = slider3.end;
if (start || end2) {
doSliderFilter(rightView, [start, end2]);
}
}
});
}
return params;
}
function adaptor10(params) {
return flow(transformOptions2, createViews, theme2, geometry11, meta8, axis6, limitInPlot3, tooltip4, interaction3, annotation2, animation2, color2, legend8, slider2)(params);
}
// node_modules/@antv/g2plot/esm/plots/dual-axes/index.js
var DualAxes = function(_super) {
__extends(DualAxes2, _super);
function DualAxes2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "dual-axes";
return _this;
}
DualAxes2.prototype.getDefaultOptions = function() {
return deepAssign({}, _super.prototype.getDefaultOptions.call(this), {
yAxis: [],
syncViewPadding: true
});
};
DualAxes2.prototype.getSchemaAdaptor = function() {
return adaptor10;
};
return DualAxes2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/tiny-line/constants.js
var X_FIELD = "x";
var Y_FIELD = "y";
var DEFAULT_TOOLTIP_OPTIONS = {
showTitle: false,
shared: true,
showMarkers: false,
customContent: function(x6, data3) {
return "" + get_default(data3, [0, "data", "y"], 0);
},
containerTpl: '',
itemTpl: "{value}",
domStyles: {
"g2-tooltip": {
padding: "2px 4px",
fontSize: "10px"
}
},
showCrosshairs: true,
crosshairs: {
type: "x"
}
};
var DEFAULT_OPTIONS10 = {
appendPadding: 2,
tooltip: __assign({}, DEFAULT_TOOLTIP_OPTIONS),
animation: {}
};
// node_modules/@antv/g2plot/esm/plots/tiny-line/utils.js
function getTinyData(data3) {
return map_default(data3 || [], function(y5, x6) {
return { x: "" + x6, y: y5 };
});
}
// node_modules/@antv/g2plot/esm/plots/tiny-area/adaptor.js
function geometry12(params) {
var chart = params.chart, options = params.options;
var data3 = options.data, color4 = options.color, areaStyle = options.areaStyle, pointOptions = options.point, lineOptions = options.line;
var pointState = pointOptions === null || pointOptions === void 0 ? void 0 : pointOptions.state;
var seriesData = getTinyData(data3);
chart.data(seriesData);
var primary = deepAssign({}, params, {
options: {
xField: X_FIELD,
yField: Y_FIELD,
area: { color: color4, style: areaStyle },
line: lineOptions,
point: pointOptions
}
});
var second = deepAssign({}, primary, { options: { tooltip: false } });
var pointParams = deepAssign({}, primary, { options: { tooltip: false, state: pointState } });
area(primary);
line(second);
point(pointParams);
chart.axis(false);
chart.legend(false);
return params;
}
function meta9(params) {
var _a6, _b;
var options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis, data3 = options.data;
var seriesData = getTinyData(data3);
return flow(scale7((_a6 = {}, _a6[X_FIELD] = xAxis, _a6[Y_FIELD] = yAxis, _a6), (_b = {}, _b[X_FIELD] = {
type: "cat"
}, _b[Y_FIELD] = adjustYMetaByZero(seriesData, Y_FIELD), _b)))(params);
}
function adaptor11(params) {
return flow(pattern("areaStyle"), geometry12, meta9, tooltip, theme, animation, annotation())(params);
}
// node_modules/@antv/g2plot/esm/plots/tiny-line/adaptor.js
function geometry13(params) {
var chart = params.chart, options = params.options;
var data3 = options.data, color4 = options.color, lineStyle = options.lineStyle, pointMapping = options.point;
var pointState = pointMapping === null || pointMapping === void 0 ? void 0 : pointMapping.state;
var seriesData = getTinyData(data3);
chart.data(seriesData);
var primary = deepAssign({}, params, {
options: {
xField: X_FIELD,
yField: Y_FIELD,
line: {
color: color4,
style: lineStyle
},
point: pointMapping
}
});
var pointParams = deepAssign({}, primary, { options: { tooltip: false, state: pointState } });
line(primary);
point(pointParams);
chart.axis(false);
chart.legend(false);
return params;
}
function adaptor12(params) {
return flow(geometry13, meta9, theme, tooltip, animation, annotation())(params);
}
// node_modules/@antv/g2plot/esm/plots/tiny-line/index.js
var TinyLine = function(_super) {
__extends(TinyLine2, _super);
function TinyLine2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "tiny-line";
return _this;
}
TinyLine2.getDefaultOptions = function() {
return DEFAULT_OPTIONS10;
};
TinyLine2.prototype.changeData = function(data3) {
this.updateOption({ data: data3 });
var _a6 = this, chart = _a6.chart, options = _a6.options;
meta9({ chart, options });
chart.changeData(getTinyData(data3));
};
TinyLine2.prototype.getDefaultOptions = function() {
return TinyLine2.getDefaultOptions();
};
TinyLine2.prototype.getSchemaAdaptor = function() {
return adaptor12;
};
return TinyLine2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/tiny-column/adaptor.js
function geometry14(params) {
var chart = params.chart, options = params.options;
var data3 = options.data, color4 = options.color, columnStyle = options.columnStyle, columnWidthRatio = options.columnWidthRatio;
var seriesData = getTinyData(data3);
chart.data(seriesData);
var p4 = deepAssign({}, params, {
options: {
xField: X_FIELD,
yField: Y_FIELD,
widthRatio: columnWidthRatio,
interval: {
style: columnStyle,
color: color4
}
}
});
interval2(p4);
chart.axis(false);
chart.legend(false);
chart.interaction("element-active");
return params;
}
function adaptor13(params) {
return flow(theme, pattern("columnStyle"), geometry14, meta9, tooltip, animation, annotation())(params);
}
// node_modules/@antv/g2plot/esm/plots/tiny-column/constants.js
var DEFAULT_TOOLTIP_OPTIONS2 = {
showTitle: false,
shared: true,
showMarkers: false,
customContent: function(x6, data3) {
return "" + get_default(data3, [0, "data", "y"], 0);
},
containerTpl: '',
itemTpl: "{value}",
domStyles: {
"g2-tooltip": {
padding: "2px 4px",
fontSize: "10px"
}
}
};
var DEFAULT_OPTIONS11 = {
appendPadding: 2,
tooltip: __assign({}, DEFAULT_TOOLTIP_OPTIONS2),
animation: {}
};
// node_modules/@antv/g2plot/esm/plots/tiny-column/index.js
var TinyColumn = function(_super) {
__extends(TinyColumn2, _super);
function TinyColumn2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "tiny-column";
return _this;
}
TinyColumn2.getDefaultOptions = function() {
return DEFAULT_OPTIONS11;
};
TinyColumn2.prototype.changeData = function(data3) {
this.updateOption({ data: data3 });
var _a6 = this, chart = _a6.chart, options = _a6.options;
meta9({ chart, options });
chart.changeData(getTinyData(data3));
};
TinyColumn2.prototype.getDefaultOptions = function() {
return TinyColumn2.getDefaultOptions();
};
TinyColumn2.prototype.getSchemaAdaptor = function() {
return adaptor13;
};
return TinyColumn2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/tiny-area/constants.js
var DEFAULT_OPTIONS12 = {
appendPadding: 2,
tooltip: __assign({}, DEFAULT_TOOLTIP_OPTIONS),
color: "l(90) 0:#E5EDFE 1:#ffffff",
areaStyle: {
fillOpacity: 0.6
},
line: {
size: 1,
color: "#5B8FF9"
},
animation: {}
};
// node_modules/@antv/g2plot/esm/plots/tiny-area/index.js
var TinyArea = function(_super) {
__extends(TinyArea2, _super);
function TinyArea2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "tiny-area";
return _this;
}
TinyArea2.getDefaultOptions = function() {
return DEFAULT_OPTIONS12;
};
TinyArea2.prototype.changeData = function(data3) {
this.updateOption({ data: data3 });
var _a6 = this, chart = _a6.chart, options = _a6.options;
meta9({ chart, options });
chart.changeData(getTinyData(data3));
};
TinyArea2.prototype.getDefaultOptions = function() {
return TinyArea2.getDefaultOptions();
};
TinyArea2.prototype.getSchemaAdaptor = function() {
return adaptor11;
};
return TinyArea2;
}(Plot);
// node_modules/@antv/g2plot/esm/utils/transform/histogram.js
function getBinKey(value2, binWidth, binNumber) {
if (binNumber === 1) {
return [0, binWidth];
}
var index2 = Math.floor(value2 / binWidth);
return [binWidth * index2, binWidth * (index2 + 1)];
}
function sturges(values2) {
return Math.ceil(Math.log(values2.length) / Math.LN2) + 1;
}
function binHistogram(data3, binField, binWidth, binNumber, stackField) {
var originData_copy = clone_default(data3);
sort_by_default(originData_copy, binField);
var values2 = values_of_key_default(originData_copy, binField);
var range = get_range_default(values2);
var rangeWidth = range.max - range.min;
var _binWidth = binWidth;
if (!binWidth && binNumber) {
_binWidth = binNumber > 1 ? rangeWidth / (binNumber - 1) : range.max;
}
if (!binWidth && !binNumber) {
var _defaultBinNumber = sturges(values2);
_binWidth = rangeWidth / _defaultBinNumber;
}
var bins = {};
var groups = group_by_default(originData_copy, stackField);
if (is_empty_default(groups)) {
each_default(originData_copy, function(data4) {
var value2 = data4[binField];
var bin = getBinKey(value2, _binWidth, binNumber);
var binKey = bin[0] + "-" + bin[1];
if (!has_key_default(bins, binKey)) {
bins[binKey] = { range: bin, count: 0 };
}
bins[binKey].count += 1;
});
} else {
Object.keys(groups).forEach(function(groupKey) {
each_default(groups[groupKey], function(data4) {
var value2 = data4[binField];
var bin = getBinKey(value2, _binWidth, binNumber);
var binKey = bin[0] + "-" + bin[1];
var groupKeyBinKey = binKey + "-" + groupKey;
if (!has_key_default(bins, groupKeyBinKey)) {
bins[groupKeyBinKey] = { range: bin, count: 0 };
bins[groupKeyBinKey][stackField] = groupKey;
}
bins[groupKeyBinKey].count += 1;
});
});
}
var plotData = [];
each_default(bins, function(bin) {
plotData.push(bin);
});
return plotData;
}
// node_modules/@antv/g2plot/esm/plots/histogram/constant.js
var HISTOGRAM_X_FIELD = "range";
var HISTOGRAM_Y_FIELD = "count";
var DEFAULT_OPTIONS13 = deepAssign({}, Plot.getDefaultOptions(), {
columnStyle: {
stroke: "#FFFFFF"
},
tooltip: {
shared: true,
showMarkers: false
},
interactions: [{ type: "active-region" }]
});
// node_modules/@antv/g2plot/esm/plots/histogram/adaptor.js
function geometry15(params) {
var chart = params.chart, options = params.options;
var data3 = options.data, binField = options.binField, binNumber = options.binNumber, binWidth = options.binWidth, color4 = options.color, stackField = options.stackField, legend18 = options.legend, columnStyle = options.columnStyle;
var plotData = binHistogram(data3, binField, binWidth, binNumber, stackField);
chart.data(plotData);
var p4 = deepAssign({}, params, {
options: {
xField: HISTOGRAM_X_FIELD,
yField: HISTOGRAM_Y_FIELD,
seriesField: stackField,
isStack: true,
interval: {
color: color4,
style: columnStyle
}
}
});
interval2(p4);
if (legend18 && stackField) {
chart.legend(stackField, legend18);
}
return params;
}
function meta10(params) {
var _a6;
var options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis;
return flow(scale7((_a6 = {}, _a6[HISTOGRAM_X_FIELD] = xAxis, _a6[HISTOGRAM_Y_FIELD] = yAxis, _a6)))(params);
}
function axis7(params) {
var chart = params.chart, options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis;
if (xAxis === false) {
chart.axis(HISTOGRAM_X_FIELD, false);
} else {
chart.axis(HISTOGRAM_X_FIELD, xAxis);
}
if (yAxis === false) {
chart.axis(HISTOGRAM_Y_FIELD, false);
} else {
chart.axis(HISTOGRAM_Y_FIELD, yAxis);
}
return params;
}
function label9(params) {
var chart = params.chart, options = params.options;
var label17 = options.label;
var geometry35 = findGeometry(chart, "interval");
if (!label17) {
geometry35.label(false);
} else {
var callback = label17.callback, cfg = __rest(label17, ["callback"]);
geometry35.label({
fields: [HISTOGRAM_Y_FIELD],
callback,
cfg: transformLabel(cfg)
});
}
return params;
}
function adaptor14(params) {
return flow(theme, pattern("columnStyle"), geometry15, meta10, axis7, state, label9, tooltip, interaction, animation)(params);
}
// node_modules/@antv/g2plot/esm/plots/histogram/index.js
var Histogram = function(_super) {
__extends(Histogram2, _super);
function Histogram2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "histogram";
return _this;
}
Histogram2.getDefaultOptions = function() {
return DEFAULT_OPTIONS13;
};
Histogram2.prototype.changeData = function(data3) {
this.updateOption({ data: data3 });
var _a6 = this.options, binField = _a6.binField, binNumber = _a6.binNumber, binWidth = _a6.binWidth, stackField = _a6.stackField;
this.chart.changeData(binHistogram(data3, binField, binWidth, binNumber, stackField));
};
Histogram2.prototype.getDefaultOptions = function() {
return Histogram2.getDefaultOptions();
};
Histogram2.prototype.getSchemaAdaptor = function() {
return adaptor14;
};
return Histogram2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/progress/constants.js
var DEFAULT_COLOR = ["#FAAD14", "#E8EDF3"];
var DEFAULT_OPTIONS14 = {
percent: 0.2,
color: DEFAULT_COLOR,
animation: {}
};
// node_modules/@antv/g2plot/esm/plots/progress/utils.js
function getProgressData(percent2) {
var clampPercent = clamp_default(isRealNumber(percent2) ? percent2 : 0, 0, 1);
return [
{
type: "current",
percent: clampPercent
},
{
type: "target",
percent: 1 - clampPercent
}
];
}
// node_modules/@antv/g2plot/esm/plots/progress/adaptor.js
function geometry16(params) {
var chart = params.chart, options = params.options;
var percent2 = options.percent, progressStyle = options.progressStyle, color4 = options.color, barWidthRatio = options.barWidthRatio;
chart.data(getProgressData(percent2));
var p4 = deepAssign({}, params, {
options: {
xField: "1",
yField: "percent",
seriesField: "type",
isStack: true,
widthRatio: barWidthRatio,
interval: {
style: progressStyle,
color: is_string_default(color4) ? [color4, DEFAULT_COLOR[1]] : color4
},
args: {
zIndexReversed: true,
sortZIndex: true
}
}
});
interval2(p4);
chart.tooltip(false);
chart.axis(false);
chart.legend(false);
return params;
}
function coordinate5(params) {
var chart = params.chart;
chart.coordinate("rect").transpose();
return params;
}
function adaptor15(params) {
return flow(geometry16, scale7({}), coordinate5, animation, theme, annotation())(params);
}
// node_modules/@antv/g2plot/esm/plots/progress/index.js
var Progress = function(_super) {
__extends(Progress2, _super);
function Progress2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "process";
return _this;
}
Progress2.getDefaultOptions = function() {
return DEFAULT_OPTIONS14;
};
Progress2.prototype.changeData = function(percent2) {
this.updateOption({ percent: percent2 });
this.chart.changeData(getProgressData(percent2));
};
Progress2.prototype.getDefaultOptions = function() {
return Progress2.getDefaultOptions();
};
Progress2.prototype.getSchemaAdaptor = function() {
return adaptor15;
};
return Progress2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/ring-progress/adaptor.js
function coordinate6(params) {
var chart = params.chart, options = params.options;
var innerRadius = options.innerRadius, radius = options.radius;
chart.coordinate("theta", {
innerRadius,
radius
});
return params;
}
function statistic(params, updated) {
var chart = params.chart, options = params.options;
var innerRadius = options.innerRadius, statistic4 = options.statistic, percent2 = options.percent, meta23 = options.meta;
chart.getController("annotation").clear(true);
if (innerRadius && statistic4) {
var metaFormatter = get_default(meta23, ["percent", "formatter"]) || function(v3) {
return (v3 * 100).toFixed(2) + "%";
};
var contentOpt = statistic4.content;
if (contentOpt) {
contentOpt = deepAssign({}, contentOpt, {
content: !is_nil_default(contentOpt.content) ? contentOpt.content : metaFormatter(percent2)
});
}
renderStatistic(chart, { statistic: __assign(__assign({}, statistic4), { content: contentOpt }), plotType: "ring-progress" }, { percent: percent2 });
}
if (updated) {
chart.render(true);
}
return params;
}
function adaptor16(params) {
return flow(geometry16, scale7({}), coordinate6, statistic, animation, theme, annotation())(params);
}
// node_modules/@antv/g2plot/esm/plots/ring-progress/constants.js
var DEFAULT_OPTIONS15 = {
percent: 0.2,
innerRadius: 0.8,
radius: 0.98,
color: ["#FAAD14", "#E8EDF3"],
statistic: {
title: false,
content: {
style: {
fontSize: "14px",
fontWeight: 300,
fill: "#4D4D4D",
textAlign: "center",
textBaseline: "middle"
}
}
},
animation: {}
};
// node_modules/@antv/g2plot/esm/plots/ring-progress/index.js
var RingProgress = function(_super) {
__extends(RingProgress2, _super);
function RingProgress2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "ring-process";
return _this;
}
RingProgress2.getDefaultOptions = function() {
return DEFAULT_OPTIONS15;
};
RingProgress2.prototype.changeData = function(percent2) {
this.chart.emit(VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, event_default.fromData(this.chart, VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, null));
this.updateOption({ percent: percent2 });
this.chart.data(getProgressData(percent2));
statistic({ chart: this.chart, options: this.options }, true);
this.chart.emit(VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA, event_default.fromData(this.chart, VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA, null));
};
RingProgress2.prototype.getDefaultOptions = function() {
return RingProgress2.getDefaultOptions();
};
RingProgress2.prototype.getSchemaAdaptor = function() {
return adaptor16;
};
return RingProgress2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/heatmap/adaptor.js
function geometry17(params) {
var chart = params.chart, options = params.options;
var data3 = options.data, type2 = options.type, xField = options.xField, yField = options.yField, colorField = options.colorField, sizeField = options.sizeField, sizeRatio = options.sizeRatio, shape = options.shape, color4 = options.color, tooltip10 = options.tooltip, heatmapStyle = options.heatmapStyle;
chart.data(data3);
var geometryType = "polygon";
if (type2 === "density") {
geometryType = "heatmap";
}
var _a6 = getTooltipMapping(tooltip10, [xField, yField, colorField]), fields = _a6.fields, formatter = _a6.formatter;
var checkedSizeRatio = 1;
if (sizeRatio || sizeRatio === 0) {
if (!shape && !sizeField) {
console.warn("sizeRatio is not in effect: Must define shape or sizeField first");
} else if (sizeRatio < 0 || sizeRatio > 1) {
console.warn("sizeRatio is not in effect: It must be a number in [0,1]");
} else {
checkedSizeRatio = sizeRatio;
}
}
geometry(deepAssign({}, params, {
options: {
type: geometryType,
colorField,
tooltipFields: fields,
shapeField: sizeField || "",
label: void 0,
mapping: {
tooltip: formatter,
shape: shape && (sizeField ? function(dautm) {
var field6 = data3.map(function(row) {
return row[sizeField];
});
var min7 = Math.min.apply(Math, field6);
var max8 = Math.max.apply(Math, field6);
return [shape, (get_default(dautm, sizeField) - min7) / (max8 - min7), checkedSizeRatio];
} : function() {
return [shape, 1, checkedSizeRatio];
}),
color: color4 || colorField && chart.getTheme().sequenceColors.join("-"),
style: heatmapStyle
}
}
}));
return params;
}
function meta11(params) {
var _a6;
var options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField;
return flow(scale7((_a6 = {}, _a6[xField] = xAxis, _a6[yField] = yAxis, _a6)))(params);
}
function axis8(params) {
var chart = params.chart, options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField;
if (xAxis === false) {
chart.axis(xField, false);
} else {
chart.axis(xField, xAxis);
}
if (yAxis === false) {
chart.axis(yField, false);
} else {
chart.axis(yField, yAxis);
}
return params;
}
function legend9(params) {
var chart = params.chart, options = params.options;
var legend18 = options.legend, colorField = options.colorField, sizeField = options.sizeField, sizeLegend = options.sizeLegend;
var showLegend = legend18 !== false;
if (colorField) {
chart.legend(colorField, showLegend ? legend18 : false);
}
if (sizeField) {
chart.legend(sizeField, sizeLegend === void 0 ? legend18 : sizeLegend);
}
if (!showLegend && !sizeLegend) {
chart.legend(false);
}
return params;
}
function label10(params) {
var chart = params.chart, options = params.options;
var label17 = options.label, colorField = options.colorField, type2 = options.type;
var geometry35 = findGeometry(chart, type2 === "density" ? "heatmap" : "polygon");
if (!label17) {
geometry35.label(false);
} else if (colorField) {
var callback = label17.callback, cfg = __rest(label17, ["callback"]);
geometry35.label({
fields: [colorField],
callback,
cfg: transformLabel(cfg)
});
}
return params;
}
function coordinate7(params) {
var chart = params.chart, options = params.options;
var coordinate11 = options.coordinate, reflect = options.reflect;
if (coordinate11) {
chart.coordinate({
type: coordinate11.type || "rect",
cfg: coordinate11.cfg
});
}
if (reflect) {
chart.coordinate().reflect(reflect);
}
return params;
}
function adaptor17(params) {
return flow(theme, pattern("heatmapStyle"), meta11, coordinate7, geometry17, axis8, legend9, tooltip, label10, annotation(), interaction, animation, state)(params);
}
// node_modules/@antv/g2plot/esm/plots/heatmap/constant.js
var DEFAULT_OPTIONS16 = deepAssign({}, Plot.getDefaultOptions(), {
type: "polygon",
legend: false,
coordinate: {
type: "rect"
},
xAxis: {
tickLine: null,
line: null,
grid: {
alignTick: false,
line: {
style: {
lineWidth: 1,
lineDash: null,
stroke: "#f0f0f0"
}
}
}
},
yAxis: {
grid: {
alignTick: false,
line: {
style: {
lineWidth: 1,
lineDash: null,
stroke: "#f0f0f0"
}
}
}
}
});
// node_modules/@antv/g2plot/esm/plots/heatmap/shapes/circle.js
registerShape("polygon", "circle", {
draw: function(cfg, group2) {
var _a6, _b;
var cx = cfg.x;
var cy = cfg.y;
var points = this.parsePoints(cfg.points);
var width2 = Math.abs(points[2].x - points[1].x);
var height = Math.abs(points[1].y - points[0].y);
var maxRadius = Math.min(width2, height) / 2;
var value2 = Number(cfg.shape[1]);
var sizeRatio = Number(cfg.shape[2]);
var radiusRatio = Math.sqrt(sizeRatio);
var radius = maxRadius * radiusRatio * Math.sqrt(value2);
var fill = ((_a6 = cfg.style) === null || _a6 === void 0 ? void 0 : _a6.fill) || cfg.color || ((_b = cfg.defaultStyle) === null || _b === void 0 ? void 0 : _b.fill);
var polygon2 = group2.addShape("circle", {
attrs: __assign(__assign(__assign({ x: cx, y: cy, r: radius }, cfg.defaultStyle), cfg.style), { fill })
});
return polygon2;
}
});
// node_modules/@antv/g2plot/esm/plots/heatmap/shapes/square.js
registerShape("polygon", "square", {
draw: function(cfg, group2) {
var _a6, _b;
var cx = cfg.x;
var cy = cfg.y;
var points = this.parsePoints(cfg.points);
var width2 = Math.abs(points[2].x - points[1].x);
var height = Math.abs(points[1].y - points[0].y);
var maxSideLength = Math.min(width2, height);
var value2 = Number(cfg.shape[1]);
var sizeRatio = Number(cfg.shape[2]);
var lenRatio = Math.sqrt(sizeRatio);
var sideLength = maxSideLength * lenRatio * Math.sqrt(value2);
var fill = ((_a6 = cfg.style) === null || _a6 === void 0 ? void 0 : _a6.fill) || cfg.color || ((_b = cfg.defaultStyle) === null || _b === void 0 ? void 0 : _b.fill);
var polygon2 = group2.addShape("rect", {
attrs: __assign(__assign(__assign({ x: cx - sideLength / 2, y: cy - sideLength / 2, width: sideLength, height: sideLength }, cfg.defaultStyle), cfg.style), { fill })
});
return polygon2;
}
});
// node_modules/@antv/g2plot/esm/plots/heatmap/index.js
var Heatmap2 = function(_super) {
__extends(Heatmap3, _super);
function Heatmap3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "heatmap";
return _this;
}
Heatmap3.getDefaultOptions = function() {
return DEFAULT_OPTIONS16;
};
Heatmap3.prototype.getSchemaAdaptor = function() {
return adaptor17;
};
Heatmap3.prototype.getDefaultOptions = function() {
return Heatmap3.getDefaultOptions();
};
return Heatmap3;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/box/constant.js
var _a3;
var BOX_RANGE = "$$range$$";
var BOX_RANGE_ALIAS = "low-q1-median-q3-high";
var BOX_SYNC_NAME = "$$y_outliers$$";
var OUTLIERS_VIEW_ID = "outliers_view";
var DEFAULT_OPTIONS17 = deepAssign({}, Plot.getDefaultOptions(), {
meta: (_a3 = {}, _a3[BOX_RANGE] = { min: 0, alias: BOX_RANGE_ALIAS }, _a3),
interactions: [{ type: "active-region" }],
tooltip: {
showMarkers: false,
shared: true
},
boxStyle: {
lineWidth: 1
}
});
// node_modules/@antv/g2plot/esm/plots/box/utils.js
var transformData = function(data3, yField) {
var newData = data3;
if (Array.isArray(yField)) {
var low_1 = yField[0], q1_1 = yField[1], median_1 = yField[2], q3_1 = yField[3], high_1 = yField[4];
newData = map_default(data3, function(obj) {
obj[BOX_RANGE] = [obj[low_1], obj[q1_1], obj[median_1], obj[q3_1], obj[high_1]];
return obj;
});
}
return newData;
};
// node_modules/@antv/g2plot/esm/plots/box/adaptor.js
function field(params) {
var chart = params.chart, options = params.options;
var xField = options.xField, yField = options.yField, groupField = options.groupField, color4 = options.color, tooltip10 = options.tooltip, boxStyle = options.boxStyle;
chart.data(transformData(options.data, yField));
var yFieldName = is_array_default(yField) ? BOX_RANGE : yField;
var rawFields = yField ? is_array_default(yField) ? yField : [yField] : [];
var tooltipOptions = tooltip10;
if (tooltipOptions !== false) {
tooltipOptions = deepAssign({}, { fields: is_array_default(yField) ? yField : [] }, tooltipOptions);
}
var ext = schema2(deepAssign({}, params, {
options: {
xField,
yField: yFieldName,
seriesField: groupField,
tooltip: tooltipOptions,
rawFields,
label: false,
schema: {
shape: "box",
color: color4,
style: boxStyle
}
}
})).ext;
if (groupField) {
ext.geometry.adjust("dodge");
}
return params;
}
function outliersPoint(params) {
var chart = params.chart, options = params.options;
var xField = options.xField, data3 = options.data, outliersField = options.outliersField, outliersStyle = options.outliersStyle, padding3 = options.padding, label17 = options.label;
if (!outliersField)
return params;
var outliersView = chart.createView({ padding: padding3, id: OUTLIERS_VIEW_ID });
var outliersViewData = data3.reduce(function(ret, datum) {
var outliersData = datum[outliersField];
outliersData.forEach(function(d3) {
var _a6;
return ret.push(__assign(__assign({}, datum), (_a6 = {}, _a6[outliersField] = d3, _a6)));
});
return ret;
}, []);
outliersView.data(outliersViewData);
point({
chart: outliersView,
options: {
xField,
yField: outliersField,
point: { shape: "circle", style: outliersStyle },
label: label17
}
});
outliersView.axis(false);
return params;
}
function meta12(params) {
var _a6, _b;
var chart = params.chart, options = params.options;
var meta23 = options.meta, xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField, outliersField = options.outliersField;
var yFieldName = Array.isArray(yField) ? BOX_RANGE : yField;
var baseMeta = {};
if (outliersField) {
var syncName = BOX_SYNC_NAME;
baseMeta = (_a6 = {}, _a6[outliersField] = { sync: syncName, nice: true }, _a6[yFieldName] = { sync: syncName, nice: true }, _a6);
}
var scales = deepAssign(baseMeta, meta23, (_b = {}, _b[xField] = pick(xAxis, AXIS_META_CONFIG_KEYS), _b[yFieldName] = pick(yAxis, AXIS_META_CONFIG_KEYS), _b));
chart.scale(scales);
return params;
}
function axis9(params) {
var chart = params.chart, options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField;
var yFieldName = Array.isArray(yField) ? BOX_RANGE : yField;
if (xAxis === false) {
chart.axis(xField, false);
} else {
chart.axis(xField, xAxis);
}
if (yAxis === false) {
chart.axis(BOX_RANGE, false);
} else {
chart.axis(yFieldName, yAxis);
}
return params;
}
function legend10(params) {
var chart = params.chart, options = params.options;
var legend18 = options.legend, groupField = options.groupField;
if (groupField) {
if (legend18) {
chart.legend(groupField, legend18);
} else {
chart.legend(groupField, { position: "bottom" });
}
} else {
chart.legend(false);
}
return params;
}
function adaptor18(params) {
return flow(field, outliersPoint, meta12, axis9, legend10, tooltip, interaction, animation, theme)(params);
}
// node_modules/@antv/g2plot/esm/plots/box/index.js
var Box = function(_super) {
__extends(Box3, _super);
function Box3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "box";
return _this;
}
Box3.getDefaultOptions = function() {
return DEFAULT_OPTIONS17;
};
Box3.prototype.changeData = function(data3) {
this.updateOption({ data: data3 });
var yField = this.options.yField;
var outliersView = this.chart.views.find(function(v3) {
return v3.id === OUTLIERS_VIEW_ID;
});
if (outliersView) {
outliersView.data(data3);
}
this.chart.changeData(transformData(data3, yField));
};
Box3.prototype.getDefaultOptions = function() {
return Box3.getDefaultOptions();
};
Box3.prototype.getSchemaAdaptor = function() {
return adaptor18;
};
return Box3;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/violin/utils.js
var import_pdfast = __toModule(require_src());
// node_modules/@antv/g2plot/esm/utils/transform/quantile.js
function quantileSorted2(x6, p4) {
var idx = x6.length * p4;
if (x6.length === 0) {
throw new Error("quantile requires at least one data point.");
} else if (p4 < 0 || p4 > 1) {
throw new Error("quantiles must be between 0 and 1");
} else if (p4 === 1) {
return x6[x6.length - 1];
} else if (p4 === 0) {
return x6[0];
} else if (idx % 1 !== 0) {
return x6[Math.ceil(idx) - 1];
} else if (x6.length % 2 === 0) {
return (x6[idx - 1] + x6[idx]) / 2;
} else {
return x6[idx];
}
}
function swap2(arr, i4, j4) {
var tmp = arr[i4];
arr[i4] = arr[j4];
arr[j4] = tmp;
}
function quickselect(arr, k4, left2, right2) {
left2 = left2 || 0;
right2 = right2 || arr.length - 1;
while (right2 > left2) {
if (right2 - left2 > 600) {
var n3 = right2 - left2 + 1;
var m4 = k4 - left2 + 1;
var z3 = Math.log(n3);
var s4 = 0.5 * Math.exp(2 * z3 / 3);
var sd = 0.5 * Math.sqrt(z3 * s4 * (n3 - s4) / n3);
if (m4 - n3 / 2 < 0)
sd *= -1;
var newLeft = Math.max(left2, Math.floor(k4 - m4 * s4 / n3 + sd));
var newRight = Math.min(right2, Math.floor(k4 + (n3 - m4) * s4 / n3 + sd));
quickselect(arr, k4, newLeft, newRight);
}
var t4 = arr[k4];
var i4 = left2;
var j4 = right2;
swap2(arr, left2, k4);
if (arr[right2] > t4)
swap2(arr, left2, right2);
while (i4 < j4) {
swap2(arr, i4, j4);
i4++;
j4--;
while (arr[i4] < t4)
i4++;
while (arr[j4] > t4)
j4--;
}
if (arr[left2] === t4)
swap2(arr, left2, j4);
else {
j4++;
swap2(arr, j4, right2);
}
if (j4 <= k4)
left2 = j4 + 1;
if (k4 <= j4)
right2 = j4 - 1;
}
}
function quantile(x6, p4) {
var copy8 = x6.slice();
if (Array.isArray(p4)) {
multiQuantileSelect(copy8, p4);
var results = [];
for (var i4 = 0; i4 < p4.length; i4++) {
results[i4] = quantileSorted2(copy8, p4[i4]);
}
return results;
} else {
var idx = quantileIndex(copy8.length, p4);
quantileSelect(copy8, idx, 0, copy8.length - 1);
return quantileSorted2(copy8, p4);
}
}
function quantileSelect(arr, k4, left2, right2) {
if (k4 % 1 === 0) {
quickselect(arr, k4, left2, right2);
} else {
k4 = Math.floor(k4);
quickselect(arr, k4, left2, right2);
quickselect(arr, k4 + 1, k4 + 1, right2);
}
}
function multiQuantileSelect(arr, p4) {
var indices = [0];
for (var i4 = 0; i4 < p4.length; i4++) {
indices.push(quantileIndex(arr.length, p4[i4]));
}
indices.push(arr.length - 1);
indices.sort(compare);
var stack = [0, indices.length - 1];
while (stack.length) {
var r4 = Math.ceil(stack.pop());
var l4 = Math.floor(stack.pop());
if (r4 - l4 <= 1)
continue;
var m4 = Math.floor((l4 + r4) / 2);
quantileSelect(arr, indices[m4], Math.floor(indices[l4]), Math.ceil(indices[r4]));
stack.push(l4, m4, m4, r4);
}
}
function compare(a4, b10) {
return a4 - b10;
}
function quantileIndex(len5, p4) {
var idx = len5 * p4;
if (p4 === 1) {
return len5 - 1;
} else if (p4 === 0) {
return 0;
} else if (idx % 1 !== 0) {
return Math.ceil(idx) - 1;
} else if (len5 % 2 === 0) {
return idx - 0.5;
} else {
return idx;
}
}
// node_modules/@antv/g2plot/esm/plots/violin/utils.js
var toBoxValue = function(values2) {
return {
low: min_default(values2),
high: max_default(values2),
q1: quantile(values2, 0.25),
q3: quantile(values2, 0.75),
median: quantile(values2, [0.5]),
minMax: [min_default(values2), max_default(values2)],
quantile: [quantile(values2, 0.25), quantile(values2, 0.75)]
};
};
var toViolinValue = function(values2, pdfOptions) {
var pdfResults = import_pdfast.default.create(values2, pdfOptions);
return {
violinSize: pdfResults.map(function(result) {
return result.y;
}),
violinY: pdfResults.map(function(result) {
return result.x;
})
};
};
var transformViolinData = function(options) {
var xField = options.xField, yField = options.yField, seriesField = options.seriesField, data3 = options.data, kde = options.kde;
var pdfOptions = {
min: kde.min,
max: kde.max,
size: kde.sampleSize,
width: kde.width
};
if (!seriesField) {
var group_1 = group_by_default(data3, xField);
return Object.keys(group_1).map(function(x6) {
var records = group_1[x6];
var values2 = records.map(function(record) {
return record[yField];
});
return __assign(__assign({ x: x6 }, toViolinValue(values2, pdfOptions)), toBoxValue(values2));
});
}
var resultList = [];
var seriesGroup = group_by_default(data3, seriesField);
Object.keys(seriesGroup).forEach(function(series) {
var group2 = group_by_default(seriesGroup[series], xField);
return Object.keys(group2).forEach(function(key) {
var _a6;
var records = group2[key];
var values2 = records.map(function(record) {
return record[yField];
});
resultList.push(__assign(__assign((_a6 = { x: key }, _a6[seriesField] = series, _a6), toViolinValue(values2, pdfOptions)), toBoxValue(values2)));
});
});
return resultList;
};
// node_modules/@antv/g2plot/esm/plots/violin/constant.js
var X_FIELD2 = "x";
var VIOLIN_Y_FIELD = "violinY";
var VIOLIN_SIZE_FIELD = "violinSize";
var MIN_MAX_FIELD = "minMax";
var QUANTILE_FIELD = "quantile";
var MEDIAN_FIELD = "median";
var VIOLIN_VIEW_ID = "violin_view";
var MIN_MAX_VIEW_ID = "min_max_view";
var QUANTILE_VIEW_ID = "quantile_view";
var MEDIAN_VIEW_ID = "median_view";
var DEFAULT_OPTIONS18 = deepAssign({}, Plot.getDefaultOptions(), {
syncViewPadding: true,
kde: {
type: "triangular",
sampleSize: 32,
width: 3
},
violinStyle: {
lineWidth: 1,
fillOpacity: 0.3,
strokeOpacity: 0.75
},
xAxis: {
grid: {
line: null
},
tickLine: {
alignTick: false
}
},
yAxis: {
grid: {
line: {
style: {
lineWidth: 0.5,
lineDash: [4, 4]
}
}
}
},
legend: {
position: "top-left"
},
tooltip: {
showMarkers: false
}
});
// node_modules/@antv/g2plot/esm/plots/violin/adaptor.js
var TOOLTIP_FIELDS = ["low", "high", "q1", "q3", "median"];
var adjustCfg = [
{
type: "dodge",
marginRatio: 1 / 32
}
];
function data(params) {
var chart = params.chart, options = params.options;
chart.data(transformViolinData(options));
return params;
}
function violinView(params) {
var chart = params.chart, options = params.options;
var seriesField = options.seriesField, color4 = options.color, _a6 = options.shape, shape = _a6 === void 0 ? "violin" : _a6, violinStyle = options.violinStyle, tooltip10 = options.tooltip, state2 = options.state;
var view = chart.createView({ id: VIOLIN_VIEW_ID });
violin({
chart: view,
options: {
xField: X_FIELD2,
yField: VIOLIN_Y_FIELD,
seriesField: seriesField ? seriesField : X_FIELD2,
sizeField: VIOLIN_SIZE_FIELD,
tooltip: __assign({ fields: TOOLTIP_FIELDS }, tooltip10),
violin: {
style: violinStyle,
color: color4,
shape
},
state: state2
}
});
view.geometries[0].adjust(adjustCfg);
return params;
}
function boxView(params) {
var chart = params.chart, options = params.options;
var seriesField = options.seriesField, color4 = options.color, tooltip10 = options.tooltip, box2 = options.box;
if (box2 === false)
return params;
var minMaxView = chart.createView({ id: MIN_MAX_VIEW_ID });
interval2({
chart: minMaxView,
options: {
xField: X_FIELD2,
yField: MIN_MAX_FIELD,
seriesField: seriesField ? seriesField : X_FIELD2,
tooltip: __assign({ fields: TOOLTIP_FIELDS }, tooltip10),
state: typeof box2 === "object" ? box2.state : {},
interval: {
color: color4,
size: 1,
style: {
lineWidth: 0
}
}
}
});
minMaxView.geometries[0].adjust(adjustCfg);
var quantileView = chart.createView({ id: QUANTILE_VIEW_ID });
interval2({
chart: quantileView,
options: {
xField: X_FIELD2,
yField: QUANTILE_FIELD,
seriesField: seriesField ? seriesField : X_FIELD2,
tooltip: __assign({ fields: TOOLTIP_FIELDS }, tooltip10),
state: typeof box2 === "object" ? box2.state : {},
interval: {
color: color4,
size: 8,
style: {
fillOpacity: 1
}
}
}
});
quantileView.geometries[0].adjust(adjustCfg);
var medianView = chart.createView({ id: MEDIAN_VIEW_ID });
point({
chart: medianView,
options: {
xField: X_FIELD2,
yField: MEDIAN_FIELD,
seriesField: seriesField ? seriesField : X_FIELD2,
tooltip: __assign({ fields: TOOLTIP_FIELDS }, tooltip10),
state: typeof box2 === "object" ? box2.state : {},
point: {
color: color4,
size: 1,
style: {
fill: "white",
lineWidth: 0
}
}
}
});
medianView.geometries[0].adjust(adjustCfg);
quantileView.axis(false);
minMaxView.axis(false);
medianView.axis(false);
medianView.legend(false);
minMaxView.legend(false);
quantileView.legend(false);
return params;
}
function meta13(params) {
var _a6;
var chart = params.chart, options = params.options;
var meta23 = options.meta, xAxis = options.xAxis, yAxis = options.yAxis;
var baseMeta = {};
var scales = deepAssign(baseMeta, meta23, (_a6 = {}, _a6[X_FIELD2] = __assign(__assign({ sync: true }, pick(xAxis, AXIS_META_CONFIG_KEYS)), {
type: "cat"
}), _a6[VIOLIN_Y_FIELD] = __assign({ sync: true }, pick(yAxis, AXIS_META_CONFIG_KEYS)), _a6[MIN_MAX_FIELD] = __assign({ sync: VIOLIN_Y_FIELD }, pick(yAxis, AXIS_META_CONFIG_KEYS)), _a6[QUANTILE_FIELD] = __assign({ sync: VIOLIN_Y_FIELD }, pick(yAxis, AXIS_META_CONFIG_KEYS)), _a6[MEDIAN_FIELD] = __assign({ sync: VIOLIN_Y_FIELD }, pick(yAxis, AXIS_META_CONFIG_KEYS)), _a6));
chart.scale(scales);
return params;
}
function axis10(params) {
var chart = params.chart, options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis;
var view = findViewById(chart, VIOLIN_VIEW_ID);
if (xAxis === false) {
view.axis(X_FIELD2, false);
} else {
view.axis(X_FIELD2, xAxis);
}
if (yAxis === false) {
view.axis(VIOLIN_Y_FIELD, false);
} else {
view.axis(VIOLIN_Y_FIELD, yAxis);
}
chart.axis(false);
return params;
}
function legend11(params) {
var chart = params.chart, options = params.options;
var legend18 = options.legend, seriesField = options.seriesField, shape = options.shape;
if (legend18 === false) {
chart.legend(false);
} else {
var legendField_1 = seriesField ? seriesField : X_FIELD2;
var legendOptions = omit_default(legend18, ["selected"]);
if (!shape || !shape.startsWith("hollow")) {
if (!get_default(legendOptions, ["marker", "style", "lineWidth"])) {
set_default(legendOptions, ["marker", "style", "lineWidth"], 0);
}
}
chart.legend(legendField_1, legendOptions);
if (get_default(legend18, "selected")) {
each_default(chart.views, function(view) {
return view.legend(legendField_1, legend18);
});
}
}
return params;
}
function annotation3(params) {
var chart = params.chart;
var violinView2 = findViewById(chart, VIOLIN_VIEW_ID);
annotation()(__assign(__assign({}, params), { chart: violinView2 }));
return params;
}
function animation3(params) {
var chart = params.chart, options = params.options;
var animation7 = options.animation;
each_default(chart.views, function(view) {
if (typeof animation7 === "boolean") {
view.animate(animation7);
} else {
view.animate(true);
}
each_default(view.geometries, function(g4) {
g4.animate(animation7);
});
});
return params;
}
function adaptor19(params) {
return flow(theme, data, violinView, boxView, meta13, tooltip, axis10, legend11, interaction, annotation3, animation3)(params);
}
// node_modules/@antv/g2plot/esm/plots/violin/index.js
var Violin2 = function(_super) {
__extends(Violin3, _super);
function Violin3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "violin";
return _this;
}
Violin3.getDefaultOptions = function() {
return DEFAULT_OPTIONS18;
};
Violin3.prototype.changeData = function(data3) {
this.updateOption({ data: data3 });
this.chart.changeData(transformViolinData(this.options));
};
Violin3.prototype.getDefaultOptions = function() {
return Violin3.getDefaultOptions();
};
Violin3.prototype.getSchemaAdaptor = function() {
return adaptor19;
};
return Violin3;
}(Plot);
// node_modules/@antv/g2plot/esm/utils/color/blend.js
var each2 = function(f3) {
return function(c0, c1) {
var out = [];
out[0] = f3(c0[0], c1[0]);
out[1] = f3(c0[1], c1[1]);
out[2] = f3(c0[2], c1[2]);
return out;
};
};
var blendObject = {
normal: function(a4) {
return a4;
},
multiply: function(a4, b10) {
return a4 * b10 / 255;
},
screen: function(a4, b10) {
return 255 * (1 - (1 - a4 / 255) * (1 - b10 / 255));
},
overlay: function(a4, b10) {
return b10 < 128 ? 2 * a4 * b10 / 255 : 255 * (1 - 2 * (1 - a4 / 255) * (1 - b10 / 255));
},
darken: function(a4, b10) {
return a4 > b10 ? b10 : a4;
},
lighten: function(a4, b10) {
return a4 > b10 ? a4 : b10;
},
dodge: function(a4, b10) {
if (a4 === 255)
return 255;
a4 = 255 * (b10 / 255) / (1 - a4 / 255);
return a4 > 255 ? 255 : a4;
},
burn: function(a4, b10) {
if (b10 === 255)
return 255;
else if (a4 === 0)
return 0;
else
return 255 * (1 - Math.min(1, (1 - b10 / 255) / (a4 / 255)));
}
};
var innerBlend = function(mode) {
if (!blendObject[mode]) {
throw new Error("unknown blend mode " + mode);
}
return blendObject[mode];
};
function blend(c0, c1, mode) {
if (mode === void 0) {
mode = "normal";
}
var blendRgbArr = each2(innerBlend(mode))(colorToArr(c0), colorToArr(c1));
var _a6 = colorToArr(c0), r0 = _a6[0], g0 = _a6[1], b02 = _a6[2], a0 = _a6[3];
var _b = colorToArr(c1), r1 = _b[0], g1 = _b[1], b12 = _b[2], a1 = _b[3];
var a4 = Number((a0 + a1 * (1 - a0)).toFixed(2));
var r4 = Math.round((a0 * (1 - a1) * (r0 / 255) + a0 * a1 * (blendRgbArr[0] / 255) + (1 - a0) * a1 * (r1 / 255)) / a4 * 255);
var g4 = Math.round((a0 * (1 - a1) * (g0 / 255) + a0 * a1 * (blendRgbArr[1] / 255) + (1 - a0) * a1 * (g1 / 255)) / a4 * 255);
var b10 = Math.round((a0 * (1 - a1) * (b02 / 255) + a0 * a1 * (blendRgbArr[2] / 255) + (1 - a0) * a1 * (b12 / 255)) / a4 * 255);
return "rgba(" + r4 + ", " + g4 + ", " + b10 + ", " + a4 + ")";
}
function colorToArr(c5) {
var color4 = c5.replace("/s+/g", "");
var rgbaArr;
if (typeof color4 === "string" && !color4.startsWith("rgba") && !color4.startsWith("#")) {
return rgbaArr = esm_default2.rgb2arr(esm_default2.toRGB(color4)).concat([1]);
}
if (color4.startsWith("rgba"))
rgbaArr = color4.replace("rgba(", "").replace(")", "").split(",");
if (color4.startsWith("#"))
rgbaArr = esm_default2.rgb2arr(color4).concat([1]);
return rgbaArr.map(function(item, index2) {
return index2 === 3 ? Number(item) : item | 0;
});
}
// node_modules/@antv/g2plot/esm/plots/venn/layout/layout.js
var import_fmin = __toModule(require_fmin());
// node_modules/@antv/g2plot/esm/plots/venn/layout/circleintersection.js
var SMALL = 1e-10;
function intersectionArea(circles, stats) {
var intersectionPoints = getIntersectionPoints(circles);
var innerPoints = intersectionPoints.filter(function(p5) {
return containedInCircles(p5, circles);
});
var arcArea = 0, polygonArea = 0, i4;
var arcs = [];
if (innerPoints.length > 1) {
var center2 = getCenter(innerPoints);
for (i4 = 0; i4 < innerPoints.length; ++i4) {
var p4 = innerPoints[i4];
p4.angle = Math.atan2(p4.x - center2.x, p4.y - center2.y);
}
innerPoints.sort(function(a5, b10) {
return b10.angle - a5.angle;
});
var p22 = innerPoints[innerPoints.length - 1];
for (i4 = 0; i4 < innerPoints.length; ++i4) {
var p1 = innerPoints[i4];
polygonArea += (p22.x + p1.x) * (p1.y - p22.y);
var midPoint = { x: (p1.x + p22.x) / 2, y: (p1.y + p22.y) / 2 };
var arc2 = null;
for (var j4 = 0; j4 < p1.parentIndex.length; ++j4) {
if (p22.parentIndex.indexOf(p1.parentIndex[j4]) > -1) {
var circle3 = circles[p1.parentIndex[j4]], a1 = Math.atan2(p1.x - circle3.x, p1.y - circle3.y), a22 = Math.atan2(p22.x - circle3.x, p22.y - circle3.y);
var angleDiff = a22 - a1;
if (angleDiff < 0) {
angleDiff += 2 * Math.PI;
}
var a4 = a22 - angleDiff / 2;
var width2 = distance9(midPoint, {
x: circle3.x + circle3.radius * Math.sin(a4),
y: circle3.y + circle3.radius * Math.cos(a4)
});
if (width2 > circle3.radius * 2) {
width2 = circle3.radius * 2;
}
if (arc2 === null || arc2.width > width2) {
arc2 = { circle: circle3, width: width2, p1, p2: p22 };
}
}
}
if (arc2 !== null) {
arcs.push(arc2);
arcArea += circleArea(arc2.circle.radius, arc2.width);
p22 = p1;
}
}
} else {
var smallest = circles[0];
for (i4 = 1; i4 < circles.length; ++i4) {
if (circles[i4].radius < smallest.radius) {
smallest = circles[i4];
}
}
var disjoint = false;
for (i4 = 0; i4 < circles.length; ++i4) {
if (distance9(circles[i4], smallest) > Math.abs(smallest.radius - circles[i4].radius)) {
disjoint = true;
break;
}
}
if (disjoint) {
arcArea = polygonArea = 0;
} else {
arcArea = smallest.radius * smallest.radius * Math.PI;
arcs.push({
circle: smallest,
p1: { x: smallest.x, y: smallest.y + smallest.radius },
p2: { x: smallest.x - SMALL, y: smallest.y + smallest.radius },
width: smallest.radius * 2
});
}
}
polygonArea /= 2;
if (stats) {
stats.area = arcArea + polygonArea;
stats.arcArea = arcArea;
stats.polygonArea = polygonArea;
stats.arcs = arcs;
stats.innerPoints = innerPoints;
stats.intersectionPoints = intersectionPoints;
}
return arcArea + polygonArea;
}
function containedInCircles(point2, circles) {
for (var i4 = 0; i4 < circles.length; ++i4) {
if (distance9(point2, circles[i4]) > circles[i4].radius + SMALL) {
return false;
}
}
return true;
}
function getIntersectionPoints(circles) {
var ret = [];
for (var i4 = 0; i4 < circles.length; ++i4) {
for (var j4 = i4 + 1; j4 < circles.length; ++j4) {
var intersect2 = circleCircleIntersection(circles[i4], circles[j4]);
for (var k4 = 0; k4 < intersect2.length; ++k4) {
var p4 = intersect2[k4];
p4.parentIndex = [i4, j4];
ret.push(p4);
}
}
}
return ret;
}
function circleArea(r4, width2) {
return r4 * r4 * Math.acos(1 - width2 / r4) - (r4 - width2) * Math.sqrt(width2 * (2 * r4 - width2));
}
function distance9(p1, p22) {
return Math.sqrt((p1.x - p22.x) * (p1.x - p22.x) + (p1.y - p22.y) * (p1.y - p22.y));
}
function circleOverlap(r1, r22, d3) {
if (d3 >= r1 + r22) {
return 0;
}
if (d3 <= Math.abs(r1 - r22)) {
return Math.PI * Math.min(r1, r22) * Math.min(r1, r22);
}
var w1 = r1 - (d3 * d3 - r22 * r22 + r1 * r1) / (2 * d3), w22 = r22 - (d3 * d3 - r1 * r1 + r22 * r22) / (2 * d3);
return circleArea(r1, w1) + circleArea(r22, w22);
}
function circleCircleIntersection(p1, p22) {
var d3 = distance9(p1, p22), r1 = p1.radius, r22 = p22.radius;
if (d3 >= r1 + r22 || d3 <= Math.abs(r1 - r22)) {
return [];
}
var a4 = (r1 * r1 - r22 * r22 + d3 * d3) / (2 * d3), h3 = Math.sqrt(r1 * r1 - a4 * a4), x0 = p1.x + a4 * (p22.x - p1.x) / d3, y0 = p1.y + a4 * (p22.y - p1.y) / d3, rx = -(p22.y - p1.y) * (h3 / d3), ry = -(p22.x - p1.x) * (h3 / d3);
return [
{ x: x0 + rx, y: y0 - ry },
{ x: x0 - rx, y: y0 + ry }
];
}
function getCenter(points) {
var center2 = { x: 0, y: 0 };
for (var i4 = 0; i4 < points.length; ++i4) {
center2.x += points[i4].x;
center2.y += points[i4].y;
}
center2.x /= points.length;
center2.y /= points.length;
return center2;
}
// node_modules/@antv/g2plot/esm/plots/venn/layout/layout.js
function venn(areas, parameters) {
parameters = parameters || {};
parameters.maxIterations = parameters.maxIterations || 500;
var initialLayout = parameters.initialLayout || bestInitialLayout;
var loss = parameters.lossFunction || lossFunction;
areas = addMissingAreas(areas);
var circles = initialLayout(areas, parameters);
var initial = [], setids = [];
var setid;
for (setid in circles) {
if (circles.hasOwnProperty(setid)) {
initial.push(circles[setid].x);
initial.push(circles[setid].y);
setids.push(setid);
}
}
var solution = (0, import_fmin.nelderMead)(function(values2) {
var current = {};
for (var i5 = 0; i5 < setids.length; ++i5) {
var setid_1 = setids[i5];
current[setid_1] = {
x: values2[2 * i5],
y: values2[2 * i5 + 1],
radius: circles[setid_1].radius
};
}
return loss(current, areas);
}, initial, parameters);
var positions = solution.x;
for (var i4 = 0; i4 < setids.length; ++i4) {
setid = setids[i4];
circles[setid].x = positions[2 * i4];
circles[setid].y = positions[2 * i4 + 1];
}
return circles;
}
var SMALL2 = 1e-10;
function distanceFromIntersectArea(r1, r22, overlap2) {
if (Math.min(r1, r22) * Math.min(r1, r22) * Math.PI <= overlap2 + SMALL2) {
return Math.abs(r1 - r22);
}
return (0, import_fmin.bisect)(function(distance15) {
return circleOverlap(r1, r22, distance15) - overlap2;
}, 0, r1 + r22);
}
function addMissingAreas(areas) {
areas = areas.slice();
var ids = [], pairs2 = {};
var i4, j4, a4, b10;
for (i4 = 0; i4 < areas.length; ++i4) {
var area2 = areas[i4];
if (area2.sets.length == 1) {
ids.push(area2.sets[0]);
} else if (area2.sets.length == 2) {
a4 = area2.sets[0];
b10 = area2.sets[1];
pairs2[[a4, b10]] = true;
pairs2[[b10, a4]] = true;
}
}
ids.sort(function(a5, b11) {
return a5 > b11 ? 1 : -1;
});
for (i4 = 0; i4 < ids.length; ++i4) {
a4 = ids[i4];
for (j4 = i4 + 1; j4 < ids.length; ++j4) {
b10 = ids[j4];
if (!([a4, b10] in pairs2)) {
areas.push({ sets: [a4, b10], size: 0 });
}
}
}
return areas;
}
function getDistanceMatrices(areas, sets, setids) {
var distances = (0, import_fmin.zerosM)(sets.length, sets.length), constraints = (0, import_fmin.zerosM)(sets.length, sets.length);
areas.filter(function(x6) {
return x6.sets.length == 2;
}).map(function(current) {
var left2 = setids[current.sets[0]], right2 = setids[current.sets[1]], r1 = Math.sqrt(sets[left2].size / Math.PI), r22 = Math.sqrt(sets[right2].size / Math.PI), distance15 = distanceFromIntersectArea(r1, r22, current.size);
distances[left2][right2] = distances[right2][left2] = distance15;
var c5 = 0;
if (current.size + 1e-10 >= Math.min(sets[left2].size, sets[right2].size)) {
c5 = 1;
} else if (current.size <= 1e-10) {
c5 = -1;
}
constraints[left2][right2] = constraints[right2][left2] = c5;
});
return { distances, constraints };
}
function constrainedMDSGradient(x6, fxprime, distances, constraints) {
var loss = 0, i4;
for (i4 = 0; i4 < fxprime.length; ++i4) {
fxprime[i4] = 0;
}
for (i4 = 0; i4 < distances.length; ++i4) {
var xi = x6[2 * i4], yi = x6[2 * i4 + 1];
for (var j4 = i4 + 1; j4 < distances.length; ++j4) {
var xj = x6[2 * j4], yj = x6[2 * j4 + 1], dij = distances[i4][j4], constraint = constraints[i4][j4];
var squaredDistance4 = (xj - xi) * (xj - xi) + (yj - yi) * (yj - yi), distance_1 = Math.sqrt(squaredDistance4), delta = squaredDistance4 - dij * dij;
if (constraint > 0 && distance_1 <= dij || constraint < 0 && distance_1 >= dij) {
continue;
}
loss += 2 * delta * delta;
fxprime[2 * i4] += 4 * delta * (xi - xj);
fxprime[2 * i4 + 1] += 4 * delta * (yi - yj);
fxprime[2 * j4] += 4 * delta * (xj - xi);
fxprime[2 * j4 + 1] += 4 * delta * (yj - yi);
}
}
return loss;
}
function bestInitialLayout(areas, params) {
var initial = greedyLayout(areas, params);
var loss = params.lossFunction || lossFunction;
if (areas.length >= 8) {
var constrained = constrainedMDSLayout(areas, params), constrainedLoss = loss(constrained, areas), greedyLoss = loss(initial, areas);
if (constrainedLoss + 1e-8 < greedyLoss) {
initial = constrained;
}
}
return initial;
}
function constrainedMDSLayout(areas, params) {
params = params || {};
var restarts = params.restarts || 10;
var sets = [], setids = {};
var i4;
for (i4 = 0; i4 < areas.length; ++i4) {
var area2 = areas[i4];
if (area2.sets.length == 1) {
setids[area2.sets[0]] = sets.length;
sets.push(area2);
}
}
var matrices = getDistanceMatrices(areas, sets, setids);
var distances = matrices.distances;
var constraints = matrices.constraints;
var norm = (0, import_fmin.norm2)(distances.map(import_fmin.norm2)) / distances.length;
distances = distances.map(function(row) {
return row.map(function(value2) {
return value2 / norm;
});
});
var obj = function(x6, fxprime) {
return constrainedMDSGradient(x6, fxprime, distances, constraints);
};
var best, current;
for (i4 = 0; i4 < restarts; ++i4) {
var initial = (0, import_fmin.zeros)(distances.length * 2).map(Math.random);
current = (0, import_fmin.conjugateGradient)(obj, initial, params);
if (!best || current.fx < best.fx) {
best = current;
}
}
var positions = best.x;
var circles = {};
for (i4 = 0; i4 < sets.length; ++i4) {
var set10 = sets[i4];
circles[set10.sets[0]] = {
x: positions[2 * i4] * norm,
y: positions[2 * i4 + 1] * norm,
radius: Math.sqrt(set10.size / Math.PI)
};
}
if (params.history) {
for (i4 = 0; i4 < params.history.length; ++i4) {
(0, import_fmin.scale)(params.history[i4].x, norm);
}
}
return circles;
}
function greedyLayout(areas, params) {
var loss = params && params.lossFunction ? params.lossFunction : lossFunction;
var circles = {}, setOverlaps = {};
var set10;
for (var i4 = 0; i4 < areas.length; ++i4) {
var area2 = areas[i4];
if (area2.sets.length == 1) {
set10 = area2.sets[0];
circles[set10] = {
x: 1e10,
y: 1e10,
rowid: Object.keys(circles).length,
size: area2.size,
radius: Math.sqrt(area2.size / Math.PI)
};
setOverlaps[set10] = [];
}
}
areas = areas.filter(function(a4) {
return a4.sets.length == 2;
});
for (var i4 = 0; i4 < areas.length; ++i4) {
var current = areas[i4];
var weight = current.hasOwnProperty("weight") ? current.weight : 1;
var left2 = current.sets[0], right2 = current.sets[1];
if (current.size + SMALL2 >= Math.min(circles[left2].size, circles[right2].size)) {
weight = 0;
}
setOverlaps[left2].push({ set: right2, size: current.size, weight });
setOverlaps[right2].push({ set: left2, size: current.size, weight });
}
var mostOverlapped = [];
for (set10 in setOverlaps) {
if (setOverlaps.hasOwnProperty(set10)) {
var size2 = 0;
for (var i4 = 0; i4 < setOverlaps[set10].length; ++i4) {
size2 += setOverlaps[set10][i4].size * setOverlaps[set10][i4].weight;
}
mostOverlapped.push({ set: set10, size: size2 });
}
}
function sortOrder(a4, b10) {
return b10.size - a4.size;
}
mostOverlapped.sort(sortOrder);
var positioned = {};
function isPositioned(element) {
return element.set in positioned;
}
function positionSet(point2, index2) {
circles[index2].x = point2.x;
circles[index2].y = point2.y;
positioned[index2] = true;
}
positionSet({ x: 0, y: 0 }, mostOverlapped[0].set);
for (var i4 = 1; i4 < mostOverlapped.length; ++i4) {
var setIndex = mostOverlapped[i4].set, overlap2 = setOverlaps[setIndex].filter(isPositioned);
set10 = circles[setIndex];
overlap2.sort(sortOrder);
if (overlap2.length === 0) {
throw "ERROR: missing pairwise overlap information";
}
var points = [];
for (var j4 = 0; j4 < overlap2.length; ++j4) {
var p1 = circles[overlap2[j4].set], d1 = distanceFromIntersectArea(set10.radius, p1.radius, overlap2[j4].size);
points.push({ x: p1.x + d1, y: p1.y });
points.push({ x: p1.x - d1, y: p1.y });
points.push({ y: p1.y + d1, x: p1.x });
points.push({ y: p1.y - d1, x: p1.x });
for (var k4 = j4 + 1; k4 < overlap2.length; ++k4) {
var p22 = circles[overlap2[k4].set], d22 = distanceFromIntersectArea(set10.radius, p22.radius, overlap2[k4].size);
var extraPoints = circleCircleIntersection({ x: p1.x, y: p1.y, radius: d1 }, { x: p22.x, y: p22.y, radius: d22 });
for (var l4 = 0; l4 < extraPoints.length; ++l4) {
points.push(extraPoints[l4]);
}
}
}
var bestLoss = 1e50, bestPoint = points[0];
for (var j4 = 0; j4 < points.length; ++j4) {
circles[setIndex].x = points[j4].x;
circles[setIndex].y = points[j4].y;
var localLoss = loss(circles, areas);
if (localLoss < bestLoss) {
bestLoss = localLoss;
bestPoint = points[j4];
}
}
positionSet(bestPoint, setIndex);
}
return circles;
}
function lossFunction(sets, overlaps) {
var output = 0;
function getCircles(indices) {
return indices.map(function(i5) {
return sets[i5];
});
}
for (var i4 = 0; i4 < overlaps.length; ++i4) {
var area2 = overlaps[i4];
var overlap2 = void 0;
if (area2.sets.length == 1) {
continue;
} else if (area2.sets.length == 2) {
var left2 = sets[area2.sets[0]], right2 = sets[area2.sets[1]];
overlap2 = circleOverlap(left2.radius, right2.radius, distance9(left2, right2));
} else {
overlap2 = intersectionArea(getCircles(area2.sets));
}
var weight = area2.hasOwnProperty("weight") ? area2.weight : 1;
output += weight * (overlap2 - area2.size) * (overlap2 - area2.size);
}
return output;
}
function getBoundingBox(circles) {
var minMax = function(d3) {
var hi = Math.max.apply(null, circles.map(function(c5) {
return c5[d3] + c5.radius;
})), lo = Math.min.apply(null, circles.map(function(c5) {
return c5[d3] - c5.radius;
}));
return { max: hi, min: lo };
};
return { xRange: minMax("x"), yRange: minMax("y") };
}
function scaleSolution(solution, width2, height, padding3) {
var circles = [], setids = [];
for (var setid in solution) {
if (solution.hasOwnProperty(setid)) {
setids.push(setid);
circles.push(solution[setid]);
}
}
width2 -= 2 * padding3;
height -= 2 * padding3;
var bounds = getBoundingBox(circles), xRange = bounds.xRange, yRange = bounds.yRange;
if (xRange.max == xRange.min || yRange.max == yRange.min) {
console.log("not scaling solution: zero size detected");
return solution;
}
var xScaling = width2 / (xRange.max - xRange.min), yScaling = height / (yRange.max - yRange.min), scaling = Math.min(yScaling, xScaling), xOffset = (width2 - (xRange.max - xRange.min) * scaling) / 2, yOffset = (height - (yRange.max - yRange.min) * scaling) / 2;
var scaled = {};
for (var i4 = 0; i4 < circles.length; ++i4) {
var circle3 = circles[i4];
scaled[setids[i4]] = {
radius: scaling * circle3.radius,
x: padding3 + xOffset + (circle3.x - xRange.min) * scaling,
y: padding3 + yOffset + (circle3.y - yRange.min) * scaling
};
}
return scaled;
}
// node_modules/@antv/g2plot/esm/plots/venn/layout/diagram.js
var import_fmin2 = __toModule(require_fmin());
function circleMargin(current, interior, exterior) {
var margin = interior[0].radius - distance9(interior[0], current), i4, m4;
for (i4 = 1; i4 < interior.length; ++i4) {
m4 = interior[i4].radius - distance9(interior[i4], current);
if (m4 <= margin) {
margin = m4;
}
}
for (i4 = 0; i4 < exterior.length; ++i4) {
m4 = distance9(exterior[i4], current) - exterior[i4].radius;
if (m4 <= margin) {
margin = m4;
}
}
return margin;
}
function computeTextCentre(interior, exterior) {
var points = [];
var i4;
for (i4 = 0; i4 < interior.length; ++i4) {
var c5 = interior[i4];
points.push({ x: c5.x, y: c5.y });
points.push({ x: c5.x + c5.radius / 2, y: c5.y });
points.push({ x: c5.x - c5.radius / 2, y: c5.y });
points.push({ x: c5.x, y: c5.y + c5.radius / 2 });
points.push({ x: c5.x, y: c5.y - c5.radius / 2 });
}
var initial = points[0], margin = circleMargin(points[0], interior, exterior);
for (i4 = 1; i4 < points.length; ++i4) {
var m4 = circleMargin(points[i4], interior, exterior);
if (m4 >= margin) {
initial = points[i4];
margin = m4;
}
}
var solution = (0, import_fmin2.nelderMead)(function(p4) {
return -1 * circleMargin({ x: p4[0], y: p4[1] }, interior, exterior);
}, [initial.x, initial.y], { maxIterations: 500, minErrorDelta: 1e-10 }).x;
var ret = { x: solution[0], y: solution[1] };
var valid = true;
for (i4 = 0; i4 < interior.length; ++i4) {
if (distance9(ret, interior[i4]) > interior[i4].radius) {
valid = false;
break;
}
}
for (i4 = 0; i4 < exterior.length; ++i4) {
if (distance9(ret, exterior[i4]) < exterior[i4].radius) {
valid = false;
break;
}
}
if (!valid) {
if (interior.length == 1) {
ret = { x: interior[0].x, y: interior[0].y };
} else {
var areaStats = {};
intersectionArea(interior, areaStats);
if (areaStats.arcs.length === 0) {
ret = { x: 0, y: -1e3, disjoint: true };
} else if (areaStats.arcs.length == 1) {
ret = { x: areaStats.arcs[0].circle.x, y: areaStats.arcs[0].circle.y };
} else if (exterior.length) {
ret = computeTextCentre(interior, []);
} else {
ret = getCenter(areaStats.arcs.map(function(a4) {
return a4.p1;
}));
}
}
}
return ret;
}
function getOverlappingCircles(circles) {
var ret = {}, circleids = [];
for (var circleid in circles) {
circleids.push(circleid);
ret[circleid] = [];
}
for (var i4 = 0; i4 < circleids.length; i4++) {
var a4 = circles[circleids[i4]];
for (var j4 = i4 + 1; j4 < circleids.length; ++j4) {
var b10 = circles[circleids[j4]], d3 = distance9(a4, b10);
if (d3 + b10.radius <= a4.radius + 1e-10) {
ret[circleids[j4]].push(circleids[i4]);
} else if (d3 + a4.radius <= b10.radius + 1e-10) {
ret[circleids[i4]].push(circleids[j4]);
}
}
}
return ret;
}
function computeTextCentres(circles, areas) {
var ret = {}, overlapped = getOverlappingCircles(circles);
for (var i4 = 0; i4 < areas.length; ++i4) {
var area2 = areas[i4].sets, areaids = {}, exclude = {};
for (var j4 = 0; j4 < area2.length; ++j4) {
areaids[area2[j4]] = true;
var overlaps = overlapped[area2[j4]];
for (var k4 = 0; k4 < overlaps.length; ++k4) {
exclude[overlaps[k4]] = true;
}
}
var interior = [], exterior = [];
for (var setid in circles) {
if (setid in areaids) {
interior.push(circles[setid]);
} else if (!(setid in exclude)) {
exterior.push(circles[setid]);
}
}
var centre = computeTextCentre(interior, exterior);
ret[area2] = centre;
if (centre.disjoint && areas[i4].size > 0) {
console.log("WARNING: area " + area2 + " not represented on screen");
}
}
return ret;
}
function circlePath(x6, y5, r4) {
var ret = [];
var x0 = x6 - r4;
var y0 = y5;
ret.push("M", x0, y0);
ret.push("A", r4, r4, 0, 1, 0, x0 + 2 * r4, y0);
ret.push("A", r4, r4, 0, 1, 0, x0, y0);
return ret.join(" ");
}
function intersectionAreaPath(circles) {
var stats = {};
intersectionArea(circles, stats);
var arcs = stats.arcs;
if (arcs.length === 0) {
return "M 0 0";
} else if (arcs.length == 1) {
var circle3 = arcs[0].circle;
return circlePath(circle3.x, circle3.y, circle3.radius);
} else {
var ret = ["\nM", arcs[0].p2.x, arcs[0].p2.y];
for (var i4 = 0; i4 < arcs.length; ++i4) {
var arc2 = arcs[i4], r4 = arc2.circle.radius, wide = arc2.width > r4;
ret.push("\nA", r4, r4, 0, wide ? 1 : 0, 1, arc2.p1.x, arc2.p1.y);
}
return ret.join(" ");
}
}
// node_modules/@antv/g2plot/esm/plots/venn/constant.js
var ID_FIELD = "id";
var PATH_FIELD = "path";
var DEFAULT_OPTIONS19 = {
appendPadding: [10, 0, 20, 0],
blendMode: "multiply",
tooltip: {
showTitle: false,
showMarkers: false,
fields: ["id", "size"],
formatter: function(datum) {
return { name: datum.id, value: datum.size };
}
},
legend: { position: "top-left" },
label: {
style: {
textAlign: "center",
fill: "#fff"
}
},
interactions: [{ type: "legend-filter", enable: false }],
state: {
active: {
style: {
stroke: "#000"
}
},
selected: {
style: {
stroke: "#000",
lineWidth: 2
}
},
inactive: {
style: {
fillOpacity: 0.3,
strokeOpacity: 0.3
}
}
},
defaultInteractions: ["tooltip", "venn-legend-active"]
};
// node_modules/@antv/g2plot/esm/plots/venn/utils.js
var getColorMap = memoize_default(function(colorPalette, data3, blendMode, setsField) {
var colorMap2 = new Map();
var colorPaletteLen = colorPalette.length;
data3.forEach(function(d3, idx) {
if (d3[setsField].length === 1) {
colorMap2.set(d3[ID_FIELD], colorPalette[(idx + colorPaletteLen) % colorPaletteLen]);
} else {
var colorArr = d3[setsField].map(function(id) {
return colorMap2.get(id);
});
colorMap2.set(d3[ID_FIELD], colorArr.slice(1).reduce(function(a4, b10) {
return blend(a4, b10, blendMode);
}, colorArr[0]));
}
});
return colorMap2;
}, function() {
var params = [];
for (var _i = 0; _i < arguments.length; _i++) {
params[_i] = arguments[_i];
}
return JSON.stringify(params);
});
function layoutVennData(options, width2, height, padding3) {
if (padding3 === void 0) {
padding3 = 0;
}
var data3 = options.data, setsField = options.setsField, sizeField = options.sizeField;
if (data3.length === 0) {
log2(LEVEL.WARN, false, "warn: %s", "\u6570\u636E\u4E0D\u80FD\u4E3A\u7A7A");
return [];
}
var vennData = data3.map(function(d3) {
var _a6;
return __assign(__assign({}, d3), (_a6 = { sets: d3[setsField] || [], size: d3[sizeField] }, _a6[PATH_FIELD] = "", _a6[ID_FIELD] = "", _a6));
});
vennData.sort(function(a4, b10) {
return a4.sets.length - b10.sets.length;
});
var solution = venn(vennData);
var circles = scaleSolution(solution, width2, height, padding3);
var textCenters = computeTextCentres(circles, vennData);
vennData.forEach(function(row) {
var sets = row.sets;
var id = sets.join(",");
row[ID_FIELD] = id;
var setCircles = sets.map(function(set10) {
return circles[set10];
});
var path = intersectionAreaPath(setCircles);
if (!/[zZ]$/.test(path)) {
path += " Z";
}
row[PATH_FIELD] = path;
var center2 = textCenters[id] || { x: 0, y: 0 };
mix(row, center2);
});
return vennData;
}
function islegalSets(legalArr, testArr) {
for (var i4 = 0; i4 < testArr.length; i4++) {
if (!legalArr.includes(testArr[i4])) {
return false;
}
}
return true;
}
// node_modules/@antv/g2plot/esm/plots/venn/shape.js
function getFillAttrs(cfg) {
return deepAssign({}, cfg.defaultStyle, { fill: cfg.color }, cfg.style);
}
registerShape("schema", "venn", {
draw: function(cfg, container2) {
var data3 = cfg.data;
var segments = parsePathString2(data3[PATH_FIELD]);
var fillAttrs = getFillAttrs(cfg);
var group2 = container2.addGroup({ name: "venn-shape" });
group2.addShape("path", {
attrs: __assign(__assign({}, fillAttrs), { path: segments }),
name: "venn-path"
});
var _a6 = cfg.customInfo, offsetX = _a6.offsetX, offsetY = _a6.offsetY;
var matrix = Util.transform(null, [["t", offsetX, offsetY]]);
group2.setMatrix(matrix);
return group2;
},
getMarker: function(markerCfg) {
var color4 = markerCfg.color;
return {
symbol: "circle",
style: {
lineWidth: 0,
stroke: color4,
fill: color4,
r: 4
}
};
}
});
// node_modules/@antv/g2plot/esm/plots/venn/label.js
var VennLabel = function(_super) {
__extends(VennLabel2, _super);
function VennLabel2() {
return _super !== null && _super.apply(this, arguments) || this;
}
VennLabel2.prototype.getLabelPoint = function(labelCfg, mappingData, index2) {
var _a6 = labelCfg.data, x6 = _a6.x, y5 = _a6.y;
var _b = labelCfg.customLabelInfo, offsetX = _b.offsetX, offsetY = _b.offsetY;
return {
content: labelCfg.content[index2],
x: x6 + offsetX,
y: y5 + offsetY
};
};
return VennLabel2;
}(base_default14);
registerGeometryLabel("venn", VennLabel);
// node_modules/@antv/g2plot/esm/plots/venn/interactions/util.js
function placeElementsOrdered(view) {
if (!view) {
return;
}
var elements = view.geometries[0].elements;
elements.forEach(function(elem) {
elem.shape.toFront();
});
}
// node_modules/@antv/g2plot/esm/plots/venn/interactions/actions/active.js
var ElementActiveAction = getActionClass("element-active");
var VennElementActive = function(_super) {
__extends(VennElementActive2, _super);
function VennElementActive2() {
return _super !== null && _super.apply(this, arguments) || this;
}
VennElementActive2.prototype.syncElementsPos = function() {
placeElementsOrdered(this.context.view);
};
VennElementActive2.prototype.active = function() {
_super.prototype.active.call(this);
this.syncElementsPos();
};
VennElementActive2.prototype.toggle = function() {
_super.prototype.toggle.call(this);
this.syncElementsPos();
};
VennElementActive2.prototype.reset = function() {
_super.prototype.reset.call(this);
this.syncElementsPos();
};
return VennElementActive2;
}(ElementActiveAction);
// node_modules/@antv/g2plot/esm/plots/venn/interactions/actions/highlight.js
var ElementHighlightAction = getActionClass("element-highlight");
var VennElementHighlight = function(_super) {
__extends(VennElementHighlight2, _super);
function VennElementHighlight2() {
return _super !== null && _super.apply(this, arguments) || this;
}
VennElementHighlight2.prototype.syncElementsPos = function() {
placeElementsOrdered(this.context.view);
};
VennElementHighlight2.prototype.highlight = function() {
_super.prototype.highlight.call(this);
this.syncElementsPos();
};
VennElementHighlight2.prototype.toggle = function() {
_super.prototype.toggle.call(this);
this.syncElementsPos();
};
VennElementHighlight2.prototype.clear = function() {
_super.prototype.clear.call(this);
this.syncElementsPos();
};
VennElementHighlight2.prototype.reset = function() {
_super.prototype.reset.call(this);
this.syncElementsPos();
};
return VennElementHighlight2;
}(ElementHighlightAction);
// node_modules/@antv/g2plot/esm/plots/venn/interactions/actions/selected.js
var ElementSelectedAction = getActionClass("element-selected");
var ElementSingleSelectedAction = getActionClass("element-single-selected");
var VennElementSelected = function(_super) {
__extends(VennElementSelected2, _super);
function VennElementSelected2() {
return _super !== null && _super.apply(this, arguments) || this;
}
VennElementSelected2.prototype.syncElementsPos = function() {
placeElementsOrdered(this.context.view);
};
VennElementSelected2.prototype.selected = function() {
_super.prototype.selected.call(this);
this.syncElementsPos();
};
VennElementSelected2.prototype.toggle = function() {
_super.prototype.toggle.call(this);
this.syncElementsPos();
};
VennElementSelected2.prototype.reset = function() {
_super.prototype.reset.call(this);
this.syncElementsPos();
};
return VennElementSelected2;
}(ElementSelectedAction);
var VennElementSingleSelected = function(_super) {
__extends(VennElementSingleSelected2, _super);
function VennElementSingleSelected2() {
return _super !== null && _super.apply(this, arguments) || this;
}
VennElementSingleSelected2.prototype.syncElementsPos = function() {
placeElementsOrdered(this.context.view);
};
VennElementSingleSelected2.prototype.selected = function() {
_super.prototype.selected.call(this);
this.syncElementsPos();
};
VennElementSingleSelected2.prototype.toggle = function() {
_super.prototype.toggle.call(this);
this.syncElementsPos();
};
VennElementSingleSelected2.prototype.reset = function() {
_super.prototype.reset.call(this);
this.syncElementsPos();
};
return VennElementSingleSelected2;
}(ElementSingleSelectedAction);
// node_modules/@antv/g2plot/esm/plots/venn/interactions/index.js
registerAction("venn-element-active", VennElementActive);
registerAction("venn-element-highlight", VennElementHighlight);
registerAction("venn-element-selected", VennElementSelected);
registerAction("venn-element-single-selected", VennElementSingleSelected);
registerInteraction("venn-element-active", {
start: [{ trigger: "element:mouseenter", action: "venn-element-active:active" }],
end: [{ trigger: "element:mouseleave", action: "venn-element-active:reset" }]
});
registerInteraction("venn-element-highlight", {
start: [{ trigger: "element:mouseenter", action: "venn-element-highlight:highlight" }],
end: [{ trigger: "element:mouseleave", action: "venn-element-highlight:reset" }]
});
registerInteraction("venn-element-selected", {
start: [{ trigger: "element:click", action: "venn-element-selected:toggle" }],
rollback: [{ trigger: "dblclick", action: ["venn-element-selected:reset"] }]
});
registerInteraction("venn-element-single-selected", {
start: [{ trigger: "element:click", action: "venn-element-single-selected:toggle" }],
rollback: [{ trigger: "dblclick", action: ["venn-element-single-selected:reset"] }]
});
registerInteraction("venn-legend-active", {
start: [{ trigger: "legend-item:mouseenter", action: ["list-active:active", "venn-element-active:active"] }],
end: [{ trigger: "legend-item:mouseleave", action: ["list-active:reset", "venn-element-active:reset"] }]
});
registerInteraction("venn-legend-highlight", {
start: [
{
trigger: "legend-item:mouseenter",
action: ["legend-item-highlight:highlight", "venn-element-highlight:highlight"]
}
],
end: [{ trigger: "legend-item:mouseleave", action: ["legend-item-highlight:reset", "venn-element-highlight:reset"] }]
});
// node_modules/@antv/g2plot/esm/plots/venn/adaptor.js
var LEGEND_SPACE = 40;
function colorMap(params, data3, colorPalette) {
var chart = params.chart, options = params.options;
var blendMode = options.blendMode, setsField = options.setsField;
var _a6 = chart.getTheme(), colors10 = _a6.colors10, colors20 = _a6.colors20;
var palette = colorPalette;
if (!is_array_default(palette)) {
palette = data3.filter(function(d3) {
return d3[setsField].length === 1;
}).length <= 10 ? colors10 : colors20;
}
var map6 = getColorMap(palette, data3, blendMode, setsField);
return function(id) {
return map6.get(id) || palette[0];
};
}
function transformColor(params, data3) {
var options = params.options;
var color4 = options.color;
if (typeof color4 !== "function") {
var colorPalette = typeof color4 === "string" ? [color4] : color4;
var map_1 = colorMap(params, data3, colorPalette);
return function(datum) {
return map_1(datum[ID_FIELD]);
};
}
return color4;
}
function padding(params) {
var chart = params.chart, options = params.options;
var legend18 = options.legend, appendPadding = options.appendPadding, padding3 = options.padding;
var tempPadding = normalPadding(appendPadding);
if (legend18 !== false) {
tempPadding = getAdjustAppendPadding(appendPadding, get_default(legend18, "position"), LEGEND_SPACE);
}
chart.appendPadding = resolveAllPadding([tempPadding, padding3]);
return params;
}
function data2(params) {
var options = params.options;
var data3 = options["data"];
if (!data3) {
log2(LEVEL.WARN, false, "warn: %s", "\u6570\u636E\u4E0D\u80FD\u4E3A\u7A7A");
data3 = [];
}
var currSets = data3.filter(function(datum) {
return datum.sets.length === 1;
}).map(function(datum) {
return datum.sets[0];
});
var filterSets = data3.filter(function(datum) {
var sets = datum.sets;
return islegalSets(currSets, sets);
});
if (!is_equal_default(filterSets, data3))
log2(LEVEL.WARN, false, "warn: %s", "\u4EA4\u96C6\u4E2D\u4E0D\u80FD\u51FA\u73B0\u4E0D\u5B58\u5728\u7684\u96C6\u5408, \u8BF7\u8F93\u5165\u5408\u6CD5\u6570\u636E");
return deep_mix_default({}, params, {
options: {
data: filterSets
}
});
}
function geometry18(params) {
var chart = params.chart, options = params.options;
var pointStyle = options.pointStyle, setsField = options.setsField, sizeField = options.sizeField;
var _a6 = normalPadding(chart.appendPadding), t4 = _a6[0], r4 = _a6[1], b10 = _a6[2], l4 = _a6[3];
var customInfo = { offsetX: l4, offsetY: t4 };
var _b = chart.viewBBox, width2 = _b.width, height = _b.height;
var vennData = layoutVennData(options, Math.max(width2 - (r4 + l4), 0), Math.max(height - (t4 + b10), 0), 0);
chart.data(vennData);
var ext = schema2(deepAssign({}, params, {
options: {
xField: "x",
yField: "y",
sizeField,
seriesField: ID_FIELD,
rawFields: [setsField, sizeField],
schema: {
shape: "venn",
style: pointStyle
}
}
})).ext;
var geometry35 = ext.geometry;
geometry35.customInfo(customInfo);
var colorOptions = transformColor(params, vennData);
if (typeof colorOptions === "function") {
geometry35.color(ID_FIELD, function(id) {
var datum = vennData.find(function(d3) {
return d3[ID_FIELD] === id;
});
var defaultColor = colorMap(params, vennData)(id);
return colorOptions(datum, defaultColor);
});
}
return params;
}
function label11(params) {
var chart = params.chart, options = params.options;
var label17 = options.label;
var _a6 = normalPadding(chart.appendPadding), t4 = _a6[0], l4 = _a6[3];
var customLabelInfo = { offsetX: l4, offsetY: t4 };
var geometry35 = findGeometry(chart, "schema");
if (!label17) {
geometry35.label(false);
} else {
var callback = label17.callback, cfg = __rest(label17, ["callback"]);
geometry35.label({
fields: ["id"],
callback,
cfg: deep_mix_default({}, transformLabel(cfg), {
type: "venn",
customLabelInfo
})
});
}
return params;
}
function legend12(params) {
var chart = params.chart, options = params.options;
var legend18 = options.legend, sizeField = options.sizeField;
chart.legend(ID_FIELD, legend18);
chart.legend(sizeField, false);
return params;
}
function axis11(params) {
var chart = params.chart;
chart.axis(false);
return params;
}
function vennInteraction(params) {
var options = params.options, chart = params.chart;
var interactions = options.interactions;
if (interactions) {
var MAP_1 = {
"legend-active": "venn-legend-active",
"legend-highlight": "venn-legend-highlight"
};
interaction(deepAssign({}, params, {
options: {
interactions: interactions.map(function(i4) {
return __assign(__assign({}, i4), { type: MAP_1[i4.type] || i4.type });
})
}
}));
}
chart.removeInteraction("legend-active");
chart.removeInteraction("legend-highlight");
return params;
}
function adaptor20(params) {
return flow(padding, theme, data2, geometry18, label11, scale7({}), legend12, axis11, tooltip, vennInteraction, animation)(params);
}
// node_modules/@antv/g2plot/esm/plots/venn/index.js
var Venn = function(_super) {
__extends(Venn2, _super);
function Venn2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "venn";
return _this;
}
Venn2.getDefaultOptions = function() {
return DEFAULT_OPTIONS19;
};
Venn2.prototype.getDefaultOptions = function() {
return Venn2.getDefaultOptions();
};
Venn2.prototype.getSchemaAdaptor = function() {
return adaptor20;
};
Venn2.prototype.triggerResize = function() {
if (!this.chart.destroyed) {
this.chart.forceFit();
this.chart.clear();
this.execAdaptor();
this.chart.render(true);
}
};
return Venn2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/stock/constant.js
var Y_FIELD2 = "$$stock-range$$";
var TREND_FIELD = "trend";
var TREND_UP = "up";
var TREND_DOWN = "down";
var DEFAULT_TOOLTIP_OPTIONS3 = {
showMarkers: false,
showCrosshairs: true,
shared: true,
crosshairs: {
type: "xy",
follow: true,
text: function(type2, defaultContent, items) {
var textContent;
if (type2 === "x") {
var item = items[0];
textContent = item ? item.title : defaultContent;
} else {
textContent = defaultContent;
}
return {
position: type2 === "y" ? "start" : "end",
content: textContent,
style: {
fill: "#dfdfdf"
}
};
},
textBackground: {
padding: [2, 4],
style: {
fill: "#666"
}
}
}
};
var DEFAULT_OPTIONS20 = deepAssign({}, Plot.getDefaultOptions(), {
tooltip: DEFAULT_TOOLTIP_OPTIONS3,
interactions: [{ type: "tooltip" }],
legend: {
position: "top-left"
},
risingFill: "#ef5350",
fallingFill: "#26a69a"
});
// node_modules/@antv/g2plot/esm/plots/stock/utils.js
function getStockData(data3, yField) {
return map_default(data3, function(obj) {
if (is_array_default(yField)) {
var open_1 = yField[0], close_1 = yField[1], high = yField[2], low = yField[3];
obj[TREND_FIELD] = obj[open_1] <= obj[close_1] ? TREND_UP : TREND_DOWN;
obj[Y_FIELD2] = [obj[open_1], obj[close_1], obj[high], obj[low]];
}
return obj;
});
}
// node_modules/@antv/g2plot/esm/plots/stock/adaptor.js
function geometry19(params) {
var chart = params.chart, options = params.options;
var yField = options.yField;
var data3 = options.data, risingFill = options.risingFill, fallingFill = options.fallingFill, tooltip10 = options.tooltip, stockStyle = options.stockStyle;
chart.data(getStockData(data3, yField));
var tooltipOptions = tooltip10;
if (tooltipOptions !== false) {
tooltipOptions = deepAssign({}, { fields: yField }, tooltipOptions);
}
schema2(deepAssign({}, params, {
options: {
schema: {
shape: "candle",
color: [risingFill, fallingFill],
style: stockStyle
},
yField: Y_FIELD2,
seriesField: TREND_FIELD,
rawFields: yField,
tooltip: tooltipOptions
}
}));
return params;
}
function meta14(params) {
var _a6, _b;
var chart = params.chart, options = params.options;
var meta23 = options.meta, xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField;
var baseMeta = (_a6 = {}, _a6[xField] = {
type: "timeCat",
tickCount: 6
}, _a6[TREND_FIELD] = {
values: [TREND_UP, TREND_DOWN]
}, _a6);
var scales = deepAssign(baseMeta, meta23, (_b = {}, _b[xField] = pick(xAxis, AXIS_META_CONFIG_KEYS), _b[Y_FIELD2] = pick(yAxis, AXIS_META_CONFIG_KEYS), _b));
chart.scale(scales);
return params;
}
function axis12(params) {
var chart = params.chart, options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField;
if (xAxis === false) {
chart.axis(xField, false);
} else {
chart.axis(xField, xAxis);
}
if (yAxis === false) {
chart.axis(Y_FIELD2, false);
} else {
chart.axis(Y_FIELD2, yAxis);
}
return params;
}
function tooltip5(params) {
var chart = params.chart, options = params.options;
var tooltip10 = options.tooltip;
if (tooltip10 !== false) {
chart.tooltip(tooltip10);
} else {
chart.tooltip(false);
}
return params;
}
function legend13(params) {
var chart = params.chart, options = params.options;
var legend18 = options.legend;
if (legend18) {
chart.legend(TREND_FIELD, legend18);
} else if (legend18 === false) {
chart.legend(false);
}
return params;
}
function adaptor21(params) {
flow(theme, geometry19, meta14, axis12, tooltip5, legend13, interaction, animation, annotation(), slider)(params);
}
// node_modules/@antv/g2plot/esm/plots/stock/index.js
var Stock = function(_super) {
__extends(Stock2, _super);
function Stock2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "stock";
return _this;
}
Stock2.getDefaultOptions = function() {
return DEFAULT_OPTIONS20;
};
Stock2.prototype.getDefaultOptions = function() {
return Stock2.getDefaultOptions();
};
Stock2.prototype.getSchemaAdaptor = function() {
return adaptor21;
};
Stock2.prototype.changeData = function(data3) {
this.updateOption({ data: data3 });
var yField = this.options.yField;
this.chart.changeData(getStockData(data3, yField));
};
return Stock2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/funnel/constant.js
var _a4;
var FUNNEL_PERCENT = "$$percentage$$";
var FUNNEL_MAPPING_VALUE = "$$mappingValue$$";
var FUNNEL_CONVERSATION = "$$conversion$$";
var FUNNEL_TOTAL_PERCENT = "$$totalPercentage$$";
var PLOYGON_X = "$$x$$";
var PLOYGON_Y = "$$y$$";
var DEFAULT_OPTIONS21 = {
appendPadding: [0, 80],
minSize: 0,
maxSize: 1,
meta: (_a4 = {}, _a4[FUNNEL_MAPPING_VALUE] = {
min: 0,
max: 1,
nice: false
}, _a4),
label: {
style: {
fill: "#fff",
fontSize: 12
}
},
tooltip: {
showTitle: false,
showMarkers: false,
shared: false
},
conversionTag: {
offsetX: 10,
offsetY: 0,
style: {
fontSize: 12,
fill: "rgba(0,0,0,0.45)"
}
}
};
// node_modules/@antv/g2plot/esm/plots/funnel/geometries/common.js
function transformData2(data3, originData, options) {
var formatData = [];
var yField = options.yField, maxSize = options.maxSize, minSize = options.minSize;
var maxYFieldValue = get_default(max_by_default(originData, yField), [yField]);
var max8 = is_number_default(maxSize) ? maxSize : 1;
var min7 = is_number_default(minSize) ? minSize : 0;
formatData = map_default(data3, function(row, index2) {
var percent2 = (row[yField] || 0) / maxYFieldValue;
row[FUNNEL_PERCENT] = percent2;
row[FUNNEL_MAPPING_VALUE] = (max8 - min7) * percent2 + min7;
row[FUNNEL_CONVERSATION] = [get_default(data3, [index2 - 1, yField]), row[yField]];
return row;
});
return formatData;
}
function conversionTagComponent(getLineCoordinate) {
return function(params) {
var chart = params.chart, options = params.options;
var conversionTag5 = options.conversionTag;
var data3 = chart.getOptions().data;
if (conversionTag5) {
var formatter_1 = conversionTag5.formatter;
data3.forEach(function(obj, index2) {
if (index2 <= 0 || Number.isNaN(obj[FUNNEL_MAPPING_VALUE]))
return;
var lineOption = getLineCoordinate(obj, index2, data3, {
top: true,
text: {
content: is_function_default(formatter_1) ? formatter_1(obj, data3) : formatter_1,
offsetX: conversionTag5.offsetX,
offsetY: conversionTag5.offsetY,
position: "end",
autoRotate: false,
style: __assign({ textAlign: "start", textBaseline: "middle" }, conversionTag5.style)
}
});
chart.annotation().line(lineOption);
});
}
return params;
};
}
// node_modules/@antv/g2plot/esm/plots/funnel/geometries/basic.js
function field2(params) {
var chart = params.chart, options = params.options;
var _a6 = options.data, data3 = _a6 === void 0 ? [] : _a6, yField = options.yField, maxSize = options.maxSize, minSize = options.minSize;
var formatData = transformData2(data3, data3, {
yField,
maxSize,
minSize
});
chart.data(formatData);
return params;
}
function geometry20(params) {
var chart = params.chart, options = params.options;
var xField = options.xField, yField = options.yField, color4 = options.color, tooltip10 = options.tooltip, label17 = options.label, _a6 = options.shape, shape = _a6 === void 0 ? "funnel" : _a6, funnelStyle = options.funnelStyle, state2 = options.state;
var _b = getTooltipMapping(tooltip10, [xField, yField]), fields = _b.fields, formatter = _b.formatter;
geometry({
chart,
options: {
type: "interval",
xField,
yField: FUNNEL_MAPPING_VALUE,
colorField: xField,
tooltipFields: is_array_default(fields) && fields.concat([FUNNEL_PERCENT, FUNNEL_CONVERSATION]),
mapping: {
shape,
tooltip: formatter,
color: color4,
style: funnelStyle
},
label: label17,
state: state2
}
});
var geo = findGeometry(params.chart, "interval");
geo.adjust("symmetric");
return params;
}
function transpose3(params) {
var chart = params.chart, options = params.options;
var isTransposed = options.isTransposed;
chart.coordinate({
type: "rect",
actions: !isTransposed ? [["transpose"], ["scale", 1, -1]] : []
});
return params;
}
function conversionTag2(params) {
var options = params.options;
var maxSize = options.maxSize;
var getLineCoordinate = function(datum, datumIndex, data3, initLineOption) {
var percent2 = maxSize - (maxSize - datum[FUNNEL_MAPPING_VALUE]) / 2;
return __assign(__assign({}, initLineOption), { start: [datumIndex - 0.5, percent2], end: [datumIndex - 0.5, percent2 + 0.05] });
};
conversionTagComponent(getLineCoordinate)(params);
return params;
}
function basicFunnel(params) {
return flow(field2, geometry20, transpose3, conversionTag2)(params);
}
// node_modules/@antv/g2plot/esm/plots/funnel/geometries/compare.js
function field3(params) {
var _a6;
var chart = params.chart, options = params.options;
var _b = options.data, data3 = _b === void 0 ? [] : _b, yField = options.yField;
chart.data(data3);
chart.scale((_a6 = {}, _a6[yField] = {
sync: true
}, _a6));
return params;
}
function geometry21(params) {
var chart = params.chart, options = params.options;
var data3 = options.data, xField = options.xField, yField = options.yField, color4 = options.color, compareField = options.compareField, isTransposed = options.isTransposed, tooltip10 = options.tooltip, maxSize = options.maxSize, minSize = options.minSize, label17 = options.label, funnelStyle = options.funnelStyle, state2 = options.state;
chart.facet("mirror", {
fields: [compareField],
transpose: !isTransposed,
padding: isTransposed ? 0 : [32, 0, 0, 0],
eachView: function(view, facet) {
var index2 = isTransposed ? facet.rowIndex : facet.columnIndex;
if (!isTransposed) {
view.coordinate({
type: "rect",
actions: [["transpose"], ["scale", index2 === 0 ? -1 : 1, -1]]
});
}
var formatterData = transformData2(facet.data, data3, {
yField,
maxSize,
minSize
});
view.data(formatterData);
var _a6 = getTooltipMapping(tooltip10, [xField, yField, compareField]), fields = _a6.fields, formatter = _a6.formatter;
var defaultFacetLabel = isTransposed ? {
offset: index2 === 0 ? 10 : -23,
position: index2 === 0 ? "bottom" : "top"
} : {
offset: 10,
position: "left",
style: {
textAlign: index2 === 0 ? "end" : "start"
}
};
geometry({
chart: view,
options: {
type: "interval",
xField,
yField: FUNNEL_MAPPING_VALUE,
colorField: xField,
tooltipFields: is_array_default(fields) && fields.concat([FUNNEL_PERCENT, FUNNEL_CONVERSATION]),
mapping: {
shape: "funnel",
tooltip: formatter,
color: color4,
style: funnelStyle
},
label: label17 === false ? false : deepAssign({}, defaultFacetLabel, label17),
state: state2
}
});
}
});
return params;
}
function conversionTag3(params) {
var chart = params.chart, options = params.options;
var conversionTag5 = options.conversionTag, isTransposed = options.isTransposed;
chart.once("beforepaint", function() {
chart.views.forEach(function(view, viewIndex) {
var getLineCoordinate = function(datum, datumIndex, data3, initLineOption) {
var ratio = viewIndex === 0 ? -1 : 1;
return deepAssign({}, initLineOption, {
start: [datumIndex - 0.5, datum[FUNNEL_MAPPING_VALUE]],
end: [datumIndex - 0.5, datum[FUNNEL_MAPPING_VALUE] + 0.05],
text: isTransposed ? {
style: {
textAlign: "start"
}
} : {
offsetX: conversionTag5 !== false ? ratio * conversionTag5.offsetX : 0,
style: {
textAlign: viewIndex === 0 ? "end" : "start"
}
}
});
};
conversionTagComponent(getLineCoordinate)(deepAssign({}, {
chart: view,
options
}));
});
});
return params;
}
function compareFunnel(params) {
return flow(field3, geometry21, conversionTag3)(params);
}
// node_modules/@antv/g2plot/esm/plots/funnel/geometries/facet.js
function field4(params) {
var _a6;
var chart = params.chart, options = params.options;
var _b = options.data, data3 = _b === void 0 ? [] : _b, yField = options.yField;
chart.data(data3);
chart.scale((_a6 = {}, _a6[yField] = {
sync: true
}, _a6));
return params;
}
function geometry22(params) {
var chart = params.chart, options = params.options;
var seriesField = options.seriesField, isTransposed = options.isTransposed;
chart.facet("rect", {
fields: [seriesField],
padding: [isTransposed ? 0 : 32, 10, 0, 10],
eachView: function(view, facet) {
basicFunnel(deepAssign({}, params, {
chart: view,
options: {
data: facet.data
}
}));
}
});
return params;
}
function facetFunnel(params) {
return flow(field4, geometry22)(params);
}
// node_modules/@antv/g2plot/esm/plots/funnel/geometries/dynamic-height.js
function field5(params) {
var chart = params.chart, options = params.options;
var _a6 = options.data, data3 = _a6 === void 0 ? [] : _a6, yField = options.yField;
var sum = reduce_default(data3, function(total, item) {
return total + (item[yField] || 0);
}, 0);
var max8 = max_by_default(data3, yField)[yField];
var formatData = map_default(data3, function(row, index2) {
var x6 = [];
var y5 = [];
row[FUNNEL_TOTAL_PERCENT] = (row[yField] || 0) / sum;
if (index2) {
var preItemX = data3[index2 - 1][PLOYGON_X];
var preItemY = data3[index2 - 1][PLOYGON_Y];
x6[0] = preItemX[3];
y5[0] = preItemY[3];
x6[1] = preItemX[2];
y5[1] = preItemY[2];
} else {
x6[0] = -0.5;
y5[0] = 1;
x6[1] = 0.5;
y5[1] = 1;
}
y5[2] = y5[1] - row[FUNNEL_TOTAL_PERCENT];
x6[2] = (y5[2] + 1) / 4;
y5[3] = y5[2];
x6[3] = -x6[2];
row[PLOYGON_X] = x6;
row[PLOYGON_Y] = y5;
row[FUNNEL_PERCENT] = (row[yField] || 0) / max8;
row[FUNNEL_CONVERSATION] = [get_default(data3, [index2 - 1, yField]), row[yField]];
return row;
});
chart.data(formatData);
return params;
}
function geometry23(params) {
var chart = params.chart, options = params.options;
var xField = options.xField, yField = options.yField, color4 = options.color, tooltip10 = options.tooltip, label17 = options.label, funnelStyle = options.funnelStyle, state2 = options.state;
var _a6 = getTooltipMapping(tooltip10, [xField, yField]), fields = _a6.fields, formatter = _a6.formatter;
geometry({
chart,
options: {
type: "polygon",
xField: PLOYGON_X,
yField: PLOYGON_Y,
colorField: xField,
tooltipFields: is_array_default(fields) && fields.concat([FUNNEL_PERCENT, FUNNEL_CONVERSATION]),
label: label17,
state: state2,
mapping: {
tooltip: formatter,
color: color4,
style: funnelStyle
}
}
});
return params;
}
function transpose4(params) {
var chart = params.chart, options = params.options;
var isTransposed = options.isTransposed;
chart.coordinate({
type: "rect",
actions: isTransposed ? [["transpose"], ["reflect", "x"]] : []
});
return params;
}
function conversionTag4(params) {
var getLineCoordinate = function(datum, datumIndex, data3, initLineOption) {
return __assign(__assign({}, initLineOption), { start: [datum[PLOYGON_X][1], datum[PLOYGON_Y][1]], end: [datum[PLOYGON_X][1] + 0.05, datum[PLOYGON_Y][1]] });
};
conversionTagComponent(getLineCoordinate)(params);
return params;
}
function dynamicHeightFunnel(params) {
return flow(field5, geometry23, transpose4, conversionTag4)(params);
}
// node_modules/@antv/g2plot/esm/plots/funnel/adaptor.js
function defaultOptions3(params) {
var options = params.options;
var compareField = options.compareField, xField = options.xField, yField = options.yField, locale = options.locale, funnelStyle = options.funnelStyle, data3 = options.data;
var i18n = getLocale(locale);
var defaultOption = {
label: compareField ? {
fields: [xField, yField, compareField, FUNNEL_PERCENT, FUNNEL_CONVERSATION],
formatter: function(datum) {
return "" + datum[yField];
}
} : {
fields: [xField, yField, FUNNEL_PERCENT, FUNNEL_CONVERSATION],
offset: 0,
position: "middle",
formatter: function(datum) {
return datum[xField] + " " + datum[yField];
}
},
tooltip: {
title: xField,
formatter: function(datum) {
return { name: datum[xField], value: datum[yField] };
}
},
conversionTag: {
formatter: function(datum) {
return i18n.get(["conversionTag", "label"]) + ": " + conversionTagFormatter.apply(void 0, datum[FUNNEL_CONVERSATION]);
}
}
};
var style;
if (compareField || funnelStyle) {
style = function(datum) {
return deepAssign({}, compareField && { lineWidth: 1, stroke: "#fff" }, is_function_default(funnelStyle) ? funnelStyle(datum) : funnelStyle);
};
}
return deepAssign({ options: defaultOption }, params, { options: { funnelStyle: style, data: clone_default(data3) } });
}
function geometry24(params) {
var options = params.options;
var compareField = options.compareField, dynamicHeight = options.dynamicHeight, seriesField = options.seriesField;
if (seriesField) {
return facetFunnel(params);
}
if (compareField) {
return compareFunnel(params);
}
if (dynamicHeight) {
return dynamicHeightFunnel(params);
}
return basicFunnel(params);
}
function meta15(params) {
var _a6;
var options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField;
return flow(scale7((_a6 = {}, _a6[xField] = xAxis, _a6[yField] = yAxis, _a6)))(params);
}
function axis13(params) {
var chart = params.chart;
chart.axis(false);
return params;
}
function legend14(params) {
var chart = params.chart, options = params.options;
var legend18 = options.legend;
if (legend18 === false) {
chart.legend(false);
} else {
chart.legend(legend18);
}
return params;
}
function adaptor22(params) {
return flow(defaultOptions3, geometry24, meta15, axis13, tooltip, interaction, legend14, animation, theme, annotation())(params);
}
// node_modules/@antv/g2plot/esm/plots/funnel/index.js
var Funnel = function(_super) {
__extends(Funnel2, _super);
function Funnel2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "funnel";
return _this;
}
Funnel2.getDefaultOptions = function() {
return DEFAULT_OPTIONS21;
};
Funnel2.prototype.getDefaultOptions = function() {
return Funnel2.getDefaultOptions();
};
Funnel2.prototype.getSchemaAdaptor = function() {
return adaptor22;
};
Funnel2.prototype.setState = function(type2, condition, status) {
if (status === void 0) {
status = true;
}
var elements = getAllElementsRecursively(this.chart);
each_default(elements, function(ele) {
if (condition(ele.getData())) {
ele.setState(type2, status);
}
});
};
Funnel2.prototype.getStates = function() {
var elements = getAllElementsRecursively(this.chart);
var stateObjects = [];
each_default(elements, function(element) {
var data3 = element.getData();
var states = element.getStates();
each_default(states, function(state2) {
stateObjects.push({ data: data3, state: state2, geometry: element.geometry, element });
});
});
return stateObjects;
};
Funnel2.CONVERSATION_FIELD = FUNNEL_CONVERSATION;
Funnel2.PERCENT_FIELD = FUNNEL_PERCENT;
Funnel2.TOTAL_PERCENT_FIELD = FUNNEL_TOTAL_PERCENT;
return Funnel2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/liquid/utils.js
var CAT_VALUE = "liquid";
function getLiquidData(percent2) {
return [{ percent: percent2, type: CAT_VALUE }];
}
// node_modules/@antv/g2plot/esm/plots/liquid/adaptor.js
function geometry25(params) {
var chart = params.chart, options = params.options;
var percent2 = options.percent, liquidStyle = options.liquidStyle, radius = options.radius, outline = options.outline, wave = options.wave, shape = options.shape, animation7 = options.animation;
chart.scale({
percent: {
min: 0,
max: 1
}
});
chart.data(getLiquidData(percent2));
var color4 = options.color || chart.getTheme().defaultColor;
var p4 = deepAssign({}, params, {
options: {
xField: "type",
yField: "percent",
widthRatio: radius,
interval: {
color: color4,
style: liquidStyle,
shape: "liquid-fill-gauge"
}
}
});
var ext = interval2(p4).ext;
var geometry35 = ext.geometry;
var background = chart.getTheme().background;
var customInfo = {
radius,
outline,
wave,
shape,
background,
animation: animation7
};
geometry35.customInfo(customInfo);
chart.legend(false);
chart.axis(false);
chart.tooltip(false);
return params;
}
function statistic2(params, updated) {
var chart = params.chart, options = params.options;
var statistic4 = options.statistic, percent2 = options.percent, meta23 = options.meta;
chart.getController("annotation").clear(true);
var metaFormatter = get_default(meta23, ["percent", "formatter"]) || function(v3) {
return (v3 * 100).toFixed(2) + "%";
};
var contentOpt = statistic4.content;
if (contentOpt) {
contentOpt = deepAssign({}, contentOpt, {
content: !is_nil_default(contentOpt.content) ? contentOpt.content : metaFormatter(percent2)
});
}
renderStatistic(chart, { statistic: __assign(__assign({}, statistic4), { content: contentOpt }), plotType: "liquid" }, { percent: percent2 });
if (updated) {
chart.render(true);
}
return params;
}
function adaptor23(params) {
return flow(theme, pattern("liquidStyle"), geometry25, statistic2, scale7({}), animation, interaction)(params);
}
// node_modules/@antv/g2plot/esm/plots/liquid/constants.js
var DEFAULT_OPTIONS22 = {
radius: 0.9,
statistic: {
title: false,
content: {
style: {
opacity: 0.75,
fontSize: "30px",
lineHeight: "30px",
textAlign: "center"
}
}
},
outline: {
border: 2,
distance: 0
},
wave: {
count: 3,
length: 192
},
shape: "circle"
};
// node_modules/@antv/g2plot/esm/plots/liquid/shapes/liquid.js
var DURATION = 5e3;
function lerp5(min7, max8, factor) {
return min7 + (max8 - min7) * factor;
}
function getFillAttrs2(cfg) {
var attrs = __assign({ opacity: 1 }, cfg.style);
if (cfg.color && !attrs.fill) {
attrs.fill = cfg.color;
}
return attrs;
}
function getLineAttrs(cfg) {
var defaultAttrs = {
fill: "#fff",
fillOpacity: 0,
lineWidth: 4
};
var attrs = mix({}, defaultAttrs, cfg.style);
if (cfg.color && !attrs.stroke) {
attrs.stroke = cfg.color;
}
if (is_number_default(cfg.opacity)) {
attrs.opacity = attrs.strokeOpacity = cfg.opacity;
}
return attrs;
}
function getWaterWavePositions(x6, stage, waveLength, amplitude2) {
if (stage === 0) {
return [
[x6 + 1 / 2 * waveLength / Math.PI / 2, amplitude2 / 2],
[x6 + 1 / 2 * waveLength / Math.PI, amplitude2],
[x6 + waveLength / 4, amplitude2]
];
}
if (stage === 1) {
return [
[x6 + 1 / 2 * waveLength / Math.PI / 2 * (Math.PI - 2), amplitude2],
[x6 + 1 / 2 * waveLength / Math.PI / 2 * (Math.PI - 1), amplitude2 / 2],
[x6 + waveLength / 4, 0]
];
}
if (stage === 2) {
return [
[x6 + 1 / 2 * waveLength / Math.PI / 2, -amplitude2 / 2],
[x6 + 1 / 2 * waveLength / Math.PI, -amplitude2],
[x6 + waveLength / 4, -amplitude2]
];
}
return [
[x6 + 1 / 2 * waveLength / Math.PI / 2 * (Math.PI - 2), -amplitude2],
[x6 + 1 / 2 * waveLength / Math.PI / 2 * (Math.PI - 1), -amplitude2 / 2],
[x6 + waveLength / 4, 0]
];
}
function getWaterWavePath(radius, waterLevel, waveLength, phase, amplitude2, cx, cy) {
var curves = Math.ceil(2 * radius / waveLength * 4) * 4;
var path = [];
var _phase = phase;
while (_phase < -Math.PI * 2) {
_phase += Math.PI * 2;
}
while (_phase > 0) {
_phase -= Math.PI * 2;
}
_phase = _phase / Math.PI / 2 * waveLength;
var left2 = cx - radius + _phase - radius * 2;
path.push(["M", left2, waterLevel]);
var waveRight = 0;
for (var c5 = 0; c5 < curves; ++c5) {
var stage = c5 % 4;
var pos = getWaterWavePositions(c5 * waveLength / 4, stage, waveLength, amplitude2);
path.push([
"C",
pos[0][0] + left2,
-pos[0][1] + waterLevel,
pos[1][0] + left2,
-pos[1][1] + waterLevel,
pos[2][0] + left2,
-pos[2][1] + waterLevel
]);
if (c5 === curves - 1) {
waveRight = pos[2][0];
}
}
path.push(["L", waveRight + left2, cy + radius]);
path.push(["L", left2, cy + radius]);
path.push(["Z"]);
return path;
}
function addWaterWave(x6, y5, level, waveCount, waveAttrs, group2, clip, radius, waveLength, animation7) {
var fill = waveAttrs.fill, opacity = waveAttrs.opacity;
var bbox = clip.getBBox();
var width2 = bbox.maxX - bbox.minX;
var height = bbox.maxY - bbox.minY;
for (var idx = 0; idx < waveCount; idx++) {
var factor = waveCount <= 1 ? 0 : idx / (waveCount - 1);
var wave = group2.addShape("path", {
name: "waterwave-path",
attrs: {
path: getWaterWavePath(radius, bbox.minY + height * level, waveLength, 0, width2 / 32, x6, y5),
fill,
opacity: lerp5(0.2, 0.9, factor) * opacity
}
});
try {
if (animation7 === false)
return;
var matrix = transform5([["t", waveLength, 0]]);
wave.stopAnimate();
wave.animate({ matrix }, {
duration: lerp5(0.5 * DURATION, DURATION, factor),
repeat: true
});
} catch (e4) {
console.warn("off-screen group animate error!");
}
}
}
function pin(x6, y5, width2, height) {
var w4 = width2 * 2 / 3;
var h3 = Math.max(w4, height);
var r4 = w4 / 2;
var cx = x6;
var cy = r4 + y5 - h3 / 2;
var theta = Math.asin(r4 / ((h3 - r4) * 0.85));
var dy = Math.sin(theta) * r4;
var dx = Math.cos(theta) * r4;
var x0 = cx - dx;
var y0 = cy + dy;
var cpX = x6;
var cpY = cy + r4 / Math.sin(theta);
return "\n M " + x0 + " " + y0 + "\n A " + r4 + " " + r4 + " 0 1 1 " + (x0 + dx * 2) + " " + y0 + "\n Q " + cpX + " " + cpY + " " + x6 + " " + (y5 + h3 / 2) + "\n Q " + cpX + " " + cpY + " " + x0 + " " + y0 + "\n Z \n ";
}
function circle(x6, y5, width2, height) {
var rx = width2 / 2;
var ry = height / 2;
return "\n M " + x6 + " " + (y5 - ry) + " \n a " + rx + " " + ry + " 0 1 0 0 " + ry * 2 + "\n a " + rx + " " + ry + " 0 1 0 0 " + -ry * 2 + "\n Z\n ";
}
function diamond(x6, y5, width2, height) {
var h3 = height / 2;
var w4 = width2 / 2;
return "\n M " + x6 + " " + (y5 - h3) + "\n L " + (x6 + w4) + " " + y5 + "\n L " + x6 + " " + (y5 + h3) + "\n L " + (x6 - w4) + " " + y5 + "\n Z\n ";
}
function triangle(x6, y5, width2, height) {
var h3 = height / 2;
var w4 = width2 / 2;
return "\n M " + x6 + " " + (y5 - h3) + "\n L " + (x6 + w4) + " " + (y5 + h3) + "\n L " + (x6 - w4) + " " + (y5 + h3) + "\n Z\n ";
}
function rect(x6, y5, width2, height) {
var GOLDEN_SECTION_RATIO = 0.618;
var h3 = height / 2;
var w4 = width2 / 2 * GOLDEN_SECTION_RATIO;
return "\n M " + (x6 - w4) + " " + (y5 - h3) + "\n L " + (x6 + w4) + " " + (y5 - h3) + "\n L " + (x6 + w4) + " " + (y5 + h3) + "\n L " + (x6 - w4) + " " + (y5 + h3) + "\n Z\n ";
}
registerShape("interval", "liquid-fill-gauge", {
draw: function(cfg, container2) {
var cx = 0.5;
var cy = 0.5;
var customInfo = cfg.customInfo;
var _a6 = customInfo, radio = _a6.radius, shape = _a6.shape, background = _a6.background, animation7 = _a6.animation;
var outline = customInfo.outline;
var wave = customInfo.wave;
var border = outline.border, distance15 = outline.distance;
var waveCount = wave.count, waveLength = wave.length;
var minX = reduce_default(cfg.points, function(r4, p4) {
return Math.min(r4, p4.x);
}, Infinity);
var center2 = this.parsePoint({ x: cx, y: cy });
var minXPoint = this.parsePoint({ x: minX, y: cy });
var halfWidth = center2.x - minXPoint.x;
var radius = Math.min(halfWidth, minXPoint.y * radio);
var waveAttrs = getFillAttrs2(cfg);
var outlineAttrs = getLineAttrs(mix({}, cfg, outline));
var innerRadius = radius - border / 2;
var builtInShapeByName = {
pin,
circle,
diamond,
triangle,
rect
};
var buildPath = typeof shape === "function" ? shape : builtInShapeByName[shape] || builtInShapeByName["circle"];
var shapePath = buildPath(center2.x, center2.y, innerRadius * 2, innerRadius * 2);
var waves = container2.addGroup({
name: "waves"
});
var clipPath = waves.setClip({
type: "path",
attrs: {
path: shapePath
}
});
addWaterWave(center2.x, center2.y, 1 - cfg.points[1].y, waveCount, waveAttrs, waves, clipPath, radius * 2, waveLength, animation7);
container2.addShape("path", {
name: "distance",
attrs: {
path: shapePath,
fill: "transparent",
lineWidth: border + distance15 * 2,
stroke: background === "transparent" ? "#fff" : background
}
});
container2.addShape("path", {
name: "wrap",
attrs: mix(outlineAttrs, {
path: shapePath,
fill: "transparent",
lineWidth: border
})
});
return container2;
}
});
// node_modules/@antv/g2plot/esm/plots/liquid/index.js
var Liquid = function(_super) {
__extends(Liquid2, _super);
function Liquid2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "liquid";
return _this;
}
Liquid2.getDefaultOptions = function() {
return DEFAULT_OPTIONS22;
};
Liquid2.prototype.getDefaultOptions = function() {
return Liquid2.getDefaultOptions();
};
Liquid2.prototype.changeData = function(percent2) {
this.chart.emit(VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, event_default.fromData(this.chart, VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, null));
this.updateOption({ percent: percent2 });
this.chart.data(getLiquidData(percent2));
statistic2({ chart: this.chart, options: this.options }, true);
this.chart.emit(VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA, event_default.fromData(this.chart, VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA, null));
};
Liquid2.prototype.getSchemaAdaptor = function() {
return adaptor23;
};
return Liquid2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/bullet/utils.js
function transformData3(options) {
var data3 = options.data, xField = options.xField, measureField = options.measureField, rangeField = options.rangeField, targetField = options.targetField, layout6 = options.layout;
var ds = [];
var scales = [];
data3.forEach(function(item, index2) {
var _a6;
item[rangeField].sort(function(a4, b10) {
return a4 - b10;
});
item[rangeField].forEach(function(d3, i4) {
var _a7;
var range = i4 === 0 ? d3 : item[rangeField][i4] - item[rangeField][i4 - 1];
ds.push((_a7 = {
rKey: rangeField + "_" + i4
}, _a7[xField] = xField ? item[xField] : String(index2), _a7[rangeField] = range, _a7));
});
item[measureField].forEach(function(d3, i4) {
var _a7;
ds.push((_a7 = {
mKey: item[measureField].length > 1 ? measureField + "_" + i4 : "" + measureField
}, _a7[xField] = xField ? item[xField] : String(index2), _a7[measureField] = d3, _a7));
});
ds.push((_a6 = {
tKey: "" + targetField
}, _a6[xField] = xField ? item[xField] : String(index2), _a6[targetField] = item[targetField], _a6));
scales.push(item[rangeField], item[measureField], item[targetField]);
});
var min7 = Math.min.apply(Math, scales.flat(Infinity));
var max8 = Math.max.apply(Math, scales.flat(Infinity));
min7 = min7 > 0 ? 0 : min7;
if (layout6 === "vertical") {
ds.reverse();
}
return { min: min7, max: max8, ds };
}
// node_modules/@antv/g2plot/esm/plots/bullet/adaptor.js
function geometry26(params) {
var chart = params.chart, options = params.options;
var bulletStyle = options.bulletStyle, targetField = options.targetField, rangeField = options.rangeField, measureField = options.measureField, xField = options.xField, color4 = options.color, layout6 = options.layout, size2 = options.size, label17 = options.label;
var _a6 = transformData3(options), min7 = _a6.min, max8 = _a6.max, ds = _a6.ds;
chart.data(ds);
var r4 = deepAssign({}, params, {
options: {
xField,
yField: rangeField,
seriesField: "rKey",
isStack: true,
label: get_default(label17, "range"),
interval: {
color: get_default(color4, "range"),
style: get_default(bulletStyle, "range"),
size: get_default(size2, "range")
}
}
});
interval2(r4);
chart.geometries[0].tooltip(false);
var m4 = deepAssign({}, params, {
options: {
xField,
yField: measureField,
seriesField: "mKey",
isStack: true,
label: get_default(label17, "measure"),
interval: {
color: get_default(color4, "measure"),
style: get_default(bulletStyle, "measure"),
size: get_default(size2, "measure")
}
}
});
interval2(m4);
var t4 = deepAssign({}, params, {
options: {
xField,
yField: targetField,
seriesField: "tKey",
label: get_default(label17, "target"),
point: {
color: get_default(color4, "target"),
style: get_default(bulletStyle, "target"),
size: is_function_default(get_default(size2, "target")) ? function(data3) {
return get_default(size2, "target")(data3) / 2;
} : get_default(size2, "target") / 2,
shape: layout6 === "horizontal" ? "line" : "hyphen"
}
}
});
point(t4);
if (layout6 === "horizontal") {
chart.coordinate().transpose();
}
return __assign(__assign({}, params), { ext: { data: { min: min7, max: max8 } } });
}
function meta16(params) {
var _a6, _b;
var options = params.options, ext = params.ext;
var xAxis = options.xAxis, yAxis = options.yAxis, targetField = options.targetField, rangeField = options.rangeField, measureField = options.measureField, xField = options.xField;
var extData = ext.data;
return flow(scale7((_a6 = {}, _a6[xField] = xAxis, _a6[measureField] = yAxis, _a6), (_b = {}, _b[measureField] = { min: extData === null || extData === void 0 ? void 0 : extData.min, max: extData === null || extData === void 0 ? void 0 : extData.max, sync: true }, _b[targetField] = {
sync: "" + measureField
}, _b[rangeField] = {
sync: "" + measureField
}, _b)))(params);
}
function axis14(params) {
var chart = params.chart, options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, measureField = options.measureField, rangeField = options.rangeField, targetField = options.targetField;
chart.axis("" + rangeField, false);
chart.axis("" + targetField, false);
if (xAxis === false) {
chart.axis("" + xField, false);
} else {
chart.axis("" + xField, xAxis);
}
if (yAxis === false) {
chart.axis("" + measureField, false);
} else {
chart.axis("" + measureField, yAxis);
}
return params;
}
function legend15(params) {
var chart = params.chart, options = params.options;
var legend18 = options.legend;
chart.removeInteraction("legend-filter");
chart.legend(legend18);
chart.legend("rKey", false);
chart.legend("mKey", false);
chart.legend("tKey", false);
return params;
}
function label12(params) {
var chart = params.chart, options = params.options;
var label17 = options.label, measureField = options.measureField, targetField = options.targetField, rangeField = options.rangeField;
var _a6 = chart.geometries, rangeGeometry = _a6[0], measureGeometry = _a6[1], targetGeometry = _a6[2];
if (get_default(label17, "range")) {
rangeGeometry.label("" + rangeField, __assign({ layout: [{ type: "limit-in-plot" }] }, transformLabel(label17.range)));
} else {
rangeGeometry.label(false);
}
if (get_default(label17, "measure")) {
measureGeometry.label("" + measureField, __assign({ layout: [{ type: "limit-in-plot" }] }, transformLabel(label17.measure)));
} else {
measureGeometry.label(false);
}
if (get_default(label17, "target")) {
targetGeometry.label("" + targetField, __assign({ layout: [{ type: "limit-in-plot" }] }, transformLabel(label17.target)));
} else {
targetGeometry.label(false);
}
return params;
}
function adaptor24(params) {
flow(geometry26, meta16, axis14, legend15, theme, label12, tooltip, interaction, animation)(params);
}
// node_modules/@antv/g2plot/esm/plots/bullet/constant.js
var DEFAULT_OPTIONS23 = deepAssign({}, Plot.getDefaultOptions(), {
layout: "horizontal",
size: {
range: 30,
measure: 20,
target: 20
},
xAxis: {
tickLine: false,
line: null
},
bulletStyle: {
range: {
fillOpacity: 0.5
}
},
label: {
measure: {
position: "right"
}
},
tooltip: {
showMarkers: false
}
});
// node_modules/@antv/g2plot/esm/plots/bullet/index.js
var Bullet = function(_super) {
__extends(Bullet2, _super);
function Bullet2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "bullet";
return _this;
}
Bullet2.getDefaultOptions = function() {
return DEFAULT_OPTIONS23;
};
Bullet2.prototype.changeData = function(data3) {
this.updateOption({ data: data3 });
var _a6 = transformData3(this.options), min7 = _a6.min, max8 = _a6.max, ds = _a6.ds;
meta16({ options: this.options, ext: { data: { min: min7, max: max8 } }, chart: this.chart });
this.chart.changeData(ds);
};
Bullet2.prototype.getSchemaAdaptor = function() {
return adaptor24;
};
Bullet2.prototype.getDefaultOptions = function() {
return Bullet2.getDefaultOptions();
};
return Bullet2;
}(Plot);
// node_modules/@antv/g2plot/esm/utils/hierarchy/util.js
var NODE_INDEX_FIELD = "nodeIndex";
var CHILD_NODE_COUNT = "childNodeCount";
var NODE_ANCESTORS_FIELD = "nodeAncestor";
var INVALID_FIELD_ERR_MSG = "Invalid field: it must be a string!";
function getField(options, defaultField) {
var field6 = options.field, fields = options.fields;
if (is_string_default(field6)) {
return field6;
}
if (is_array_default(field6)) {
console.warn(INVALID_FIELD_ERR_MSG);
return field6[0];
}
console.warn(INVALID_FIELD_ERR_MSG + " will try to get fields instead.");
if (is_string_default(fields)) {
return fields;
}
if (is_array_default(fields) && fields.length) {
return fields[0];
}
if (defaultField) {
return defaultField;
}
throw new TypeError(INVALID_FIELD_ERR_MSG);
}
function getAllNodes(root) {
var nodes = [];
if (root && root.each) {
var parent_1;
var index_1;
root.each(function(node) {
var _a6, _b;
if (node.parent !== parent_1) {
parent_1 = node.parent;
index_1 = 0;
} else {
index_1 += 1;
}
var ancestors = filter_default((((_a6 = node.ancestors) === null || _a6 === void 0 ? void 0 : _a6.call(node)) || []).map(function(d3) {
return nodes.find(function(n3) {
return n3.name === d3.name;
}) || d3;
}), function(_a7) {
var depth = _a7.depth;
return depth > 0 && depth < node.depth;
});
node[NODE_ANCESTORS_FIELD] = ancestors;
node[CHILD_NODE_COUNT] = ((_b = node.children) === null || _b === void 0 ? void 0 : _b.length) || 0;
node[NODE_INDEX_FIELD] = index_1;
nodes.push(node);
});
} else if (root && root.eachNode) {
root.eachNode(function(node) {
nodes.push(node);
});
}
return nodes;
}
// node_modules/@antv/g2plot/esm/plots/sunburst/constant.js
var SUNBURST_ANCESTOR_FIELD = "ancestor-node";
var SUNBURST_Y_FIELD = "value";
var SUNBURST_PATH_FIELD = "path";
var RAW_FIELDS = [
SUNBURST_PATH_FIELD,
NODE_INDEX_FIELD,
NODE_ANCESTORS_FIELD,
CHILD_NODE_COUNT,
"name",
"depth",
"height"
];
var DEFAULT_OPTIONS24 = deepAssign({}, Plot.getDefaultOptions(), {
innerRadius: 0,
radius: 0.85,
hierarchyConfig: {
field: "value"
},
tooltip: {
shared: true,
showMarkers: false,
offset: 20,
showTitle: false
},
legend: false,
sunburstStyle: {
lineWidth: 0.5,
stroke: "#FFF"
},
drilldown: { enabled: true }
});
// node_modules/@antv/g2plot/esm/interactions/actions/drill-down.js
var PADDING = 4;
var PADDING_LEFT = 0;
var PADDING_TOP3 = 5;
var BREAD_CRUMB_NAME = "drilldown-bread-crumb";
var DEFAULT_BREAD_CRUMB_CONFIG = {
position: "top-left",
dividerText: "/",
textStyle: {
fontSize: 12,
fill: "rgba(0, 0, 0, 0.65)",
cursor: "pointer"
},
activeTextStyle: {
fill: "#87B5FF"
}
};
var HIERARCHY_DATA_TRANSFORM_PARAMS = "hierarchy-data-transform-params";
var DrillDownAction = function(_super) {
__extends(DrillDownAction2, _super);
function DrillDownAction2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.name = "drill-down";
_this.historyCache = [];
_this.breadCrumbGroup = null;
_this.breadCrumbCfg = DEFAULT_BREAD_CRUMB_CONFIG;
return _this;
}
DrillDownAction2.prototype.click = function() {
var data3 = get_default(this.context, ["event", "data", "data"]);
if (!data3)
return false;
this.drill(data3);
this.drawBreadCrumb();
};
DrillDownAction2.prototype.resetPosition = function() {
if (!this.breadCrumbGroup)
return;
var coordinate11 = this.context.view.getCoordinate();
var breadCrumbGroup = this.breadCrumbGroup;
var bbox = breadCrumbGroup.getBBox();
var position2 = this.getButtonCfg().position;
var point2 = { x: coordinate11.start.x, y: coordinate11.end.y - (bbox.height + PADDING_TOP3 * 2) };
if (coordinate11.isPolar) {
point2 = { x: 0, y: 0 };
}
if (position2 === "bottom-left") {
point2 = { x: coordinate11.start.x, y: coordinate11.start.y };
}
var matrix = Util.transform(null, [["t", point2.x + PADDING_LEFT, point2.y + bbox.height + PADDING_TOP3]]);
breadCrumbGroup.setMatrix(matrix);
};
DrillDownAction2.prototype.back = function() {
if (size(this.historyCache)) {
this.backTo(this.historyCache.slice(0, -1));
}
};
DrillDownAction2.prototype.reset = function() {
if (this.historyCache[0]) {
this.backTo(this.historyCache.slice(0, 1));
}
this.historyCache = [];
this.hideCrumbGroup();
};
DrillDownAction2.prototype.drill = function(nodeInfo) {
var view = this.context.view;
var transformData10 = get_default(view, ["interactions", "drill-down", "cfg", "transformData"], function(v3) {
return v3;
});
var drillData = transformData10(__assign({ data: nodeInfo.data }, nodeInfo[HIERARCHY_DATA_TRANSFORM_PARAMS]));
view.changeData(drillData);
var historyCache = [];
var node = nodeInfo;
while (node) {
var nodeData = node.data;
historyCache.unshift({
id: nodeData.name + "_" + node.height + "_" + node.depth,
name: nodeData.name,
children: transformData10(__assign({ data: nodeData }, nodeInfo[HIERARCHY_DATA_TRANSFORM_PARAMS]))
});
node = node.parent;
}
this.historyCache = (this.historyCache || []).slice(0, -1).concat(historyCache);
};
DrillDownAction2.prototype.backTo = function(historyCache) {
if (!historyCache || historyCache.length <= 0) {
return;
}
var view = this.context.view;
var data3 = last(historyCache).children;
view.changeData(data3);
if (historyCache.length > 1) {
this.historyCache = historyCache;
this.drawBreadCrumb();
} else {
this.historyCache = [];
this.hideCrumbGroup();
}
};
DrillDownAction2.prototype.getButtonCfg = function() {
var view = this.context.view;
var drillDownConfig = get_default(view, ["interactions", "drill-down", "cfg", "drillDownConfig"]);
return deepAssign(this.breadCrumbCfg, drillDownConfig === null || drillDownConfig === void 0 ? void 0 : drillDownConfig.breadCrumb, this.cfg);
};
DrillDownAction2.prototype.drawBreadCrumb = function() {
this.drawBreadCrumbGroup();
this.resetPosition();
this.breadCrumbGroup.show();
};
DrillDownAction2.prototype.drawBreadCrumbGroup = function() {
var _this = this;
var config = this.getButtonCfg();
var cache3 = this.historyCache;
if (!this.breadCrumbGroup) {
this.breadCrumbGroup = this.context.view.foregroundGroup.addGroup({
name: BREAD_CRUMB_NAME
});
} else {
this.breadCrumbGroup.clear();
}
var left2 = 0;
cache3.forEach(function(record, index2) {
var textShape = _this.breadCrumbGroup.addShape({
type: "text",
id: record.id,
name: BREAD_CRUMB_NAME + "_" + record.name + "_text",
attrs: __assign(__assign({ text: index2 === 0 && !is_nil_default(config.rootText) ? config.rootText : record.name }, config.textStyle), { x: left2, y: 0 })
});
var textShapeBox = textShape.getBBox();
left2 += textShapeBox.width + PADDING;
textShape.on("click", function(event) {
var _a6;
var targetId = event.target.get("id");
if (targetId !== ((_a6 = last(cache3)) === null || _a6 === void 0 ? void 0 : _a6.id)) {
var newHistoryCache = cache3.slice(0, cache3.findIndex(function(d3) {
return d3.id === targetId;
}) + 1);
_this.backTo(newHistoryCache);
}
});
textShape.on("mouseenter", function(event) {
var _a6;
var targetId = event.target.get("id");
if (targetId !== ((_a6 = last(cache3)) === null || _a6 === void 0 ? void 0 : _a6.id)) {
textShape.attr(config.activeTextStyle);
} else {
textShape.attr({ cursor: "default" });
}
});
textShape.on("mouseleave", function() {
textShape.attr(config.textStyle);
});
if (index2 < cache3.length - 1) {
var dividerShape = _this.breadCrumbGroup.addShape({
type: "text",
name: config.name + "_" + record.name + "_divider",
attrs: __assign(__assign({ text: config.dividerText }, config.textStyle), { x: left2, y: 0 })
});
var dividerBox = dividerShape.getBBox();
left2 += dividerBox.width + PADDING;
}
});
};
DrillDownAction2.prototype.hideCrumbGroup = function() {
if (this.breadCrumbGroup) {
this.breadCrumbGroup.hide();
}
};
DrillDownAction2.prototype.destroy = function() {
if (this.breadCrumbGroup) {
this.breadCrumbGroup.remove();
}
_super.prototype.destroy.call(this);
};
return DrillDownAction2;
}(base_default12);
// node_modules/d3-hierarchy/src/index.js
var src_exports2 = {};
__export(src_exports2, {
cluster: () => cluster_default,
hierarchy: () => hierarchy,
pack: () => pack_default,
packEnclose: () => enclose_default,
packSiblings: () => siblings_default,
partition: () => partition_default,
stratify: () => stratify_default,
tree: () => tree_default2,
treemap: () => treemap_default,
treemapBinary: () => binary_default,
treemapDice: () => dice_default,
treemapResquarify: () => resquarify_default,
treemapSlice: () => slice_default,
treemapSliceDice: () => sliceDice_default,
treemapSquarify: () => squarify_default
});
// node_modules/d3-hierarchy/src/cluster.js
function defaultSeparation(a4, b10) {
return a4.parent === b10.parent ? 1 : 2;
}
function meanX(children) {
return children.reduce(meanXReduce, 0) / children.length;
}
function meanXReduce(x6, c5) {
return x6 + c5.x;
}
function maxY(children) {
return 1 + children.reduce(maxYReduce, 0);
}
function maxYReduce(y5, c5) {
return Math.max(y5, c5.y);
}
function leafLeft(node) {
var children;
while (children = node.children)
node = children[0];
return node;
}
function leafRight(node) {
var children;
while (children = node.children)
node = children[children.length - 1];
return node;
}
function cluster_default() {
var separation = defaultSeparation, dx = 1, dy = 1, nodeSize = false;
function cluster(root) {
var previousNode, x6 = 0;
root.eachAfter(function(node) {
var children = node.children;
if (children) {
node.x = meanX(children);
node.y = maxY(children);
} else {
node.x = previousNode ? x6 += separation(node, previousNode) : 0;
node.y = 0;
previousNode = node;
}
});
var left2 = leafLeft(root), right2 = leafRight(root), x0 = left2.x - separation(left2, right2) / 2, x1 = right2.x + separation(right2, left2) / 2;
return root.eachAfter(nodeSize ? function(node) {
node.x = (node.x - root.x) * dx;
node.y = (root.y - node.y) * dy;
} : function(node) {
node.x = (node.x - x0) / (x1 - x0) * dx;
node.y = (1 - (root.y ? node.y / root.y : 1)) * dy;
});
}
cluster.separation = function(x6) {
return arguments.length ? (separation = x6, cluster) : separation;
};
cluster.size = function(x6) {
return arguments.length ? (nodeSize = false, dx = +x6[0], dy = +x6[1], cluster) : nodeSize ? null : [dx, dy];
};
cluster.nodeSize = function(x6) {
return arguments.length ? (nodeSize = true, dx = +x6[0], dy = +x6[1], cluster) : nodeSize ? [dx, dy] : null;
};
return cluster;
}
// node_modules/d3-hierarchy/src/hierarchy/count.js
function count(node) {
var sum = 0, children = node.children, i4 = children && children.length;
if (!i4)
sum = 1;
else
while (--i4 >= 0)
sum += children[i4].value;
node.value = sum;
}
function count_default() {
return this.eachAfter(count);
}
// node_modules/d3-hierarchy/src/hierarchy/each.js
function each_default2(callback, that) {
let index2 = -1;
for (const node of this) {
callback.call(that, node, ++index2, this);
}
return this;
}
// node_modules/d3-hierarchy/src/hierarchy/eachBefore.js
function eachBefore_default(callback, that) {
var node = this, nodes = [node], children, i4, index2 = -1;
while (node = nodes.pop()) {
callback.call(that, node, ++index2, this);
if (children = node.children) {
for (i4 = children.length - 1; i4 >= 0; --i4) {
nodes.push(children[i4]);
}
}
}
return this;
}
// node_modules/d3-hierarchy/src/hierarchy/eachAfter.js
function eachAfter_default(callback, that) {
var node = this, nodes = [node], next = [], children, i4, n3, index2 = -1;
while (node = nodes.pop()) {
next.push(node);
if (children = node.children) {
for (i4 = 0, n3 = children.length; i4 < n3; ++i4) {
nodes.push(children[i4]);
}
}
}
while (node = next.pop()) {
callback.call(that, node, ++index2, this);
}
return this;
}
// node_modules/d3-hierarchy/src/hierarchy/find.js
function find_default2(callback, that) {
let index2 = -1;
for (const node of this) {
if (callback.call(that, node, ++index2, this)) {
return node;
}
}
}
// node_modules/d3-hierarchy/src/hierarchy/sum.js
function sum_default(value2) {
return this.eachAfter(function(node) {
var sum = +value2(node.data) || 0, children = node.children, i4 = children && children.length;
while (--i4 >= 0)
sum += children[i4].value;
node.value = sum;
});
}
// node_modules/d3-hierarchy/src/hierarchy/sort.js
function sort_default(compare4) {
return this.eachBefore(function(node) {
if (node.children) {
node.children.sort(compare4);
}
});
}
// node_modules/d3-hierarchy/src/hierarchy/path.js
function path_default7(end2) {
var start = this, ancestor = leastCommonAncestor(start, end2), nodes = [start];
while (start !== ancestor) {
start = start.parent;
nodes.push(start);
}
var k4 = nodes.length;
while (end2 !== ancestor) {
nodes.splice(k4, 0, end2);
end2 = end2.parent;
}
return nodes;
}
function leastCommonAncestor(a4, b10) {
if (a4 === b10)
return a4;
var aNodes = a4.ancestors(), bNodes = b10.ancestors(), c5 = null;
a4 = aNodes.pop();
b10 = bNodes.pop();
while (a4 === b10) {
c5 = a4;
a4 = aNodes.pop();
b10 = bNodes.pop();
}
return c5;
}
// node_modules/d3-hierarchy/src/hierarchy/ancestors.js
function ancestors_default() {
var node = this, nodes = [node];
while (node = node.parent) {
nodes.push(node);
}
return nodes;
}
// node_modules/d3-hierarchy/src/hierarchy/descendants.js
function descendants_default() {
return Array.from(this);
}
// node_modules/d3-hierarchy/src/hierarchy/leaves.js
function leaves_default() {
var leaves = [];
this.eachBefore(function(node) {
if (!node.children) {
leaves.push(node);
}
});
return leaves;
}
// node_modules/d3-hierarchy/src/hierarchy/links.js
function links_default() {
var root = this, links = [];
root.each(function(node) {
if (node !== root) {
links.push({ source: node.parent, target: node });
}
});
return links;
}
// node_modules/d3-hierarchy/src/hierarchy/iterator.js
function* iterator_default() {
var node = this, current, next = [node], children, i4, n3;
do {
current = next.reverse(), next = [];
while (node = current.pop()) {
yield node;
if (children = node.children) {
for (i4 = 0, n3 = children.length; i4 < n3; ++i4) {
next.push(children[i4]);
}
}
}
} while (next.length);
}
// node_modules/d3-hierarchy/src/hierarchy/index.js
function hierarchy(data3, children) {
if (data3 instanceof Map) {
data3 = [void 0, data3];
if (children === void 0)
children = mapChildren;
} else if (children === void 0) {
children = objectChildren;
}
var root = new Node(data3), node, nodes = [root], child, childs, i4, n3;
while (node = nodes.pop()) {
if ((childs = children(node.data)) && (n3 = (childs = Array.from(childs)).length)) {
node.children = childs;
for (i4 = n3 - 1; i4 >= 0; --i4) {
nodes.push(child = childs[i4] = new Node(childs[i4]));
child.parent = node;
child.depth = node.depth + 1;
}
}
}
return root.eachBefore(computeHeight);
}
function node_copy() {
return hierarchy(this).eachBefore(copyData);
}
function objectChildren(d3) {
return d3.children;
}
function mapChildren(d3) {
return Array.isArray(d3) ? d3[1] : null;
}
function copyData(node) {
if (node.data.value !== void 0)
node.value = node.data.value;
node.data = node.data.data;
}
function computeHeight(node) {
var height = 0;
do
node.height = height;
while ((node = node.parent) && node.height < ++height);
}
function Node(data3) {
this.data = data3;
this.depth = this.height = 0;
this.parent = null;
}
Node.prototype = hierarchy.prototype = {
constructor: Node,
count: count_default,
each: each_default2,
eachAfter: eachAfter_default,
eachBefore: eachBefore_default,
find: find_default2,
sum: sum_default,
sort: sort_default,
path: path_default7,
ancestors: ancestors_default,
descendants: descendants_default,
leaves: leaves_default,
links: links_default,
copy: node_copy,
[Symbol.iterator]: iterator_default
};
// node_modules/d3-hierarchy/src/array.js
function array_default2(x6) {
return typeof x6 === "object" && "length" in x6 ? x6 : Array.from(x6);
}
function shuffle(array) {
var m4 = array.length, t4, i4;
while (m4) {
i4 = Math.random() * m4-- | 0;
t4 = array[m4];
array[m4] = array[i4];
array[i4] = t4;
}
return array;
}
// node_modules/d3-hierarchy/src/pack/enclose.js
function enclose_default(circles) {
var i4 = 0, n3 = (circles = shuffle(Array.from(circles))).length, B3 = [], p4, e4;
while (i4 < n3) {
p4 = circles[i4];
if (e4 && enclosesWeak(e4, p4))
++i4;
else
e4 = encloseBasis(B3 = extendBasis(B3, p4)), i4 = 0;
}
return e4;
}
function extendBasis(B3, p4) {
var i4, j4;
if (enclosesWeakAll(p4, B3))
return [p4];
for (i4 = 0; i4 < B3.length; ++i4) {
if (enclosesNot(p4, B3[i4]) && enclosesWeakAll(encloseBasis2(B3[i4], p4), B3)) {
return [B3[i4], p4];
}
}
for (i4 = 0; i4 < B3.length - 1; ++i4) {
for (j4 = i4 + 1; j4 < B3.length; ++j4) {
if (enclosesNot(encloseBasis2(B3[i4], B3[j4]), p4) && enclosesNot(encloseBasis2(B3[i4], p4), B3[j4]) && enclosesNot(encloseBasis2(B3[j4], p4), B3[i4]) && enclosesWeakAll(encloseBasis3(B3[i4], B3[j4], p4), B3)) {
return [B3[i4], B3[j4], p4];
}
}
}
throw new Error();
}
function enclosesNot(a4, b10) {
var dr = a4.r - b10.r, dx = b10.x - a4.x, dy = b10.y - a4.y;
return dr < 0 || dr * dr < dx * dx + dy * dy;
}
function enclosesWeak(a4, b10) {
var dr = a4.r - b10.r + Math.max(a4.r, b10.r, 1) * 1e-9, dx = b10.x - a4.x, dy = b10.y - a4.y;
return dr > 0 && dr * dr > dx * dx + dy * dy;
}
function enclosesWeakAll(a4, B3) {
for (var i4 = 0; i4 < B3.length; ++i4) {
if (!enclosesWeak(a4, B3[i4])) {
return false;
}
}
return true;
}
function encloseBasis(B3) {
switch (B3.length) {
case 1:
return encloseBasis1(B3[0]);
case 2:
return encloseBasis2(B3[0], B3[1]);
case 3:
return encloseBasis3(B3[0], B3[1], B3[2]);
}
}
function encloseBasis1(a4) {
return {
x: a4.x,
y: a4.y,
r: a4.r
};
}
function encloseBasis2(a4, b10) {
var x1 = a4.x, y1 = a4.y, r1 = a4.r, x22 = b10.x, y22 = b10.y, r22 = b10.r, x21 = x22 - x1, y21 = y22 - y1, r21 = r22 - r1, l4 = Math.sqrt(x21 * x21 + y21 * y21);
return {
x: (x1 + x22 + x21 / l4 * r21) / 2,
y: (y1 + y22 + y21 / l4 * r21) / 2,
r: (l4 + r1 + r22) / 2
};
}
function encloseBasis3(a4, b10, c5) {
var x1 = a4.x, y1 = a4.y, r1 = a4.r, x22 = b10.x, y22 = b10.y, r22 = b10.r, x32 = c5.x, y32 = c5.y, r32 = c5.r, a22 = x1 - x22, a32 = x1 - x32, b23 = y1 - y22, b32 = y1 - y32, c22 = r22 - r1, c32 = r32 - r1, d1 = x1 * x1 + y1 * y1 - r1 * r1, d22 = d1 - x22 * x22 - y22 * y22 + r22 * r22, d3 = d1 - x32 * x32 - y32 * y32 + r32 * r32, ab = a32 * b23 - a22 * b32, xa = (b23 * d3 - b32 * d22) / (ab * 2) - x1, xb = (b32 * c22 - b23 * c32) / ab, ya = (a32 * d22 - a22 * d3) / (ab * 2) - y1, yb = (a22 * c32 - a32 * c22) / ab, A4 = xb * xb + yb * yb - 1, B3 = 2 * (r1 + xa * xb + ya * yb), C3 = xa * xa + ya * ya - r1 * r1, r4 = -(A4 ? (B3 + Math.sqrt(B3 * B3 - 4 * A4 * C3)) / (2 * A4) : C3 / B3);
return {
x: x1 + xa + xb * r4,
y: y1 + ya + yb * r4,
r: r4
};
}
// node_modules/d3-hierarchy/src/pack/siblings.js
function place(b10, a4, c5) {
var dx = b10.x - a4.x, x6, a22, dy = b10.y - a4.y, y5, b23, d22 = dx * dx + dy * dy;
if (d22) {
a22 = a4.r + c5.r, a22 *= a22;
b23 = b10.r + c5.r, b23 *= b23;
if (a22 > b23) {
x6 = (d22 + b23 - a22) / (2 * d22);
y5 = Math.sqrt(Math.max(0, b23 / d22 - x6 * x6));
c5.x = b10.x - x6 * dx - y5 * dy;
c5.y = b10.y - x6 * dy + y5 * dx;
} else {
x6 = (d22 + a22 - b23) / (2 * d22);
y5 = Math.sqrt(Math.max(0, a22 / d22 - x6 * x6));
c5.x = a4.x + x6 * dx - y5 * dy;
c5.y = a4.y + x6 * dy + y5 * dx;
}
} else {
c5.x = a4.x + c5.r;
c5.y = a4.y;
}
}
function intersects(a4, b10) {
var dr = a4.r + b10.r - 1e-6, dx = b10.x - a4.x, dy = b10.y - a4.y;
return dr > 0 && dr * dr > dx * dx + dy * dy;
}
function score(node) {
var a4 = node._, b10 = node.next._, ab = a4.r + b10.r, dx = (a4.x * b10.r + b10.x * a4.r) / ab, dy = (a4.y * b10.r + b10.y * a4.r) / ab;
return dx * dx + dy * dy;
}
function Node2(circle3) {
this._ = circle3;
this.next = null;
this.previous = null;
}
function packEnclose(circles) {
if (!(n3 = (circles = array_default2(circles)).length))
return 0;
var a4, b10, c5, n3, aa, ca, i4, j4, k4, sj, sk;
a4 = circles[0], a4.x = 0, a4.y = 0;
if (!(n3 > 1))
return a4.r;
b10 = circles[1], a4.x = -b10.r, b10.x = a4.r, b10.y = 0;
if (!(n3 > 2))
return a4.r + b10.r;
place(b10, a4, c5 = circles[2]);
a4 = new Node2(a4), b10 = new Node2(b10), c5 = new Node2(c5);
a4.next = c5.previous = b10;
b10.next = a4.previous = c5;
c5.next = b10.previous = a4;
pack:
for (i4 = 3; i4 < n3; ++i4) {
place(a4._, b10._, c5 = circles[i4]), c5 = new Node2(c5);
j4 = b10.next, k4 = a4.previous, sj = b10._.r, sk = a4._.r;
do {
if (sj <= sk) {
if (intersects(j4._, c5._)) {
b10 = j4, a4.next = b10, b10.previous = a4, --i4;
continue pack;
}
sj += j4._.r, j4 = j4.next;
} else {
if (intersects(k4._, c5._)) {
a4 = k4, a4.next = b10, b10.previous = a4, --i4;
continue pack;
}
sk += k4._.r, k4 = k4.previous;
}
} while (j4 !== k4.next);
c5.previous = a4, c5.next = b10, a4.next = b10.previous = b10 = c5;
aa = score(a4);
while ((c5 = c5.next) !== b10) {
if ((ca = score(c5)) < aa) {
a4 = c5, aa = ca;
}
}
b10 = a4.next;
}
a4 = [b10._], c5 = b10;
while ((c5 = c5.next) !== b10)
a4.push(c5._);
c5 = enclose_default(a4);
for (i4 = 0; i4 < n3; ++i4)
a4 = circles[i4], a4.x -= c5.x, a4.y -= c5.y;
return c5.r;
}
function siblings_default(circles) {
packEnclose(circles);
return circles;
}
// node_modules/d3-hierarchy/src/accessors.js
function optional(f3) {
return f3 == null ? null : required(f3);
}
function required(f3) {
if (typeof f3 !== "function")
throw new Error();
return f3;
}
// node_modules/d3-hierarchy/src/constant.js
function constantZero() {
return 0;
}
function constant_default2(x6) {
return function() {
return x6;
};
}
// node_modules/d3-hierarchy/src/pack/index.js
function defaultRadius(d3) {
return Math.sqrt(d3.value);
}
function pack_default() {
var radius = null, dx = 1, dy = 1, padding3 = constantZero;
function pack2(root) {
root.x = dx / 2, root.y = dy / 2;
if (radius) {
root.eachBefore(radiusLeaf(radius)).eachAfter(packChildren(padding3, 0.5)).eachBefore(translateChild(1));
} else {
root.eachBefore(radiusLeaf(defaultRadius)).eachAfter(packChildren(constantZero, 1)).eachAfter(packChildren(padding3, root.r / Math.min(dx, dy))).eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r)));
}
return root;
}
pack2.radius = function(x6) {
return arguments.length ? (radius = optional(x6), pack2) : radius;
};
pack2.size = function(x6) {
return arguments.length ? (dx = +x6[0], dy = +x6[1], pack2) : [dx, dy];
};
pack2.padding = function(x6) {
return arguments.length ? (padding3 = typeof x6 === "function" ? x6 : constant_default2(+x6), pack2) : padding3;
};
return pack2;
}
function radiusLeaf(radius) {
return function(node) {
if (!node.children) {
node.r = Math.max(0, +radius(node) || 0);
}
};
}
function packChildren(padding3, k4) {
return function(node) {
if (children = node.children) {
var children, i4, n3 = children.length, r4 = padding3(node) * k4 || 0, e4;
if (r4)
for (i4 = 0; i4 < n3; ++i4)
children[i4].r += r4;
e4 = packEnclose(children);
if (r4)
for (i4 = 0; i4 < n3; ++i4)
children[i4].r -= r4;
node.r = e4 + r4;
}
};
}
function translateChild(k4) {
return function(node) {
var parent = node.parent;
node.r *= k4;
if (parent) {
node.x = parent.x + k4 * node.x;
node.y = parent.y + k4 * node.y;
}
};
}
// node_modules/d3-hierarchy/src/treemap/round.js
function round_default(node) {
node.x0 = Math.round(node.x0);
node.y0 = Math.round(node.y0);
node.x1 = Math.round(node.x1);
node.y1 = Math.round(node.y1);
}
// node_modules/d3-hierarchy/src/treemap/dice.js
function dice_default(parent, x0, y0, x1, y1) {
var nodes = parent.children, node, i4 = -1, n3 = nodes.length, k4 = parent.value && (x1 - x0) / parent.value;
while (++i4 < n3) {
node = nodes[i4], node.y0 = y0, node.y1 = y1;
node.x0 = x0, node.x1 = x0 += node.value * k4;
}
}
// node_modules/d3-hierarchy/src/partition.js
function partition_default() {
var dx = 1, dy = 1, padding3 = 0, round5 = false;
function partition3(root) {
var n3 = root.height + 1;
root.x0 = root.y0 = padding3;
root.x1 = dx;
root.y1 = dy / n3;
root.eachBefore(positionNode(dy, n3));
if (round5)
root.eachBefore(round_default);
return root;
}
function positionNode(dy2, n3) {
return function(node) {
if (node.children) {
dice_default(node, node.x0, dy2 * (node.depth + 1) / n3, node.x1, dy2 * (node.depth + 2) / n3);
}
var x0 = node.x0, y0 = node.y0, x1 = node.x1 - padding3, y1 = node.y1 - padding3;
if (x1 < x0)
x0 = x1 = (x0 + x1) / 2;
if (y1 < y0)
y0 = y1 = (y0 + y1) / 2;
node.x0 = x0;
node.y0 = y0;
node.x1 = x1;
node.y1 = y1;
};
}
partition3.round = function(x6) {
return arguments.length ? (round5 = !!x6, partition3) : round5;
};
partition3.size = function(x6) {
return arguments.length ? (dx = +x6[0], dy = +x6[1], partition3) : [dx, dy];
};
partition3.padding = function(x6) {
return arguments.length ? (padding3 = +x6, partition3) : padding3;
};
return partition3;
}
// node_modules/d3-hierarchy/src/stratify.js
var preroot = { depth: -1 };
var ambiguous = {};
function defaultId(d3) {
return d3.id;
}
function defaultParentId(d3) {
return d3.parentId;
}
function stratify_default() {
var id = defaultId, parentId = defaultParentId;
function stratify(data3) {
var nodes = Array.from(data3), n3 = nodes.length, d3, i4, root, parent, node, nodeId, nodeKey, nodeByKey = new Map();
for (i4 = 0; i4 < n3; ++i4) {
d3 = nodes[i4], node = nodes[i4] = new Node(d3);
if ((nodeId = id(d3, i4, data3)) != null && (nodeId += "")) {
nodeKey = node.id = nodeId;
nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node);
}
if ((nodeId = parentId(d3, i4, data3)) != null && (nodeId += "")) {
node.parent = nodeId;
}
}
for (i4 = 0; i4 < n3; ++i4) {
node = nodes[i4];
if (nodeId = node.parent) {
parent = nodeByKey.get(nodeId);
if (!parent)
throw new Error("missing: " + nodeId);
if (parent === ambiguous)
throw new Error("ambiguous: " + nodeId);
if (parent.children)
parent.children.push(node);
else
parent.children = [node];
node.parent = parent;
} else {
if (root)
throw new Error("multiple roots");
root = node;
}
}
if (!root)
throw new Error("no root");
root.parent = preroot;
root.eachBefore(function(node2) {
node2.depth = node2.parent.depth + 1;
--n3;
}).eachBefore(computeHeight);
root.parent = null;
if (n3 > 0)
throw new Error("cycle");
return root;
}
stratify.id = function(x6) {
return arguments.length ? (id = required(x6), stratify) : id;
};
stratify.parentId = function(x6) {
return arguments.length ? (parentId = required(x6), stratify) : parentId;
};
return stratify;
}
// node_modules/d3-hierarchy/src/tree.js
function defaultSeparation2(a4, b10) {
return a4.parent === b10.parent ? 1 : 2;
}
function nextLeft(v3) {
var children = v3.children;
return children ? children[0] : v3.t;
}
function nextRight(v3) {
var children = v3.children;
return children ? children[children.length - 1] : v3.t;
}
function moveSubtree(wm, wp, shift) {
var change = shift / (wp.i - wm.i);
wp.c -= change;
wp.s += shift;
wm.c += change;
wp.z += shift;
wp.m += shift;
}
function executeShifts(v3) {
var shift = 0, change = 0, children = v3.children, i4 = children.length, w4;
while (--i4 >= 0) {
w4 = children[i4];
w4.z += shift;
w4.m += shift;
shift += w4.s + (change += w4.c);
}
}
function nextAncestor(vim, v3, ancestor) {
return vim.a.parent === v3.parent ? vim.a : ancestor;
}
function TreeNode(node, i4) {
this._ = node;
this.parent = null;
this.children = null;
this.A = null;
this.a = this;
this.z = 0;
this.m = 0;
this.c = 0;
this.s = 0;
this.t = null;
this.i = i4;
}
TreeNode.prototype = Object.create(Node.prototype);
function treeRoot(root) {
var tree = new TreeNode(root, 0), node, nodes = [tree], child, children, i4, n3;
while (node = nodes.pop()) {
if (children = node._.children) {
node.children = new Array(n3 = children.length);
for (i4 = n3 - 1; i4 >= 0; --i4) {
nodes.push(child = node.children[i4] = new TreeNode(children[i4], i4));
child.parent = node;
}
}
}
(tree.parent = new TreeNode(null, 0)).children = [tree];
return tree;
}
function tree_default2() {
var separation = defaultSeparation2, dx = 1, dy = 1, nodeSize = null;
function tree(root) {
var t4 = treeRoot(root);
t4.eachAfter(firstWalk), t4.parent.m = -t4.z;
t4.eachBefore(secondWalk);
if (nodeSize)
root.eachBefore(sizeNode);
else {
var left2 = root, right2 = root, bottom = root;
root.eachBefore(function(node) {
if (node.x < left2.x)
left2 = node;
if (node.x > right2.x)
right2 = node;
if (node.depth > bottom.depth)
bottom = node;
});
var s4 = left2 === right2 ? 1 : separation(left2, right2) / 2, tx = s4 - left2.x, kx = dx / (right2.x + s4 + tx), ky = dy / (bottom.depth || 1);
root.eachBefore(function(node) {
node.x = (node.x + tx) * kx;
node.y = node.depth * ky;
});
}
return root;
}
function firstWalk(v3) {
var children = v3.children, siblings = v3.parent.children, w4 = v3.i ? siblings[v3.i - 1] : null;
if (children) {
executeShifts(v3);
var midpoint = (children[0].z + children[children.length - 1].z) / 2;
if (w4) {
v3.z = w4.z + separation(v3._, w4._);
v3.m = v3.z - midpoint;
} else {
v3.z = midpoint;
}
} else if (w4) {
v3.z = w4.z + separation(v3._, w4._);
}
v3.parent.A = apportion(v3, w4, v3.parent.A || siblings[0]);
}
function secondWalk(v3) {
v3._.x = v3.z + v3.parent.m;
v3.m += v3.parent.m;
}
function apportion(v3, w4, ancestor) {
if (w4) {
var vip = v3, vop = v3, vim = w4, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift;
while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {
vom = nextLeft(vom);
vop = nextRight(vop);
vop.a = v3;
shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);
if (shift > 0) {
moveSubtree(nextAncestor(vim, v3, ancestor), v3, shift);
sip += shift;
sop += shift;
}
sim += vim.m;
sip += vip.m;
som += vom.m;
sop += vop.m;
}
if (vim && !nextRight(vop)) {
vop.t = vim;
vop.m += sim - sop;
}
if (vip && !nextLeft(vom)) {
vom.t = vip;
vom.m += sip - som;
ancestor = v3;
}
}
return ancestor;
}
function sizeNode(node) {
node.x *= dx;
node.y = node.depth * dy;
}
tree.separation = function(x6) {
return arguments.length ? (separation = x6, tree) : separation;
};
tree.size = function(x6) {
return arguments.length ? (nodeSize = false, dx = +x6[0], dy = +x6[1], tree) : nodeSize ? null : [dx, dy];
};
tree.nodeSize = function(x6) {
return arguments.length ? (nodeSize = true, dx = +x6[0], dy = +x6[1], tree) : nodeSize ? [dx, dy] : null;
};
return tree;
}
// node_modules/d3-hierarchy/src/treemap/slice.js
function slice_default(parent, x0, y0, x1, y1) {
var nodes = parent.children, node, i4 = -1, n3 = nodes.length, k4 = parent.value && (y1 - y0) / parent.value;
while (++i4 < n3) {
node = nodes[i4], node.x0 = x0, node.x1 = x1;
node.y0 = y0, node.y1 = y0 += node.value * k4;
}
}
// node_modules/d3-hierarchy/src/treemap/squarify.js
var phi = (1 + Math.sqrt(5)) / 2;
function squarifyRatio(ratio, parent, x0, y0, x1, y1) {
var rows = [], nodes = parent.children, row, nodeValue, i0 = 0, i1 = 0, n3 = nodes.length, dx, dy, value2 = parent.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta;
while (i0 < n3) {
dx = x1 - x0, dy = y1 - y0;
do
sumValue = nodes[i1++].value;
while (!sumValue && i1 < n3);
minValue = maxValue = sumValue;
alpha = Math.max(dy / dx, dx / dy) / (value2 * ratio);
beta = sumValue * sumValue * alpha;
minRatio = Math.max(maxValue / beta, beta / minValue);
for (; i1 < n3; ++i1) {
sumValue += nodeValue = nodes[i1].value;
if (nodeValue < minValue)
minValue = nodeValue;
if (nodeValue > maxValue)
maxValue = nodeValue;
beta = sumValue * sumValue * alpha;
newRatio = Math.max(maxValue / beta, beta / minValue);
if (newRatio > minRatio) {
sumValue -= nodeValue;
break;
}
minRatio = newRatio;
}
rows.push(row = { value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1) });
if (row.dice)
dice_default(row, x0, y0, x1, value2 ? y0 += dy * sumValue / value2 : y1);
else
slice_default(row, x0, y0, value2 ? x0 += dx * sumValue / value2 : x1, y1);
value2 -= sumValue, i0 = i1;
}
return rows;
}
var squarify_default = function custom10(ratio) {
function squarify(parent, x0, y0, x1, y1) {
squarifyRatio(ratio, parent, x0, y0, x1, y1);
}
squarify.ratio = function(x6) {
return custom10((x6 = +x6) > 1 ? x6 : 1);
};
return squarify;
}(phi);
// node_modules/d3-hierarchy/src/treemap/index.js
function treemap_default() {
var tile = squarify_default, round5 = false, dx = 1, dy = 1, paddingStack = [0], paddingInner = constantZero, paddingTop = constantZero, paddingRight = constantZero, paddingBottom = constantZero, paddingLeft = constantZero;
function treemap2(root) {
root.x0 = root.y0 = 0;
root.x1 = dx;
root.y1 = dy;
root.eachBefore(positionNode);
paddingStack = [0];
if (round5)
root.eachBefore(round_default);
return root;
}
function positionNode(node) {
var p4 = paddingStack[node.depth], x0 = node.x0 + p4, y0 = node.y0 + p4, x1 = node.x1 - p4, y1 = node.y1 - p4;
if (x1 < x0)
x0 = x1 = (x0 + x1) / 2;
if (y1 < y0)
y0 = y1 = (y0 + y1) / 2;
node.x0 = x0;
node.y0 = y0;
node.x1 = x1;
node.y1 = y1;
if (node.children) {
p4 = paddingStack[node.depth + 1] = paddingInner(node) / 2;
x0 += paddingLeft(node) - p4;
y0 += paddingTop(node) - p4;
x1 -= paddingRight(node) - p4;
y1 -= paddingBottom(node) - p4;
if (x1 < x0)
x0 = x1 = (x0 + x1) / 2;
if (y1 < y0)
y0 = y1 = (y0 + y1) / 2;
tile(node, x0, y0, x1, y1);
}
}
treemap2.round = function(x6) {
return arguments.length ? (round5 = !!x6, treemap2) : round5;
};
treemap2.size = function(x6) {
return arguments.length ? (dx = +x6[0], dy = +x6[1], treemap2) : [dx, dy];
};
treemap2.tile = function(x6) {
return arguments.length ? (tile = required(x6), treemap2) : tile;
};
treemap2.padding = function(x6) {
return arguments.length ? treemap2.paddingInner(x6).paddingOuter(x6) : treemap2.paddingInner();
};
treemap2.paddingInner = function(x6) {
return arguments.length ? (paddingInner = typeof x6 === "function" ? x6 : constant_default2(+x6), treemap2) : paddingInner;
};
treemap2.paddingOuter = function(x6) {
return arguments.length ? treemap2.paddingTop(x6).paddingRight(x6).paddingBottom(x6).paddingLeft(x6) : treemap2.paddingTop();
};
treemap2.paddingTop = function(x6) {
return arguments.length ? (paddingTop = typeof x6 === "function" ? x6 : constant_default2(+x6), treemap2) : paddingTop;
};
treemap2.paddingRight = function(x6) {
return arguments.length ? (paddingRight = typeof x6 === "function" ? x6 : constant_default2(+x6), treemap2) : paddingRight;
};
treemap2.paddingBottom = function(x6) {
return arguments.length ? (paddingBottom = typeof x6 === "function" ? x6 : constant_default2(+x6), treemap2) : paddingBottom;
};
treemap2.paddingLeft = function(x6) {
return arguments.length ? (paddingLeft = typeof x6 === "function" ? x6 : constant_default2(+x6), treemap2) : paddingLeft;
};
return treemap2;
}
// node_modules/d3-hierarchy/src/treemap/binary.js
function binary_default(parent, x0, y0, x1, y1) {
var nodes = parent.children, i4, n3 = nodes.length, sum, sums = new Array(n3 + 1);
for (sums[0] = sum = i4 = 0; i4 < n3; ++i4) {
sums[i4 + 1] = sum += nodes[i4].value;
}
partition3(0, n3, parent.value, x0, y0, x1, y1);
function partition3(i5, j4, value2, x02, y02, x12, y12) {
if (i5 >= j4 - 1) {
var node = nodes[i5];
node.x0 = x02, node.y0 = y02;
node.x1 = x12, node.y1 = y12;
return;
}
var valueOffset = sums[i5], valueTarget = value2 / 2 + valueOffset, k4 = i5 + 1, hi = j4 - 1;
while (k4 < hi) {
var mid2 = k4 + hi >>> 1;
if (sums[mid2] < valueTarget)
k4 = mid2 + 1;
else
hi = mid2;
}
if (valueTarget - sums[k4 - 1] < sums[k4] - valueTarget && i5 + 1 < k4)
--k4;
var valueLeft = sums[k4] - valueOffset, valueRight = value2 - valueLeft;
if (x12 - x02 > y12 - y02) {
var xk = value2 ? (x02 * valueRight + x12 * valueLeft) / value2 : x12;
partition3(i5, k4, valueLeft, x02, y02, xk, y12);
partition3(k4, j4, valueRight, xk, y02, x12, y12);
} else {
var yk = value2 ? (y02 * valueRight + y12 * valueLeft) / value2 : y12;
partition3(i5, k4, valueLeft, x02, y02, x12, yk);
partition3(k4, j4, valueRight, x02, yk, x12, y12);
}
}
}
// node_modules/d3-hierarchy/src/treemap/sliceDice.js
function sliceDice_default(parent, x0, y0, x1, y1) {
(parent.depth & 1 ? slice_default : dice_default)(parent, x0, y0, x1, y1);
}
// node_modules/d3-hierarchy/src/treemap/resquarify.js
var resquarify_default = function custom11(ratio) {
function resquarify(parent, x0, y0, x1, y1) {
if ((rows = parent._squarify) && rows.ratio === ratio) {
var rows, row, nodes, i4, j4 = -1, n3, m4 = rows.length, value2 = parent.value;
while (++j4 < m4) {
row = rows[j4], nodes = row.children;
for (i4 = row.value = 0, n3 = nodes.length; i4 < n3; ++i4)
row.value += nodes[i4].value;
if (row.dice)
dice_default(row, x0, y0, x1, value2 ? y0 += (y1 - y0) * row.value / value2 : y1);
else
slice_default(row, x0, y0, value2 ? x0 += (x1 - x0) * row.value / value2 : x1, y1);
value2 -= row.value;
}
} else {
parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1);
rows.ratio = ratio;
}
}
resquarify.ratio = function(x6) {
return custom11((x6 = +x6) > 1 ? x6 : 1);
};
return resquarify;
}(phi);
// node_modules/@antv/g2plot/esm/utils/hierarchy/partition.js
var DEFAULT_OPTIONS25 = {
field: "value",
size: [1, 1],
round: false,
padding: 0,
sort: function(a4, b10) {
return b10.value - a4.value;
},
as: ["x", "y"],
ignoreParentValue: true
};
function partition(data3, options) {
options = mix({}, DEFAULT_OPTIONS25, options);
var as = options.as;
if (!is_array_default(as) || as.length !== 2) {
throw new TypeError('Invalid as: it must be an array with 2 strings (e.g. [ "x", "y" ])!');
}
var field6;
try {
field6 = getField(options);
} catch (e4) {
console.warn(e4);
}
var partition3 = function(data4) {
return partition_default().size(options.size).round(options.round).padding(options.padding)(hierarchy(data4).sum(function(d3) {
return size(d3.children) ? options.ignoreParentValue ? 0 : d3[field6] - reduce_default(d3.children, function(a4, b10) {
return a4 + b10[field6];
}, 0) : d3[field6];
}).sort(options.sort));
};
var root = partition3(data3);
var x6 = as[0];
var y5 = as[1];
root.each(function(node) {
var _a6, _b;
node[x6] = [node.x0, node.x1, node.x1, node.x0];
node[y5] = [node.y1, node.y1, node.y0, node.y0];
node.name = node.name || ((_a6 = node.data) === null || _a6 === void 0 ? void 0 : _a6.name) || ((_b = node.data) === null || _b === void 0 ? void 0 : _b.label);
node.data.name = node.name;
["x0", "x1", "y0", "y1"].forEach(function(prop) {
if (as.indexOf(prop) === -1) {
delete node[prop];
}
});
});
return getAllNodes(root);
}
// node_modules/@antv/g2plot/esm/utils/hierarchy/treemap.js
var DEFAULT_OPTIONS26 = {
field: "value",
tile: "treemapSquarify",
size: [1, 1],
round: false,
ignoreParentValue: true,
padding: 0,
paddingInner: 0,
paddingOuter: 0,
paddingTop: 0,
paddingRight: 0,
paddingBottom: 0,
paddingLeft: 0,
as: ["x", "y"],
sort: function(a4, b10) {
return b10.value - a4.value;
},
ratio: 0.5 * (1 + Math.sqrt(5))
};
function getTileMethod(tile, ratio) {
return tile === "treemapSquarify" ? src_exports2[tile].ratio(ratio) : src_exports2[tile];
}
function treemap(data3, options) {
options = mix({}, DEFAULT_OPTIONS26, options);
var as = options.as;
if (!is_array_default(as) || as.length !== 2) {
throw new TypeError('Invalid as: it must be an array with 2 strings (e.g. [ "x", "y" ])!');
}
var field6;
try {
field6 = getField(options);
} catch (e4) {
console.warn(e4);
}
var tileMethod = getTileMethod(options.tile, options.ratio);
var partition3 = function(data4) {
return treemap_default().tile(tileMethod).size(options.size).round(options.round).padding(options.padding).paddingInner(options.paddingInner).paddingOuter(options.paddingOuter).paddingTop(options.paddingTop).paddingRight(options.paddingRight).paddingBottom(options.paddingBottom).paddingLeft(options.paddingLeft)(hierarchy(data4).sum(function(d3) {
return options.ignoreParentValue && d3.children ? 0 : d3[field6];
}).sort(options.sort));
};
var root = partition3(data3);
var x6 = as[0];
var y5 = as[1];
root.each(function(node) {
node[x6] = [node.x0, node.x1, node.x1, node.x0];
node[y5] = [node.y1, node.y1, node.y0, node.y0];
["x0", "x1", "y0", "y1"].forEach(function(prop) {
if (as.indexOf(prop) === -1) {
delete node[prop];
}
});
});
return getAllNodes(root);
}
// node_modules/@antv/g2plot/esm/plots/sunburst/utils.js
function transformData4(options) {
var data3 = options.data, colorField = options.colorField, rawFields = options.rawFields, _a6 = options.hierarchyConfig, hierarchyConfig = _a6 === void 0 ? {} : _a6;
var activeDepth = hierarchyConfig.activeDepth;
var transform18 = {
partition,
treemap
};
var seriesField = options.seriesField;
var type2 = options.type || "partition";
var nodes = transform18[type2](data3, __assign(__assign({ field: seriesField || "value" }, omit_default(hierarchyConfig, ["activeDepth"])), {
type: "hierarchy." + type2,
as: ["x", "y"]
}));
var result = [];
nodes.forEach(function(node) {
var _a7;
var _b, _c, _d, _e, _f;
if (node.depth === 0) {
return null;
}
if (activeDepth > 0 && node.depth > activeDepth) {
return null;
}
var path = node.data.name;
var ancestorNode = __assign({}, node);
while (ancestorNode.depth > 1) {
path = ((_b = ancestorNode.parent.data) === null || _b === void 0 ? void 0 : _b.name) + " / " + path;
ancestorNode = ancestorNode.parent;
}
var nodeInfo = __assign(__assign(__assign({}, pick(node.data, __spreadArrays(rawFields || [], [hierarchyConfig.field]))), (_a7 = {}, _a7[SUNBURST_PATH_FIELD] = path, _a7[SUNBURST_ANCESTOR_FIELD] = ancestorNode.data.name, _a7)), node);
if (seriesField) {
nodeInfo[seriesField] = node.data[seriesField] || ((_d = (_c = node.parent) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d[seriesField]);
}
if (colorField) {
nodeInfo[colorField] = node.data[colorField] || ((_f = (_e = node.parent) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f[colorField]);
}
nodeInfo.ext = hierarchyConfig;
nodeInfo[HIERARCHY_DATA_TRANSFORM_PARAMS] = { hierarchyConfig, colorField, rawFields };
result.push(nodeInfo);
});
return result;
}
// node_modules/@antv/g2plot/esm/plots/sunburst/adaptor.js
function geometry27(params) {
var chart = params.chart, options = params.options;
var color4 = options.color, _a6 = options.colorField, colorField = _a6 === void 0 ? SUNBURST_ANCESTOR_FIELD : _a6, sunburstStyle = options.sunburstStyle, _b = options.rawFields, rawFields = _b === void 0 ? [] : _b;
var data3 = transformData4(options);
chart.data(data3);
var style;
if (sunburstStyle) {
style = function(datum) {
return deepAssign({}, {
fillOpacity: Math.pow(0.85, datum.depth)
}, is_function_default(sunburstStyle) ? sunburstStyle(datum) : sunburstStyle);
};
}
polygon(deepAssign({}, params, {
options: {
xField: "x",
yField: "y",
seriesField: colorField,
rawFields: uniq(__spreadArrays(RAW_FIELDS, rawFields)),
polygon: {
color: color4,
style
}
}
}));
return params;
}
function axis15(params) {
var chart = params.chart;
chart.axis(false);
return params;
}
function label13(params) {
var chart = params.chart, options = params.options;
var label17 = options.label;
var geometry35 = findGeometry(chart, "polygon");
if (!label17) {
geometry35.label(false);
} else {
var _a6 = label17.fields, fields = _a6 === void 0 ? ["name"] : _a6, callback = label17.callback, cfg = __rest(label17, ["fields", "callback"]);
geometry35.label({
fields,
callback,
cfg: transformLabel(cfg)
});
}
return params;
}
function coordinate8(params) {
var chart = params.chart, options = params.options;
var innerRadius = options.innerRadius, radius = options.radius, reflect = options.reflect;
var coord2 = chart.coordinate({
type: "polar",
cfg: {
innerRadius,
radius
}
});
if (reflect) {
coord2.reflect(reflect);
}
return params;
}
function meta17(params) {
var _a6;
var options = params.options;
var hierarchyConfig = options.hierarchyConfig, meta23 = options.meta;
return flow(scale7({}, (_a6 = {}, _a6[SUNBURST_Y_FIELD] = get_default(meta23, get_default(hierarchyConfig, ["field"], "value")), _a6)))(params);
}
function tooltip6(params) {
var chart = params.chart, options = params.options;
var tooltip10 = options.tooltip;
if (tooltip10 === false) {
chart.tooltip(false);
} else {
var tooltipOptions = tooltip10;
if (!get_default(tooltip10, "fields")) {
tooltipOptions = deepAssign({}, {
customItems: function(items) {
return items.map(function(item) {
var scales = get_default(chart.getOptions(), "scales");
var pathFormatter = get_default(scales, [SUNBURST_PATH_FIELD, "formatter"], function(v3) {
return v3;
});
var valueFormatter = get_default(scales, [SUNBURST_Y_FIELD, "formatter"], function(v3) {
return v3;
});
return __assign(__assign({}, item), { name: pathFormatter(item.data[SUNBURST_PATH_FIELD]), value: valueFormatter(item.data.value) });
});
}
}, tooltipOptions);
}
chart.tooltip(tooltipOptions);
}
return params;
}
function adaptorInteraction(options) {
var drilldown = options.drilldown, _a6 = options.interactions, interactions = _a6 === void 0 ? [] : _a6;
if (drilldown === null || drilldown === void 0 ? void 0 : drilldown.enabled) {
return deepAssign({}, options, {
interactions: __spreadArrays(interactions, [
{
type: "drill-down",
cfg: { drillDownConfig: drilldown, transformData: transformData4 }
}
])
});
}
return options;
}
function interaction4(params) {
var chart = params.chart, options = params.options;
var drilldown = options.drilldown;
interaction({
chart,
options: adaptorInteraction(options)
});
if (drilldown === null || drilldown === void 0 ? void 0 : drilldown.enabled) {
chart.appendPadding = getAdjustAppendPadding(chart.appendPadding, get_default(drilldown, ["breadCrumb", "position"]));
}
return params;
}
function adaptor25(params) {
return flow(theme, pattern("sunburstStyle"), geometry27, axis15, meta17, legend, coordinate8, tooltip6, label13, interaction4, animation, annotation())(params);
}
// node_modules/@antv/g2plot/esm/interactions/drill-down.js
function isParentNode(context) {
var data3 = get_default(context, ["event", "data", "data"], {});
return is_array_default(data3.children) && data3.children.length > 0;
}
function inCenter(context) {
var coordinate11 = context.view.getCoordinate();
var innerRadius = coordinate11.innerRadius;
if (innerRadius) {
var _a6 = context.event, x6 = _a6.x, y5 = _a6.y;
var _b = coordinate11.center, centerX = _b.x, centerY = _b.y;
var r4 = coordinate11.getRadius() * innerRadius;
var distance15 = Math.sqrt(Math.pow(centerX - x6, 2) + Math.pow(centerY - y5, 2));
return distance15 < r4;
}
return false;
}
registerAction("drill-down-action", DrillDownAction);
registerInteraction("drill-down", {
showEnable: [
{ trigger: "element:mouseenter", action: "cursor:pointer", isEnable: isParentNode },
{ trigger: "element:mouseleave", action: "cursor:default" },
{ trigger: "element:mouseleave", action: "cursor:pointer", isEnable: inCenter }
],
start: [
{
trigger: "element:click",
isEnable: isParentNode,
action: ["drill-down-action:click"]
},
{
trigger: "afterchangesize",
action: ["drill-down-action:resetPosition"]
},
{
trigger: "click",
isEnable: inCenter,
action: ["drill-down-action:back"]
}
]
});
// node_modules/@antv/g2plot/esm/plots/sunburst/index.js
var Sunburst = function(_super) {
__extends(Sunburst2, _super);
function Sunburst2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "sunburst";
return _this;
}
Sunburst2.getDefaultOptions = function() {
return DEFAULT_OPTIONS24;
};
Sunburst2.prototype.getDefaultOptions = function() {
return Sunburst2.getDefaultOptions();
};
Sunburst2.prototype.getSchemaAdaptor = function() {
return adaptor25;
};
Sunburst2.SUNBURST_ANCESTOR_FIELD = SUNBURST_ANCESTOR_FIELD;
Sunburst2.SUNBURST_PATH_FIELD = SUNBURST_PATH_FIELD;
Sunburst2.NODE_ANCESTORS_FIELD = NODE_ANCESTORS_FIELD;
return Sunburst2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/gauge/constants.js
var _a5;
var RANGE_VALUE = "range";
var RANGE_TYPE = "type";
var PERCENT = "percent";
var DEFAULT_COLOR2 = "#f0f0f0";
var INDICATEOR_VIEW_ID = "indicator-view";
var RANGE_VIEW_ID = "range-view";
var DEFAULT_OPTIONS27 = {
percent: 0,
range: {
ticks: []
},
innerRadius: 0.9,
radius: 0.95,
startAngle: -7 / 6 * Math.PI,
endAngle: 1 / 6 * Math.PI,
syncViewPadding: true,
axis: {
line: null,
label: {
offset: -24,
style: {
textAlign: "center",
textBaseline: "middle"
}
},
subTickLine: {
length: -8
},
tickLine: {
length: -12
},
grid: null
},
indicator: {
pointer: {
style: {
lineWidth: 5,
lineCap: "round"
}
},
pin: {
style: {
r: 9.75,
lineWidth: 4.5,
fill: "#fff"
}
}
},
statistic: {
title: false
},
meta: (_a5 = {}, _a5[RANGE_VALUE] = {
sync: "v"
}, _a5[PERCENT] = {
sync: "v",
tickCount: 5,
tickInterval: 0.2
}, _a5),
animation: false
};
// node_modules/@antv/g2plot/esm/plots/gauge/utils.js
function processRangeData(range, percent2) {
return range.map(function(r4, idx) {
var _a6;
return _a6 = {}, _a6[RANGE_VALUE] = r4 - (range[idx - 1] || 0), _a6[RANGE_TYPE] = "" + idx, _a6[PERCENT] = percent2, _a6;
}).filter(function(d3) {
return !!d3[RANGE_VALUE];
});
}
function getIndicatorData(percent2) {
var _a6;
return [(_a6 = {}, _a6[PERCENT] = clamp_default(percent2, 0, 1), _a6)];
}
function getRangeData(percent2, range) {
var ticks = get_default(range, ["ticks"], []);
var clampTicks = size(ticks) ? ticks : [0, clamp_default(percent2, 0, 1), 1];
return processRangeData(clampTicks, percent2);
}
// node_modules/@antv/g2plot/esm/plots/gauge/adaptor.js
function geometry28(params) {
var chart = params.chart, options = params.options;
var percent2 = options.percent, range = options.range, radius = options.radius, innerRadius = options.innerRadius, startAngle = options.startAngle, endAngle = options.endAngle, axis22 = options.axis, indicator = options.indicator, gaugeStyle = options.gaugeStyle, type2 = options.type, meter = options.meter;
var color4 = range.color, rangeWidth = range.width;
if (indicator) {
var indicatorData = getIndicatorData(percent2);
var v1 = chart.createView({ id: INDICATEOR_VIEW_ID });
v1.data(indicatorData);
v1.point().position(PERCENT + "*1").shape(indicator.shape || "gauge-indicator").customInfo({
defaultColor: chart.getTheme().defaultColor,
indicator
});
v1.coordinate("polar", {
startAngle,
endAngle,
radius: innerRadius * radius
});
v1.axis(PERCENT, axis22);
v1.scale(PERCENT, pick(axis22, AXIS_META_CONFIG_KEYS));
}
var rangeData = getRangeData(percent2, options.range);
var v22 = chart.createView({ id: RANGE_VIEW_ID });
v22.data(rangeData);
var rangeColor = is_string_default(color4) ? [color4, DEFAULT_COLOR2] : color4;
var ext = interval2({
chart: v22,
options: {
xField: "1",
yField: RANGE_VALUE,
seriesField: RANGE_TYPE,
rawFields: [PERCENT],
isStack: true,
interval: {
color: rangeColor,
style: gaugeStyle,
shape: type2 === "meter" ? "meter-gauge" : null
},
args: {
zIndexReversed: true,
sortZIndex: true
},
minColumnWidth: rangeWidth,
maxColumnWidth: rangeWidth
}
}).ext;
var geometry35 = ext.geometry;
geometry35.customInfo({ meter });
v22.coordinate("polar", {
innerRadius,
radius,
startAngle,
endAngle
}).transpose();
return params;
}
function meta18(params) {
var _a6;
return flow(scale7((_a6 = {
range: {
min: 0,
max: 1,
maxLimit: 1,
minLimit: 0
}
}, _a6[PERCENT] = {}, _a6)))(params);
}
function statistic3(params, updated) {
var chart = params.chart, options = params.options;
var statistic4 = options.statistic, percent2 = options.percent;
chart.getController("annotation").clear(true);
if (statistic4) {
var contentOption = statistic4.content;
var transformContent = void 0;
if (contentOption) {
transformContent = deepAssign({}, {
content: (percent2 * 100).toFixed(2) + "%",
style: {
opacity: 0.75,
fontSize: "30px",
lineHeight: 1,
textAlign: "center",
color: "rgba(44,53,66,0.85)"
}
}, contentOption);
}
renderGaugeStatistic(chart, { statistic: __assign(__assign({}, statistic4), { content: transformContent }) }, { percent: percent2 });
}
if (updated) {
chart.render(true);
}
return params;
}
function other(params) {
var chart = params.chart;
chart.legend(false);
chart.tooltip(false);
return params;
}
function adaptor26(params) {
return flow(theme, animation, geometry28, meta18, statistic3, interaction, annotation(), other)(params);
}
// node_modules/@antv/g2plot/esm/plots/gauge/shapes/indicator.js
registerShape("point", "gauge-indicator", {
draw: function(cfg, container2) {
var _a6 = cfg.customInfo, indicator = _a6.indicator, defaultColor = _a6.defaultColor;
var _b = indicator, pointer = _b.pointer, pin2 = _b.pin;
var group2 = container2.addGroup();
var center2 = this.parsePoint({ x: 0, y: 0 });
if (pointer) {
group2.addShape("line", {
name: "pointer",
attrs: __assign({ x1: center2.x, y1: center2.y, x2: cfg.x, y2: cfg.y, stroke: defaultColor }, pointer.style)
});
}
if (pin2) {
group2.addShape("circle", {
name: "pin",
attrs: __assign({ x: center2.x, y: center2.y, stroke: defaultColor }, pin2.style)
});
}
return group2;
}
});
// node_modules/@antv/g2plot/esm/plots/gauge/shapes/meter-gauge.js
registerShape("interval", "meter-gauge", {
draw: function(cfg, container2) {
var _a6 = cfg.customInfo.meter, meter = _a6 === void 0 ? {} : _a6;
var _b = meter.steps, STEP = _b === void 0 ? 50 : _b, _c = meter.stepRatio, STEP_RATIO = _c === void 0 ? 0.5 : _c;
STEP = STEP < 1 ? 1 : STEP;
STEP_RATIO = clamp_default(STEP_RATIO, 0, 1);
var _d = this.coordinate, COORD_START_ANGLE = _d.startAngle, COORD_END_ANGLE = _d.endAngle;
var GAP2 = 0;
if (STEP_RATIO > 0 && STEP_RATIO < 1) {
var TOTAL = COORD_END_ANGLE - COORD_START_ANGLE;
GAP2 = TOTAL / STEP / (STEP_RATIO / (1 - STEP_RATIO) + 1 - 1 / STEP);
}
var INTERVAL = GAP2 / (1 - STEP_RATIO) * STEP_RATIO;
var group2 = container2.addGroup();
var center2 = this.coordinate.getCenter();
var radius = this.coordinate.getRadius();
var _e = Util.getAngle(cfg, this.coordinate), START_ANGLE = _e.startAngle, END_ANGLE = _e.endAngle;
for (var startAngle = START_ANGLE; startAngle < END_ANGLE; ) {
var endAngle = void 0;
var r4 = (startAngle - COORD_START_ANGLE) % (INTERVAL + GAP2);
if (r4 < INTERVAL) {
endAngle = startAngle + (INTERVAL - r4);
} else {
startAngle += INTERVAL + GAP2 - r4;
endAngle = startAngle + INTERVAL;
}
var path = Util.getSectorPath(center2.x, center2.y, radius, startAngle, Math.min(endAngle, END_ANGLE), radius * this.coordinate.innerRadius);
group2.addShape("path", {
name: "meter-gauge",
attrs: {
path,
fill: cfg.color,
stroke: cfg.color,
lineWidth: 0.5
}
});
startAngle = endAngle + GAP2;
}
return group2;
}
});
// node_modules/@antv/g2plot/esm/plots/gauge/index.js
var Gauge = function(_super) {
__extends(Gauge2, _super);
function Gauge2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "gauge";
return _this;
}
Gauge2.getDefaultOptions = function() {
return DEFAULT_OPTIONS27;
};
Gauge2.prototype.changeData = function(percent2) {
this.chart.emit(VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, event_default.fromData(this.chart, VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, null));
this.updateOption({ percent: percent2 });
var indicatorView = this.chart.views.find(function(v3) {
return v3.id === INDICATEOR_VIEW_ID;
});
if (indicatorView) {
indicatorView.data(getIndicatorData(percent2));
}
var rangeView = this.chart.views.find(function(v3) {
return v3.id === RANGE_VIEW_ID;
});
if (rangeView) {
rangeView.data(getRangeData(percent2, this.options.range));
}
statistic3({ chart: this.chart, options: this.options }, true);
this.chart.emit(VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA, event_default.fromData(this.chart, VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA, null));
};
Gauge2.prototype.getDefaultOptions = function() {
return Gauge2.getDefaultOptions();
};
Gauge2.prototype.getSchemaAdaptor = function() {
return adaptor26;
};
return Gauge2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/waterfall/constant.js
var Y_FIELD3 = "$$yField$$";
var DIFF_FIELD = "$$diffField$$";
var ABSOLUTE_FIELD = "$$absoluteField$$";
var IS_TOTAL = "$$isTotal$$";
var DEFAULT_OPTIONS28 = {
label: {},
leaderLine: {
style: {
lineWidth: 1,
stroke: "#8c8c8c",
lineDash: [4, 2]
}
},
total: {
style: {
fill: "rgba(0, 0, 0, 0.25)"
}
},
interactions: [{ type: "element-active" }],
risingFill: "#f4664a",
fallingFill: "#30bf78",
waterfallStyle: {
fill: "rgba(0, 0, 0, 0.25)"
},
yAxis: {
grid: {
line: {
style: {
lineDash: [4, 2]
}
}
}
}
};
// node_modules/@antv/g2plot/esm/plots/waterfall/utils.js
function processData(data3, xField, yField, newYField, total) {
var _a6;
var newData = [];
reduce_default(data3, function(r4, d3) {
var _a7;
log2(LEVEL.WARN, is_number_default(d3[yField]), d3[yField] + " is not a valid number");
var value2 = is_undefined_default(d3[yField]) ? null : d3[yField];
newData.push(__assign(__assign({}, d3), (_a7 = {}, _a7[newYField] = [r4, r4 + value2], _a7)));
return r4 + value2;
}, 0);
if (newData.length && total) {
var sum = get_default(newData, [[data3.length - 1], newYField, [1]]);
newData.push((_a6 = {}, _a6[xField] = total.label, _a6[yField] = sum, _a6[newYField] = [0, sum], _a6));
}
return newData;
}
function transformData5(data3, xField, yField, total) {
var processed = processData(data3, xField, yField, Y_FIELD3, total);
return processed.map(function(d3, dIdx) {
var _a6;
if (!is_object_default(d3)) {
return d3;
}
return __assign(__assign({}, d3), (_a6 = {}, _a6[ABSOLUTE_FIELD] = d3[Y_FIELD3][1], _a6[DIFF_FIELD] = d3[Y_FIELD3][1] - d3[Y_FIELD3][0], _a6[IS_TOTAL] = dIdx === data3.length, _a6));
});
}
// node_modules/@antv/g2plot/esm/plots/waterfall/shape.js
function getRectPath2(points) {
var path = [];
for (var i4 = 0; i4 < points.length; i4++) {
var point2 = points[i4];
if (point2) {
var action = i4 === 0 ? "M" : "L";
path.push([action, point2.x, point2.y]);
}
}
var first = points[0];
path.push(["L", first.x, first.y]);
path.push(["z"]);
return path;
}
function getFillAttrs3(cfg) {
return deepAssign({}, cfg.defaultStyle, cfg.style, { fill: cfg.color });
}
registerShape("interval", "waterfall", {
draw: function(cfg, container2) {
var customInfo = cfg.customInfo, points = cfg.points, nextPoints = cfg.nextPoints;
var group2 = container2.addGroup();
var rectPath3 = this.parsePath(getRectPath2(points));
var fillAttrs = getFillAttrs3(cfg);
group2.addShape("path", {
attrs: __assign(__assign({}, fillAttrs), { path: rectPath3 })
});
var leaderLineCfg = get_default(customInfo, "leaderLine");
if (leaderLineCfg && nextPoints) {
var linkPath = [
["M", points[2].x, points[2].y],
["L", nextPoints[0].x, nextPoints[0].y]
];
if (points[2].y === nextPoints[1].y) {
linkPath[1] = ["L", nextPoints[1].x, nextPoints[1].y];
}
linkPath = this.parsePath(linkPath);
group2.addShape("path", {
attrs: __assign({ path: linkPath }, leaderLineCfg.style || {})
});
}
return group2;
}
});
// node_modules/@antv/g2plot/esm/plots/waterfall/adaptor.js
function defaultOptions4(params) {
var _a6 = params.options, locale = _a6.locale, total = _a6.total;
var localeTotalLabel = getLocale(locale).get(["waterfall", "total"]);
if (total && typeof total.label !== "string" && localeTotalLabel) {
params.options.total.label = localeTotalLabel;
}
return params;
}
function geometry29(params) {
var chart = params.chart, options = params.options;
var data3 = options.data, xField = options.xField, yField = options.yField, total = options.total, leaderLine = options.leaderLine, columnWidthRatio = options.columnWidthRatio, waterfallStyle = options.waterfallStyle, risingFill = options.risingFill, fallingFill = options.fallingFill, color4 = options.color;
chart.data(transformData5(data3, xField, yField, total));
var colorMapping = color4 || function(datum) {
if (get_default(datum, [IS_TOTAL])) {
return get_default(total, ["style", "fill"], "");
}
return get_default(datum, [Y_FIELD3, 1]) - get_default(datum, [Y_FIELD3, 0]) > 0 ? risingFill : fallingFill;
};
var p4 = deepAssign({}, params, {
options: {
xField,
yField: Y_FIELD3,
seriesField: xField,
rawFields: [yField, DIFF_FIELD, IS_TOTAL, Y_FIELD3],
widthRatio: columnWidthRatio,
interval: {
style: waterfallStyle,
shape: "waterfall",
color: colorMapping
}
}
});
var ext = interval2(p4).ext;
var geometry35 = ext.geometry;
geometry35.customInfo({ leaderLine });
return params;
}
function meta19(params) {
var _a6, _b;
var options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField, meta23 = options.meta;
var Y_FIELD_META = deepAssign({}, { alias: yField }, get_default(meta23, yField));
return flow(scale7((_a6 = {}, _a6[xField] = xAxis, _a6[yField] = yAxis, _a6[Y_FIELD3] = yAxis, _a6), deepAssign({}, meta23, (_b = {}, _b[Y_FIELD3] = Y_FIELD_META, _b[DIFF_FIELD] = Y_FIELD_META, _b[ABSOLUTE_FIELD] = Y_FIELD_META, _b))))(params);
}
function axis16(params) {
var chart = params.chart, options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField;
if (xAxis === false) {
chart.axis(xField, false);
} else {
chart.axis(xField, xAxis);
}
if (yAxis === false) {
chart.axis(yField, false);
chart.axis(Y_FIELD3, false);
} else {
chart.axis(yField, yAxis);
chart.axis(Y_FIELD3, yAxis);
}
return params;
}
function legend16(params) {
var chart = params.chart, options = params.options;
var legend18 = options.legend, total = options.total, risingFill = options.risingFill, fallingFill = options.fallingFill, locale = options.locale;
var i18n = getLocale(locale);
if (legend18 === false) {
chart.legend(false);
} else {
var items = [
{
name: i18n.get(["general", "increase"]),
value: "increase",
marker: { symbol: "square", style: { r: 5, fill: risingFill } }
},
{
name: i18n.get(["general", "decrease"]),
value: "decrease",
marker: { symbol: "square", style: { r: 5, fill: fallingFill } }
}
];
if (total) {
items.push({
name: total.label || "",
value: "total",
marker: {
symbol: "square",
style: deepAssign({}, { r: 5 }, get_default(total, "style"))
}
});
}
chart.legend(deepAssign({}, {
custom: true,
position: "top",
items
}, legend18));
chart.removeInteraction("legend-filter");
}
return params;
}
function label14(params) {
var chart = params.chart, options = params.options;
var label17 = options.label, labelMode = options.labelMode, xField = options.xField;
var geometry35 = findGeometry(chart, "interval");
if (!label17) {
geometry35.label(false);
} else {
var callback = label17.callback, cfg = __rest(label17, ["callback"]);
geometry35.label({
fields: labelMode === "absolute" ? [ABSOLUTE_FIELD, xField] : [DIFF_FIELD, xField],
callback,
cfg: transformLabel(cfg)
});
}
return params;
}
function tooltip7(params) {
var chart = params.chart, options = params.options;
var tooltip10 = options.tooltip, xField = options.xField, yField = options.yField;
if (tooltip10 !== false) {
chart.tooltip(__assign({
showCrosshairs: false,
showMarkers: false,
shared: true,
fields: [yField]
}, tooltip10));
var geometry_1 = chart.geometries[0];
(tooltip10 === null || tooltip10 === void 0 ? void 0 : tooltip10.formatter) ? geometry_1.tooltip(xField + "*" + yField, tooltip10.formatter) : geometry_1.tooltip(yField);
} else {
chart.tooltip(false);
}
return params;
}
function adaptor27(params) {
return flow(defaultOptions4, theme, geometry29, meta19, axis16, legend16, tooltip7, label14, state, interaction, animation, annotation())(params);
}
// node_modules/@antv/g2plot/esm/plots/waterfall/index.js
var Waterfall = function(_super) {
__extends(Waterfall2, _super);
function Waterfall2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "waterfall";
return _this;
}
Waterfall2.getDefaultOptions = function() {
return DEFAULT_OPTIONS28;
};
Waterfall2.prototype.changeData = function(data3) {
var _a6 = this.options, xField = _a6.xField, yField = _a6.yField, total = _a6.total;
this.updateOption({ data: data3 });
this.chart.changeData(transformData5(data3, xField, yField, total));
};
Waterfall2.prototype.getSchemaAdaptor = function() {
return adaptor27;
};
Waterfall2.prototype.getDefaultOptions = function() {
return Waterfall2.getDefaultOptions();
};
return Waterfall2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/radial-bar/utils.js
function getScaleMax(maxAngle, yField, data3) {
var yData = data3.map(function(item) {
return item[yField];
}).filter(function(v3) {
return v3 !== void 0;
});
var maxValue = yData.length > 0 ? Math.max.apply(Math, yData) : 0;
var formatRadian = Math.abs(maxAngle) % 360;
if (!formatRadian) {
return maxValue;
}
return maxValue * 360 / formatRadian;
}
function getStackedData(data3, xField, yField) {
var stackedData = [];
data3.forEach(function(item) {
var valueItem = stackedData.find(function(v3) {
return v3[xField] === item[xField];
});
if (valueItem) {
valueItem[yField] += item[yField] || null;
} else {
stackedData.push(__assign({}, item));
}
});
return stackedData;
}
// node_modules/@antv/g2plot/esm/plots/radial-bar/adaptor.js
function geometry30(params) {
var chart = params.chart, options = params.options;
var style = options.barStyle, color4 = options.color, tooltip10 = options.tooltip, colorField = options.colorField, type2 = options.type, xField = options.xField, yField = options.yField, data3 = options.data;
var processData2 = processIllegalData(data3, yField);
chart.data(processData2);
var p4 = deepAssign({}, params, {
options: {
tooltip: tooltip10,
seriesField: colorField,
interval: {
style,
color: color4,
shape: type2 === "line" ? "line" : "intervel"
},
minColumnWidth: options.minBarWidth,
maxColumnWidth: options.maxBarWidth,
columnBackground: options.barBackground
}
});
interval2(p4);
if (type2 === "line") {
point({
chart,
options: { xField, yField, seriesField: colorField, point: { shape: "circle", color: color4 } }
});
}
return params;
}
function meta20(params) {
var _a6;
var options = params.options;
var yField = options.yField, xField = options.xField, data3 = options.data, isStack = options.isStack, isGroup = options.isGroup, colorField = options.colorField, maxAngle = options.maxAngle;
var actualData = isStack && !isGroup && colorField ? getStackedData(data3, xField, yField) : data3;
var processData2 = processIllegalData(actualData, yField);
return flow(scale7((_a6 = {}, _a6[yField] = {
min: 0,
max: getScaleMax(maxAngle, yField, processData2)
}, _a6)))(params);
}
function coordinate9(params) {
var chart = params.chart, options = params.options;
var radius = options.radius, innerRadius = options.innerRadius, startAngle = options.startAngle, endAngle = options.endAngle;
chart.coordinate({
type: "polar",
cfg: {
radius,
innerRadius,
startAngle,
endAngle
}
}).transpose();
return params;
}
function axis17(params) {
var chart = params.chart, options = params.options;
var xField = options.xField, xAxis = options.xAxis;
chart.axis(xField, xAxis);
return params;
}
function label15(params) {
var chart = params.chart, options = params.options;
var label17 = options.label, yField = options.yField;
var intervalGeometry = findGeometry(chart, "interval");
if (!label17) {
intervalGeometry.label(false);
} else {
var callback = label17.callback, cfg = __rest(label17, ["callback"]);
intervalGeometry.label({
fields: [yField],
callback,
cfg: __assign(__assign({}, transformLabel(cfg)), { type: "polar" })
});
}
return params;
}
function adaptor28(params) {
return flow(pattern("barStyle"), geometry30, meta20, axis17, coordinate9, interaction, animation, theme, tooltip, legend, annotation(), label15)(params);
}
// node_modules/@antv/g2plot/esm/plots/radial-bar/constant.js
var DEFAULT_OPTIONS29 = deepAssign({}, Plot.getDefaultOptions(), {
interactions: [{ type: "element-active" }],
legend: false,
tooltip: {
showMarkers: false
},
xAxis: {
grid: null,
tickLine: null,
line: null
},
maxAngle: 240
});
// node_modules/@antv/g2plot/esm/plots/radial-bar/index.js
var RadialBar = function(_super) {
__extends(RadialBar2, _super);
function RadialBar2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "radial-bar";
return _this;
}
RadialBar2.getDefaultOptions = function() {
return DEFAULT_OPTIONS29;
};
RadialBar2.prototype.changeData = function(data3) {
this.updateOption({ data: data3 });
meta20({ chart: this.chart, options: this.options });
this.chart.changeData(data3);
};
RadialBar2.prototype.getDefaultOptions = function() {
return RadialBar2.getDefaultOptions();
};
RadialBar2.prototype.getSchemaAdaptor = function() {
return adaptor28;
};
return RadialBar2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/bidirectional-bar/constant.js
var FIRST_AXES_VIEW = "first-axes-view";
var SECOND_AXES_VIEW = "second-axes-view";
var SERIES_FIELD_KEY = "series-field-key";
// node_modules/@antv/g2plot/esm/plots/bidirectional-bar/utils.js
function transformData6(xField, yField, seriesField, data3, reverse) {
var hopeData = [];
yField.forEach(function(d3) {
data3.forEach(function(k4) {
var _a7;
var obj = (_a7 = {}, _a7[xField] = k4[xField], _a7[seriesField] = d3, _a7[d3] = k4[d3], _a7);
hopeData.push(obj);
});
});
var groupData = Object.values(group_by_default(hopeData, seriesField));
var _a6 = groupData[0], data1 = _a6 === void 0 ? [] : _a6, _b = groupData[1], data22 = _b === void 0 ? [] : _b;
return reverse ? [data1.reverse(), data22.reverse()] : [data1, data22];
}
function isHorizontal(layout6) {
return layout6 !== "vertical";
}
function syncViewPadding(chart, views, p4) {
var v1 = views[0], v22 = views[1];
var p1 = v1.autoPadding;
var p22 = v22.autoPadding;
var _a6 = chart.__axisPosition, layout6 = _a6.layout, position2 = _a6.position;
if (isHorizontal(layout6) && position2 === "top") {
v1.autoPadding = p4.instance(p1.top, 0, p1.bottom, p1.left);
v22.autoPadding = p4.instance(p22.top, p1.left, p22.bottom, 0);
}
if (isHorizontal(layout6) && position2 === "bottom") {
v1.autoPadding = p4.instance(p1.top, p1.right / 2 + 5, p1.bottom, p1.left);
v22.autoPadding = p4.instance(p22.top, p22.right, p22.bottom, p1.right / 2 + 5);
}
if (!isHorizontal(layout6) && position2 === "bottom") {
var left2 = p1.left >= p22.left ? p1.left : p22.left;
v1.autoPadding = p4.instance(p1.top, p1.right, p1.bottom / 2 + 5, left2);
v22.autoPadding = p4.instance(p1.bottom / 2 + 5, p22.right, p22.bottom, left2);
}
if (!isHorizontal(layout6) && position2 === "top") {
var left2 = p1.left >= p22.left ? p1.left : p22.left;
v1.autoPadding = p4.instance(p1.top, p1.right, 0, left2);
v22.autoPadding = p4.instance(0, p22.right, p1.top, left2);
}
}
// node_modules/@antv/g2plot/esm/plots/bidirectional-bar/adaptor.js
function geometry31(params) {
var chart = params.chart, options = params.options;
var data3 = options.data, xField = options.xField, yField = options.yField, color4 = options.color, barStyle = options.barStyle, widthRatio = options.widthRatio, legend18 = options.legend, layout6 = options.layout;
var groupData = transformData6(xField, yField, SERIES_FIELD_KEY, data3, isHorizontal(layout6));
if (legend18) {
chart.legend(SERIES_FIELD_KEY, legend18);
} else if (legend18 === false) {
chart.legend(false);
}
var firstView;
var secondView;
var firstViewData = groupData[0], secondViewData = groupData[1];
if (isHorizontal(layout6)) {
firstView = chart.createView({
region: {
start: { x: 0, y: 0 },
end: { x: 0.5, y: 1 }
},
id: FIRST_AXES_VIEW
});
firstView.coordinate().transpose().reflect("x");
secondView = chart.createView({
region: {
start: { x: 0.5, y: 0 },
end: { x: 1, y: 1 }
},
id: SECOND_AXES_VIEW
});
secondView.coordinate().transpose();
firstView.data(firstViewData);
secondView.data(secondViewData);
} else {
firstView = chart.createView({
region: {
start: { x: 0, y: 0 },
end: { x: 1, y: 0.5 }
},
id: FIRST_AXES_VIEW
});
secondView = chart.createView({
region: {
start: { x: 0, y: 0.5 },
end: { x: 1, y: 1 }
},
id: SECOND_AXES_VIEW
});
secondView.coordinate().reflect("y");
firstView.data(firstViewData);
secondView.data(secondViewData);
}
var left2 = deepAssign({}, params, {
chart: firstView,
options: {
widthRatio,
xField,
yField: yField[0],
seriesField: SERIES_FIELD_KEY,
interval: {
color: color4,
style: barStyle
}
}
});
interval2(left2);
var right2 = deepAssign({}, params, {
chart: secondView,
options: {
xField,
yField: yField[1],
seriesField: SERIES_FIELD_KEY,
widthRatio,
interval: {
color: color4,
style: barStyle
}
}
});
interval2(right2);
return params;
}
function meta21(params) {
var _a6, _b, _c;
var options = params.options, chart = params.chart;
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField;
var firstView = findViewById(chart, FIRST_AXES_VIEW);
var secondView = findViewById(chart, SECOND_AXES_VIEW);
var aliasMap = {};
keys_default((options === null || options === void 0 ? void 0 : options.meta) || {}).map(function(metaKey) {
if (get_default(options === null || options === void 0 ? void 0 : options.meta, [metaKey, "alias"])) {
aliasMap[metaKey] = options.meta[metaKey].alias;
}
});
chart.scale((_a6 = {}, _a6[SERIES_FIELD_KEY] = {
sync: true,
formatter: function(v3) {
return get_default(aliasMap, v3, v3);
}
}, _a6));
scale7((_b = {}, _b[xField] = xAxis, _b[yField[0]] = yAxis[yField[0]], _b))(deepAssign({}, params, { chart: firstView }));
scale7((_c = {}, _c[xField] = xAxis, _c[yField[1]] = yAxis[yField[1]], _c))(deepAssign({}, params, { chart: secondView }));
return params;
}
function axis18(params) {
var chart = params.chart, options = params.options;
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField, layout6 = options.layout;
var firstView = findViewById(chart, FIRST_AXES_VIEW);
var secondView = findViewById(chart, SECOND_AXES_VIEW);
if ((xAxis === null || xAxis === void 0 ? void 0 : xAxis.position) === "bottom") {
secondView.axis(xField, __assign(__assign({}, xAxis), { label: { formatter: function() {
return "";
} } }));
} else {
secondView.axis(xField, false);
}
if (xAxis === false) {
firstView.axis(xField, false);
} else {
firstView.axis(xField, __assign({
position: isHorizontal(layout6) ? "top" : "bottom"
}, xAxis));
}
if (yAxis === false) {
firstView.axis(yField[0], false);
secondView.axis(yField[1], false);
} else {
firstView.axis(yField[0], yAxis[yField[0]]);
secondView.axis(yField[1], yAxis[yField[1]]);
}
chart.__axisPosition = {
position: firstView.getOptions().axes[xField].position,
layout: layout6
};
return params;
}
function interaction5(params) {
var chart = params.chart;
interaction(deepAssign({}, params, { chart: findViewById(chart, FIRST_AXES_VIEW) }));
interaction(deepAssign({}, params, { chart: findViewById(chart, SECOND_AXES_VIEW) }));
return params;
}
function limitInPlot4(params) {
var chart = params.chart, options = params.options;
var yField = options.yField, yAxis = options.yAxis;
limitInPlot2(deepAssign({}, params, {
chart: findViewById(chart, FIRST_AXES_VIEW),
options: {
yAxis: yAxis[yField[0]]
}
}));
limitInPlot2(deepAssign({}, params, {
chart: findViewById(chart, SECOND_AXES_VIEW),
options: {
yAxis: yAxis[yField[1]]
}
}));
return params;
}
function theme3(params) {
var chart = params.chart;
theme(deepAssign({}, params, { chart: findViewById(chart, FIRST_AXES_VIEW) }));
theme(deepAssign({}, params, { chart: findViewById(chart, SECOND_AXES_VIEW) }));
return params;
}
function animation4(params) {
var chart = params.chart;
animation(deepAssign({}, params, { chart: findViewById(chart, FIRST_AXES_VIEW) }));
animation(deepAssign({}, params, { chart: findViewById(chart, SECOND_AXES_VIEW) }));
return params;
}
function label16(params) {
var _this = this;
var _a6, _b;
var chart = params.chart, options = params.options;
var label17 = options.label, yField = options.yField, layout6 = options.layout;
var firstView = findViewById(chart, FIRST_AXES_VIEW);
var secondView = findViewById(chart, SECOND_AXES_VIEW);
var leftGeometry = findGeometry(firstView, "interval");
var rightGeometry = findGeometry(secondView, "interval");
if (!label17) {
leftGeometry.label(false);
rightGeometry.label(false);
} else {
var callback = label17.callback, cfg_1 = __rest(label17, ["callback"]);
if (!cfg_1.position) {
cfg_1.position = "middle";
}
if (cfg_1.offset === void 0) {
cfg_1.offset = 2;
}
var leftLabelCfg = __assign({}, cfg_1);
if (isHorizontal(layout6)) {
var textAlign = ((_a6 = leftLabelCfg.style) === null || _a6 === void 0 ? void 0 : _a6.textAlign) || (cfg_1.position === "middle" ? "center" : "left");
cfg_1.style = deepAssign({}, cfg_1.style, { textAlign });
var textAlignMap = { left: "right", right: "left", center: "center" };
leftLabelCfg.style = deepAssign({}, leftLabelCfg.style, { textAlign: textAlignMap[textAlign] });
} else {
var positionMap_1 = { top: "bottom", bottom: "top", middle: "middle" };
if (typeof cfg_1.position === "string") {
cfg_1.position = positionMap_1[cfg_1.position];
} else if (typeof cfg_1.position === "function") {
cfg_1.position = function() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return positionMap_1[cfg_1.position.apply(_this, args)];
};
}
var textBaseline = ((_b = leftLabelCfg.style) === null || _b === void 0 ? void 0 : _b.textBaseline) || "bottom";
leftLabelCfg.style = deepAssign({}, leftLabelCfg.style, { textBaseline });
var textBaselineMap = { top: "bottom", bottom: "top", middle: "middle" };
cfg_1.style = deepAssign({}, cfg_1.style, { textBaseline: textBaselineMap[textBaseline] });
}
leftGeometry.label({
fields: [yField[0]],
callback,
cfg: transformLabel(leftLabelCfg)
});
rightGeometry.label({
fields: [yField[1]],
callback,
cfg: transformLabel(cfg_1)
});
}
return params;
}
function adaptor29(params) {
return flow(geometry31, meta21, axis18, limitInPlot4, theme3, label16, tooltip, interaction5, animation4)(params);
}
// node_modules/@antv/g2plot/esm/plots/bidirectional-bar/index.js
var BidirectionalBar = function(_super) {
__extends(BidirectionalBar2, _super);
function BidirectionalBar2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "bidirectional-bar";
return _this;
}
BidirectionalBar2.getDefaultOptions = function() {
return deepAssign({}, _super.getDefaultOptions.call(this), {
syncViewPadding
});
};
BidirectionalBar2.prototype.changeData = function(data3) {
if (data3 === void 0) {
data3 = [];
}
this.chart.emit(VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, event_default.fromData(this.chart, VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, null));
this.updateOption({ data: data3 });
var _a6 = this.options, xField = _a6.xField, yField = _a6.yField, layout6 = _a6.layout;
var groupData = transformData6(xField, yField, SERIES_FIELD_KEY, data3, isHorizontal(layout6));
var firstViewData = groupData[0], secondViewData = groupData[1];
var firstView = findViewById(this.chart, FIRST_AXES_VIEW);
var secondView = findViewById(this.chart, SECOND_AXES_VIEW);
firstView.data(firstViewData);
secondView.data(secondViewData);
this.chart.render(true);
this.chart.emit(VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA, event_default.fromData(this.chart, VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA, null));
};
BidirectionalBar2.prototype.getDefaultOptions = function() {
return BidirectionalBar2.getDefaultOptions();
};
BidirectionalBar2.prototype.getSchemaAdaptor = function() {
return adaptor29;
};
BidirectionalBar2.SERIES_FIELD_KEY = SERIES_FIELD_KEY;
return BidirectionalBar2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/treemap/utils.js
function findInteraction(interactions, interactionType) {
if (!is_array_default(interactions))
return void 0;
return interactions.find(function(i4) {
return i4.type === interactionType;
});
}
function enableInteraction(interactions, interactionType) {
var interaction8 = findInteraction(interactions, interactionType);
return interaction8 && interaction8.enable !== false;
}
function enableDrillInteraction(options) {
var interactions = options.interactions, drilldown = options.drilldown;
return get_default(drilldown, "enabled") || enableInteraction(interactions, "treemap-drill-down");
}
function resetDrillDown(chart) {
var drillDownInteraction = chart.interactions["drill-down"];
if (!drillDownInteraction)
return;
var drillDownAction = drillDownInteraction.context.actions.find(function(i4) {
return i4.name === "drill-down-action";
});
drillDownAction.reset();
}
function transformData7(options) {
var data3 = options.data, colorField = options.colorField, enableDrillDown = options.enableDrillDown, hierarchyConfig = options.hierarchyConfig;
var nodes = treemap(data3, __assign(__assign({}, hierarchyConfig), {
type: "hierarchy.treemap",
field: "value",
as: ["x", "y"]
}));
var result = [];
nodes.forEach(function(node) {
if (node.depth === 0) {
return null;
}
if (enableDrillDown && node.depth !== 1) {
return null;
}
if (!enableDrillDown && node.children) {
return null;
}
var curPath = node.ancestors().map(function(n3) {
return {
data: n3.data,
height: n3.height,
value: n3.value
};
});
var path = enableDrillDown && is_array_default(data3.path) ? curPath.concat(data3.path.slice(1)) : curPath;
var nodeInfo = Object.assign({}, node.data, __assign({ x: node.x, y: node.y, depth: node.depth, value: node.value, path }, node));
if (!node.data[colorField] && node.parent) {
var ancestorNode = node.ancestors().find(function(n3) {
return n3.data[colorField];
});
nodeInfo[colorField] = ancestorNode === null || ancestorNode === void 0 ? void 0 : ancestorNode.data[colorField];
} else {
nodeInfo[colorField] = node.data[colorField];
}
nodeInfo[HIERARCHY_DATA_TRANSFORM_PARAMS] = { hierarchyConfig, colorField, enableDrillDown };
result.push(nodeInfo);
});
return result;
}
// node_modules/@antv/g2plot/esm/plots/treemap/adaptor.js
function defaultOptions5(params) {
var options = params.options;
var colorField = options.colorField;
return deepAssign({
options: {
rawFields: ["value"],
tooltip: {
fields: ["name", "value", colorField, "path"],
formatter: function(data3) {
return {
name: data3.name,
value: data3.value
};
}
}
}
}, params);
}
function geometry32(params) {
var chart = params.chart, options = params.options;
var color4 = options.color, colorField = options.colorField, rectStyle = options.rectStyle, hierarchyConfig = options.hierarchyConfig, rawFields = options.rawFields;
var data3 = transformData7({
data: options.data,
colorField: options.colorField,
enableDrillDown: enableDrillInteraction(options),
hierarchyConfig
});
chart.data(data3);
polygon(deepAssign({}, params, {
options: {
xField: "x",
yField: "y",
seriesField: colorField,
rawFields,
polygon: {
color: color4,
style: rectStyle
}
}
}));
chart.coordinate().reflect("y");
return params;
}
function axis19(params) {
var chart = params.chart;
chart.axis(false);
return params;
}
function adaptorInteraction2(options) {
var drilldown = options.drilldown, _a6 = options.interactions, interactions = _a6 === void 0 ? [] : _a6;
var enableDrillDown = enableDrillInteraction(options);
if (enableDrillDown) {
return deepAssign({}, options, {
interactions: __spreadArrays(interactions, [
{
type: "drill-down",
cfg: { drillDownConfig: drilldown, transformData: transformData7 }
}
])
});
}
return options;
}
function interaction6(params) {
var chart = params.chart, options = params.options;
var interactions = options.interactions, drilldown = options.drilldown;
interaction({
chart,
options: adaptorInteraction2(options)
});
var viewZoomInteraction = findInteraction(interactions, "view-zoom");
if (viewZoomInteraction) {
if (viewZoomInteraction.enable !== false) {
chart.getCanvas().on("mousewheel", function(ev) {
ev.preventDefault();
});
} else {
chart.getCanvas().off("mousewheel");
}
}
var enableDrillDown = enableDrillInteraction(options);
if (enableDrillDown) {
chart.appendPadding = getAdjustAppendPadding(chart.appendPadding, get_default(drilldown, ["breadCrumb", "position"]));
}
return params;
}
function adaptor30(params) {
return flow(defaultOptions5, theme, pattern("rectStyle"), geometry32, axis19, legend, tooltip, interaction6, animation, annotation())(params);
}
// node_modules/@antv/g2plot/esm/plots/treemap/constant.js
var DEFAULT_OPTIONS30 = {
colorField: "name",
rectStyle: {
lineWidth: 1,
stroke: "#fff"
},
hierarchyConfig: {
tile: "treemapSquarify"
},
label: {
fields: ["name"],
layout: {
type: "limit-in-shape"
}
},
tooltip: {
showMarkers: false,
showTitle: false
},
drilldown: {
enabled: false,
breadCrumb: {
position: "bottom-left",
rootText: "\u521D\u59CB",
dividerText: "/",
textStyle: {
fontSize: 12,
fill: "rgba(0, 0, 0, 0.65)",
cursor: "pointer"
},
activeTextStyle: {
fill: "#87B5FF"
}
}
}
};
// node_modules/@antv/g2plot/esm/plots/treemap/index.js
var Treemap = function(_super) {
__extends(Treemap2, _super);
function Treemap2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "treemap";
return _this;
}
Treemap2.getDefaultOptions = function() {
return DEFAULT_OPTIONS30;
};
Treemap2.prototype.changeData = function(data3) {
var _a6 = this.options, colorField = _a6.colorField, interactions = _a6.interactions, hierarchyConfig = _a6.hierarchyConfig;
this.updateOption({ data: data3 });
var transData = transformData7({
data: data3,
colorField,
enableDrillDown: enableInteraction(interactions, "treemap-drill-down"),
hierarchyConfig
});
this.chart.changeData(transData);
resetDrillDown(this.chart);
};
Treemap2.prototype.getDefaultOptions = function() {
return Treemap2.getDefaultOptions();
};
Treemap2.prototype.getSchemaAdaptor = function() {
return adaptor30;
};
return Treemap2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/sankey/sankey/align.js
function targetDepth(d3) {
return d3.target.depth;
}
function left(node) {
return node.depth;
}
function right(node, n3) {
return n3 - 1 - node.height;
}
function justify(node, n3) {
return node.sourceLinks.length ? node.depth : n3 - 1;
}
function center(node) {
return node.targetLinks.length ? node.depth : node.sourceLinks.length ? min_by_default(node.sourceLinks, targetDepth) - 1 : 0;
}
// node_modules/@antv/g2plot/esm/plots/sankey/sankey/helper.js
function constant(x6) {
return function() {
return x6;
};
}
function sumBy(arr, func) {
var r4 = 0;
for (var i4 = 0; i4 < arr.length; i4++) {
r4 += func(arr[i4]);
}
return r4;
}
function maxValueBy(arr, func) {
var r4 = -Infinity;
for (var i4 = 0; i4 < arr.length; i4++) {
r4 = Math.max(func(arr[i4]), r4);
}
return r4;
}
function minValueBy(arr, func) {
var r4 = Infinity;
for (var i4 = 0; i4 < arr.length; i4++) {
r4 = Math.min(func(arr[i4]), r4);
}
return r4;
}
// node_modules/@antv/g2plot/esm/plots/sankey/sankey/sankey.js
function ascendingSourceBreadth(a4, b10) {
return ascendingBreadth(a4.source, b10.source) || a4.index - b10.index;
}
function ascendingTargetBreadth(a4, b10) {
return ascendingBreadth(a4.target, b10.target) || a4.index - b10.index;
}
function ascendingBreadth(a4, b10) {
return a4.y0 - b10.y0;
}
function value(d3) {
return d3.value;
}
function defaultId2(d3) {
return d3.index;
}
function defaultNodes(graph) {
return graph.nodes;
}
function defaultLinks(graph) {
return graph.links;
}
function find2(nodeById, id) {
var node = nodeById.get(id);
if (!node)
throw new Error("missing: " + id);
return node;
}
function computeLinkBreadths(_a6) {
var nodes = _a6.nodes;
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
var node = nodes_1[_i];
var y0 = node.y0;
var y1 = y0;
for (var _b = 0, _c = node.sourceLinks; _b < _c.length; _b++) {
var link = _c[_b];
link.y0 = y0 + link.width / 2;
y0 += link.width;
}
for (var _d = 0, _e = node.targetLinks; _d < _e.length; _d++) {
var link = _e[_d];
link.y1 = y1 + link.width / 2;
y1 += link.width;
}
}
}
function Sankey() {
var x0 = 0, y0 = 0, x1 = 1, y1 = 1;
var dx = 24;
var dy = 8, py;
var id = defaultId2;
var align = justify;
var depth;
var sort2;
var linkSort;
var nodes = defaultNodes;
var links = defaultLinks;
var iterations = 6;
function sankey(arg) {
var graph = {
nodes: nodes(arg),
links: links(arg)
};
computeNodeLinks(graph);
computeNodeValues(graph);
computeNodeDepths(graph);
computeNodeHeights(graph);
computeNodeBreadths(graph);
computeLinkBreadths(graph);
return graph;
}
sankey.update = function(graph) {
computeLinkBreadths(graph);
return graph;
};
sankey.nodeId = function(_8) {
return arguments.length ? (id = typeof _8 === "function" ? _8 : constant(_8), sankey) : id;
};
sankey.nodeAlign = function(_8) {
return arguments.length ? (align = typeof _8 === "function" ? _8 : constant(_8), sankey) : align;
};
sankey.nodeDepth = function(_8) {
return arguments.length ? (depth = typeof _8 === "function" ? _8 : _8, sankey) : depth;
};
sankey.nodeSort = function(_8) {
return arguments.length ? (sort2 = _8, sankey) : sort2;
};
sankey.nodeWidth = function(_8) {
return arguments.length ? (dx = +_8, sankey) : dx;
};
sankey.nodePadding = function(_8) {
return arguments.length ? (dy = py = +_8, sankey) : dy;
};
sankey.nodes = function(_8) {
return arguments.length ? (nodes = typeof _8 === "function" ? _8 : constant(_8), sankey) : nodes;
};
sankey.links = function(_8) {
return arguments.length ? (links = typeof _8 === "function" ? _8 : constant(_8), sankey) : links;
};
sankey.linkSort = function(_8) {
return arguments.length ? (linkSort = _8, sankey) : linkSort;
};
sankey.size = function(_8) {
return arguments.length ? (x0 = y0 = 0, x1 = +_8[0], y1 = +_8[1], sankey) : [x1 - x0, y1 - y0];
};
sankey.extent = function(_8) {
return arguments.length ? (x0 = +_8[0][0], x1 = +_8[1][0], y0 = +_8[0][1], y1 = +_8[1][1], sankey) : [
[x0, y0],
[x1, y1]
];
};
sankey.iterations = function(_8) {
return arguments.length ? (iterations = +_8, sankey) : iterations;
};
function computeNodeLinks(_a6) {
var nodes2 = _a6.nodes, links2 = _a6.links;
nodes2.forEach(function(node, idx) {
node.index = idx;
node.sourceLinks = [];
node.targetLinks = [];
});
var nodeById = new Map(nodes2.map(function(d3) {
return [id(d3), d3];
}));
links2.forEach(function(link, idx) {
link.index = idx;
var source = link.source, target = link.target;
if (typeof source !== "object")
source = link.source = find2(nodeById, source);
if (typeof target !== "object")
target = link.target = find2(nodeById, target);
source.sourceLinks.push(link);
target.targetLinks.push(link);
});
if (linkSort != null) {
for (var _i = 0, nodes_2 = nodes2; _i < nodes_2.length; _i++) {
var _b = nodes_2[_i], sourceLinks = _b.sourceLinks, targetLinks = _b.targetLinks;
sourceLinks.sort(linkSort);
targetLinks.sort(linkSort);
}
}
}
function computeNodeValues(_a6) {
var nodes2 = _a6.nodes;
for (var _i = 0, nodes_3 = nodes2; _i < nodes_3.length; _i++) {
var node = nodes_3[_i];
node.value = node.fixedValue === void 0 ? Math.max(sumBy(node.sourceLinks, value), sumBy(node.targetLinks, value)) : node.fixedValue;
}
}
function computeNodeDepths(_a6) {
var nodes2 = _a6.nodes;
var n3 = nodes2.length;
var current = new Set(nodes2);
var next = new Set();
var x6 = 0;
while (current.size) {
current.forEach(function(node2) {
node2.depth = x6;
for (var _i = 0, _a7 = node2.sourceLinks; _i < _a7.length; _i++) {
var target = _a7[_i].target;
next.add(target);
}
});
if (++x6 > n3)
throw new Error("circular link");
current = next;
next = new Set();
}
if (depth) {
var maxDepth = Math.max(maxValueBy(nodes2, function(d3) {
return d3.depth;
}) + 1, 0);
var node = void 0;
for (var i4 = 0; i4 < nodes2.length; i4++) {
node = nodes2[i4];
node.depth = depth.call(null, node, maxDepth);
}
}
}
function computeNodeHeights(_a6) {
var nodes2 = _a6.nodes;
var n3 = nodes2.length;
var current = new Set(nodes2);
var next = new Set();
var x6 = 0;
while (current.size) {
current.forEach(function(node) {
node.height = x6;
for (var _i = 0, _a7 = node.targetLinks; _i < _a7.length; _i++) {
var source = _a7[_i].source;
next.add(source);
}
});
if (++x6 > n3)
throw new Error("circular link");
current = next;
next = new Set();
}
}
function computeNodeLayers(_a6) {
var nodes2 = _a6.nodes;
var x6 = Math.max(maxValueBy(nodes2, function(d3) {
return d3.depth;
}) + 1, 0);
var kx = (x1 - x0 - dx) / (x6 - 1);
var columns = new Array(x6).fill(0).map(function() {
return [];
});
for (var _i = 0, nodes_4 = nodes2; _i < nodes_4.length; _i++) {
var node = nodes_4[_i];
var i4 = Math.max(0, Math.min(x6 - 1, Math.floor(align.call(null, node, x6))));
node.layer = i4;
node.x0 = x0 + i4 * kx;
node.x1 = node.x0 + dx;
if (columns[i4])
columns[i4].push(node);
else
columns[i4] = [node];
}
if (sort2)
for (var _b = 0, columns_1 = columns; _b < columns_1.length; _b++) {
var column = columns_1[_b];
column.sort(sort2);
}
return columns;
}
function initializeNodeBreadths(columns) {
var ky = minValueBy(columns, function(c5) {
return (y1 - y0 - (c5.length - 1) * py) / sumBy(c5, value);
});
for (var _i = 0, columns_2 = columns; _i < columns_2.length; _i++) {
var nodes_6 = columns_2[_i];
var y5 = y0;
for (var _a6 = 0, nodes_5 = nodes_6; _a6 < nodes_5.length; _a6++) {
var node = nodes_5[_a6];
node.y0 = y5;
node.y1 = y5 + node.value * ky;
y5 = node.y1 + py;
for (var _b = 0, _c = node.sourceLinks; _b < _c.length; _b++) {
var link = _c[_b];
link.width = link.value * ky;
}
}
y5 = (y1 - y5 + py) / (nodes_6.length + 1);
for (var i4 = 0; i4 < nodes_6.length; ++i4) {
var node = nodes_6[i4];
node.y0 += y5 * (i4 + 1);
node.y1 += y5 * (i4 + 1);
}
reorderLinks(nodes_6);
}
}
function computeNodeBreadths(graph) {
var columns = computeNodeLayers(graph);
py = Math.min(dy, (y1 - y0) / (maxValueBy(columns, function(c5) {
return c5.length;
}) - 1));
initializeNodeBreadths(columns);
for (var i4 = 0; i4 < iterations; ++i4) {
var alpha = Math.pow(0.99, i4);
var beta = Math.max(1 - alpha, (i4 + 1) / iterations);
relaxRightToLeft(columns, alpha, beta);
relaxLeftToRight(columns, alpha, beta);
}
}
function relaxLeftToRight(columns, alpha, beta) {
for (var i4 = 1, n3 = columns.length; i4 < n3; ++i4) {
var column = columns[i4];
for (var _i = 0, column_1 = column; _i < column_1.length; _i++) {
var target = column_1[_i];
var y5 = 0;
var w4 = 0;
for (var _a6 = 0, _b = target.targetLinks; _a6 < _b.length; _a6++) {
var _c = _b[_a6], source = _c.source, value_1 = _c.value;
var v3 = value_1 * (target.layer - source.layer);
y5 += targetTop(source, target) * v3;
w4 += v3;
}
if (!(w4 > 0))
continue;
var dy_1 = (y5 / w4 - target.y0) * alpha;
target.y0 += dy_1;
target.y1 += dy_1;
reorderNodeLinks(target);
}
if (sort2 === void 0)
column.sort(ascendingBreadth);
if (column.length)
resolveCollisions(column, beta);
}
}
function relaxRightToLeft(columns, alpha, beta) {
for (var n3 = columns.length, i4 = n3 - 2; i4 >= 0; --i4) {
var column = columns[i4];
for (var _i = 0, column_2 = column; _i < column_2.length; _i++) {
var source = column_2[_i];
var y5 = 0;
var w4 = 0;
for (var _a6 = 0, _b = source.sourceLinks; _a6 < _b.length; _a6++) {
var _c = _b[_a6], target = _c.target, value_2 = _c.value;
var v3 = value_2 * (target.layer - source.layer);
y5 += sourceTop(source, target) * v3;
w4 += v3;
}
if (!(w4 > 0))
continue;
var dy_2 = (y5 / w4 - source.y0) * alpha;
source.y0 += dy_2;
source.y1 += dy_2;
reorderNodeLinks(source);
}
if (sort2 === void 0)
column.sort(ascendingBreadth);
if (column.length)
resolveCollisions(column, beta);
}
}
function resolveCollisions(nodes2, alpha) {
var i4 = nodes2.length >> 1;
var subject = nodes2[i4];
resolveCollisionsBottomToTop(nodes2, subject.y0 - py, i4 - 1, alpha);
resolveCollisionsTopToBottom(nodes2, subject.y1 + py, i4 + 1, alpha);
resolveCollisionsBottomToTop(nodes2, y1, nodes2.length - 1, alpha);
resolveCollisionsTopToBottom(nodes2, y0, 0, alpha);
}
function resolveCollisionsTopToBottom(nodes2, y5, i4, alpha) {
for (; i4 < nodes2.length; ++i4) {
var node = nodes2[i4];
var dy_3 = (y5 - node.y0) * alpha;
if (dy_3 > 1e-6)
node.y0 += dy_3, node.y1 += dy_3;
y5 = node.y1 + py;
}
}
function resolveCollisionsBottomToTop(nodes2, y5, i4, alpha) {
for (; i4 >= 0; --i4) {
var node = nodes2[i4];
var dy_4 = (node.y1 - y5) * alpha;
if (dy_4 > 1e-6)
node.y0 -= dy_4, node.y1 -= dy_4;
y5 = node.y0 - py;
}
}
function reorderNodeLinks(_a6) {
var sourceLinks = _a6.sourceLinks, targetLinks = _a6.targetLinks;
if (linkSort === void 0) {
for (var _i = 0, targetLinks_1 = targetLinks; _i < targetLinks_1.length; _i++) {
var sourceLinks_2 = targetLinks_1[_i].source.sourceLinks;
sourceLinks_2.sort(ascendingTargetBreadth);
}
for (var _b = 0, sourceLinks_1 = sourceLinks; _b < sourceLinks_1.length; _b++) {
var targetLinks_2 = sourceLinks_1[_b].target.targetLinks;
targetLinks_2.sort(ascendingSourceBreadth);
}
}
}
function reorderLinks(nodes2) {
if (linkSort === void 0) {
for (var _i = 0, nodes_7 = nodes2; _i < nodes_7.length; _i++) {
var _a6 = nodes_7[_i], sourceLinks = _a6.sourceLinks, targetLinks = _a6.targetLinks;
sourceLinks.sort(ascendingTargetBreadth);
targetLinks.sort(ascendingSourceBreadth);
}
}
}
function targetTop(source, target) {
var y5 = source.y0 - (source.sourceLinks.length - 1) * py / 2;
for (var _i = 0, _a6 = source.sourceLinks; _i < _a6.length; _i++) {
var _b = _a6[_i], node = _b.target, width2 = _b.width;
if (node === target)
break;
y5 += width2 + py;
}
for (var _c = 0, _d = target.targetLinks; _c < _d.length; _c++) {
var _e = _d[_c], node = _e.source, width2 = _e.width;
if (node === source)
break;
y5 -= width2;
}
return y5;
}
function sourceTop(source, target) {
var y5 = target.y0 - (target.targetLinks.length - 1) * py / 2;
for (var _i = 0, _a6 = target.targetLinks; _i < _a6.length; _i++) {
var _b = _a6[_i], node = _b.source, width2 = _b.width;
if (node === source)
break;
y5 += width2 + py;
}
for (var _c = 0, _d = source.sourceLinks; _c < _d.length; _c++) {
var _e = _d[_c], node = _e.target, width2 = _e.width;
if (node === target)
break;
y5 -= width2;
}
return y5;
}
return sankey;
}
// node_modules/@antv/g2plot/esm/plots/sankey/layout.js
var ALIGN_METHOD = {
left,
right,
center,
justify
};
var DEFAULT_OPTIONS31 = {
nodeId: function(node) {
return node.index;
},
nodeAlign: "justify",
nodeWidth: 8e-3,
nodePadding: 0.03,
nodeSort: void 0
};
function getNodeAlignFunction(nodeAlign) {
var func = is_string_default(nodeAlign) ? ALIGN_METHOD[nodeAlign] : is_function_default(nodeAlign) ? nodeAlign : null;
return func || justify;
}
function getDefaultOptions(sankeyLayoutOptions) {
return mix({}, DEFAULT_OPTIONS31, sankeyLayoutOptions);
}
function sankeyLayout(sankeyLayoutOptions, data3) {
var options = getDefaultOptions(sankeyLayoutOptions);
var nodeId = options.nodeId, nodeSort = options.nodeSort, nodeAlign = options.nodeAlign, nodeWidth = options.nodeWidth, nodePadding = options.nodePadding, nodeDepth = options.nodeDepth;
var sankeyProcessor = Sankey().nodeSort(nodeSort).nodeWidth(nodeWidth).nodePadding(nodePadding).nodeDepth(nodeDepth).nodeAlign(getNodeAlignFunction(nodeAlign)).extent([
[0, 0],
[1, 1]
]).nodeId(nodeId);
var layoutData = sankeyProcessor(data3);
layoutData.nodes.forEach(function(node) {
var x0 = node.x0, x1 = node.x1, y0 = node.y0, y1 = node.y1;
node.x = [x0, x1, x1, x0];
node.y = [y0, y0, y1, y1];
});
layoutData.links.forEach(function(edge2) {
var source = edge2.source, target = edge2.target;
var sx = source.x1;
var tx = target.x0;
edge2.x = [sx, sx, tx, tx];
var offset = edge2.width / 2;
edge2.y = [edge2.y0 + offset, edge2.y0 - offset, edge2.y1 + offset, edge2.y1 - offset];
});
return layoutData;
}
// node_modules/@antv/g2plot/esm/plots/sankey/circle.js
function getNodes(edges, sourceField, targetField) {
var nodes = [];
edges.forEach(function(e4) {
var source = e4[sourceField];
var target = e4[targetField];
if (!nodes.includes(source)) {
nodes.push(source);
}
if (!nodes.includes(target)) {
nodes.push(target);
}
});
return nodes;
}
function getMatrix(edges, nodes, sourceField, targetField) {
var graphMatrix = {};
nodes.forEach(function(pre) {
graphMatrix[pre] = {};
nodes.forEach(function(next) {
graphMatrix[pre][next] = 0;
});
});
edges.forEach(function(edge2) {
graphMatrix[edge2[sourceField]][edge2[targetField]] = 1;
});
return graphMatrix;
}
function cutoffCircle(edges, sourceField, targetField) {
if (!is_array_default(edges))
return [];
var removedData = [];
var nodes = getNodes(edges, sourceField, targetField);
var graphMatrix = getMatrix(edges, nodes, sourceField, targetField);
var visited = {};
nodes.forEach(function(node) {
visited[node] = 0;
});
function DFS(dfsNode) {
visited[dfsNode] = 1;
nodes.forEach(function(node) {
if (graphMatrix[dfsNode][node] != 0) {
if (visited[node] == 1) {
removedData.push(dfsNode + "_" + node);
} else if (visited[node] == -1) {
return;
} else {
DFS(node);
}
}
});
visited[dfsNode] = -1;
}
nodes.forEach(function(node) {
if (visited[node] == -1) {
return;
}
DFS(node);
});
if (removedData.length !== 0) {
console.warn("sankey data contains circle, " + removedData.length + " records removed.", removedData);
}
return edges.filter(function(edge2) {
return removedData.findIndex(function(i4) {
return i4 === edge2[sourceField] + "_" + edge2[targetField];
}) < 0;
});
}
// node_modules/@antv/g2plot/esm/plots/sankey/helper.js
function isNodeLink(dataType) {
return dataType === "node-link";
}
function getNodeWidthRatio(nodeWidth, nodeWidthRatio, width2) {
return isRealNumber(nodeWidth) ? nodeWidth / width2 : nodeWidthRatio;
}
function getNodePaddingRatio(nodePadding, nodePaddingRatio, height) {
return isRealNumber(nodePadding) ? nodePadding / height : nodePaddingRatio;
}
function transformToViewsData(options, width2, height) {
var dataType = options.dataType, data3 = options.data, sourceField = options.sourceField, targetField = options.targetField, weightField = options.weightField, nodeAlign = options.nodeAlign, nodeSort = options.nodeSort, nodePadding = options.nodePadding, nodePaddingRatio = options.nodePaddingRatio, nodeWidth = options.nodeWidth, nodeWidthRatio = options.nodeWidthRatio, nodeDepth = options.nodeDepth, _a6 = options.rawFields, rawFields = _a6 === void 0 ? [] : _a6;
var sankeyLayoutInputData;
if (!isNodeLink(dataType)) {
sankeyLayoutInputData = transformDataToNodeLinkData(cutoffCircle(data3, sourceField, targetField), sourceField, targetField, weightField, rawFields);
} else {
sankeyLayoutInputData = data3;
}
var _b = sankeyLayout({
nodeAlign,
nodePadding: getNodePaddingRatio(nodePadding, nodePaddingRatio, height),
nodeWidth: getNodeWidthRatio(nodeWidth, nodeWidthRatio, width2),
nodeSort,
nodeDepth
}, sankeyLayoutInputData), nodes = _b.nodes, links = _b.links;
return {
nodes: nodes.map(function(node) {
return __assign(__assign({}, pick(node, __spreadArrays(["x", "y", "name"], rawFields))), { isNode: true });
}),
edges: links.map(function(link) {
return __assign(__assign({ source: link.source.name, target: link.target.name, name: link.source.name || link.target.name }, pick(link, __spreadArrays(["x", "y", "value"], rawFields))), { isNode: false });
})
};
}
// node_modules/@antv/g2plot/esm/plots/sankey/constant.js
var X_FIELD3 = "x";
var Y_FIELD4 = "y";
var COLOR_FIELD = "name";
var NODES_VIEW_ID = "nodes";
var EDGES_VIEW_ID = "edges";
// node_modules/@antv/g2plot/esm/plots/sankey/adaptor.js
function defaultOptions6(params) {
var options = params.options;
var _a6 = options.rawFields, rawFields = _a6 === void 0 ? [] : _a6;
return deepAssign({}, {
options: {
tooltip: {
fields: uniq(__spreadArrays(["name", "source", "target", "value", "isNode"], rawFields))
},
label: {
fields: uniq(__spreadArrays(["x", "name"], rawFields))
}
}
}, params);
}
function geometry33(params) {
var chart = params.chart, options = params.options;
var color4 = options.color, nodeStyle = options.nodeStyle, edgeStyle = options.edgeStyle, label17 = options.label, tooltip10 = options.tooltip, nodeState = options.nodeState, edgeState = options.edgeState;
chart.legend(false);
chart.tooltip(tooltip10);
chart.axis(false);
chart.coordinate().reflect("y");
var _a6 = transformToViewsData(options, chart.width, chart.height), nodes = _a6.nodes, edges = _a6.edges;
var edgeView = chart.createView({ id: EDGES_VIEW_ID });
edgeView.data(edges);
edge({
chart: edgeView,
options: {
xField: X_FIELD3,
yField: Y_FIELD4,
seriesField: COLOR_FIELD,
edge: {
color: color4,
style: edgeStyle,
shape: "arc"
},
tooltip: tooltip10,
state: edgeState
}
});
var nodeView = chart.createView({ id: NODES_VIEW_ID });
nodeView.data(nodes);
polygon({
chart: nodeView,
options: {
xField: X_FIELD3,
yField: Y_FIELD4,
seriesField: COLOR_FIELD,
polygon: {
color: color4,
style: nodeStyle
},
label: label17,
tooltip: tooltip10,
state: nodeState
}
});
chart.interaction("element-active");
chart.scale({
x: { sync: true, nice: true, min: 0, max: 1, minLimit: 0, maxLimit: 1 },
y: { sync: true, nice: true, min: 0, max: 1, minLimit: 0, maxLimit: 1 },
name: { sync: "color", type: "cat" }
});
return params;
}
function animation5(params) {
var chart = params.chart, options = params.options;
var animation7 = options.animation;
if (typeof animation7 === "boolean") {
chart.animate(animation7);
} else {
chart.animate(true);
}
var geometries = __spreadArrays(chart.views[0].geometries, chart.views[1].geometries);
geometries.forEach(function(g4) {
g4.animate(animation7);
});
return params;
}
function nodeDraggable(params) {
var chart = params.chart, options = params.options;
var nodeDraggable2 = options.nodeDraggable;
var DRAG_INTERACTION = "sankey-node-draggable";
if (nodeDraggable2) {
chart.interaction(DRAG_INTERACTION);
} else {
chart.removeInteraction(DRAG_INTERACTION);
}
return params;
}
function adaptor31(params) {
return flow(defaultOptions6, geometry33, interaction, nodeDraggable, animation5, theme)(params);
}
// node_modules/@antv/g2plot/esm/plots/sankey/interactions/actions/node-drag.js
var SankeyNodeDragAction = function(_super) {
__extends(SankeyNodeDragAction2, _super);
function SankeyNodeDragAction2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.isDragging = false;
return _this;
}
SankeyNodeDragAction2.prototype.isNodeElement = function() {
var shape = get_default(this.context, "event.target");
if (shape) {
var element = shape.get("element");
return element && element.getModel().data.isNode;
}
return false;
};
SankeyNodeDragAction2.prototype.getNodeView = function() {
return findViewById(this.context.view, NODES_VIEW_ID);
};
SankeyNodeDragAction2.prototype.getEdgeView = function() {
return findViewById(this.context.view, EDGES_VIEW_ID);
};
SankeyNodeDragAction2.prototype.getCurrentDatumIdx = function(element) {
return this.getNodeView().geometries[0].elements.indexOf(element);
};
SankeyNodeDragAction2.prototype.start = function() {
if (this.isNodeElement()) {
this.prevPoint = {
x: get_default(this.context, "event.x"),
y: get_default(this.context, "event.y")
};
var element = this.context.event.target.get("element");
var idx = this.getCurrentDatumIdx(element);
if (idx === -1) {
return;
}
this.currentElementIdx = idx;
this.context.isDragging = true;
this.isDragging = true;
this.prevNodeAnimateCfg = this.getNodeView().getOptions().animate;
this.prevEdgeAnimateCfg = this.getEdgeView().getOptions().animate;
this.getNodeView().animate(false);
this.getEdgeView().animate(false);
}
};
SankeyNodeDragAction2.prototype.translate = function() {
if (this.isDragging) {
var chart = this.context.view;
var currentPoint = {
x: get_default(this.context, "event.x"),
y: get_default(this.context, "event.y")
};
var x6 = currentPoint.x - this.prevPoint.x;
var y5 = currentPoint.y - this.prevPoint.y;
var nodeView = this.getNodeView();
var element = nodeView.geometries[0].elements[this.currentElementIdx];
if (element && element.getModel()) {
var prevDatum = element.getModel().data;
var data3 = nodeView.getOptions().data;
var coordinate11 = nodeView.getCoordinate();
var datumGap_1 = {
x: x6 / coordinate11.getWidth(),
y: y5 / coordinate11.getHeight()
};
var nextDatum = __assign(__assign({}, prevDatum), { x: prevDatum.x.map(function(x7) {
return x7 += datumGap_1.x;
}), y: prevDatum.y.map(function(y6) {
return y6 += datumGap_1.y;
}) });
var newData = __spreadArrays(data3);
newData[this.currentElementIdx] = nextDatum;
nodeView.data(newData);
var name_1 = prevDatum.name;
var edgeView = this.getEdgeView();
var edgeData = edgeView.getOptions().data;
edgeData.forEach(function(datum) {
if (datum.source === name_1) {
datum.x[0] += datumGap_1.x;
datum.x[1] += datumGap_1.x;
datum.y[0] += datumGap_1.y;
datum.y[1] += datumGap_1.y;
}
if (datum.target === name_1) {
datum.x[2] += datumGap_1.x;
datum.x[3] += datumGap_1.x;
datum.y[2] += datumGap_1.y;
datum.y[3] += datumGap_1.y;
}
});
edgeView.data(edgeData);
this.prevPoint = currentPoint;
chart.render(true);
}
}
};
SankeyNodeDragAction2.prototype.end = function() {
this.isDragging = false;
this.context.isDragging = false;
this.prevPoint = null;
this.currentElementIdx = null;
this.getNodeView().animate(this.prevNodeAnimateCfg);
this.getEdgeView().animate(this.prevEdgeAnimateCfg);
};
return SankeyNodeDragAction2;
}(base_default12);
// node_modules/@antv/g2plot/esm/plots/sankey/interactions/node-draggable.js
registerAction("sankey-node-drag", SankeyNodeDragAction);
registerInteraction("sankey-node-draggable", {
showEnable: [
{ trigger: "polygon:mouseenter", action: "cursor:pointer" },
{ trigger: "polygon:mouseleave", action: "cursor:default" }
],
start: [{ trigger: "polygon:mousedown", action: "sankey-node-drag:start" }],
processing: [
{ trigger: "plot:mousemove", action: "sankey-node-drag:translate" },
{ isEnable: function(context) {
return context.isDragging;
}, trigger: "plot:mousemove", action: "cursor:move" }
],
end: [{ trigger: "plot:mouseup", action: "sankey-node-drag:end" }]
});
// node_modules/@antv/g2plot/esm/plots/sankey/index.js
var Sankey2 = function(_super) {
__extends(Sankey3, _super);
function Sankey3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "sankey";
return _this;
}
Sankey3.getDefaultOptions = function() {
return {
appendPadding: 8,
syncViewPadding: true,
nodeStyle: {
opacity: 1,
fillOpacity: 1,
lineWidth: 1
},
edgeStyle: {
opacity: 0.3,
lineWidth: 0
},
edgeState: {
active: {
style: {
opacity: 0.8,
lineWidth: 0
}
}
},
label: {
formatter: function(_a6) {
var name = _a6.name;
return name;
},
callback: function(x6) {
var isLast = x6[1] === 1;
return {
style: {
fill: "#545454",
textAlign: isLast ? "end" : "start"
},
offsetX: isLast ? -8 : 8
};
},
layout: [
{
type: "hide-overlap"
}
]
},
tooltip: {
showTitle: false,
showMarkers: false,
shared: false,
showContent: function(items) {
return !get_default(items, [0, "data", "isNode"]);
},
formatter: function(datum) {
var source = datum.source, target = datum.target, value2 = datum.value;
return {
name: source + " -> " + target,
value: value2
};
}
},
nodeWidthRatio: 8e-3,
nodePaddingRatio: 0.01,
animation: {
appear: {
animation: "wave-in"
},
enter: {
animation: "wave-in"
}
}
};
};
Sankey3.prototype.changeData = function(data3) {
this.updateOption({ data: data3 });
var _a6 = transformToViewsData(this.options, this.chart.width, this.chart.height), nodes = _a6.nodes, edges = _a6.edges;
var nodesView = findViewById(this.chart, NODES_VIEW_ID);
var edgesView = findViewById(this.chart, EDGES_VIEW_ID);
nodesView.changeData(nodes);
edgesView.changeData(edges);
};
Sankey3.prototype.getSchemaAdaptor = function() {
return adaptor31;
};
Sankey3.prototype.getDefaultOptions = function() {
return Sankey3.getDefaultOptions();
};
return Sankey3;
}(Plot);
// node_modules/@antv/g2plot/esm/utils/transform/chord.js
var DEFAULT_OPTIONS32 = {
y: 0,
nodeWidthRatio: 0.05,
weight: false,
nodePaddingRatio: 0.1,
id: function(node) {
return node.id;
},
source: function(edge2) {
return edge2.source;
},
target: function(edge2) {
return edge2.target;
},
sourceWeight: function(edge2) {
return edge2.value || 1;
},
targetWeight: function(edge2) {
return edge2.value || 1;
},
sortBy: null
};
function processGraph(nodeById, edges, options) {
for_in_default(nodeById, function(node, id) {
node.inEdges = edges.filter(function(edge2) {
return "" + options.target(edge2) === "" + id;
});
node.outEdges = edges.filter(function(edge2) {
return "" + options.source(edge2) === "" + id;
});
node.edges = node.outEdges.concat(node.inEdges);
node.frequency = node.edges.length;
node.value = 0;
node.inEdges.forEach(function(edge2) {
node.value += options.targetWeight(edge2);
});
node.outEdges.forEach(function(edge2) {
node.value += options.sourceWeight(edge2);
});
});
}
function sortNodes(nodes, options) {
var sortMethods = {
weight: function(a4, b10) {
return b10.value - a4.value;
},
frequency: function(a4, b10) {
return b10.frequency - a4.frequency;
},
id: function(a4, b10) {
return ("" + options.id(a4)).localeCompare("" + options.id(b10));
}
};
var method = sortMethods[options.sortBy];
if (!method && is_function_default(options.sortBy)) {
method = options.sortBy;
}
if (method) {
nodes.sort(method);
}
}
function layoutNodes(nodes, options) {
var len5 = nodes.length;
if (!len5) {
throw new TypeError("Invalid nodes: it's empty!");
}
if (options.weight) {
var nodePaddingRatio_1 = options.nodePaddingRatio;
if (nodePaddingRatio_1 < 0 || nodePaddingRatio_1 >= 1) {
throw new TypeError("Invalid nodePaddingRatio: it must be in range [0, 1)!");
}
var margin_1 = nodePaddingRatio_1 / (2 * len5);
var nodeWidthRatio_1 = options.nodeWidthRatio;
if (nodeWidthRatio_1 <= 0 || nodeWidthRatio_1 >= 1) {
throw new TypeError("Invalid nodeWidthRatio: it must be in range (0, 1)!");
}
var totalValue_1 = 0;
nodes.forEach(function(node) {
totalValue_1 += node.value;
});
nodes.forEach(function(node) {
node.weight = node.value / totalValue_1;
node.width = node.weight * (1 - nodePaddingRatio_1);
node.height = nodeWidthRatio_1;
});
nodes.forEach(function(node, index2) {
var deltaX = 0;
for (var i4 = index2 - 1; i4 >= 0; i4--) {
deltaX += nodes[i4].width + 2 * margin_1;
}
var minX = node.minX = margin_1 + deltaX;
var maxX = node.maxX = node.minX + node.width;
var minY = node.minY = options.y - nodeWidthRatio_1 / 2;
var maxY2 = node.maxY = minY + nodeWidthRatio_1;
node.x = [minX, maxX, maxX, minX];
node.y = [minY, minY, maxY2, maxY2];
});
} else {
var deltaX_1 = 1 / len5;
nodes.forEach(function(node, index2) {
node.x = (index2 + 0.5) * deltaX_1;
node.y = options.y;
});
}
return nodes;
}
function locatingEdges(nodeById, edges, options) {
if (options.weight) {
var valueById_1 = {};
for_in_default(nodeById, function(node, id) {
valueById_1[id] = node.value;
});
edges.forEach(function(edge2) {
var sId = options.source(edge2);
var tId = options.target(edge2);
var sNode = nodeById[sId];
var tNode = nodeById[tId];
if (sNode && tNode) {
var sValue = valueById_1[sId];
var currentSValue = options.sourceWeight(edge2);
var sStart = sNode.minX + (sNode.value - sValue) / sNode.value * sNode.width;
var sEnd = sStart + currentSValue / sNode.value * sNode.width;
valueById_1[sId] -= currentSValue;
var tValue = valueById_1[tId];
var currentTValue = options.targetWeight(edge2);
var tStart = tNode.minX + (tNode.value - tValue) / tNode.value * tNode.width;
var tEnd = tStart + currentTValue / tNode.value * tNode.width;
valueById_1[tId] -= currentTValue;
var y5 = options.y;
edge2.x = [sStart, sEnd, tStart, tEnd];
edge2.y = [y5, y5, y5, y5];
edge2.source = sNode;
edge2.target = tNode;
}
});
} else {
edges.forEach(function(edge2) {
var sNode = nodeById[options.source(edge2)];
var tNode = nodeById[options.target(edge2)];
if (sNode && tNode) {
edge2.x = [sNode.x, tNode.x];
edge2.y = [sNode.y, tNode.y];
edge2.source = sNode;
edge2.target = tNode;
}
});
}
return edges;
}
function getDefaultOptions2(options) {
return mix({}, DEFAULT_OPTIONS32, options);
}
function chordLayout(chordLayoutOptions, chordLayoutInputData) {
var options = getDefaultOptions2(chordLayoutOptions);
var nodeById = {};
var nodes = chordLayoutInputData.nodes;
var links = chordLayoutInputData.links;
nodes.forEach(function(node) {
var id = options.id(node);
nodeById[id] = node;
});
processGraph(nodeById, links, options);
sortNodes(nodes, options);
var outputNodes = layoutNodes(nodes, options);
var outputLinks = locatingEdges(nodeById, links, options);
return {
nodes: outputNodes,
links: outputLinks
};
}
// node_modules/@antv/g2plot/esm/plots/chord/constant.js
var X_FIELD4 = "x";
var Y_FIELD5 = "y";
var NODE_COLOR_FIELD = "name";
var EDGE_COLOR_FIELD = "source";
var DEFAULT_OPTIONS33 = {
nodeStyle: {
opacity: 1,
fillOpacity: 1,
lineWidth: 1
},
edgeStyle: {
opacity: 0.5,
lineWidth: 2
},
label: {
fields: ["x", "name"],
callback: function(x6, name) {
var centerX = (x6[0] + x6[1]) / 2;
var offsetX = centerX > 0.5 ? -4 : 4;
return {
labelEmit: true,
style: {
fill: "#8c8c8c"
},
offsetX,
content: name
};
}
},
tooltip: {
showTitle: false,
showMarkers: false,
fields: ["source", "target", "value", "isNode"],
showContent: function(items) {
return !get_default(items, [0, "data", "isNode"]);
},
formatter: function(datum) {
var source = datum.source, target = datum.target, value2 = datum.value;
return {
name: source + " -> " + target,
value: value2
};
}
},
interactions: [
{
type: "element-active"
}
],
weight: true,
nodePaddingRatio: 0.1,
nodeWidthRatio: 0.05
};
// node_modules/@antv/g2plot/esm/plots/chord/adaptor.js
function transformData8(params) {
var options = params.options;
var data3 = options.data, sourceField = options.sourceField, targetField = options.targetField, weightField = options.weightField, nodePaddingRatio = options.nodePaddingRatio, nodeWidthRatio = options.nodeWidthRatio, _a6 = options.rawFields, rawFields = _a6 === void 0 ? [] : _a6;
var chordLayoutInputData = transformDataToNodeLinkData(data3, sourceField, targetField, weightField);
var _b = chordLayout({ weight: true, nodePaddingRatio, nodeWidthRatio }, chordLayoutInputData), nodes = _b.nodes, links = _b.links;
var nodesData = nodes.map(function(node) {
return __assign(__assign({}, pick(node, __spreadArrays(["id", "x", "y", "name"], rawFields))), { isNode: true });
});
var edgesData = links.map(function(link) {
return __assign(__assign({ source: link.source.name, target: link.target.name, name: link.source.name || link.target.name }, pick(link, __spreadArrays(["x", "y", "value"], rawFields))), { isNode: false });
});
return __assign(__assign({}, params), { ext: __assign(__assign({}, params.ext), {
chordData: { nodesData, edgesData }
}) });
}
function scale9(params) {
var _a6;
var chart = params.chart;
chart.scale((_a6 = {
x: { sync: true, nice: true },
y: { sync: true, nice: true, max: 1 }
}, _a6[NODE_COLOR_FIELD] = { sync: "color" }, _a6[EDGE_COLOR_FIELD] = { sync: "color" }, _a6));
return params;
}
function axis20(params) {
var chart = params.chart;
chart.axis(false);
return params;
}
function legend17(params) {
var chart = params.chart;
chart.legend(false);
return params;
}
function tooltip8(params) {
var chart = params.chart, options = params.options;
var tooltip10 = options.tooltip;
chart.tooltip(tooltip10);
return params;
}
function coordinate10(params) {
var chart = params.chart;
chart.coordinate("polar").reflect("y");
return params;
}
function nodeGeometry(params) {
var chart = params.chart, options = params.options;
var nodesData = params.ext.chordData.nodesData;
var nodeStyle = options.nodeStyle, label17 = options.label, tooltip10 = options.tooltip;
var nodeView = chart.createView();
nodeView.data(nodesData);
polygon({
chart: nodeView,
options: {
xField: X_FIELD4,
yField: Y_FIELD5,
seriesField: NODE_COLOR_FIELD,
polygon: {
style: nodeStyle
},
label: label17,
tooltip: tooltip10
}
});
return params;
}
function edgeGeometry(params) {
var chart = params.chart, options = params.options;
var edgesData = params.ext.chordData.edgesData;
var edgeStyle = options.edgeStyle, tooltip10 = options.tooltip;
var edgeView = chart.createView();
edgeView.data(edgesData);
var edgeOptions = {
xField: X_FIELD4,
yField: Y_FIELD5,
seriesField: EDGE_COLOR_FIELD,
edge: {
style: edgeStyle,
shape: "arc"
},
tooltip: tooltip10
};
edge({
chart: edgeView,
options: edgeOptions
});
return params;
}
function animation6(params) {
var chart = params.chart, options = params.options;
var animation7 = options.animation;
if (typeof animation7 === "boolean") {
chart.animate(animation7);
} else {
chart.animate(true);
}
each_default(getAllGeometriesRecursively(chart), function(g4) {
g4.animate(animation7);
});
return params;
}
function adaptor32(params) {
return flow(theme, transformData8, coordinate10, scale9, axis20, legend17, tooltip8, edgeGeometry, nodeGeometry, interaction, state, animation6)(params);
}
// node_modules/@antv/g2plot/esm/plots/chord/index.js
var Chord = function(_super) {
__extends(Chord2, _super);
function Chord2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "chord";
return _this;
}
Chord2.getDefaultOptions = function() {
return DEFAULT_OPTIONS33;
};
Chord2.prototype.getDefaultOptions = function() {
return Chord2.getDefaultOptions();
};
Chord2.prototype.getSchemaAdaptor = function() {
return adaptor32;
};
return Chord2;
}(Plot);
// node_modules/@antv/g2plot/esm/utils/hierarchy/pack.js
var DEFAULT_OPTIONS34 = {
field: "value",
as: ["x", "y", "r"],
sort: function(a4, b10) {
return b10.value - a4.value;
}
};
function pack(data3, options) {
options = mix({}, DEFAULT_OPTIONS34, options);
var as = options.as;
if (!is_array_default(as) || as.length !== 3) {
throw new TypeError('Invalid as: it must be an array with 3 strings (e.g. [ "x", "y", "r" ])!');
}
var field6;
try {
field6 = getField(options);
} catch (e4) {
console.warn(e4);
}
var packLayout = function(data4) {
return pack_default().size(options.size).padding(options.padding)(hierarchy(data4).sum(function(d3) {
return d3[field6];
}).sort(options.sort));
};
var root = packLayout(data3);
var x6 = as[0];
var y5 = as[1];
var r4 = as[2];
root.each(function(node) {
node[x6] = node.x;
node[y5] = node.y;
node[r4] = node.r;
});
return getAllNodes(root);
}
// node_modules/@antv/g2plot/esm/plots/circle-packing/utils.js
function transformData9(options) {
var data3 = options.data, hierarchyConfig = options.hierarchyConfig, _a6 = options.rawFields, rawFields = _a6 === void 0 ? [] : _a6, enableDrillDown = options.enableDrillDown;
var nodes = pack(data3, __assign(__assign({}, hierarchyConfig), { field: "value", as: ["x", "y", "r"] }));
var result = [];
nodes.forEach(function(node) {
var _a7;
var path = node.data.name;
var ancestorNode = __assign({}, node);
while (ancestorNode.depth > 1) {
path = ((_a7 = ancestorNode.parent.data) === null || _a7 === void 0 ? void 0 : _a7.name) + " / " + path;
ancestorNode = ancestorNode.parent;
}
if (enableDrillDown && node.depth > 2) {
return null;
}
var nodeInfo = deepAssign({}, node.data, __assign(__assign(__assign({}, pick(node.data, rawFields)), { path }), node));
nodeInfo.ext = hierarchyConfig;
nodeInfo[HIERARCHY_DATA_TRANSFORM_PARAMS] = { hierarchyConfig, rawFields, enableDrillDown };
result.push(nodeInfo);
});
return result;
}
function resolvePaddingForCircle(padding3, appendPadding, containerSize) {
var tempPadding = resolveAllPadding([padding3, appendPadding]);
var top = tempPadding[0], right2 = tempPadding[1], bottom = tempPadding[2], left2 = tempPadding[3];
var width2 = containerSize.width, height = containerSize.height;
var wSize = width2 - (left2 + right2);
var hSize = height - (top + bottom);
var minSize = Math.min(wSize, hSize);
var restWidthPadding = (wSize - minSize) / 2;
var restHeightPadding = (hSize - minSize) / 2;
var finalTop = top + restHeightPadding;
var finalRight = right2 + restWidthPadding;
var finalBottom = bottom + restHeightPadding;
var finalLeft = left2 + restWidthPadding;
var finalPadding = [finalTop, finalRight, finalBottom, finalLeft];
var finalSize = minSize < 0 ? 0 : minSize;
return { finalPadding, finalSize };
}
// node_modules/@antv/g2plot/esm/plots/circle-packing/constant.js
var RAW_FIELDS2 = ["x", "y", "r", "name", "value", "path", "depth"];
var DEFAULT_OPTIONS35 = {
colorField: "name",
autoFit: true,
pointStyle: {
lineWidth: 0,
stroke: "#fff"
},
legend: false,
hierarchyConfig: {
size: [1, 1],
padding: 0
},
label: {
fields: ["name"],
layout: {
type: "limit-in-shape"
}
},
tooltip: {
showMarkers: false,
showTitle: false
},
drilldown: { enabled: false }
};
// node_modules/@antv/g2plot/esm/plots/circle-packing/adaptor.js
function defaultOptions7(params) {
var chart = params.chart;
var diameter = Math.min(chart.viewBBox.width, chart.viewBBox.height);
return deepAssign({
options: {
size: function(_a6) {
var r4 = _a6.r;
return r4 * diameter;
}
}
}, params);
}
function padding2(params) {
var options = params.options, chart = params.chart;
var containerSize = chart.viewBBox;
var padding3 = options.padding, appendPadding = options.appendPadding, drilldown = options.drilldown;
var tempAppendPadding = appendPadding;
if (drilldown === null || drilldown === void 0 ? void 0 : drilldown.enabled) {
var appendPaddingByDrilldown = getAdjustAppendPadding(chart.appendPadding, get_default(drilldown, ["breadCrumb", "position"]));
tempAppendPadding = resolveAllPadding([appendPaddingByDrilldown, appendPadding]);
}
var finalPadding = resolvePaddingForCircle(padding3, tempAppendPadding, containerSize).finalPadding;
chart.padding = finalPadding;
chart.appendPadding = 0;
return params;
}
function geometry34(params) {
var chart = params.chart, options = params.options;
var padding3 = chart.padding, appendPadding = chart.appendPadding;
var color4 = options.color, colorField = options.colorField, pointStyle = options.pointStyle, hierarchyConfig = options.hierarchyConfig, sizeField = options.sizeField, _a6 = options.rawFields, rawFields = _a6 === void 0 ? [] : _a6, drilldown = options.drilldown;
var data3 = transformData9({
data: options.data,
hierarchyConfig,
enableDrillDown: drilldown === null || drilldown === void 0 ? void 0 : drilldown.enabled,
rawFields
});
chart.data(data3);
var containerSize = chart.viewBBox;
var finalSize = resolvePaddingForCircle(padding3, appendPadding, containerSize).finalSize;
var circleSize = function(_a7) {
var r4 = _a7.r;
return r4 * finalSize;
};
if (sizeField) {
circleSize = function(d3) {
return d3[sizeField] * finalSize;
};
}
point(deepAssign({}, params, {
options: {
xField: "x",
yField: "y",
seriesField: colorField,
sizeField,
rawFields: __spreadArrays(RAW_FIELDS2, rawFields),
point: {
color: color4,
style: pointStyle,
shape: "circle",
size: circleSize
}
}
}));
return params;
}
function meta22(params) {
return flow(scale7({}, {
x: { min: 0, max: 1, minLimit: 0, maxLimit: 1, nice: true },
y: { min: 0, max: 1, minLimit: 0, maxLimit: 1, nice: true }
}))(params);
}
function tooltip9(params) {
var chart = params.chart, options = params.options;
var tooltip10 = options.tooltip;
if (tooltip10 === false) {
chart.tooltip(false);
} else {
var tooltipOptions = tooltip10;
if (!get_default(tooltip10, "fields")) {
tooltipOptions = deepAssign({}, {
customItems: function(items) {
return items.map(function(item) {
var scales = get_default(chart.getOptions(), "scales");
var nameFormatter = get_default(scales, ["name", "formatter"], function(v3) {
return v3;
});
var valueFormatter = get_default(scales, ["value", "formatter"], function(v3) {
return v3;
});
return __assign(__assign({}, item), { name: nameFormatter(item.data.name), value: valueFormatter(item.data.value) });
});
}
}, tooltipOptions);
}
chart.tooltip(tooltipOptions);
}
return params;
}
function axis21(params) {
var chart = params.chart;
chart.axis(false);
return params;
}
function adaptorInteraction3(options) {
var drilldown = options.drilldown, _a6 = options.interactions, interactions = _a6 === void 0 ? [] : _a6;
if (drilldown === null || drilldown === void 0 ? void 0 : drilldown.enabled) {
return deepAssign({}, options, {
interactions: __spreadArrays(interactions, [
{
type: "drill-down",
cfg: { drillDownConfig: drilldown, transformData: transformData9, enableDrillDown: true }
}
])
});
}
return options;
}
function interaction7(params) {
var chart = params.chart, options = params.options;
interaction({
chart,
options: adaptorInteraction3(options)
});
return params;
}
function adaptor33(params) {
return flow(pattern("pointStyle"), defaultOptions7, padding2, theme, meta22, geometry34, axis21, legend, tooltip9, interaction7, animation, annotation())(params);
}
// node_modules/@antv/g2plot/esm/plots/circle-packing/index.js
var CirclePacking = function(_super) {
__extends(CirclePacking2, _super);
function CirclePacking2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "circle-packing";
return _this;
}
CirclePacking2.getDefaultOptions = function() {
return DEFAULT_OPTIONS35;
};
CirclePacking2.prototype.getDefaultOptions = function() {
return CirclePacking2.getDefaultOptions();
};
CirclePacking2.prototype.getSchemaAdaptor = function() {
return adaptor33;
};
CirclePacking2.prototype.triggerResize = function() {
if (!this.chart.destroyed) {
this.chart.forceFit();
this.chart.clear();
this.execAdaptor();
this.chart.render(true);
}
};
return CirclePacking2;
}(Plot);
// node_modules/@antv/g2plot/esm/plugin/index.js
var P3 = function(_super) {
__extends(P4, _super);
function P4(container2, options, adaptor36, defaultOptions8) {
var _this = _super.call(this, container2, deepAssign({}, defaultOptions8, options)) || this;
_this.type = "g2-plot";
_this.defaultOptions = defaultOptions8;
_this.adaptor = adaptor36;
return _this;
}
P4.prototype.getDefaultOptions = function() {
return this.defaultOptions;
};
P4.prototype.getSchemaAdaptor = function() {
return this.adaptor;
};
return P4;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/mix/utils.js
var PLOT_ADAPTORS = {
line: adaptor,
pie: adaptor5,
column: adaptor3,
bar: adaptor4,
area: adaptor2,
gauge: adaptor26,
"tiny-line": adaptor12,
"tiny-column": adaptor13,
"tiny-area": adaptor11,
"ring-progress": adaptor16,
progress: adaptor15,
scatter: adaptor8,
histogram: adaptor14,
funnel: adaptor22
};
var PLOT_CONSTRUCTOR = {
line: Line6,
pie: Pie,
column: Column,
bar: Bar,
area: Area2,
gauge: Gauge,
"tiny-line": TinyLine,
"tiny-column": TinyColumn,
"tiny-area": TinyArea,
"ring-progress": RingProgress,
progress: Progress,
scatter: Scatter,
histogram: Histogram,
funnel: Funnel
};
var DEFAULT_OPTIONS_MAP = {
pie: { label: false },
column: { tooltip: { showMarkers: false } },
bar: { tooltip: { showMarkers: false } }
};
function execPlotAdaptor(plot, view, options) {
var cls = PLOT_CONSTRUCTOR[plot];
if (!cls) {
console.error("could not find " + plot + " plot");
return;
}
var module2 = PLOT_ADAPTORS[plot];
module2({
chart: view,
options: deepAssign({}, cls.getDefaultOptions(), get_default(DEFAULT_OPTIONS_MAP, plot, {}), options)
});
}
// node_modules/@antv/g2plot/esm/plots/mix/adaptor.js
function multiView(params) {
var chart = params.chart, options = params.options;
var views = options.views, legend18 = options.legend;
each_default(views, function(v3) {
var region = v3.region, data3 = v3.data, meta23 = v3.meta, axes = v3.axes, coordinate11 = v3.coordinate, interactions = v3.interactions, annotations = v3.annotations, tooltip10 = v3.tooltip, geometries = v3.geometries;
var viewOfG2 = chart.createView({
region
});
viewOfG2.data(data3);
var scales = {};
if (axes) {
each_default(axes, function(axis22, field6) {
scales[field6] = pick(axis22, AXIS_META_CONFIG_KEYS);
});
}
scales = deepAssign({}, meta23, scales);
viewOfG2.scale(scales);
if (!axes) {
viewOfG2.axis(false);
} else {
each_default(axes, function(axis22, field6) {
viewOfG2.axis(field6, axis22);
});
}
viewOfG2.coordinate(coordinate11);
each_default(geometries, function(geometry35) {
var ext = geometry({
chart: viewOfG2,
options: geometry35
}).ext;
var adjust4 = geometry35.adjust;
if (adjust4) {
ext.geometry.adjust(adjust4);
}
});
each_default(interactions, function(interaction8) {
if (interaction8.enable === false) {
viewOfG2.removeInteraction(interaction8.type);
} else {
viewOfG2.interaction(interaction8.type, interaction8.cfg);
}
});
each_default(annotations, function(annotation4) {
viewOfG2.annotation()[annotation4.type](__assign({}, annotation4));
});
if (typeof v3.animation === "boolean") {
viewOfG2.animate(false);
} else {
viewOfG2.animate(true);
each_default(viewOfG2.geometries, function(g4) {
g4.animate(v3.animation);
});
}
if (tooltip10) {
viewOfG2.interaction("tooltip");
viewOfG2.tooltip(tooltip10);
}
});
if (!legend18) {
chart.legend(false);
} else {
each_default(legend18, function(l4, field6) {
chart.legend(field6, l4);
});
}
chart.tooltip(options.tooltip);
return params;
}
function multiPlot(params) {
var chart = params.chart, options = params.options;
var plots = options.plots;
each_default(plots, function(plot) {
var type2 = plot.type, region = plot.region, _a6 = plot.options, options2 = _a6 === void 0 ? {} : _a6;
var tooltip10 = options2.tooltip;
var viewOfG2 = chart.createView(__assign({ region }, pick(options2, PLOT_CONTAINER_OPTIONS)));
if (tooltip10) {
viewOfG2.interaction("tooltip");
}
execPlotAdaptor(type2, viewOfG2, options2);
});
return params;
}
function adaptor34(params) {
return flow(animation, multiView, multiPlot, interaction, animation, theme, tooltip)(params);
}
// node_modules/@antv/g2plot/esm/plots/mix/interactions/utils.js
function getElementValue2(element, field6) {
var model = element.getModel();
var record = model.data;
var value2;
if (is_array_default(record)) {
value2 = record[0][field6];
} else {
value2 = record[field6];
}
return value2;
}
function clearHighlight2(view) {
var elements = getAllElements(view);
each_default(elements, function(el) {
if (el.hasState("active")) {
el.setState("active", false);
}
if (el.hasState("selected")) {
el.setState("selected", false);
}
if (el.hasState("inactive")) {
el.setState("inactive", false);
}
});
}
// node_modules/@antv/g2plot/esm/plots/mix/interactions/association.js
var Association = function(_super) {
__extends(Association2, _super);
function Association2() {
return _super !== null && _super.apply(this, arguments) || this;
}
Association2.prototype.getAssociationItems = function(views, params) {
var _a6;
var event = this.context.event;
var _b = params || {}, linkField = _b.linkField, dim = _b.dim;
var items = [];
if ((_a6 = event.data) === null || _a6 === void 0 ? void 0 : _a6.data) {
var data_1 = event.data.data;
each_default(views, function(v3) {
var _a7, _b2;
var field6 = linkField;
if (dim === "x") {
field6 = v3.getXScale().field;
} else if (dim === "y") {
field6 = (_a7 = v3.getYScales().find(function(s4) {
return s4.field === field6;
})) === null || _a7 === void 0 ? void 0 : _a7.field;
} else if (!field6) {
field6 = (_b2 = v3.getGroupScales()[0]) === null || _b2 === void 0 ? void 0 : _b2.field;
}
if (!field6) {
return;
}
var elements = map_default(getAllElements(v3), function(ele) {
var active = false;
var inactive = false;
var dataValue = is_array_default(data_1) ? get_default(data_1[0], field6) : get_default(data_1, field6);
if (getElementValue2(ele, field6) === dataValue) {
active = true;
} else {
inactive = true;
}
return { element: ele, view: v3, active, inactive };
});
items.push.apply(items, elements);
});
}
return items;
};
Association2.prototype.showTooltip = function(params) {
var siblings = getSiblingViews(this.context.view);
var elements = this.getAssociationItems(siblings, params);
each_default(elements, function(ele) {
if (ele.active) {
var box2 = ele.element.shape.getCanvasBBox();
ele.view.showTooltip({ x: box2.minX + box2.width / 2, y: box2.minY + box2.height / 2 });
}
});
};
Association2.prototype.hideTooltip = function() {
var siblings = getSiblingViews(this.context.view);
each_default(siblings, function(sibling) {
sibling.hideTooltip();
});
};
Association2.prototype.active = function(params) {
var views = getViews(this.context.view);
var items = this.getAssociationItems(views, params);
each_default(items, function(item) {
var active = item.active, element = item.element;
if (active) {
element.setState("active", true);
}
});
};
Association2.prototype.selected = function(params) {
var views = getViews(this.context.view);
var items = this.getAssociationItems(views, params);
each_default(items, function(item) {
var active = item.active, element = item.element;
if (active) {
element.setState("selected", true);
}
});
};
Association2.prototype.highlight = function(params) {
var views = getViews(this.context.view);
var items = this.getAssociationItems(views, params);
each_default(items, function(item) {
var inactive = item.inactive, element = item.element;
if (inactive) {
element.setState("inactive", true);
}
});
};
Association2.prototype.reset = function() {
var views = getViews(this.context.view);
each_default(views, function(v3) {
clearHighlight2(v3);
});
};
return Association2;
}(base_default12);
registerAction("association", Association);
registerInteraction("association-active", {
start: [{ trigger: "element:mouseenter", action: "association:active" }],
end: [{ trigger: "element:mouseleave", action: "association:reset" }]
});
registerInteraction("association-selected", {
start: [{ trigger: "element:mouseenter", action: "association:selected" }],
end: [{ trigger: "element:mouseleave", action: "association:reset" }]
});
registerInteraction("association-highlight", {
start: [{ trigger: "element:mouseenter", action: "association:highlight" }],
end: [{ trigger: "element:mouseleave", action: "association:reset" }]
});
registerInteraction("association-tooltip", {
start: [{ trigger: "element:mousemove", action: "association:showTooltip" }],
end: [{ trigger: "element:mouseleave", action: "association:hideTooltip" }]
});
// node_modules/@antv/g2plot/esm/plots/mix/index.js
var Mix = function(_super) {
__extends(Mix2, _super);
function Mix2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "mix";
return _this;
}
Mix2.prototype.getSchemaAdaptor = function() {
return adaptor34;
};
return Mix2;
}(Plot);
// node_modules/@antv/g2plot/esm/plots/facet/utils.js
function execViewAdaptor(viewOfG2, options) {
var data3 = options.data, coordinate11 = options.coordinate, interactions = options.interactions, annotations = options.annotations, animation7 = options.animation, tooltip10 = options.tooltip, axes = options.axes, meta23 = options.meta, geometries = options.geometries;
if (data3) {
viewOfG2.data(data3);
}
var scales = {};
if (axes) {
each_default(axes, function(axis22, field6) {
scales[field6] = pick(axis22, AXIS_META_CONFIG_KEYS);
});
}
scales = deepAssign({}, meta23, scales);
viewOfG2.scale(scales);
if (coordinate11) {
viewOfG2.coordinate(coordinate11);
}
if (axes === false) {
viewOfG2.axis(false);
} else {
each_default(axes, function(axis22, field6) {
viewOfG2.axis(field6, axis22);
});
}
each_default(geometries, function(geometry35) {
var ext = geometry({
chart: viewOfG2,
options: geometry35
}).ext;
var adjust4 = geometry35.adjust;
if (adjust4) {
ext.geometry.adjust(adjust4);
}
});
each_default(interactions, function(interaction8) {
if (interaction8.enable === false) {
viewOfG2.removeInteraction(interaction8.type);
} else {
viewOfG2.interaction(interaction8.type, interaction8.cfg);
}
});
each_default(annotations, function(annotation4) {
viewOfG2.annotation()[annotation4.type](__assign({}, annotation4));
});
if (typeof animation7 === "boolean") {
viewOfG2.animate(false);
} else {
viewOfG2.animate(true);
each_default(viewOfG2.geometries, function(g4) {
g4.animate(animation7);
});
}
if (tooltip10) {
viewOfG2.interaction("tooltip");
viewOfG2.tooltip(tooltip10);
} else if (tooltip10 === false) {
viewOfG2.removeInteraction("tooltip");
}
}
// node_modules/@antv/g2plot/esm/plots/facet/adaptor.js
function facetAdaptor(params) {
var chart = params.chart, options = params.options;
var facetType = options.type, data3 = options.data, fields = options.fields, eachView = options.eachView;
var restFacetCfg = omit_default(options, [
"type",
"data",
"fields",
"eachView",
"axes",
"meta",
"tooltip",
"coordinate",
"theme",
"legend",
"interactions",
"annotations"
]);
chart.data(data3);
chart.facet(facetType, __assign(__assign({}, restFacetCfg), { fields, eachView: function(viewOfG2, facet) {
var viewOptions = eachView(viewOfG2, facet);
if (viewOptions.geometries) {
execViewAdaptor(viewOfG2, viewOptions);
} else {
var plot = viewOptions;
var plotOptions = plot.options;
if (plotOptions.tooltip) {
viewOfG2.interaction("tooltip");
}
execPlotAdaptor(plot.type, viewOfG2, plotOptions);
}
} }));
return params;
}
function component(params) {
var chart = params.chart, options = params.options;
var axes = options.axes, meta23 = options.meta, tooltip10 = options.tooltip, coordinate11 = options.coordinate, theme4 = options.theme, legend18 = options.legend, interactions = options.interactions, annotations = options.annotations;
var scales = {};
if (axes) {
each_default(axes, function(axis22, field6) {
scales[field6] = pick(axis22, AXIS_META_CONFIG_KEYS);
});
}
scales = deepAssign({}, meta23, scales);
chart.scale(scales);
chart.coordinate(coordinate11);
if (!axes) {
chart.axis(false);
} else {
each_default(axes, function(axis22, field6) {
chart.axis(field6, axis22);
});
}
if (tooltip10) {
chart.interaction("tooltip");
chart.tooltip(tooltip10);
} else if (tooltip10 === false) {
chart.removeInteraction("tooltip");
}
chart.legend(legend18);
if (theme4) {
chart.theme(theme4);
}
each_default(interactions, function(interaction8) {
if (interaction8.enable === false) {
chart.removeInteraction(interaction8.type);
} else {
chart.interaction(interaction8.type, interaction8.cfg);
}
});
each_default(annotations, function(annotation4) {
chart.annotation()[annotation4.type](__assign({}, annotation4));
});
return params;
}
function adaptor35(params) {
return flow(theme, facetAdaptor, component)(params);
}
// node_modules/@antv/g2plot/esm/plots/facet/constant.js
var DEFAULT_OPTIONS36 = {
title: {
style: {
fontSize: 12,
fill: "rgba(0,0,0,0.65)"
}
},
rowTitle: {
style: {
fontSize: 12,
fill: "rgba(0,0,0,0.65)"
}
},
columnTitle: {
style: {
fontSize: 12,
fill: "rgba(0,0,0,0.65)"
}
}
};
// node_modules/@antv/g2plot/esm/plots/facet/index.js
var Facet2 = function(_super) {
__extends(Facet3, _super);
function Facet3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = "area";
return _this;
}
Facet3.getDefaultOptions = function() {
return DEFAULT_OPTIONS36;
};
Facet3.prototype.getDefaultOptions = function() {
return Facet3.getDefaultOptions();
};
Facet3.prototype.getSchemaAdaptor = function() {
return adaptor35;
};
return Facet3;
}(Plot);
// node_modules/@antv/g2plot/esm/lab.js
var Stage;
(function(Stage2) {
Stage2["DEV"] = "DEV";
Stage2["BETA"] = "BETA";
Stage2["STABLE"] = "STABLE";
})(Stage || (Stage = {}));
function notice(stage, plotType) {
console.warn(stage === Stage.DEV ? "Plot '" + plotType + "' is in DEV stage, just give us issues." : stage === Stage.BETA ? "Plot '" + plotType + "' is in BETA stage, DO NOT use it in production env." : stage === Stage.STABLE ? "Plot '" + plotType + `' is in STABLE stage, import it by "import { ` + plotType + ` } from '@antv/g2plot'".` : "invalid Stage type.");
}
var Lab = function() {
function Lab2() {
}
Object.defineProperty(Lab2, "MultiView", {
get: function() {
notice(Stage.STABLE, "MultiView");
return Mix;
},
enumerable: false,
configurable: true
});
return Lab2;
}();
// node_modules/@antv/g2plot/esm/index.js
registerLocale("en-US", EN_US_LOCALE);
registerLocale("zh-CN", ZH_CN_LOCALE);
var adaptors = { scale: scale7, legend, tooltip, annotation, interaction, theme, animation };
// node_modules/@ant-design/charts/es/util/createNode.js
var createNode = function(children, type2) {
var mountPoint = document.createElement("div");
if (type2 === "tooltip") {
mountPoint.className = "g2-tooltip";
}
compat_module_default.render(children, mountPoint);
return mountPoint;
};
var createNode_default = createNode;
// node_modules/@ant-design/charts/es/util/utils.js
var isType3 = function(value2, type2) {
var toString7 = {}.toString;
return toString7.call(value2) === "[object " + type2 + "]";
};
var clone8 = function(source) {
if (!source) {
return source;
}
var target = {};
for (var k4 in source) {
target[k4] = source[k4];
}
return target;
};
var getType2 = function(n3) {
return Object.prototype.toString.call(n3).slice(8, -1);
};
var deepClone = function(source) {
if (!source) {
return source;
}
var target = new source.constructor();
for (var key in source) {
if (source.hasOwnProperty(key)) {
target[key] = getType2(source[key]) === "Object" || getType2(source[key]) === "Array" ? deepClone(source[key]) : source[key];
}
}
return target;
};
var hasPath = function(source, path) {
var current = source;
for (var i4 = 0; i4 < path.length; i4 += 1) {
if (current === null || current === void 0 ? void 0 : current[path[i4]]) {
current = current[path[i4]];
} else {
current = void 0;
break;
}
}
return current;
};
var setPath = function(source, path, value2) {
if (!source) {
return source;
}
var o3 = source;
path.forEach(function(key, idx) {
if (idx < path.length - 1) {
o3 = o3[key];
} else {
o3[key] = value2;
}
});
return source;
};
// node_modules/@ant-design/charts/es/util/getChart.js
var getChart = function(chartRef, chart) {
if (!chartRef) {
return;
}
if (is_function_default(chartRef)) {
chartRef(chart);
} else {
chartRef.current = chart;
}
};
// node_modules/@ant-design/charts/es/hooks/useChart.js
var __assign4 = function() {
__assign4 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
return t4;
};
return __assign4.apply(this, arguments);
};
var __rest4 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
function useInit(ChartClass, config) {
var chart = s3();
var chartOptions = s3();
var container2 = s3(null);
var onReady = config.onReady, onEvent = config.onEvent, chartRef = config.chartRef;
var toDataURL = function(type2, encoderOptions) {
var _a6;
if (type2 === void 0) {
type2 = "image/png";
}
return (_a6 = chart.current) === null || _a6 === void 0 ? void 0 : _a6.chart.canvas.cfg.el.toDataURL(type2, encoderOptions);
};
var downloadImage = function(name, type2, encoderOptions) {
var _a6;
if (name === void 0) {
name = "download";
}
if (type2 === void 0) {
type2 = "image/png";
}
var imageName = name;
if (name.indexOf(".") === -1) {
imageName = name + "." + type2.split("/")[1];
}
var base64 = (_a6 = chart.current) === null || _a6 === void 0 ? void 0 : _a6.chart.canvas.cfg.el.toDataURL(type2, encoderOptions);
var a4 = document.createElement("a");
a4.href = base64;
a4.download = imageName;
document.body.appendChild(a4);
a4.click();
document.body.removeChild(a4);
a4 = null;
return imageName;
};
var reactDomToString = function(source, path, type2) {
var statisticCustomHtml = hasPath(source, path);
setPath(source, path, function() {
var arg = [];
for (var _i = 0; _i < arguments.length; _i++) {
arg[_i] = arguments[_i];
}
var statisticDom = isType3(statisticCustomHtml, "Function") ? statisticCustomHtml.apply(void 0, arg) : statisticCustomHtml;
if (isType3(statisticDom, "String") || isType3(statisticDom, "Number") || isType3(statisticDom, "HTMLDivElement")) {
return statisticDom;
}
return createNode_default(statisticDom, type2);
});
};
var processConfig = function() {
if (hasPath(config, ["statistic", "content", "customHtml"])) {
reactDomToString(config, ["statistic", "content", "customHtml"]);
}
if (hasPath(config, ["statistic", "title", "customHtml"])) {
reactDomToString(config, ["statistic", "title", "customHtml"]);
}
if (typeof config.tooltip === "object") {
if (hasPath(config, ["tooltip", "container"])) {
reactDomToString(config, ["tooltip", "container"], "tooltip");
}
if (hasPath(config, ["tooltip", "customContent"])) {
reactDomToString(config, ["tooltip", "customContent"], "tooltip");
}
}
};
y2(function() {
if (chart.current && !is_equal_default(chartOptions.current, config)) {
var changeData = false;
if (chartOptions.current) {
var _a6 = chartOptions.current, currentData = _a6.data, currentValue = _a6.value, currentPercent = _a6.percent, currentConfig = __rest4(_a6, ["data", "value", "percent"]);
var inputData = config.data, inputValue = config.value, inputPercent = config.percent, inputConfig = __rest4(config, ["data", "value", "percent"]);
changeData = is_equal_default(currentConfig, inputConfig);
}
if (changeData) {
var changeType_1 = "data";
var typeMaps = ["percent"];
var currentKeys_1 = Object.keys(config);
typeMaps.forEach(function(type2) {
if (currentKeys_1.includes(type2)) {
changeType_1 = type2;
}
});
chart.current.changeData((config === null || config === void 0 ? void 0 : config[changeType_1]) || []);
} else {
processConfig();
chart.current.update(config);
}
chartOptions.current = deepClone(config);
}
}, [config]);
y2(function() {
if (!container2.current) {
return function() {
return null;
};
}
processConfig();
var chartInstance = new ChartClass(container2.current, __assign4({}, config));
ChartClass.prototype.toDataURL = function(type2, encoderOptions) {
return toDataURL(type2, encoderOptions);
};
ChartClass.prototype.downloadImage = function(name, type2, encoderOptions) {
return downloadImage(name, type2, encoderOptions);
};
chartInstance.render();
if (!chartOptions.current) {
chartOptions.current = deepClone(config);
}
chart.current = clone8(chartInstance);
if (onReady) {
onReady(chartInstance);
}
getChart(chartRef, chart.current);
var handler = function(event) {
if (onEvent) {
onEvent(chartInstance, event);
}
};
chartInstance.on("*", handler);
return function() {
if (chart.current) {
chart.current.destroy();
chart.current.off("*", handler);
chart.current = void 0;
}
};
}, []);
return {
chart,
container: container2
};
}
// node_modules/@ant-design/charts/es/errorBoundary/index.js
var __extends4 = function() {
var extendStatics = function(d3, b10) {
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d4, b11) {
d4.__proto__ = b11;
} || function(d4, b11) {
for (var p4 in b11)
if (Object.prototype.hasOwnProperty.call(b11, p4))
d4[p4] = b11[p4];
};
return extendStatics(d3, b10);
};
return function(d3, b10) {
if (typeof b10 !== "function" && b10 !== null)
throw new TypeError("Class extends value " + String(b10) + " is not a constructor or null");
extendStatics(d3, b10);
function __() {
this.constructor = d3;
}
d3.prototype = b10 === null ? Object.create(b10) : (__.prototype = b10.prototype, new __());
};
}();
var ErrorBoundary = function(_super) {
__extends4(ErrorBoundary3, _super);
function ErrorBoundary3() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.state = {
hasError: false
};
_this.renderError = function(e4) {
var errorTemplate = _this.props.errorTemplate;
switch (e4) {
default:
return errorTemplate && typeof errorTemplate === "function" ? errorTemplate(e4) : compat_module_default.createElement("h5", null, "\u7EC4\u4EF6\u51FA\u9519\u4E86\uFF0C\u8BF7\u6838\u67E5\u540E\u91CD\u8BD5\uFF1A ", e4.message);
}
};
return _this;
}
ErrorBoundary3.getDerivedStateFromError = function(error) {
return { hasError: true, error };
};
ErrorBoundary3.getDerivedStateFromProps = function(nextProps, state2) {
if (state2.children !== nextProps.children) {
return {
children: nextProps.children,
hasError: false,
error: void 0
};
}
return null;
};
ErrorBoundary3.prototype.render = function() {
if (this.state.hasError) {
return this.renderError(this.state.error);
}
return compat_module_default.createElement(d, null, this.props.children);
};
return ErrorBoundary3;
}(compat_module_default.Component);
var errorBoundary_default = ErrorBoundary;
// node_modules/react-content-loader/dist/react-content-loader.es.js
var __assign5 = function() {
__assign5 = Object.assign || function __assign30(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
return t4;
};
return __assign5.apply(this, arguments);
};
function __rest5(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
}
var uid = function() {
return Math.random().toString(36).substring(6);
};
var SVG = function(_a6) {
var animate = _a6.animate, backgroundColor = _a6.backgroundColor, backgroundOpacity = _a6.backgroundOpacity, baseUrl = _a6.baseUrl, children = _a6.children, foregroundColor = _a6.foregroundColor, foregroundOpacity = _a6.foregroundOpacity, gradientRatio = _a6.gradientRatio, uniqueKey = _a6.uniqueKey, interval3 = _a6.interval, rtl = _a6.rtl, speed = _a6.speed, style = _a6.style, title = _a6.title, props = __rest5(_a6, ["animate", "backgroundColor", "backgroundOpacity", "baseUrl", "children", "foregroundColor", "foregroundOpacity", "gradientRatio", "uniqueKey", "interval", "rtl", "speed", "style", "title"]);
var fixedId = uniqueKey || uid();
var idClip = fixedId + "-diff";
var idGradient = fixedId + "-animated-diff";
var idAria = fixedId + "-aria";
var rtlStyle = rtl ? { transform: "scaleX(-1)" } : null;
var keyTimes = "0; " + interval3 + "; 1";
var dur = speed + "s";
return v("svg", __assign5({ "aria-labelledby": idAria, role: "img", style: __assign5(__assign5({}, style), rtlStyle) }, props), title ? v("title", { id: idAria }, title) : null, v("rect", { role: "presentation", x: "0", y: "0", width: "100%", height: "100%", clipPath: "url(" + baseUrl + "#" + idClip + ")", style: { fill: "url(" + baseUrl + "#" + idGradient + ")" } }), v("defs", { role: "presentation" }, v("clipPath", { id: idClip }, children), v("linearGradient", { id: idGradient }, v("stop", { offset: "0%", stopColor: backgroundColor, stopOpacity: backgroundOpacity }, animate && v("animate", { attributeName: "offset", values: -gradientRatio + "; " + -gradientRatio + "; 1", keyTimes, dur, repeatCount: "indefinite" })), v("stop", { offset: "50%", stopColor: foregroundColor, stopOpacity: foregroundOpacity }, animate && v("animate", { attributeName: "offset", values: -gradientRatio / 2 + "; " + -gradientRatio / 2 + "; " + (1 + gradientRatio / 2), keyTimes, dur, repeatCount: "indefinite" })), v("stop", { offset: "100%", stopColor: backgroundColor, stopOpacity: backgroundOpacity }, animate && v("animate", { attributeName: "offset", values: "0; 0; " + (1 + gradientRatio), keyTimes, dur, repeatCount: "indefinite" })))));
};
SVG.defaultProps = {
animate: true,
backgroundColor: "#f5f6f7",
backgroundOpacity: 1,
baseUrl: "",
foregroundColor: "#eee",
foregroundOpacity: 1,
gradientRatio: 2,
id: null,
interval: 0.25,
rtl: false,
speed: 1.2,
style: {},
title: "Loading..."
};
var ContentLoader = function(props) {
return props.children ? v(SVG, __assign5({}, props)) : v(ReactContentLoaderFacebook, __assign5({}, props));
};
var ReactContentLoaderFacebook = function(props) {
return v(ContentLoader, __assign5({ viewBox: "0 0 476 124" }, props), v("rect", { x: "48", y: "8", width: "88", height: "6", rx: "3" }), v("rect", { x: "48", y: "26", width: "52", height: "6", rx: "3" }), v("rect", { x: "0", y: "56", width: "410", height: "6", rx: "3" }), v("rect", { x: "0", y: "72", width: "380", height: "6", rx: "3" }), v("rect", { x: "0", y: "88", width: "178", height: "6", rx: "3" }), v("circle", { cx: "20", cy: "20", r: "20" }));
};
var react_content_loader_es_default = ContentLoader;
// node_modules/@ant-design/charts/es/util/createLoading.js
var ChartLoading = function(_a6) {
var loadingTemplate = _a6.loadingTemplate;
var renderLoading = function() {
if (loadingTemplate) {
return loadingTemplate;
}
return compat_module_default.createElement(react_content_loader_es_default, { viewBox: "0 0 400 180", width: 200, height: 90, speed: 1 }, compat_module_default.createElement("rect", { x: "20", y: "5", rx: "0", ry: "0", width: "1", height: "170" }), compat_module_default.createElement("rect", { x: "20", y: "175", rx: "0", ry: "0", width: "360", height: "1" }), compat_module_default.createElement("rect", { x: "40", y: "75", rx: "0", ry: "0", width: "35", height: "100" }), compat_module_default.createElement("rect", { x: "80", y: "125", rx: "0", ry: "0", width: "35", height: "50" }), compat_module_default.createElement("rect", { x: "120", y: "105", rx: "0", ry: "0", width: "35", height: "70" }), compat_module_default.createElement("rect", { x: "160", y: "35", rx: "0", ry: "0", width: "35", height: "140" }), compat_module_default.createElement("rect", { x: "200", y: "55", rx: "0", ry: "0", width: "35", height: "120" }), compat_module_default.createElement("rect", { x: "240", y: "15", rx: "0", ry: "0", width: "35", height: "160" }), compat_module_default.createElement("rect", { x: "280", y: "135", rx: "0", ry: "0", width: "35", height: "40" }), compat_module_default.createElement("rect", { x: "320", y: "85", rx: "0", ry: "0", width: "35", height: "90" }));
};
return compat_module_default.createElement("div", { style: {
position: "absolute",
width: "100%",
height: "100%",
display: "flex",
alignItems: "center",
justifyContent: "center",
left: 0,
top: 0,
zIndex: 99,
backgroundColor: "#fff"
} }, renderLoading());
};
var createLoading_default = ChartLoading;
// node_modules/@ant-design/charts/es/plots/area/index.js
var __rest6 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var AreaChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest6(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Area2, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var area_default2 = AreaChart;
// node_modules/@ant-design/charts/es/plots/bar/index.js
var __rest7 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var BarChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest7(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Bar, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var bar_default = BarChart;
// node_modules/@ant-design/charts/es/plots/bullet/index.js
var __rest8 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var BulletChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest8(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Bullet, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var bullet_default = BulletChart;
// node_modules/@ant-design/charts/es/plots/column/index.js
var __rest9 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var ColumnChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest9(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Column, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var column_default = ColumnChart;
// node_modules/@ant-design/charts/es/plots/funnel/index.js
var __rest10 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var FunnelChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest10(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Funnel, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var funnel_default = FunnelChart;
// node_modules/@ant-design/charts/es/plots/histogram/index.js
var __rest11 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var HistogramChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest11(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Histogram, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var histogram_default = HistogramChart;
// node_modules/@ant-design/charts/es/plots/line/index.js
var __rest12 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var LineChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest12(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Line6, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var line_default10 = LineChart;
// node_modules/@ant-design/charts/es/plots/box/index.js
var __rest13 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var BoxChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest13(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Box, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var box_default = BoxChart;
// node_modules/@ant-design/charts/es/plots/liquid/index.js
var __rest14 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var LiquidChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest14(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Liquid, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var liquid_default = LiquidChart;
// node_modules/@ant-design/charts/es/plots/heatmap/index.js
var __rest15 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var HeatmapChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest15(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Heatmap2, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var heatmap_default2 = HeatmapChart;
// node_modules/@ant-design/charts/es/plots/pie/index.js
var __rest16 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var PieChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest16(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Pie, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var pie_default2 = PieChart;
// node_modules/@ant-design/charts/es/plots/gauge/index.js
var __rest17 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var GaugeChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest17(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Gauge, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var gauge_default = GaugeChart;
// node_modules/@ant-design/charts/es/plots/progress/index.js
var __rest18 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var ProgressChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest18(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Progress, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var progress_default = ProgressChart;
// node_modules/@ant-design/charts/es/plots/radar/index.js
var __rest19 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var RadarChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest19(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Radar, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var radar_default = RadarChart;
// node_modules/@ant-design/charts/es/plots/ringProgress/index.js
var __rest20 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var RingProgressChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest20(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(RingProgress, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var ringProgress_default = RingProgressChart;
// node_modules/@ant-design/charts/es/plots/rose/index.js
var __rest21 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var RoseChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest21(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Rose, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var rose_default = RoseChart;
// node_modules/@ant-design/charts/es/plots/chord/index.js
var __rest22 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var ChordChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest22(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Chord, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var chord_default = ChordChart;
// node_modules/@ant-design/charts/es/plots/scatter/index.js
var __rest23 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var ScatterChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest23(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Scatter, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var scatter_default = ScatterChart;
// node_modules/@ant-design/charts/es/plots/tinyArea/index.js
var __rest24 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var TinyAreaChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest24(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(TinyArea, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var tinyArea_default = TinyAreaChart;
// node_modules/@ant-design/charts/es/plots/tinyColumn/index.js
var __rest25 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var TinyColumnChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest25(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(TinyColumn, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var tinyColumn_default = TinyColumnChart;
// node_modules/@ant-design/charts/es/plots/dualAxes/index.js
var __rest26 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var DualAxesChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest26(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(DualAxes, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var dualAxes_default = DualAxesChart;
// node_modules/@ant-design/charts/es/plots/tinyLine/index.js
var __rest27 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var TinyLineChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest27(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(TinyLine, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var tinyLine_default = TinyLineChart;
// node_modules/@ant-design/charts/es/plots/waterfall/index.js
var __rest28 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var WaterfallChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest28(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Waterfall, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var waterfall_default = WaterfallChart;
// node_modules/@ant-design/charts/es/plots/wordCloud/index.js
var __rest29 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var WordCloudChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest29(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(WordCloud, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var wordCloud_default = WordCloudChart;
// node_modules/@ant-design/charts/es/plots/sunburst/index.js
var __rest30 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var SunburstChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest30(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Sunburst, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var sunburst_default = SunburstChart;
// node_modules/@ant-design/charts/es/plots/stock/index.js
var __rest31 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var StockChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest31(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Stock, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var stock_default = StockChart;
// node_modules/@ant-design/charts/es/plots/radialBar/index.js
var __rest32 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var RadialBarChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest32(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(RadialBar, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var radialBar_default = RadialBarChart;
// node_modules/@ant-design/charts/es/plots/sankey/index.js
var __rest33 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var SankeyChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest33(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Sankey2, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var sankey_default = SankeyChart;
// node_modules/@ant-design/charts/es/plots/treemap/index.js
var __rest34 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var TreemapChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest34(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Treemap, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var treemap_default2 = TreemapChart;
// node_modules/@ant-design/charts/es/plots/violin/index.js
var __rest35 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var ViolinChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest35(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Violin2, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var violin_default2 = ViolinChart;
// node_modules/@ant-design/charts/es/plots/facet/index.js
var __rest36 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var FacetChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest36(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Facet2, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var facet_default = FacetChart;
// node_modules/@ant-design/charts/es/plots/mix/index.js
var __rest37 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var MultiViewChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest37(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Mix, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var mix_default = MultiViewChart;
// node_modules/@ant-design/charts/es/plots/venn/index.js
var __rest38 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var VennChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest38(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(Venn, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var venn_default = VennChart;
// node_modules/@ant-design/charts/es/plots/bidirectionalBar/index.js
var __rest39 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var BidirectionalBarChart = x3(function(props, ref) {
var _a6 = props.style, style = _a6 === void 0 ? {
height: "inherit"
} : _a6, className = props.className, loading = props.loading, loadingTemplate = props.loadingTemplate, errorTemplate = props.errorTemplate, rest = __rest39(props, ["style", "className", "loading", "loadingTemplate", "errorTemplate"]);
var _b = useInit(BidirectionalBar, rest), chart = _b.chart, container2 = _b.container;
_2(ref, function() {
return {
getChart: function() {
return chart.current;
}
};
});
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
});
var bidirectionalBar_default = BidirectionalBarChart;
// node_modules/@antv/g6-core/es/behavior/behaviorOption.js
var behaviorOption_default = {
getDefaultCfg: function getDefaultCfg() {
return {};
},
getEvents: function getEvents() {
return {};
},
updateCfg: function updateCfg(cfg) {
Object.assign(this, cfg);
return true;
},
shouldBegin: function shouldBegin() {
return true;
},
shouldUpdate: function shouldUpdate() {
return true;
},
shouldEnd: function shouldEnd() {
return true;
},
bind: function bind2(graph) {
var _this = this;
var events = this.events;
this.graph = graph;
if (this.type === "drag-canvas" || this.type === "brush-select" || this.type === "lasso-select") {
graph.get("canvas").set("draggable", true);
}
each_default(events, function(handler, event) {
graph.on(event, handler);
});
document.addEventListener("visibilitychange", function() {
_this.keydown = false;
});
},
unbind: function unbind(graph) {
var events = this.events;
if (this.type === "drag-canvas" || this.type === "brush-select" || this.type === "lasso-select") {
graph.get("canvas").set("draggable", false);
}
each_default(events, function(handler, event) {
graph.off(event, handler);
});
},
get: function get(val) {
return this[val];
},
set: function set8(key, val) {
this[key] = val;
return this;
}
};
// node_modules/@antv/g6-core/es/behavior/behavior.js
var Behavior = function() {
function Behavior2() {
}
Behavior2.registerBehavior = function(type2, behavior) {
if (!behavior) {
throw new Error("please specify handler for this behavior: " + type2);
}
var prototype = clone_default(behaviorOption_default);
Object.assign(prototype, behavior);
var base = function base2(cfg) {
var _this = this;
Object.assign(this, this.getDefaultCfg(), cfg);
var events = this.getEvents();
this.events = null;
var eventsToBind = {};
if (events) {
each_default(events, function(handle, event) {
eventsToBind[event] = wrap_behavior_default(_this, handle);
});
this.events = eventsToBind;
}
};
base.prototype = prototype;
Behavior2.types[type2] = base;
};
Behavior2.hasBehavior = function(type2) {
return !!Behavior2.types[type2];
};
Behavior2.getBehavior = function(type2) {
return Behavior2.types[type2];
};
Behavior2.types = {};
return Behavior2;
}();
var behavior_default = Behavior;
// node_modules/@antv/g6-core/es/behavior/index.js
var behavior_default2 = behavior_default;
// node_modules/@antv/algorithm/es/index.js
var es_exports = {};
__export(es_exports, {
GADDI: () => gaddi_default,
Stack: () => stack_default2,
breadthFirstSearch: () => bfs_default,
connectedComponent: () => getConnectedComponents,
cosineSimilarity: () => cosine_similarity_default,
default: () => es_default,
depthFirstSearch: () => depthFirstSearch,
detectAllCycles: () => detectAllCycles,
detectAllDirectedCycle: () => detectAllDirectedCycle,
detectAllUndirectedCycle: () => detectAllUndirectedCycle,
detectCycle: () => detect_cycle_default,
detectDirectedCycle: () => detectDirectedCycle3,
dijkstra: () => dijkstra_default,
findAllPath: () => findAllPath,
findShortestPath: () => findShortestPath,
floydWarshall: () => floydWarshall_default,
getAdjMatrix: () => adjacent_matrix_default,
getDegree: () => degree_default,
getInDegree: () => getInDegree,
getNeighbors: () => getNeighbors,
getOutDegree: () => getOutDegree,
iLouvain: () => i_louvain_default,
kCore: () => k_core_default,
kMeans: () => k_means_default,
labelPropagation: () => label_propagation_default,
louvain: () => louvain_default,
minimumSpanningTree: () => mts_default,
nodesCosineSimilarity: () => nodes_cosine_similarity_default,
pageRank: () => pageRank_default
});
// node_modules/@antv/algorithm/es/adjacent-matrix.js
var adjMatrix = function adjMatrix2(graphData, directed) {
var nodes = graphData.nodes, edges = graphData.edges;
var matrix = [];
var nodeMap = {};
if (!nodes) {
throw new Error("invalid nodes data!");
}
if (nodes) {
nodes.forEach(function(node, i4) {
nodeMap[node.id] = i4;
var row = [];
matrix.push(row);
});
}
if (edges) {
edges.forEach(function(edge2) {
var source = edge2.source, target = edge2.target;
var sIndex = nodeMap[source];
var tIndex = nodeMap[target];
if (!sIndex && sIndex !== 0 || !tIndex && tIndex !== 0)
return;
matrix[sIndex][tIndex] = 1;
if (!directed) {
matrix[tIndex][sIndex] = 1;
}
});
}
return matrix;
};
var adjacent_matrix_default = adjMatrix;
// node_modules/@antv/algorithm/es/structs/linked-list.js
var defaultComparator = function defaultComparator2(a4, b10) {
if (a4 === b10) {
return true;
}
return false;
};
var LinkedListNode = function() {
function LinkedListNode2(value2, next) {
if (next === void 0) {
next = null;
}
this.value = value2;
this.next = next;
}
LinkedListNode2.prototype.toString = function(callback) {
return callback ? callback(this.value) : "".concat(this.value);
};
return LinkedListNode2;
}();
var LinkedList = function() {
function LinkedList2(comparator) {
if (comparator === void 0) {
comparator = defaultComparator;
}
this.head = null;
this.tail = null;
this.compare = comparator;
}
LinkedList2.prototype.prepend = function(value2) {
var newNode = new LinkedListNode(value2, this.head);
this.head = newNode;
if (!this.tail) {
this.tail = newNode;
}
return this;
};
LinkedList2.prototype.append = function(value2) {
var newNode = new LinkedListNode(value2);
if (!this.head) {
this.head = newNode;
this.tail = newNode;
return this;
}
this.tail.next = newNode;
this.tail = newNode;
return this;
};
LinkedList2.prototype.delete = function(value2) {
if (!this.head) {
return null;
}
var deleteNode = null;
while (this.head && this.compare(this.head.value, value2)) {
deleteNode = this.head;
this.head = this.head.next;
}
var currentNode = this.head;
if (currentNode !== null) {
while (currentNode.next) {
if (this.compare(currentNode.next.value, value2)) {
deleteNode = currentNode.next;
currentNode.next = currentNode.next.next;
} else {
currentNode = currentNode.next;
}
}
}
if (this.compare(this.tail.value, value2)) {
this.tail = currentNode;
}
return deleteNode;
};
LinkedList2.prototype.find = function(_a6) {
var _b = _a6.value, value2 = _b === void 0 ? void 0 : _b, _c = _a6.callback, callback = _c === void 0 ? void 0 : _c;
if (!this.head) {
return null;
}
var currentNode = this.head;
while (currentNode) {
if (callback && callback(currentNode.value)) {
return currentNode;
}
if (value2 !== void 0 && this.compare(currentNode.value, value2)) {
return currentNode;
}
currentNode = currentNode.next;
}
return null;
};
LinkedList2.prototype.deleteTail = function() {
var deletedTail = this.tail;
if (this.head === this.tail) {
this.head = null;
this.tail = null;
return deletedTail;
}
var currentNode = this.head;
while (currentNode.next) {
if (!currentNode.next.next) {
currentNode.next = null;
} else {
currentNode = currentNode.next;
}
}
this.tail = currentNode;
return deletedTail;
};
LinkedList2.prototype.deleteHead = function() {
if (!this.head) {
return null;
}
var deletedHead = this.head;
if (this.head.next) {
this.head = this.head.next;
} else {
this.head = null;
this.tail = null;
}
return deletedHead;
};
LinkedList2.prototype.fromArray = function(values2) {
var _this = this;
values2.forEach(function(value2) {
return _this.append(value2);
});
return this;
};
LinkedList2.prototype.toArray = function() {
var nodes = [];
var currentNode = this.head;
while (currentNode) {
nodes.push(currentNode);
currentNode = currentNode.next;
}
return nodes;
};
LinkedList2.prototype.reverse = function() {
var currentNode = this.head;
var prevNode = null;
var nextNode = null;
while (currentNode) {
nextNode = currentNode.next;
currentNode.next = prevNode;
prevNode = currentNode;
currentNode = nextNode;
}
this.tail = this.head;
this.head = prevNode;
};
LinkedList2.prototype.toString = function(callback) {
if (callback === void 0) {
callback = void 0;
}
return this.toArray().map(function(node) {
return node.toString(callback);
}).toString();
};
return LinkedList2;
}();
var linked_list_default = LinkedList;
// node_modules/@antv/algorithm/es/structs/queue.js
var Queue = function() {
function Queue2() {
this.linkedList = new linked_list_default();
}
Queue2.prototype.isEmpty = function() {
return !this.linkedList.head;
};
Queue2.prototype.peek = function() {
if (!this.linkedList.head) {
return null;
}
return this.linkedList.head.value;
};
Queue2.prototype.enqueue = function(value2) {
this.linkedList.append(value2);
};
Queue2.prototype.dequeue = function() {
var removeHead = this.linkedList.deleteHead();
return removeHead ? removeHead.value : null;
};
Queue2.prototype.toString = function(callback) {
return this.linkedList.toString(callback);
};
return Queue2;
}();
var queue_default = Queue;
// node_modules/@antv/algorithm/es/util.js
var getNeighbors = function getNeighbors2(nodeId, edges, type2) {
if (edges === void 0) {
edges = [];
}
var currentEdges = edges.filter(function(edge2) {
return edge2.source === nodeId || edge2.target === nodeId;
});
if (type2 === "target") {
var neighhborsConverter_1 = function neighhborsConverter_12(edge2) {
return edge2.source === nodeId;
};
return currentEdges.filter(neighhborsConverter_1).map(function(edge2) {
return edge2.target;
});
}
if (type2 === "source") {
var neighhborsConverter_2 = function neighhborsConverter_22(edge2) {
return edge2.target === nodeId;
};
return currentEdges.filter(neighhborsConverter_2).map(function(edge2) {
return edge2.source;
});
}
var neighhborsConverter = function neighhborsConverter2(edge2) {
return edge2.source === nodeId ? edge2.target : edge2.source;
};
return currentEdges.map(neighhborsConverter);
};
var getOutEdgesNodeId = function getOutEdgesNodeId2(nodeId, edges) {
return edges.filter(function(edge2) {
return edge2.source === nodeId;
});
};
var getEdgesByNodeId = function getEdgesByNodeId2(nodeId, edges) {
return edges.filter(function(edge2) {
return edge2.source === nodeId || edge2.target === nodeId;
});
};
var uniqueId = function uniqueId2(index2) {
if (index2 === void 0) {
index2 = 0;
}
var random1 = "".concat(Math.random()).split(".")[1].substr(0, 5);
var random22 = "".concat(Math.random()).split(".")[1].substr(0, 5);
return "".concat(index2, "-").concat(random1).concat(random22);
};
// node_modules/@antv/algorithm/es/bfs.js
function initCallbacks(callbacks) {
if (callbacks === void 0) {
callbacks = {};
}
var initiatedCallback = callbacks;
var stubCallback = function stubCallback2() {
};
var allowTraversalCallback = function() {
var seen = {};
return function(_a6) {
var next = _a6.next;
var id = next;
if (!seen[id]) {
seen[id] = true;
return true;
}
return false;
};
}();
initiatedCallback.allowTraversal = callbacks.allowTraversal || allowTraversalCallback;
initiatedCallback.enter = callbacks.enter || stubCallback;
initiatedCallback.leave = callbacks.leave || stubCallback;
return initiatedCallback;
}
var breadthFirstSearch = function breadthFirstSearch2(graphData, startNodeId, originalCallbacks, directed) {
if (directed === void 0) {
directed = true;
}
var callbacks = initCallbacks(originalCallbacks);
var nodeQueue = new queue_default();
var _a6 = graphData.edges, edges = _a6 === void 0 ? [] : _a6;
nodeQueue.enqueue(startNodeId);
var previousNode = "";
var _loop_1 = function _loop_12() {
var currentNode = nodeQueue.dequeue();
callbacks.enter({
current: currentNode,
previous: previousNode
});
getNeighbors(currentNode, edges, directed ? "target" : void 0).forEach(function(nextNode) {
if (callbacks.allowTraversal({
previous: previousNode,
current: currentNode,
next: nextNode
})) {
nodeQueue.enqueue(nextNode);
}
});
callbacks.leave({
current: currentNode,
previous: previousNode
});
previousNode = currentNode;
};
while (!nodeQueue.isEmpty()) {
_loop_1();
}
};
var bfs_default = breadthFirstSearch;
// node_modules/@antv/algorithm/es/connected-component.js
var detectConnectedComponents = function detectConnectedComponents2(graphData) {
var _a6 = graphData.nodes, nodes = _a6 === void 0 ? [] : _a6, _b = graphData.edges, edges = _b === void 0 ? [] : _b;
var allComponents = [];
var visited = {};
var nodeStack = [];
var getComponent = function getComponent2(node2) {
nodeStack.push(node2);
visited[node2.id] = true;
var neighbors = getNeighbors(node2.id, edges);
var _loop_1 = function _loop_12(i6) {
var neighbor = neighbors[i6];
if (!visited[neighbor]) {
var targetNode = nodes.filter(function(node3) {
return node3.id === neighbor;
});
if (targetNode.length > 0) {
getComponent2(targetNode[0]);
}
}
};
for (var i5 = 0; i5 < neighbors.length; ++i5) {
_loop_1(i5);
}
};
for (var i4 = 0; i4 < nodes.length; i4++) {
var node = nodes[i4];
if (!visited[node.id]) {
getComponent(node);
var component2 = [];
while (nodeStack.length > 0) {
component2.push(nodeStack.pop());
}
allComponents.push(component2);
}
}
return allComponents;
};
var detectStrongConnectComponents = function detectStrongConnectComponents2(graphData) {
var _a6 = graphData.nodes, nodes = _a6 === void 0 ? [] : _a6, _b = graphData.edges, edges = _b === void 0 ? [] : _b;
var nodeStack = [];
var inStack = {};
var indices = {};
var lowLink = {};
var allComponents = [];
var index2 = 0;
var getComponent = function getComponent2(node2) {
indices[node2.id] = index2;
lowLink[node2.id] = index2;
index2 += 1;
nodeStack.push(node2);
inStack[node2.id] = true;
var neighbors = getNeighbors(node2.id, edges, "target").filter(function(n3) {
return nodes.map(function(node3) {
return node3.id;
}).indexOf(n3) > -1;
});
var _loop_2 = function _loop_22(i5) {
var targetNodeID = neighbors[i5];
if (!indices[targetNodeID] && indices[targetNodeID] !== 0) {
var targetNode = nodes.filter(function(node3) {
return node3.id === targetNodeID;
});
if (targetNode.length > 0) {
getComponent2(targetNode[0]);
}
lowLink[node2.id] = Math.min(lowLink[node2.id], lowLink[targetNodeID]);
} else if (inStack[targetNodeID]) {
lowLink[node2.id] = Math.min(lowLink[node2.id], indices[targetNodeID]);
}
};
for (var i4 = 0; i4 < neighbors.length; i4++) {
_loop_2(i4);
}
if (lowLink[node2.id] === indices[node2.id]) {
var component2 = [];
while (nodeStack.length > 0) {
var tmpNode = nodeStack.pop();
inStack[tmpNode.id] = false;
component2.push(tmpNode);
if (tmpNode === node2)
break;
}
if (component2.length > 0) {
allComponents.push(component2);
}
}
};
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
var node = nodes_1[_i];
if (!indices[node.id] && indices[node.id] !== 0) {
getComponent(node);
}
}
return allComponents;
};
function getConnectedComponents(graphData, directed) {
if (directed)
return detectStrongConnectComponents(graphData);
return detectConnectedComponents(graphData);
}
// node_modules/@antv/algorithm/es/degree.js
var degree2 = function degree3(graphData) {
var degrees = {};
var _a6 = graphData.nodes, nodes = _a6 === void 0 ? [] : _a6, _b = graphData.edges, edges = _b === void 0 ? [] : _b;
nodes.forEach(function(node) {
degrees[node.id] = {
degree: 0,
inDegree: 0,
outDegree: 0
};
});
edges.forEach(function(edge2) {
degrees[edge2.source].degree++;
degrees[edge2.source].outDegree++;
degrees[edge2.target].degree++;
degrees[edge2.target].inDegree++;
});
return degrees;
};
var degree_default = degree2;
var getInDegree = function getInDegree2(graphData, nodeId) {
var nodeDegree = degree2(graphData);
if (nodeDegree[nodeId]) {
return degree2(graphData)[nodeId].inDegree;
}
return 0;
};
var getOutDegree = function getOutDegree2(graphData, nodeId) {
var nodeDegree = degree2(graphData);
if (nodeDegree[nodeId]) {
return degree2(graphData)[nodeId].outDegree;
}
return 0;
};
// node_modules/@antv/algorithm/es/dfs.js
function initCallbacks2(callbacks) {
if (callbacks === void 0) {
callbacks = {};
}
var initiatedCallback = callbacks;
var stubCallback = function stubCallback2() {
};
var allowTraversalCallback = function() {
var seen = {};
return function(_a6) {
var next = _a6.next;
if (!seen[next]) {
seen[next] = true;
return true;
}
return false;
};
}();
initiatedCallback.allowTraversal = callbacks.allowTraversal || allowTraversalCallback;
initiatedCallback.enter = callbacks.enter || stubCallback;
initiatedCallback.leave = callbacks.leave || stubCallback;
return initiatedCallback;
}
function depthFirstSearchRecursive(graphData, currentNode, previousNode, callbacks) {
callbacks.enter({
current: currentNode,
previous: previousNode
});
var _a6 = graphData.edges, edges = _a6 === void 0 ? [] : _a6;
getNeighbors(currentNode, edges, "target").forEach(function(nextNode) {
if (callbacks.allowTraversal({
previous: previousNode,
current: currentNode,
next: nextNode
})) {
depthFirstSearchRecursive(graphData, nextNode, currentNode, callbacks);
}
});
callbacks.leave({
current: currentNode,
previous: previousNode
});
}
function depthFirstSearch(graphData, startNodeId, callbacks) {
depthFirstSearchRecursive(graphData, startNodeId, "", initCallbacks2(callbacks));
}
// node_modules/@antv/algorithm/es/detect-cycle.js
var detectDirectedCycle = function detectDirectedCycle2(graphData) {
var cycle = null;
var _a6 = graphData.nodes, nodes = _a6 === void 0 ? [] : _a6;
var dfsParentMap = {};
var unvisitedSet = {};
var visitingSet = {};
var visitedSet = {};
nodes.forEach(function(node) {
unvisitedSet[node.id] = node;
});
var callbacks = {
enter: function enter(_a7) {
var currentNode = _a7.current, previousNode = _a7.previous;
if (visitingSet[currentNode]) {
cycle = {};
var currentCycleNode = currentNode;
var previousCycleNode = previousNode;
while (previousCycleNode !== currentNode) {
cycle[currentCycleNode] = previousCycleNode;
currentCycleNode = previousCycleNode;
previousCycleNode = dfsParentMap[previousCycleNode];
}
cycle[currentCycleNode] = previousCycleNode;
} else {
visitingSet[currentNode] = currentNode;
delete unvisitedSet[currentNode];
dfsParentMap[currentNode] = previousNode;
}
},
leave: function leave(_a7) {
var currentNode = _a7.current;
visitedSet[currentNode] = currentNode;
delete visitingSet[currentNode];
},
allowTraversal: function allowTraversal(_a7) {
var nextNode = _a7.next;
if (cycle) {
return false;
}
return !visitedSet[nextNode];
}
};
while (Object.keys(unvisitedSet).length) {
var firsetUnVisitedKey = Object.keys(unvisitedSet)[0];
depthFirstSearch(graphData, firsetUnVisitedKey, callbacks);
}
return cycle;
};
var detectAllUndirectedCycle = function detectAllUndirectedCycle2(graphData, nodeIds, include) {
var _a6, _b;
if (include === void 0) {
include = true;
}
var allCycles = [];
var components = getConnectedComponents(graphData, false);
for (var _i = 0, components_1 = components; _i < components_1.length; _i++) {
var component2 = components_1[_i];
if (!component2.length)
continue;
var root = component2[0];
var rootId = root.id;
var stack = [root];
var parent_1 = (_a6 = {}, _a6[rootId] = root, _a6);
var used = (_b = {}, _b[rootId] = new Set(), _b);
while (stack.length > 0) {
var curNode = stack.pop();
var curNodeId = curNode.id;
var neighbors = getNeighbors(curNodeId, graphData.edges);
var _loop_1 = function _loop_12(i5) {
var _c;
var neighborId = neighbors[i5];
var neighbor = graphData.nodes.find(function(node) {
return node.id === neighborId;
});
if (neighborId === curNodeId) {
allCycles.push((_c = {}, _c[neighborId] = curNode, _c));
} else if (!(neighborId in used)) {
parent_1[neighborId] = curNode;
stack.push(neighbor);
used[neighborId] = new Set([curNode]);
} else if (!used[curNodeId].has(neighbor)) {
var cycleValid = true;
var cyclePath = [neighbor, curNode];
var p4 = parent_1[curNodeId];
while (used[neighborId].size && !used[neighborId].has(p4)) {
cyclePath.push(p4);
if (p4 === parent_1[p4.id])
break;
else
p4 = parent_1[p4.id];
}
cyclePath.push(p4);
if (nodeIds && include) {
cycleValid = false;
if (cyclePath.findIndex(function(node) {
return nodeIds.indexOf(node.id) > -1;
}) > -1) {
cycleValid = true;
}
} else if (nodeIds && !include) {
if (cyclePath.findIndex(function(node) {
return nodeIds.indexOf(node.id) > -1;
}) > -1) {
cycleValid = false;
}
}
if (cycleValid) {
var cycle = {};
for (var index2 = 1; index2 < cyclePath.length; index2 += 1) {
cycle[cyclePath[index2 - 1].id] = cyclePath[index2];
}
if (cyclePath.length) {
cycle[cyclePath[cyclePath.length - 1].id] = cyclePath[0];
}
allCycles.push(cycle);
}
used[neighborId].add(curNode);
}
};
for (var i4 = 0; i4 < neighbors.length; i4 += 1) {
_loop_1(i4);
}
}
}
return allCycles;
};
var detectAllDirectedCycle = function detectAllDirectedCycle2(graphData, nodeIds, include) {
if (include === void 0) {
include = true;
}
var path = [];
var blocked = new Set();
var B3 = [];
var allCycles = [];
var idx2Node = {};
var node2Idx = {};
var unblock = function unblock2(thisNode) {
var stack = [thisNode];
while (stack.length > 0) {
var node2 = stack.pop();
if (blocked.has(node2)) {
blocked.delete(node2);
B3[node2.id].forEach(function(n3) {
stack.push(n3);
});
B3[node2.id].clear();
}
}
};
var circuit = function circuit2(node2, start, adjList2) {
var closed = false;
if (nodeIds && include === false && nodeIds.indexOf(node2.id) > -1)
return closed;
path.push(node2);
blocked.add(node2);
var neighbors = adjList2[node2.id];
for (var i5 = 0; i5 < neighbors.length; i5 += 1) {
var neighbor = idx2Node[neighbors[i5]];
if (neighbor === start) {
var cycle = {};
for (var index2 = 1; index2 < path.length; index2 += 1) {
cycle[path[index2 - 1].id] = path[index2];
}
if (path.length) {
cycle[path[path.length - 1].id] = path[0];
}
allCycles.push(cycle);
closed = true;
} else if (!blocked.has(neighbor)) {
if (circuit2(neighbor, start, adjList2)) {
closed = true;
}
}
}
if (closed) {
unblock(node2);
} else {
for (var i5 = 0; i5 < neighbors.length; i5 += 1) {
var neighbor = idx2Node[neighbors[i5]];
if (!B3[neighbor.id].has(node2)) {
B3[neighbor.id].add(node2);
}
}
}
path.pop();
return closed;
};
var _a6 = graphData.nodes, nodes = _a6 === void 0 ? [] : _a6;
for (var i4 = 0; i4 < nodes.length; i4 += 1) {
var node = nodes[i4];
var nodeId = node.id;
node2Idx[nodeId] = i4;
idx2Node[i4] = node;
}
if (nodeIds && include) {
var _loop_2 = function _loop_22(i5) {
var nodeId2 = nodeIds[i5];
node2Idx[nodes[i5].id] = node2Idx[nodeId2];
node2Idx[nodeId2] = 0;
idx2Node[0] = nodes.find(function(node2) {
return node2.id === nodeId2;
});
idx2Node[node2Idx[nodes[i5].id]] = nodes[i5];
};
for (var i4 = 0; i4 < nodeIds.length; i4++) {
_loop_2(i4);
}
}
var getMinComponentAdj = function getMinComponentAdj2(components) {
var _a7;
var minCompIdx;
var minIdx2 = Infinity;
for (var i5 = 0; i5 < components.length; i5 += 1) {
var comp = components[i5];
for (var j4 = 0; j4 < comp.length; j4++) {
var nodeIdx_1 = node2Idx[comp[j4].id];
if (nodeIdx_1 < minIdx2) {
minIdx2 = nodeIdx_1;
minCompIdx = i5;
}
}
}
var component3 = components[minCompIdx];
var adjList2 = [];
for (var i5 = 0; i5 < component3.length; i5 += 1) {
var node2 = component3[i5];
adjList2[node2.id] = [];
for (var _i = 0, _b = getNeighbors(node2.id, graphData.edges, "target").filter(function(n3) {
return component3.map(function(c5) {
return c5.id;
}).indexOf(n3) > -1;
}); _i < _b.length; _i++) {
var neighbor = _b[_i];
if (neighbor === node2.id && !(include === false && nodeIds.indexOf(node2.id) > -1)) {
allCycles.push((_a7 = {}, _a7[node2.id] = node2, _a7));
} else {
adjList2[node2.id].push(node2Idx[neighbor]);
}
}
}
return {
component: component3,
adjList: adjList2,
minIdx: minIdx2
};
};
var nodeIdx = 0;
while (nodeIdx < nodes.length) {
var subgraphNodes = nodes.filter(function(n3) {
return node2Idx[n3.id] >= nodeIdx;
});
var sccs = detectStrongConnectComponents({
nodes: subgraphNodes,
edges: graphData.edges
}).filter(function(component3) {
return component3.length > 1;
});
if (sccs.length === 0)
break;
var scc = getMinComponentAdj(sccs);
var minIdx = scc.minIdx, adjList = scc.adjList, component2 = scc.component;
if (component2.length > 1) {
component2.forEach(function(node2) {
B3[node2.id] = new Set();
});
var startNode = idx2Node[minIdx];
if (nodeIds && include && nodeIds.indexOf(startNode.id) === -1)
return allCycles;
circuit(startNode, startNode, adjList);
nodeIdx = minIdx + 1;
} else {
break;
}
}
return allCycles;
};
var detectAllCycles = function detectAllCycles2(graphData, directed, nodeIds, include) {
if (include === void 0) {
include = true;
}
if (directed)
return detectAllDirectedCycle(graphData, nodeIds, include);
return detectAllUndirectedCycle(graphData, nodeIds, include);
};
var detect_cycle_default = detectDirectedCycle;
// node_modules/@antv/algorithm/es/dijkstra.js
var minVertex = function minVertex2(D3, nodes, marks) {
var minDis = Infinity;
var minNode;
for (var i4 = 0; i4 < nodes.length; i4++) {
var nodeId = nodes[i4].id;
if (!marks[nodeId] && D3[nodeId] <= minDis) {
minDis = D3[nodeId];
minNode = nodes[i4];
}
}
return minNode;
};
var dijkstra = function dijkstra2(graphData, source, directed, weightPropertyName) {
var _a6 = graphData.nodes, nodes = _a6 === void 0 ? [] : _a6, _b = graphData.edges, edges = _b === void 0 ? [] : _b;
var nodeIds = [];
var marks = {};
var D3 = {};
var prevs = {};
nodes.forEach(function(node, i5) {
var id = node.id;
nodeIds.push(id);
D3[id] = Infinity;
if (id === source)
D3[id] = 0;
});
var nodeNum = nodes.length;
var _loop_1 = function _loop_12(i5) {
var minNode = minVertex(D3, nodes, marks);
var minNodeId = minNode.id;
marks[minNodeId] = true;
if (D3[minNodeId] === Infinity)
return "continue";
var relatedEdges = [];
if (directed)
relatedEdges = getOutEdgesNodeId(minNodeId, edges);
else
relatedEdges = getEdgesByNodeId(minNodeId, edges);
relatedEdges.forEach(function(edge2) {
var edgeTarget = edge2.target;
var edgeSource = edge2.source;
var w4 = edgeTarget === minNodeId ? edgeSource : edgeTarget;
var weight = weightPropertyName && edge2[weightPropertyName] ? edge2[weightPropertyName] : 1;
if (D3[w4] > D3[minNode.id] + weight) {
D3[w4] = D3[minNode.id] + weight;
prevs[w4] = [minNode.id];
} else if (D3[w4] === D3[minNode.id] + weight) {
prevs[w4].push(minNode.id);
}
});
};
for (var i4 = 0; i4 < nodeNum; i4++) {
_loop_1(i4);
}
prevs[source] = [source];
var paths = {};
for (var target in D3) {
if (D3[target] !== Infinity) {
findAllPaths(source, target, prevs, paths);
}
}
var path = {};
for (var target in paths) {
path[target] = paths[target][0];
}
return {
length: D3,
path,
allPath: paths
};
};
var dijkstra_default = dijkstra;
function findAllPaths(source, target, prevs, foundPaths) {
if (source === target) {
return [source];
}
if (foundPaths[target]) {
return foundPaths[target];
}
var paths = [];
for (var _i = 0, _a6 = prevs[target]; _i < _a6.length; _i++) {
var prev = _a6[_i];
var prevPaths = findAllPaths(source, prev, prevs, foundPaths);
if (!prevPaths)
return;
for (var _b = 0, prevPaths_1 = prevPaths; _b < prevPaths_1.length; _b++) {
var prePath = prevPaths_1[_b];
if (is_array_default(prePath))
paths.push(__spreadArray(__spreadArray([], prePath, true), [target], false));
else
paths.push([prePath, target]);
}
}
foundPaths[target] = paths;
return foundPaths[target];
}
// node_modules/@antv/algorithm/es/find-path.js
var findShortestPath = function findShortestPath2(graphData, start, end2, directed, weightPropertyName) {
var _a6 = dijkstra_default(graphData, start, directed, weightPropertyName), length5 = _a6.length, path = _a6.path, allPath = _a6.allPath;
return {
length: length5[end2],
path: path[end2],
allPath: allPath[end2]
};
};
var findAllPath = function findAllPath2(graphData, start, end2, directed) {
var _a6;
if (start === end2)
return [[start]];
var _b = graphData.edges, edges = _b === void 0 ? [] : _b;
var visited = [start];
var isVisited = (_a6 = {}, _a6[start] = true, _a6);
var stack = [];
var allPath = [];
var neighbors = directed ? getNeighbors(start, edges, "target") : getNeighbors(start, edges);
stack.push(neighbors);
while (visited.length > 0 && stack.length > 0) {
var children = stack[stack.length - 1];
if (children.length) {
var child = children.shift();
if (child) {
visited.push(child);
isVisited[child] = true;
neighbors = directed ? getNeighbors(child, edges, "target") : getNeighbors(child, edges);
stack.push(neighbors.filter(function(neighbor) {
return !isVisited[neighbor];
}));
}
} else {
var node = visited.pop();
isVisited[node] = false;
stack.pop();
continue;
}
if (visited[visited.length - 1] === end2) {
var path = visited.map(function(node2) {
return node2;
});
allPath.push(path);
var node = visited.pop();
isVisited[node] = false;
stack.pop();
}
}
return allPath;
};
// node_modules/@antv/algorithm/es/floydWarshall.js
var floydWarshall = function floydWarshall2(graphData, directed) {
var adjacentMatrix = adjacent_matrix_default(graphData, directed);
var dist4 = [];
var size2 = adjacentMatrix.length;
for (var i4 = 0; i4 < size2; i4 += 1) {
dist4[i4] = [];
for (var j4 = 0; j4 < size2; j4 += 1) {
if (i4 === j4) {
dist4[i4][j4] = 0;
} else if (adjacentMatrix[i4][j4] === 0 || !adjacentMatrix[i4][j4]) {
dist4[i4][j4] = Infinity;
} else {
dist4[i4][j4] = adjacentMatrix[i4][j4];
}
}
}
for (var k4 = 0; k4 < size2; k4 += 1) {
for (var i4 = 0; i4 < size2; i4 += 1) {
for (var j4 = 0; j4 < size2; j4 += 1) {
if (dist4[i4][j4] > dist4[i4][k4] + dist4[k4][j4]) {
dist4[i4][j4] = dist4[i4][k4] + dist4[k4][j4];
}
}
}
}
return dist4;
};
var floydWarshall_default = floydWarshall;
// node_modules/@antv/algorithm/es/label-propagation.js
var labelPropagation = function labelPropagation2(graphData, directed, weightPropertyName, maxIteration) {
if (directed === void 0) {
directed = false;
}
if (weightPropertyName === void 0) {
weightPropertyName = "weight";
}
if (maxIteration === void 0) {
maxIteration = 1e3;
}
var _a6 = graphData.nodes, nodes = _a6 === void 0 ? [] : _a6, _b = graphData.edges, edges = _b === void 0 ? [] : _b;
var clusters = {};
var nodeMap = {};
nodes.forEach(function(node, i4) {
var cid = uniqueId();
node.clusterId = cid;
clusters[cid] = {
id: cid,
nodes: [node]
};
nodeMap[node.id] = {
node,
idx: i4
};
});
var adjMatrix3 = adjacent_matrix_default(graphData, directed);
var ks = [];
var neighbors = {};
adjMatrix3.forEach(function(row, i4) {
var k4 = 0;
var iid = nodes[i4].id;
neighbors[iid] = {};
row.forEach(function(entry, j4) {
if (!entry)
return;
k4 += entry;
var jid = nodes[j4].id;
neighbors[iid][jid] = entry;
});
ks.push(k4);
});
var iter = 0;
var _loop_1 = function _loop_12() {
var changed = false;
nodes.forEach(function(node) {
var neighborClusters = {};
Object.keys(neighbors[node.id]).forEach(function(neighborId) {
var neighborWeight = neighbors[node.id][neighborId];
var neighborNode = nodeMap[neighborId].node;
var neighborClusterId = neighborNode.clusterId;
if (!neighborClusters[neighborClusterId])
neighborClusters[neighborClusterId] = 0;
neighborClusters[neighborClusterId] += neighborWeight;
});
var maxWeight = -Infinity;
var bestClusterIds = [];
Object.keys(neighborClusters).forEach(function(clusterId) {
if (maxWeight < neighborClusters[clusterId]) {
maxWeight = neighborClusters[clusterId];
bestClusterIds = [clusterId];
} else if (maxWeight === neighborClusters[clusterId]) {
bestClusterIds.push(clusterId);
}
});
if (bestClusterIds.length === 1 && bestClusterIds[0] === node.clusterId)
return;
var selfClusterIdx = bestClusterIds.indexOf(node.clusterId);
if (selfClusterIdx >= 0)
bestClusterIds.splice(selfClusterIdx, 1);
if (bestClusterIds && bestClusterIds.length) {
changed = true;
var selfCluster = clusters[node.clusterId];
var nodeInSelfClusterIdx = selfCluster.nodes.indexOf(node);
selfCluster.nodes.splice(nodeInSelfClusterIdx, 1);
var randomIdx = Math.floor(Math.random() * bestClusterIds.length);
var bestCluster = clusters[bestClusterIds[randomIdx]];
bestCluster.nodes.push(node);
node.clusterId = bestCluster.id;
}
});
if (!changed)
return "break";
iter++;
};
while (iter < maxIteration) {
var state_1 = _loop_1();
if (state_1 === "break")
break;
}
Object.keys(clusters).forEach(function(clusterId) {
var cluster = clusters[clusterId];
if (!cluster.nodes || !cluster.nodes.length) {
delete clusters[clusterId];
}
});
var clusterEdges = [];
var clusterEdgeMap = {};
edges.forEach(function(edge2) {
var source = edge2.source, target = edge2.target;
var weight = edge2[weightPropertyName] || 1;
var sourceClusterId = nodeMap[source].node.clusterId;
var targetClusterId = nodeMap[target].node.clusterId;
var newEdgeId = "".concat(sourceClusterId, "---").concat(targetClusterId);
if (clusterEdgeMap[newEdgeId]) {
clusterEdgeMap[newEdgeId].weight += weight;
clusterEdgeMap[newEdgeId].count++;
} else {
var newEdge = {
source: sourceClusterId,
target: targetClusterId,
weight,
count: 1
};
clusterEdgeMap[newEdgeId] = newEdge;
clusterEdges.push(newEdge);
}
});
var clustersArray = [];
Object.keys(clusters).forEach(function(clusterId) {
clustersArray.push(clusters[clusterId]);
});
return {
clusters: clustersArray,
clusterEdges
};
};
var label_propagation_default = labelPropagation;
// node_modules/@antv/algorithm/es/utils/vector.js
var Vector = function() {
function Vector2(arr) {
this.arr = arr;
}
Vector2.prototype.getArr = function() {
return this.arr || [];
};
Vector2.prototype.add = function(otherVector) {
var _a6;
var otherArr = otherVector.arr;
if (!((_a6 = this.arr) === null || _a6 === void 0 ? void 0 : _a6.length)) {
return new Vector2(otherArr);
}
if (!(otherArr === null || otherArr === void 0 ? void 0 : otherArr.length)) {
return new Vector2(this.arr);
}
if (this.arr.length === otherArr.length) {
var res = [];
for (var index2 in this.arr) {
res[index2] = this.arr[index2] + otherArr[index2];
}
return new Vector2(res);
}
};
Vector2.prototype.subtract = function(otherVector) {
var _a6;
var otherArr = otherVector.arr;
if (!((_a6 = this.arr) === null || _a6 === void 0 ? void 0 : _a6.length)) {
return new Vector2(otherArr);
}
if (!(otherArr === null || otherArr === void 0 ? void 0 : otherArr.length)) {
return new Vector2(this.arr);
}
if (this.arr.length === otherArr.length) {
var res = [];
for (var index2 in this.arr) {
res[index2] = this.arr[index2] - otherArr[index2];
}
return new Vector2(res);
}
};
Vector2.prototype.avg = function(length5) {
var res = [];
if (length5 !== 0) {
for (var index2 in this.arr) {
res[index2] = this.arr[index2] / length5;
}
}
return new Vector2(res);
};
Vector2.prototype.negate = function() {
var res = [];
for (var index2 in this.arr) {
res[index2] = -this.arr[index2];
}
return new Vector2(res);
};
Vector2.prototype.squareEuclideanDistance = function(otherVector) {
var _a6;
var otherArr = otherVector.arr;
if (!((_a6 = this.arr) === null || _a6 === void 0 ? void 0 : _a6.length) || !(otherArr === null || otherArr === void 0 ? void 0 : otherArr.length)) {
return 0;
}
if (this.arr.length === otherArr.length) {
var res = 0;
for (var index2 in this.arr) {
res += Math.pow(this.arr[index2] - otherVector.arr[index2], 2);
}
return res;
}
};
Vector2.prototype.euclideanDistance = function(otherVector) {
var _a6;
var otherArr = otherVector.arr;
if (!((_a6 = this.arr) === null || _a6 === void 0 ? void 0 : _a6.length) || !(otherArr === null || otherArr === void 0 ? void 0 : otherArr.length)) {
return 0;
}
if (this.arr.length === otherArr.length) {
var res = 0;
for (var index2 in this.arr) {
res += Math.pow(this.arr[index2] - otherVector.arr[index2], 2);
}
return Math.sqrt(res);
} else {
console.error("The two vectors are unequal in length.");
}
};
Vector2.prototype.normalize = function() {
var res = [];
var cloneArr = clone_default(this.arr);
cloneArr.sort(function(a4, b10) {
return a4 - b10;
});
var max8 = cloneArr[cloneArr.length - 1];
var min7 = cloneArr[0];
for (var index2 in this.arr) {
res[index2] = (this.arr[index2] - min7) / (max8 - min7);
}
return new Vector2(res);
};
Vector2.prototype.norm2 = function() {
var _a6;
if (!((_a6 = this.arr) === null || _a6 === void 0 ? void 0 : _a6.length)) {
return 0;
}
var res = 0;
for (var index2 in this.arr) {
res += Math.pow(this.arr[index2], 2);
}
return Math.sqrt(res);
};
Vector2.prototype.dot = function(otherVector) {
var _a6;
var otherArr = otherVector.arr;
if (!((_a6 = this.arr) === null || _a6 === void 0 ? void 0 : _a6.length) || !(otherArr === null || otherArr === void 0 ? void 0 : otherArr.length)) {
return 0;
}
if (this.arr.length === otherArr.length) {
var res = 0;
for (var index2 in this.arr) {
res += this.arr[index2] * otherVector.arr[index2];
}
return res;
} else {
console.error("The two vectors are unequal in length.");
}
};
Vector2.prototype.equal = function(otherVector) {
var _a6;
var otherArr = otherVector.arr;
if (((_a6 = this.arr) === null || _a6 === void 0 ? void 0 : _a6.length) !== (otherArr === null || otherArr === void 0 ? void 0 : otherArr.length)) {
return false;
}
for (var index2 in this.arr) {
if (this.arr[index2] !== otherArr[index2]) {
return false;
}
}
return true;
};
return Vector2;
}();
var vector_default = Vector;
// node_modules/@antv/algorithm/es/utils/node-properties.js
var getAllProperties = function getAllProperties2(nodes, key) {
if (key === void 0) {
key = "properties";
}
var allProperties = [];
nodes.forEach(function(node) {
if (!node.properties) {
return;
}
allProperties.push(node[key]);
});
return allProperties;
};
// node_modules/@antv/algorithm/es/types.js
var DistanceType;
(function(DistanceType2) {
DistanceType2["EuclideanDistance"] = "euclideanDistance";
})(DistanceType || (DistanceType = {}));
// node_modules/@antv/algorithm/es/utils/data-preprocessing.js
var getAllKeyValueMap = function getAllKeyValueMap2(dataList, involvedKeys, uninvolvedKeys) {
var keys2 = [];
if (involvedKeys === null || involvedKeys === void 0 ? void 0 : involvedKeys.length) {
keys2 = involvedKeys;
} else {
dataList.forEach(function(data3) {
keys2 = keys2.concat(Object.keys(data3));
});
keys2 = uniq(keys2);
}
var allKeyValueMap = {};
keys2.forEach(function(key) {
var value2 = [];
dataList.forEach(function(data3) {
if (data3[key] !== void 0 && data3[key] !== "") {
value2.push(data3[key]);
}
});
if (value2.length && !(uninvolvedKeys === null || uninvolvedKeys === void 0 ? void 0 : uninvolvedKeys.includes(key))) {
allKeyValueMap[key] = uniq(value2);
}
});
return allKeyValueMap;
};
var oneHot = function oneHot2(dataList, involvedKeys, uninvolvedKeys) {
var allKeyValueMap = getAllKeyValueMap(dataList, involvedKeys, uninvolvedKeys);
var oneHotCode = [];
dataList.forEach(function(data3, index2) {
var code = [];
Object.keys(allKeyValueMap).forEach(function(key) {
var keyValue = data3[key];
var allKeyValue = allKeyValueMap[key];
var valueIndex = allKeyValue.findIndex(function(value2) {
return keyValue === value2;
});
var subCode = [];
for (var i4 = 0; i4 < allKeyValue.length; i4++) {
if (i4 === valueIndex) {
subCode.push(1);
} else {
subCode.push(0);
}
}
code = code.concat(subCode);
});
oneHotCode[index2] = code;
});
return oneHotCode;
};
var getDistance = function getDistance2(item, otherItem, distanceType, graphData) {
if (distanceType === void 0) {
distanceType = DistanceType.EuclideanDistance;
}
var distance15 = 0;
switch (distanceType) {
case DistanceType.EuclideanDistance:
distance15 = new vector_default(item).euclideanDistance(new vector_default(otherItem));
break;
default:
break;
}
return distance15;
};
// node_modules/@antv/algorithm/es/louvain.js
var getModularity = function getModularity2(nodes, adjMatrix3, ks, m4) {
var length5 = adjMatrix3.length;
var param = 2 * m4;
var modularity = 0;
for (var i4 = 0; i4 < length5; i4++) {
var clusteri = nodes[i4].clusterId;
for (var j4 = 0; j4 < length5; j4++) {
var clusterj = nodes[j4].clusterId;
if (clusteri !== clusterj)
continue;
var entry = adjMatrix3[i4][j4] || 0;
var ki = ks[i4] || 0;
var kj = ks[j4] || 0;
modularity += entry - ki * kj / param;
}
}
modularity *= 1 / param;
return modularity;
};
var getInertialModularity = function getInertialModularity2(nodes, allPropertiesWeight) {
if (nodes === void 0) {
nodes = [];
}
var length5 = nodes.length;
var totalProperties = new vector_default([]);
for (var i4 = 0; i4 < length5; i4++) {
totalProperties = totalProperties.add(new vector_default(allPropertiesWeight[i4]));
}
var avgProperties = totalProperties.avg(length5);
avgProperties.normalize();
var variance = 0;
for (var i4 = 0; i4 < length5; i4++) {
var propertiesi = new vector_default(allPropertiesWeight[i4]);
var squareEuclideanDistance = propertiesi.squareEuclideanDistance(avgProperties);
variance += squareEuclideanDistance;
}
var squareEuclideanDistanceInfo = [];
nodes.forEach(function() {
squareEuclideanDistanceInfo.push([]);
});
for (var i4 = 0; i4 < length5; i4++) {
var propertiesi = new vector_default(allPropertiesWeight[i4]);
nodes[i4]["clusterInertial"] = 0;
for (var j4 = 0; j4 < length5; j4++) {
if (i4 === j4) {
squareEuclideanDistanceInfo[i4][j4] = 0;
continue;
}
var propertiesj = new vector_default(allPropertiesWeight[j4]);
squareEuclideanDistanceInfo[i4][j4] = propertiesi.squareEuclideanDistance(propertiesj);
nodes[i4]["clusterInertial"] += squareEuclideanDistanceInfo[i4][j4];
}
}
var inertialModularity = 0;
var param = 2 * length5 * variance;
for (var i4 = 0; i4 < length5; i4++) {
var clusteri = nodes[i4].clusterId;
for (var j4 = 0; j4 < length5; j4++) {
var clusterj = nodes[j4].clusterId;
if (i4 === j4 || clusteri !== clusterj)
continue;
var inertial = nodes[i4].clusterInertial * nodes[j4].clusterInertial / Math.pow(param, 2) - squareEuclideanDistanceInfo[i4][j4] / param;
inertialModularity += inertial;
}
}
return Number(inertialModularity.toFixed(4));
};
var louvain = function louvain2(graphData, directed, weightPropertyName, threshold, inertialModularity, inertialWeight) {
if (directed === void 0) {
directed = false;
}
if (weightPropertyName === void 0) {
weightPropertyName = "weight";
}
if (threshold === void 0) {
threshold = 1e-4;
}
if (inertialModularity === void 0) {
inertialModularity = false;
}
if (inertialWeight === void 0) {
inertialWeight = 1;
}
var _a6 = graphData.nodes, nodes = _a6 === void 0 ? [] : _a6, _b = graphData.edges, edges = _b === void 0 ? [] : _b;
var allPropertiesWeight = [];
if (inertialModularity) {
nodes.forEach(function(node, index2) {
node.properties = node.properties || {};
node.originIndex = index2;
});
var nodeTypeInfo_1 = [];
if (nodes.every(function(node) {
return node.hasOwnProperty("nodeType");
})) {
nodeTypeInfo_1 = Array.from(new Set(nodes.map(function(node) {
return node.nodeType;
})));
nodes.forEach(function(node) {
node.properties.nodeType = nodeTypeInfo_1.findIndex(function(nodeType) {
return nodeType === node.nodeType;
});
});
}
var properties = getAllProperties(nodes);
allPropertiesWeight = oneHot(properties);
}
var uniqueId5 = 1;
var clusters = {};
var nodeMap = {};
nodes.forEach(function(node, i4) {
var cid = String(uniqueId5++);
node.clusterId = cid;
clusters[cid] = {
id: cid,
nodes: [node]
};
nodeMap[node.id] = {
node,
idx: i4
};
});
var adjMatrix3 = adjacent_matrix_default(graphData, directed);
var ks = [];
var neighbors = {};
var m4 = 0;
adjMatrix3.forEach(function(row, i4) {
var k4 = 0;
var iid = nodes[i4].id;
neighbors[iid] = {};
row.forEach(function(entry, j4) {
if (!entry)
return;
k4 += entry;
var jid = nodes[j4].id;
neighbors[iid][jid] = entry;
m4 += entry;
});
ks.push(k4);
});
m4 /= 2;
var totalModularity = Infinity;
var previousModularity = Infinity;
var iter = 0;
var finalNodes = [];
var finalClusters = {};
while (true) {
if (inertialModularity && nodes.every(function(node) {
return node.hasOwnProperty("properties");
})) {
totalModularity = getModularity(nodes, adjMatrix3, ks, m4) + getInertialModularity(nodes, allPropertiesWeight) * inertialWeight;
} else {
totalModularity = getModularity(nodes, adjMatrix3, ks, m4);
}
if (iter === 0) {
previousModularity = totalModularity;
finalNodes = nodes;
finalClusters = clusters;
}
var increaseWithinThreshold = totalModularity > 0 && totalModularity > previousModularity && totalModularity - previousModularity < threshold;
if (totalModularity > previousModularity) {
finalNodes = nodes.map(function(node) {
return {
node,
clusterId: node.clusterId
};
});
finalClusters = clone_default(clusters);
previousModularity = totalModularity;
}
if (increaseWithinThreshold || iter > 100) {
break;
}
;
iter++;
Object.keys(clusters).forEach(function(clusterId) {
var sumTot = 0;
edges.forEach(function(edge2) {
var source = edge2.source, target = edge2.target;
var sourceClusterId = nodeMap[source].node.clusterId;
var targetClusterId = nodeMap[target].node.clusterId;
if (sourceClusterId === clusterId && targetClusterId !== clusterId || targetClusterId === clusterId && sourceClusterId !== clusterId) {
sumTot = sumTot + (edge2[weightPropertyName] || 1);
}
});
clusters[clusterId].sumTot = sumTot;
});
nodes.forEach(function(node, i4) {
var selfCluster = clusters[node.clusterId];
var bestIncrease = 0;
var bestCluster;
var commonParam = ks[i4] / (2 * m4);
var kiin = 0;
var selfClusterNodes = selfCluster.nodes;
selfClusterNodes.forEach(function(scNode) {
var scNodeIdx = nodeMap[scNode.id].idx;
kiin += adjMatrix3[i4][scNodeIdx] || 0;
});
var removeModurarity = kiin - selfCluster.sumTot * commonParam;
var selfClusterNodesAfterRemove = selfClusterNodes.filter(function(scNode) {
return scNode.id !== node.id;
});
var propertiesWeightRemove = [];
selfClusterNodesAfterRemove.forEach(function(nodeRemove, index2) {
propertiesWeightRemove[index2] = allPropertiesWeight[nodeRemove.originIndex];
});
var removeInertialModularity = getInertialModularity(selfClusterNodesAfterRemove, allPropertiesWeight) * inertialWeight;
var nodeNeighborIds = neighbors[node.id];
Object.keys(nodeNeighborIds).forEach(function(neighborNodeId) {
var neighborNode = nodeMap[neighborNodeId].node;
var neighborClusterId = neighborNode.clusterId;
if (neighborClusterId === node.clusterId)
return;
var neighborCluster = clusters[neighborClusterId];
var clusterNodes = neighborCluster.nodes;
if (!clusterNodes || !clusterNodes.length)
return;
var neighborClusterKiin = 0;
clusterNodes.forEach(function(cNode) {
var cNodeIdx = nodeMap[cNode.id].idx;
neighborClusterKiin += adjMatrix3[i4][cNodeIdx] || 0;
});
var addModurarity = neighborClusterKiin - neighborCluster.sumTot * commonParam;
var clusterNodesAfterAdd = clusterNodes.concat([node]);
var propertiesWeightAdd = [];
clusterNodesAfterAdd.forEach(function(nodeAdd, index2) {
propertiesWeightAdd[index2] = allPropertiesWeight[nodeAdd.originIndex];
});
var addInertialModularity = getInertialModularity(clusterNodesAfterAdd, allPropertiesWeight) * inertialWeight;
var increase = addModurarity - removeModurarity;
if (inertialModularity) {
increase = addModurarity + addInertialModularity - (removeModurarity + removeInertialModularity);
}
if (increase > bestIncrease) {
bestIncrease = increase;
bestCluster = neighborCluster;
}
});
if (bestIncrease > 0) {
bestCluster.nodes.push(node);
var previousClusterId_1 = node.clusterId;
node.clusterId = bestCluster.id;
var nodeInSelfClusterIdx = selfCluster.nodes.indexOf(node);
selfCluster.nodes.splice(nodeInSelfClusterIdx, 1);
var neighborClusterSumTot_1 = 0;
var selfClusterSumTot_1 = 0;
edges.forEach(function(edge2) {
var source = edge2.source, target = edge2.target;
var sourceClusterId = nodeMap[source].node.clusterId;
var targetClusterId = nodeMap[target].node.clusterId;
if (sourceClusterId === bestCluster.id && targetClusterId !== bestCluster.id || targetClusterId === bestCluster.id && sourceClusterId !== bestCluster.id) {
neighborClusterSumTot_1 = neighborClusterSumTot_1 + (edge2[weightPropertyName] || 1);
}
if (sourceClusterId === previousClusterId_1 && targetClusterId !== previousClusterId_1 || targetClusterId === previousClusterId_1 && sourceClusterId !== previousClusterId_1) {
selfClusterSumTot_1 = selfClusterSumTot_1 + (edge2[weightPropertyName] || 1);
}
});
bestCluster.sumTot = neighborClusterSumTot_1;
selfCluster.sumTot = selfClusterSumTot_1;
}
});
}
var newClusterIdMap = {};
var clusterIdx = 0;
Object.keys(finalClusters).forEach(function(clusterId) {
var cluster = finalClusters[clusterId];
if (!cluster.nodes || !cluster.nodes.length) {
delete finalClusters[clusterId];
return;
}
var newId = String(clusterIdx + 1);
if (newId === clusterId) {
return;
}
cluster.id = newId;
cluster.nodes = cluster.nodes.map(function(item) {
return {
id: item.id,
clusterId: newId
};
});
finalClusters[newId] = cluster;
newClusterIdMap[clusterId] = newId;
delete finalClusters[clusterId];
clusterIdx++;
});
finalNodes.forEach(function(nodeInfo) {
var node = nodeInfo.node, clusterId = nodeInfo.clusterId;
node.clusterId = clusterId;
if (node.clusterId && newClusterIdMap[node.clusterId])
node.clusterId = newClusterIdMap[node.clusterId];
});
var clusterEdges = [];
var clusterEdgeMap = {};
edges.forEach(function(edge2) {
var source = edge2.source, target = edge2.target;
var weight = edge2[weightPropertyName] || 1;
var sourceClusterId = nodeMap[source].node.clusterId;
var targetClusterId = nodeMap[target].node.clusterId;
var newEdgeId = "".concat(sourceClusterId, "---").concat(targetClusterId);
if (clusterEdgeMap[newEdgeId]) {
clusterEdgeMap[newEdgeId].weight += weight;
clusterEdgeMap[newEdgeId].count++;
} else {
var newEdge = {
source: sourceClusterId,
target: targetClusterId,
weight,
count: 1
};
clusterEdgeMap[newEdgeId] = newEdge;
clusterEdges.push(newEdge);
}
});
var clustersArray = [];
Object.keys(finalClusters).forEach(function(clusterId) {
clustersArray.push(finalClusters[clusterId]);
});
return {
clusters: clustersArray,
clusterEdges
};
};
var louvain_default = louvain;
// node_modules/@antv/algorithm/es/i-louvain.js
var iLouvain = function iLouvain2(graphData, directed, weightPropertyName, threshold, inertialWeight) {
if (directed === void 0) {
directed = false;
}
if (weightPropertyName === void 0) {
weightPropertyName = "weight";
}
if (threshold === void 0) {
threshold = 1e-4;
}
if (inertialWeight === void 0) {
inertialWeight = 1;
}
return louvain_default(graphData, directed, weightPropertyName, threshold, true, inertialWeight);
};
var i_louvain_default = iLouvain;
// node_modules/@antv/algorithm/es/k-core.js
var kCore = function kCore2(graphData, k4) {
var _a6;
if (k4 === void 0) {
k4 = 1;
}
var data3 = clone_default(graphData);
var _b = data3.nodes, nodes = _b === void 0 ? [] : _b;
var _c = data3.edges, edges = _c === void 0 ? [] : _c;
var _loop_1 = function _loop_12() {
var degrees = degree_default({
nodes,
edges
});
var nodeIds = Object.keys(degrees);
nodeIds.sort(function(a4, b10) {
var _a7, _b2;
return ((_a7 = degrees[a4]) === null || _a7 === void 0 ? void 0 : _a7.degree) - ((_b2 = degrees[b10]) === null || _b2 === void 0 ? void 0 : _b2.degree);
});
var minIndexId = nodeIds[0];
if (!nodes.length || ((_a6 = degrees[minIndexId]) === null || _a6 === void 0 ? void 0 : _a6.degree) >= k4) {
return "break";
}
var originIndex = nodes.findIndex(function(node) {
return node.id === minIndexId;
});
nodes.splice(originIndex, 1);
edges = edges.filter(function(edge2) {
return !(edge2.source === minIndexId || edge2.target === minIndexId);
});
};
while (true) {
var state_1 = _loop_1();
if (state_1 === "break")
break;
}
return {
nodes,
edges
};
};
var k_core_default = kCore;
// node_modules/@antv/algorithm/es/k-means.js
var kMeans = function kMeans2(data3, k4, involvedKeys, uninvolvedKeys, propertyKey, distanceType) {
if (k4 === void 0) {
k4 = 3;
}
if (involvedKeys === void 0) {
involvedKeys = [];
}
if (uninvolvedKeys === void 0) {
uninvolvedKeys = [];
}
if (propertyKey === void 0) {
propertyKey = "properties";
}
if (distanceType === void 0) {
distanceType = DistanceType.EuclideanDistance;
}
var nodes = data3.nodes, edges = data3.edges;
var properties = getAllProperties(nodes, propertyKey);
var allPropertiesWeight = oneHot(properties, involvedKeys, uninvolvedKeys);
for (var i4 = 0; i4 < nodes.length; i4++) {
nodes[i4].originIndex = i4;
}
var centroids = [];
var centroidIndexList = [];
var clusters = [];
for (var i4 = 0; i4 < k4; i4++) {
if (i4 === 0) {
var randomIndex = Math.floor(Math.random() * nodes.length);
centroids[i4] = allPropertiesWeight[randomIndex];
centroidIndexList.push(randomIndex);
clusters[i4] = [nodes[randomIndex]];
nodes[randomIndex].clusterId = String(i4);
} else {
var maxDistance = -Infinity;
var maxDistanceIndex = 0;
for (var m4 = 0; m4 < nodes.length; m4++) {
if (!centroidIndexList.includes(m4)) {
var totalDistance = 0;
for (var j4 = 0; j4 < centroids.length; j4++) {
var distance15 = getDistance(allPropertiesWeight[nodes[m4].originIndex], centroids[j4], distanceType);
totalDistance += distance15;
}
var avgDistance = totalDistance / centroids.length;
if (avgDistance > maxDistance) {
maxDistance = avgDistance;
maxDistanceIndex = m4;
}
}
}
centroids[i4] = allPropertiesWeight[maxDistanceIndex];
centroidIndexList.push(maxDistanceIndex);
clusters[i4] = [nodes[maxDistanceIndex]];
nodes[maxDistanceIndex].clusterId = String(i4);
}
}
var iterations = 0;
while (true) {
for (var i4 = 0; i4 < nodes.length; i4++) {
var minDistanceIndex = 0;
var minDistance = Infinity;
if (!(iterations === 0 && centroidIndexList.includes(i4))) {
for (var j4 = 0; j4 < centroids.length; j4++) {
var distance15 = getDistance(allPropertiesWeight[i4], centroids[j4], distanceType);
if (distance15 < minDistance) {
minDistance = distance15;
minDistanceIndex = j4;
}
}
if (nodes[i4].clusterId !== String(minDistanceIndex)) {
for (var n3 = 0; n3 < clusters[minDistanceIndex].length; n3++) {
if (clusters[minDistanceIndex][n3].id === nodes[i4].id) {
clusters[minDistanceIndex].splice(n3, 1);
}
}
clusters[minDistanceIndex].push(nodes[i4]);
nodes[i4].clusterId = String(minDistanceIndex);
}
}
}
var centroidsEqualAvg = false;
for (var i4 = 0; i4 < clusters.length; i4++) {
var clusterNodes = clusters[i4];
var totalVector = new vector_default([]);
for (var j4 = 0; j4 < clusterNodes.length; j4++) {
totalVector = totalVector.add(new vector_default(allPropertiesWeight[clusterNodes[j4].originIndex]));
}
var avgVector = totalVector.avg(clusterNodes.length);
if (!avgVector.equal(new vector_default(centroids[i4]))) {
centroidsEqualAvg = true;
centroids[i4] = avgVector.getArr();
}
}
iterations++;
if (centroidsEqualAvg || iterations >= 1e3) {
break;
}
}
var clusterEdges = [];
var clusterEdgeMap = {};
edges.forEach(function(edge2) {
var _a6, _b;
var source = edge2.source, target = edge2.target;
var sourceClusterId = (_a6 = nodes.find(function(node) {
return node.id === source;
})) === null || _a6 === void 0 ? void 0 : _a6.clusterId;
var targetClusterId = (_b = nodes.find(function(node) {
return node.id === target;
})) === null || _b === void 0 ? void 0 : _b.clusterId;
var newEdgeId = "".concat(sourceClusterId, "---").concat(targetClusterId);
if (clusterEdgeMap[newEdgeId]) {
clusterEdgeMap[newEdgeId].count++;
} else {
var newEdge = {
source: sourceClusterId,
target: targetClusterId,
count: 1
};
clusterEdgeMap[newEdgeId] = newEdge;
clusterEdges.push(newEdge);
}
});
return {
clusters,
clusterEdges
};
};
var k_means_default = kMeans;
// node_modules/@antv/algorithm/es/cosine-similarity.js
var cosineSimilarity = function cosineSimilarity2(item, targetItem) {
var targetItemVector = new vector_default(targetItem);
var targetNodeNorm2 = targetItemVector.norm2();
var itemVector = new vector_default(item);
var itemNorm2 = itemVector.norm2();
var dot7 = targetItemVector.dot(itemVector);
var norm2Product = targetNodeNorm2 * itemNorm2;
var cosineSimilarity3 = norm2Product ? dot7 / norm2Product : 0;
return cosineSimilarity3;
};
var cosine_similarity_default = cosineSimilarity;
// node_modules/@antv/algorithm/es/nodes-cosine-similarity.js
var nodesCosineSimilarity = function nodesCosineSimilarity2(nodes, seedNode, involvedKeys, uninvolvedKeys, propertyKey) {
if (nodes === void 0) {
nodes = [];
}
if (involvedKeys === void 0) {
involvedKeys = [];
}
if (uninvolvedKeys === void 0) {
uninvolvedKeys = [];
}
if (propertyKey === void 0) {
propertyKey = "properties";
}
var similarNodes = clone_default(nodes.filter(function(node) {
return node.id !== seedNode.id;
}));
var seedNodeIndex = nodes.findIndex(function(node) {
return node.id === seedNode.id;
});
var properties = getAllProperties(nodes, propertyKey);
var allPropertiesWeight = oneHot(properties, involvedKeys, uninvolvedKeys);
var seedNodeProperties = allPropertiesWeight[seedNodeIndex];
var allCosineSimilarity = [];
similarNodes.forEach(function(node, index2) {
if (node.id !== seedNode.id) {
var nodeProperties = allPropertiesWeight[index2];
var cosineSimilarityValue = cosine_similarity_default(nodeProperties, seedNodeProperties);
allCosineSimilarity.push(cosineSimilarityValue);
node.cosineSimilarity = cosineSimilarityValue;
}
});
similarNodes.sort(function(a4, b10) {
return b10.cosineSimilarity - a4.cosineSimilarity;
});
return {
allCosineSimilarity,
similarNodes
};
};
var nodes_cosine_similarity_default = nodesCosineSimilarity;
// node_modules/@antv/algorithm/es/structs/union-find.js
var UnionFind = function() {
function UnionFind2(items) {
this.count = items.length;
this.parent = {};
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
var i4 = items_1[_i];
this.parent[i4] = i4;
}
}
UnionFind2.prototype.find = function(item) {
while (this.parent[item] !== item) {
item = this.parent[item];
}
return item;
};
UnionFind2.prototype.union = function(a4, b10) {
var rootA = this.find(a4);
var rootB = this.find(b10);
if (rootA === rootB)
return;
if (rootA < rootB) {
if (this.parent[b10] !== b10)
this.union(this.parent[b10], a4);
this.parent[b10] = this.parent[a4];
} else {
if (this.parent[a4] !== a4)
this.union(this.parent[a4], b10);
this.parent[a4] = this.parent[b10];
}
};
UnionFind2.prototype.connected = function(a4, b10) {
return this.find(a4) === this.find(b10);
};
return UnionFind2;
}();
var union_find_default = UnionFind;
// node_modules/@antv/algorithm/es/structs/binary-heap.js
var defaultCompare = function defaultCompare2(a4, b10) {
return a4 - b10;
};
var MinBinaryHeap = function() {
function MinBinaryHeap2(compareFn) {
if (compareFn === void 0) {
compareFn = defaultCompare;
}
this.compareFn = compareFn;
this.list = [];
}
MinBinaryHeap2.prototype.getLeft = function(index2) {
return 2 * index2 + 1;
};
MinBinaryHeap2.prototype.getRight = function(index2) {
return 2 * index2 + 2;
};
MinBinaryHeap2.prototype.getParent = function(index2) {
if (index2 === 0) {
return null;
}
return Math.floor((index2 - 1) / 2);
};
MinBinaryHeap2.prototype.isEmpty = function() {
return this.list.length <= 0;
};
MinBinaryHeap2.prototype.top = function() {
return this.isEmpty() ? void 0 : this.list[0];
};
MinBinaryHeap2.prototype.delMin = function() {
var top = this.top();
var bottom = this.list.pop();
if (this.list.length > 0) {
this.list[0] = bottom;
this.moveDown(0);
}
return top;
};
MinBinaryHeap2.prototype.insert = function(value2) {
if (value2 !== null) {
this.list.push(value2);
var index2 = this.list.length - 1;
this.moveUp(index2);
return true;
}
return false;
};
MinBinaryHeap2.prototype.moveUp = function(index2) {
var parent = this.getParent(index2);
while (index2 && index2 > 0 && this.compareFn(this.list[parent], this.list[index2]) > 0) {
var tmp = this.list[parent];
this.list[parent] = this.list[index2];
this.list[index2] = tmp;
index2 = parent;
parent = this.getParent(index2);
}
};
MinBinaryHeap2.prototype.moveDown = function(index2) {
var _a6;
var element = index2;
var left2 = this.getLeft(index2);
var right2 = this.getRight(index2);
var size2 = this.list.length;
if (left2 !== null && left2 < size2 && this.compareFn(this.list[element], this.list[left2]) > 0) {
element = left2;
} else if (right2 !== null && right2 < size2 && this.compareFn(this.list[element], this.list[right2]) > 0) {
element = right2;
}
if (index2 !== element) {
_a6 = [this.list[element], this.list[index2]], this.list[index2] = _a6[0], this.list[element] = _a6[1];
this.moveDown(element);
}
};
return MinBinaryHeap2;
}();
var binary_heap_default = MinBinaryHeap;
// node_modules/@antv/algorithm/es/mts.js
var primMST = function primMST2(graphData, weight) {
var selectedEdges = [];
var _a6 = graphData.nodes, nodes = _a6 === void 0 ? [] : _a6, _b = graphData.edges, edges = _b === void 0 ? [] : _b;
if (nodes.length === 0) {
return selectedEdges;
}
var currNode = nodes[0];
var visited = new Set();
visited.add(currNode);
var compareWeight = function compareWeight2(a4, b10) {
if (weight) {
return a4.weight - b10.weight;
}
return 0;
};
var edgeQueue = new binary_heap_default(compareWeight);
getEdgesByNodeId(currNode.id, edges).forEach(function(edge2) {
edgeQueue.insert(edge2);
});
while (!edgeQueue.isEmpty()) {
var currEdge = edgeQueue.delMin();
var source = currEdge.source;
var target = currEdge.target;
if (visited.has(source) && visited.has(target))
continue;
selectedEdges.push(currEdge);
if (!visited.has(source)) {
visited.add(source);
getEdgesByNodeId(source, edges).forEach(function(edge2) {
edgeQueue.insert(edge2);
});
}
if (!visited.has(target)) {
visited.add(target);
getEdgesByNodeId(target, edges).forEach(function(edge2) {
edgeQueue.insert(edge2);
});
}
}
return selectedEdges;
};
var kruskalMST = function kruskalMST2(graphData, weight) {
var selectedEdges = [];
var _a6 = graphData.nodes, nodes = _a6 === void 0 ? [] : _a6, _b = graphData.edges, edges = _b === void 0 ? [] : _b;
if (nodes.length === 0) {
return selectedEdges;
}
var weightEdges = edges.map(function(edge2) {
return edge2;
});
if (weight) {
weightEdges.sort(function(a4, b10) {
return a4.weight - b10.weight;
});
}
var disjointSet = new union_find_default(nodes.map(function(n3) {
return n3.id;
}));
while (weightEdges.length > 0) {
var curEdge = weightEdges.shift();
var source = curEdge.source;
var target = curEdge.target;
if (!disjointSet.connected(source, target)) {
selectedEdges.push(curEdge);
disjointSet.union(source, target);
}
}
return selectedEdges;
};
var minimumSpanningTree = function minimumSpanningTree2(graphData, weight, algo) {
var algos = {
prim: primMST,
kruskal: kruskalMST
};
if (!algo)
return kruskalMST(graphData, weight);
return algos[algo](graphData, weight);
};
var mts_default = minimumSpanningTree;
// node_modules/@antv/algorithm/es/pageRank.js
var pageRank = function pageRank2(graphData, epsilon, linkProb) {
if (typeof epsilon !== "number")
epsilon = 1e-6;
if (typeof linkProb !== "number")
linkProb = 0.85;
var distance15 = 1;
var leakedRank = 0;
var maxIterations = 1e3;
var _a6 = graphData.nodes, nodes = _a6 === void 0 ? [] : _a6, _b = graphData.edges, edges = _b === void 0 ? [] : _b;
var nodesCount = nodes.length;
var currentRank;
var curRanks = {};
var prevRanks = {};
for (var j4 = 0; j4 < nodesCount; ++j4) {
var node = nodes[j4];
var nodeId = node.id;
curRanks[nodeId] = 1 / nodesCount;
prevRanks[nodeId] = 1 / nodesCount;
}
var nodeDegree = degree_default(graphData);
while (maxIterations > 0 && distance15 > epsilon) {
leakedRank = 0;
for (var j4 = 0; j4 < nodesCount; ++j4) {
var node = nodes[j4];
var nodeId = node.id;
currentRank = 0;
if (nodeDegree[node.id].inDegree === 0) {
curRanks[nodeId] = 0;
} else {
var neighbors = getNeighbors(nodeId, edges, "source");
for (var i4 = 0; i4 < neighbors.length; ++i4) {
var neighbor = neighbors[i4];
var outDegree = nodeDegree[neighbor].outDegree;
if (outDegree > 0)
currentRank += prevRanks[neighbor] / outDegree;
}
curRanks[nodeId] = linkProb * currentRank;
leakedRank += curRanks[nodeId];
}
}
leakedRank = (1 - leakedRank) / nodesCount;
distance15 = 0;
for (var j4 = 0; j4 < nodesCount; ++j4) {
var node = nodes[j4];
var nodeId = node.id;
currentRank = curRanks[nodeId] + leakedRank;
distance15 += Math.abs(currentRank - prevRanks[nodeId]);
prevRanks[nodeId] = currentRank;
}
maxIterations -= 1;
}
return prevRanks;
};
var pageRank_default = pageRank;
// node_modules/@antv/algorithm/es/gSpan/struct.js
var VACANT_EDGE_ID = -1;
var VACANT_NODE_ID = -1;
var VACANT_EDGE_LABEL = "-1";
var VACANT_NODE_LABEL = "-1";
var VACANT_GRAPH_ID = -1;
var Edge2 = function() {
function Edge4(id, from, to, label17) {
if (id === void 0) {
id = VACANT_EDGE_ID;
}
if (from === void 0) {
from = VACANT_NODE_ID;
}
if (to === void 0) {
to = VACANT_NODE_ID;
}
if (label17 === void 0) {
label17 = VACANT_EDGE_LABEL;
}
this.id = id;
this.from = from;
this.to = to;
this.label = label17;
}
return Edge4;
}();
var Node3 = function() {
function Node5(id, label17) {
if (id === void 0) {
id = VACANT_NODE_ID;
}
if (label17 === void 0) {
label17 = VACANT_NODE_LABEL;
}
this.id = id;
this.label = label17;
this.edges = [];
this.edgeMap = {};
}
Node5.prototype.addEdge = function(edge2) {
this.edges.push(edge2);
this.edgeMap[edge2.id] = edge2;
};
return Node5;
}();
var Graph = function() {
function Graph10(id, edgeIdAutoIncrease, directed) {
if (id === void 0) {
id = VACANT_NODE_ID;
}
if (edgeIdAutoIncrease === void 0) {
edgeIdAutoIncrease = true;
}
if (directed === void 0) {
directed = false;
}
this.id = id;
this.edgeIdAutoIncrease = edgeIdAutoIncrease;
this.edges = [];
this.nodes = [];
this.nodeMap = {};
this.edgeMap = {};
this.nodeLabelMap = {};
this.edgeLabelMap = {};
this.counter = 0;
this.directed = directed;
}
Graph10.prototype.getNodeNum = function() {
return this.nodes.length;
};
Graph10.prototype.addNode = function(id, label17) {
if (this.nodeMap[id])
return;
var node = new Node3(id, label17);
this.nodes.push(node);
this.nodeMap[id] = node;
if (!this.nodeLabelMap[label17])
this.nodeLabelMap[label17] = [];
this.nodeLabelMap[label17].push(id);
};
Graph10.prototype.addEdge = function(id, from, to, label17) {
if (this.edgeIdAutoIncrease || id === void 0)
id = this.counter++;
if (this.nodeMap[from] && this.nodeMap[to] && this.nodeMap[to].edgeMap[id])
return;
var edge2 = new Edge2(id, from, to, label17);
this.edges.push(edge2);
this.edgeMap[id] = edge2;
this.nodeMap[from].addEdge(edge2);
if (!this.edgeLabelMap[label17])
this.edgeLabelMap[label17] = [];
this.edgeLabelMap[label17].push(edge2);
if (!this.directed) {
var rEdge = new Edge2(id, to, from, label17);
this.nodeMap[to].addEdge(rEdge);
this.edgeLabelMap[label17].push(rEdge);
}
};
return Graph10;
}();
// node_modules/@antv/algorithm/es/gSpan/gSpan.js
var DFSedge = function() {
function DFSedge2(fromNode, toNode, fromNodeLabel, edgeLabel, toNodeLabel) {
this.fromNode = fromNode;
this.toNode = toNode;
this.nodeEdgeNodeLabel = {
nodeLabel1: fromNodeLabel || VACANT_NODE_LABEL,
edgeLabel: edgeLabel || VACANT_EDGE_LABEL,
nodeLabel2: toNodeLabel || VACANT_NODE_LABEL
};
}
DFSedge2.prototype.equalTo = function(other2) {
return this.fromNode === other2.formNode && this.toNode === other2.toNode && this.nodeEdgeNodeLabel === other2.nodeEdgeNodeLabel;
};
DFSedge2.prototype.notEqualTo = function(other2) {
return !this.equalTo(other2);
};
return DFSedge2;
}();
var DFScode = function() {
function DFScode2() {
this.rmpath = [];
this.dfsEdgeList = [];
}
DFScode2.prototype.equalTo = function(other2) {
var aLength = this.dfsEdgeList.length;
var bLength = other2.length;
if (aLength !== bLength)
return false;
for (var i4 = 0; i4 < aLength; i4++) {
if (this.dfsEdgeList[i4] !== other2[i4])
return false;
}
return true;
};
DFScode2.prototype.notEqualTo = function(other2) {
return !this.equalTo(other2);
};
DFScode2.prototype.pushBack = function(fromNode, toNode, fromNodeLabel, edgeLabel, toNodeLabel) {
this.dfsEdgeList.push(new DFSedge(fromNode, toNode, fromNodeLabel, edgeLabel, toNodeLabel));
return this.dfsEdgeList;
};
DFScode2.prototype.toGraph = function(graphId, directed) {
if (graphId === void 0) {
graphId = VACANT_GRAPH_ID;
}
if (directed === void 0) {
directed = false;
}
var graph = new Graph(graphId, true, directed);
this.dfsEdgeList.forEach(function(dfsEdge) {
var fromNodeId = dfsEdge.fromNode;
var toNodeId = dfsEdge.toNode;
var _a6 = dfsEdge.nodeEdgeNodeLabel, nodeLabel1 = _a6.nodeLabel1, edgeLabel = _a6.edgeLabel, nodeLabel2 = _a6.nodeLabel2;
if (nodeLabel1 !== VACANT_NODE_LABEL)
graph.addNode(fromNodeId, nodeLabel1);
if (nodeLabel2 !== VACANT_NODE_LABEL)
graph.addNode(toNodeId, nodeLabel2);
if (nodeLabel1 !== VACANT_NODE_LABEL && nodeLabel2 !== nodeLabel1)
graph.addEdge(void 0, fromNodeId, toNodeId, edgeLabel);
});
return graph;
};
DFScode2.prototype.buildRmpath = function() {
this.rmpath = [];
var oldFrom = void 0;
var selfLength = this.dfsEdgeList.length;
for (var i4 = selfLength - 1; i4 >= 0; i4--) {
var dfsEdge = this.dfsEdgeList[i4];
var fromNodeIdx = dfsEdge.fromNode;
var toNodeIdx = dfsEdge.toNode;
if (fromNodeIdx < toNodeIdx && (oldFrom === void 0 || toNodeIdx === oldFrom)) {
this.rmpath.push(i4);
oldFrom = fromNodeIdx;
}
}
return this.rmpath;
};
DFScode2.prototype.getNodeNum = function() {
var nodeMap = {};
this.dfsEdgeList.forEach(function(dfsEdge) {
if (!nodeMap[dfsEdge.fromNode])
nodeMap[dfsEdge.fromNode] = true;
if (!nodeMap[dfsEdge.toNode])
nodeMap[dfsEdge.toNode] = true;
});
return Object.keys(nodeMap).length;
};
return DFScode2;
}();
var History = function() {
function History2(pdfs) {
this.his = {};
this.nodesUsed = {};
this.edgesUsed = {};
this.edges = [];
if (!pdfs)
return;
while (pdfs) {
var e4 = pdfs.edge;
this.edges.push(e4);
this.nodesUsed[e4.from] = 1;
this.nodesUsed[e4.to] = 1;
this.edgesUsed[e4.id] = 1;
pdfs = pdfs.preNode;
}
this.edges = this.edges.reverse();
}
History2.prototype.hasNode = function(node) {
return this.nodesUsed[node.id] === 1;
};
History2.prototype.hasEdge = function(edge2) {
return this.edgesUsed[edge2.id] === 1;
};
return History2;
}();
var GSpan = function() {
function GSpan2(_a6) {
var graphs8 = _a6.graphs, _b = _a6.minSupport, minSupport = _b === void 0 ? 2 : _b, _c = _a6.minNodeNum, minNodeNum = _c === void 0 ? 1 : _c, _d = _a6.maxNodeNum, maxNodeNum = _d === void 0 ? 4 : _d, _e = _a6.top, top = _e === void 0 ? 10 : _e, _f = _a6.directed, directed = _f === void 0 ? false : _f, _g = _a6.verbose, verbose = _g === void 0 ? false : _g;
this.graphs = graphs8;
this.dfsCode = new DFScode();
this.support = 0;
this.frequentSize1Subgraphs = [];
this.frequentSubgraphs = [];
this.minSupport = minSupport;
this.top = top;
this.directed = directed;
this.counter = 0;
this.maxNodeNum = maxNodeNum;
this.minNodeNum = minNodeNum;
this.verbose = verbose;
if (this.maxNodeNum < this.minNodeNum)
this.maxNodeNum = this.minNodeNum;
this.reportDF = [];
}
GSpan2.prototype.findForwardRootEdges = function(graph, fromNode) {
var _this = this;
var result = [];
var nodeMap = graph.nodeMap;
fromNode.edges.forEach(function(edge2) {
if (_this.directed || fromNode.label <= nodeMap[edge2.to].label)
result.push(edge2);
});
return result;
};
GSpan2.prototype.findBackwardEdge = function(graph, edge1, edge2, history) {
if (!this.directed && edge1 === edge2)
return null;
var nodeMap = graph.nodeMap;
var edge2To = nodeMap[edge2.to];
var edge2ToEdges = edge2To.edges;
var edgeLength = edge2ToEdges.length;
for (var i4 = 0; i4 < edgeLength; i4++) {
var edge3 = edge2ToEdges[i4];
if (history.hasEdge(edge3) || edge3.to !== edge1.from)
continue;
if (!this.directed) {
if (edge1.label < edge3.label || edge1.label === edge3.label && nodeMap[edge1.to].label <= nodeMap[edge2.to].label) {
return edge3;
}
} else {
if (nodeMap[edge1.from].label < nodeMap[edge2.to].label || nodeMap[edge1.from].label === nodeMap[edge2.to].label && edge1.label <= edge3.label) {
return edge3;
}
}
}
return null;
};
GSpan2.prototype.findForwardPureEdges = function(graph, rightmostEdge, minNodeLabel, history) {
var result = [];
var rightmostEdgeToId = rightmostEdge.to;
var edges = graph.nodeMap[rightmostEdgeToId].edges;
var edgeLength = edges.length;
for (var i4 = 0; i4 < edgeLength; i4++) {
var edge2 = edges[i4];
var toNode = graph.nodeMap[edge2.to];
if (minNodeLabel <= toNode.label && !history.hasNode(toNode)) {
result.push(edge2);
}
}
return result;
};
GSpan2.prototype.findForwardRmpathEdges = function(graph, rightmostEdge, minNodeLabel, history) {
var result = [];
var nodeMap = graph.nodeMap;
var toNodeLabel = nodeMap[rightmostEdge.to].label;
var fromNode = nodeMap[rightmostEdge.from];
var edges = fromNode.edges;
var edgeLength = edges.length;
for (var i4 = 0; i4 < edgeLength; i4++) {
var edge2 = edges[i4];
var newToNodeLabel = nodeMap[edge2.to].label;
if (rightmostEdge.to === edge2.to || minNodeLabel > newToNodeLabel || history.hasNode(nodeMap[edge2.to])) {
continue;
}
if (rightmostEdge.label < edge2.label || rightmostEdge.label === edge2.label && toNodeLabel <= newToNodeLabel) {
result.push(edge2);
}
}
return result;
};
GSpan2.prototype.getSupport = function(projected) {
var graphMap = {};
projected.forEach(function(pro) {
if (!graphMap[pro.graphId])
graphMap[pro.graphId] = true;
});
return Object.keys(graphMap).length;
};
GSpan2.prototype.findMinLabel = function(obj) {
var minLabel = void 0;
Object.keys(obj).forEach(function(nodeEdgeNodeLabel) {
var _a6 = obj[nodeEdgeNodeLabel], nodeLabel1 = _a6.nodeLabel1, edgeLabel = _a6.edgeLabel, nodeLabel2 = _a6.nodeLabel2;
if (!minLabel) {
minLabel = {
nodeLabel1,
edgeLabel,
nodeLabel2
};
return;
}
if (nodeLabel1 < minLabel.nodeLabel1 || nodeLabel1 === minLabel.nodeLabel1 && edgeLabel < minLabel.edgeLabel || nodeLabel1 === minLabel.nodeLabel1 && edgeLabel === minLabel.edgeLabel && nodeLabel2 < minLabel.nodeLabel2) {
minLabel = {
nodeLabel1,
edgeLabel,
nodeLabel2
};
}
});
return minLabel;
};
GSpan2.prototype.isMin = function() {
var _this = this;
var dfsCode = this.dfsCode;
if (this.verbose)
console.log("isMin checking", dfsCode);
if (dfsCode.dfsEdgeList.length === 1)
return true;
var directed = this.directed;
var graph = dfsCode.toGraph(VACANT_GRAPH_ID, directed);
var nodeMap = graph.nodeMap;
var dfsCodeMin = new DFScode();
var root = {};
graph.nodes.forEach(function(node) {
var forwardEdges = _this.findForwardRootEdges(graph, node);
forwardEdges.forEach(function(edge2) {
var otherNode = nodeMap[edge2.to];
var nodeEdgeNodeLabel = "".concat(node.label, "-").concat(edge2.label, "-").concat(otherNode.label);
if (!root[nodeEdgeNodeLabel])
root[nodeEdgeNodeLabel] = {
projected: [],
nodeLabel1: node.label,
edgeLabel: edge2.label,
nodeLabel2: otherNode.label
};
var pdfs = {
graphId: graph.id,
edge: edge2,
preNode: null
};
root[nodeEdgeNodeLabel].projected.push(pdfs);
});
});
var minLabel = this.findMinLabel(root);
if (!minLabel)
return;
dfsCodeMin.dfsEdgeList.push(new DFSedge(0, 1, minLabel.nodeLabel1, minLabel.edgeLabel, minLabel.nodeLabel2));
var projectIsMin = function projectIsMin2(projected) {
var rmpath = dfsCodeMin.buildRmpath();
var minNodeLabel = dfsCodeMin.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1;
var maxToC = dfsCodeMin.dfsEdgeList[rmpath[0]].toNode;
var backwardRoot = {};
var flag = false, newTo = 0;
var end2 = directed ? -1 : 0;
var _loop_1 = function _loop_12(i5) {
if (flag)
return "break";
projected.forEach(function(p4) {
var history = new History(p4);
var backwardEdge = _this.findBackwardEdge(graph, history.edges[rmpath[i5]], history.edges[rmpath[0]], history);
if (backwardEdge) {
if (!backwardRoot[backwardEdge.label]) {
backwardRoot[backwardEdge.label] = {
projected: [],
edgeLabel: backwardEdge.label
};
}
backwardRoot[backwardEdge.label].projected.push({
graphId: graph.id,
edge: backwardRoot,
preNode: p4
});
newTo = dfsCodeMin.dfsEdgeList[rmpath[i5]].fromNode;
flag = true;
}
});
};
for (var i4 = rmpath.length - 1; i4 > end2; i4--) {
var state_1 = _loop_1(i4);
if (state_1 === "break")
break;
}
if (flag) {
var minBackwardEdgeLabel = _this.findMinLabel(backwardRoot);
dfsCodeMin.dfsEdgeList.push(new DFSedge(maxToC, newTo, VACANT_NODE_LABEL, minBackwardEdgeLabel.edgeLabel, VACANT_NODE_LABEL));
var idx_1 = dfsCodeMin.dfsEdgeList.length - 1;
if (_this.dfsCode.dfsEdgeList[idx_1] !== dfsCodeMin.dfsEdgeList[idx_1])
return false;
return projectIsMin2(backwardRoot[minBackwardEdgeLabel.edgeLabel].projected);
}
var forwardRoot = {};
flag = false;
var newFrom = 0;
projected.forEach(function(p4) {
var history = new History(p4);
var forwardPureEdges = _this.findForwardPureEdges(graph, history.edges[rmpath[0]], minNodeLabel, history);
if (forwardPureEdges.length > 0) {
flag = true;
newFrom = maxToC;
forwardPureEdges.forEach(function(edge2) {
var key2 = "".concat(edge2.label, "-").concat(nodeMap[edge2.to].label);
if (!forwardRoot[key2])
forwardRoot[key2] = {
projected: [],
edgeLabel: edge2.label,
nodeLabel2: nodeMap[edge2.to].label
};
forwardRoot[key2].projected.push({
graphId: graph.id,
edge: edge2,
preNode: p4
});
});
}
});
var pathLength = rmpath.length;
var _loop_2 = function _loop_22(i5) {
if (flag)
return "break";
var value2 = rmpath[i5];
projected.forEach(function(p4) {
var history = new History(p4);
var forwardRmpathEdges = _this.findForwardRmpathEdges(graph, history.edges[value2], minNodeLabel, history);
if (forwardRmpathEdges.length > 0) {
flag = true;
newFrom = dfsCodeMin.dfsEdgeList[value2].fromNode;
forwardRmpathEdges.forEach(function(edge2) {
var key2 = "".concat(edge2.label, "-").concat(nodeMap[edge2.to].label);
if (!forwardRoot[key2])
forwardRoot[key2] = {
projected: [],
edgeLabel: edge2.label,
nodeLabel2: nodeMap[edge2.to].label
};
forwardRoot[key2].projected.push({
graphId: graph.id,
edge: edge2,
preNode: p4
});
});
}
});
};
for (var i4 = 0; i4 < pathLength; i4++) {
var state_2 = _loop_2(i4);
if (state_2 === "break")
break;
}
if (!flag)
return true;
var forwardMinEdgeNodeLabel = _this.findMinLabel(forwardRoot);
dfsCodeMin.dfsEdgeList.push(new DFSedge(newFrom, maxToC + 1, VACANT_NODE_LABEL, forwardMinEdgeNodeLabel.edgeLabel, forwardMinEdgeNodeLabel.nodeLabel2));
var idx = dfsCodeMin.dfsEdgeList.length - 1;
if (dfsCode.dfsEdgeList[idx] !== dfsCodeMin.dfsEdgeList[idx])
return false;
return projectIsMin2(forwardRoot["".concat(forwardMinEdgeNodeLabel.edgeLabel, "-").concat(forwardMinEdgeNodeLabel.nodeLabel2)].projected);
};
var key = "".concat(minLabel.nodeLabel1, "-").concat(minLabel.edgeLabel, "-").concat(minLabel.nodeLabel2);
return projectIsMin(root[key].projected);
};
GSpan2.prototype.report = function() {
if (this.dfsCode.getNodeNum() < this.minNodeNum)
return;
this.counter++;
var graph = this.dfsCode.toGraph(this.counter, this.directed);
this.frequentSubgraphs.push(clone_default(graph));
};
GSpan2.prototype.subGraphMining = function(projected) {
var _this = this;
var support = this.getSupport(projected);
if (support < this.minSupport)
return;
if (!this.isMin())
return;
this.report();
var nodeNum = this.dfsCode.getNodeNum();
var rmpath = this.dfsCode.buildRmpath();
var maxToC = this.dfsCode.dfsEdgeList[rmpath[0]].toNode;
var minNodeLabel = this.dfsCode.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1;
var forwardRoot = {};
var backwardRoot = {};
projected.forEach(function(p4) {
var graph = _this.graphs[p4.graphId];
var nodeMap = graph.nodeMap;
var history = new History(p4);
for (var i4 = rmpath.length - 1; i4 >= 0; i4--) {
var backwardEdge = _this.findBackwardEdge(graph, history.edges[rmpath[i4]], history.edges[rmpath[0]], history);
if (backwardEdge) {
var key = "".concat(_this.dfsCode.dfsEdgeList[rmpath[i4]].fromNode, "-").concat(backwardEdge.label);
if (!backwardRoot[key])
backwardRoot[key] = {
projected: [],
toNodeId: _this.dfsCode.dfsEdgeList[rmpath[i4]].fromNode,
edgeLabel: backwardEdge.label
};
backwardRoot[key].projected.push({
graphId: p4.graphId,
edge: backwardEdge,
preNode: p4
});
}
}
if (nodeNum >= _this.maxNodeNum)
return;
var forwardPureEdges = _this.findForwardPureEdges(graph, history.edges[rmpath[0]], minNodeLabel, history);
forwardPureEdges.forEach(function(edge2) {
var key2 = "".concat(maxToC, "-").concat(edge2.label, "-").concat(nodeMap[edge2.to].label);
if (!forwardRoot[key2])
forwardRoot[key2] = {
projected: [],
fromNodeId: maxToC,
edgeLabel: edge2.label,
nodeLabel2: nodeMap[edge2.to].label
};
forwardRoot[key2].projected.push({
graphId: p4.graphId,
edge: edge2,
preNode: p4
});
});
var _loop_3 = function _loop_32(i5) {
var forwardRmpathEdges = _this.findForwardRmpathEdges(graph, history.edges[rmpath[i5]], minNodeLabel, history);
forwardRmpathEdges.forEach(function(edge2) {
var key2 = "".concat(_this.dfsCode.dfsEdgeList[rmpath[i5]].fromNode, "-").concat(edge2.label, "-").concat(nodeMap[edge2.to].label);
if (!forwardRoot[key2])
forwardRoot[key2] = {
projected: [],
fromNodeId: _this.dfsCode.dfsEdgeList[rmpath[i5]].fromNode,
edgeLabel: edge2.label,
nodeLabel2: nodeMap[edge2.to].label
};
forwardRoot[key2].projected.push({
graphId: p4.graphId,
edge: edge2,
preNode: p4
});
});
};
for (var i4 = 0; i4 < rmpath.length; i4++) {
_loop_3(i4);
}
});
Object.keys(backwardRoot).forEach(function(key) {
var _a6 = backwardRoot[key], toNodeId = _a6.toNodeId, edgeLabel = _a6.edgeLabel;
_this.dfsCode.dfsEdgeList.push(new DFSedge(maxToC, toNodeId, "-1", edgeLabel, "-1"));
_this.subGraphMining(backwardRoot[key].projected);
_this.dfsCode.dfsEdgeList.pop();
});
Object.keys(forwardRoot).forEach(function(key) {
var _a6 = forwardRoot[key], fromNodeId = _a6.fromNodeId, edgeLabel = _a6.edgeLabel, nodeLabel2 = _a6.nodeLabel2;
_this.dfsCode.dfsEdgeList.push(new DFSedge(fromNodeId, maxToC + 1, VACANT_NODE_LABEL, edgeLabel, nodeLabel2));
_this.subGraphMining(forwardRoot[key].projected);
_this.dfsCode.dfsEdgeList.pop();
});
};
GSpan2.prototype.generate1EdgeFrequentSubGraphs = function() {
var graphs8 = this.graphs;
var directed = this.directed;
var minSupport = this.minSupport;
var frequentSize1Subgraphs = this.frequentSize1Subgraphs;
var nodeLabelCounter = {}, nodeEdgeNodeCounter = {};
var nodeLableCounted = {};
var nodeEdgeNodeLabelCounted = {};
Object.keys(graphs8).forEach(function(key) {
var graph = graphs8[key];
var nodeMap = graph.nodeMap;
graph.nodes.forEach(function(node, i4) {
var nodeLabel = node.label;
var graphNodeKey = "".concat(key, "-").concat(nodeLabel);
if (!nodeLableCounted[graphNodeKey]) {
var counter = nodeLabelCounter[nodeLabel] || 0;
counter++;
nodeLabelCounter[nodeLabel] = counter;
}
nodeLableCounted[graphNodeKey] = {
graphKey: key,
label: nodeLabel
};
node.edges.forEach(function(edge2) {
var nodeLabel1 = nodeLabel;
var nodeLabel2 = nodeMap[edge2.to].label;
if (!directed && nodeLabel1 > nodeLabel2) {
var tmp = nodeLabel2;
nodeLabel2 = nodeLabel1;
nodeLabel1 = tmp;
}
var edgeLabel = edge2.label;
var graphNodeEdgeNodeKey = "".concat(key, "-").concat(nodeLabel1, "-").concat(edgeLabel, "-").concat(nodeLabel2);
var nodeEdgeNodeKey = "".concat(nodeLabel1, "-").concat(edgeLabel, "-").concat(nodeLabel2);
if (!nodeEdgeNodeCounter[nodeEdgeNodeKey]) {
var counter2 = nodeEdgeNodeCounter[nodeEdgeNodeKey] || 0;
counter2++;
nodeEdgeNodeCounter[nodeEdgeNodeKey] = counter2;
}
nodeEdgeNodeLabelCounted[graphNodeEdgeNodeKey] = {
graphId: key,
nodeLabel1,
edgeLabel,
nodeLabel2
};
});
});
});
Object.keys(nodeLabelCounter).forEach(function(label17) {
var count2 = nodeLabelCounter[label17];
if (count2 < minSupport)
return;
var g4 = {
nodes: [],
edges: []
};
g4.nodes.push({
id: "0",
label: label17
});
frequentSize1Subgraphs.push(g4);
});
return frequentSize1Subgraphs;
};
GSpan2.prototype.run = function() {
var _this = this;
this.frequentSize1Subgraphs = this.generate1EdgeFrequentSubGraphs();
if (this.maxNodeNum < 2)
return;
var graphs8 = this.graphs;
var directed = this.directed;
var root = {};
Object.keys(graphs8).forEach(function(graphId) {
var graph = graphs8[graphId];
var nodeMap = graph.nodeMap;
graph.nodes.forEach(function(node) {
var forwardRootEdges = _this.findForwardRootEdges(graph, node);
forwardRootEdges.forEach(function(edge2) {
var toNode = nodeMap[edge2.to];
var nodeEdgeNodeLabel = "".concat(node.label, "-").concat(edge2.label, "-").concat(toNode.label);
if (!root[nodeEdgeNodeLabel])
root[nodeEdgeNodeLabel] = {
projected: [],
nodeLabel1: node.label,
edgeLabel: edge2.label,
nodeLabel2: toNode.label
};
var pdfs = {
graphId,
edge: edge2,
preNode: null
};
root[nodeEdgeNodeLabel].projected.push(pdfs);
});
});
});
Object.keys(root).forEach(function(nodeEdgeNodeLabel) {
var _a6 = root[nodeEdgeNodeLabel], projected = _a6.projected, nodeLabel1 = _a6.nodeLabel1, edgeLabel = _a6.edgeLabel, nodeLabel2 = _a6.nodeLabel2;
_this.dfsCode.dfsEdgeList.push(new DFSedge(0, 1, nodeLabel1, edgeLabel, nodeLabel2));
_this.subGraphMining(projected);
_this.dfsCode.dfsEdgeList.pop();
});
};
return GSpan2;
}();
var formatGraphs = function formatGraphs2(graphs8, directed, nodeLabelProp, edgeLabelProp) {
var result = {};
Object.keys(graphs8).forEach(function(key, i4) {
var graph = graphs8[key];
var fGraph = new Graph(i4, true, directed);
var nodeIdxMap = {};
graph.nodes.forEach(function(node, j4) {
fGraph.addNode(j4, node[nodeLabelProp]);
nodeIdxMap[node.id] = j4;
});
graph.edges.forEach(function(edge2, k4) {
var sourceIdx = nodeIdxMap[edge2.source];
var targetIdx = nodeIdxMap[edge2.target];
fGraph.addEdge(-1, sourceIdx, targetIdx, edge2[edgeLabelProp]);
});
if (fGraph && fGraph.getNodeNum())
result[fGraph.id] = fGraph;
});
return result;
};
var toGraphDatas = function toGraphDatas2(graphs8, nodeLabelProp, edgeLabelProp) {
var result = [];
graphs8.forEach(function(graph) {
var graphData = {
nodes: [],
edges: []
};
graph.nodes.forEach(function(node) {
var _a6;
graphData.nodes.push((_a6 = {
id: "".concat(node.id)
}, _a6[nodeLabelProp] = node.label, _a6));
});
graph.edges.forEach(function(edge2) {
var _a6;
graphData.edges.push((_a6 = {
source: "".concat(edge2.from),
target: "".concat(edge2.to)
}, _a6[edgeLabelProp] = edge2.label, _a6));
});
result.push(graphData);
});
return result;
};
var DEFAULT_LABEL_NAME = "cluster";
var gSpan = function gSpan2(params) {
var graphs8 = params.graphs, _a6 = params.directed, directed = _a6 === void 0 ? false : _a6, _b = params.nodeLabelProp, nodeLabelProp = _b === void 0 ? DEFAULT_LABEL_NAME : _b, _c = params.edgeLabelProp, edgeLabelProp = _c === void 0 ? DEFAULT_LABEL_NAME : _c;
var formattedGraphs = formatGraphs(graphs8, directed, nodeLabelProp, edgeLabelProp);
var minSupport = params.minSupport, maxNodeNum = params.maxNodeNum, minNodeNum = params.minNodeNum, verbose = params.verbose, top = params.top;
var algoParams = {
graphs: formattedGraphs,
minSupport,
maxNodeNum,
minNodeNum,
top,
verbose,
directed
};
var calculator = new GSpan(algoParams);
calculator.run();
var result = toGraphDatas(calculator.frequentSubgraphs, nodeLabelProp, edgeLabelProp);
return result;
};
var gSpan_default = gSpan;
// node_modules/@antv/algorithm/es/gaddi.js
var findKNeighborUnits = function findKNeighborUnits2(graphData, spm, nodeLabelProp, k4) {
if (nodeLabelProp === void 0) {
nodeLabelProp = "cluster";
}
if (k4 === void 0) {
k4 = 2;
}
var units = [];
var nodes = graphData.nodes;
spm.forEach(function(row, i4) {
units.push(findKNeighborUnit(nodes, row, i4, nodeLabelProp, k4));
});
return units;
};
var findKNeighborUnit = function findKNeighborUnit2(nodes, row, i4, nodeLabelProp, k4) {
var unitNodeIdxs = [i4];
var neighbors = [];
var labelCountMap = {};
row.forEach(function(v3, j4) {
if (v3 <= k4 && i4 !== j4) {
unitNodeIdxs.push(j4);
neighbors.push(nodes[j4]);
var label17 = nodes[j4][nodeLabelProp];
if (!labelCountMap[label17])
labelCountMap[label17] = {
count: 1,
dists: [v3]
};
else {
labelCountMap[label17].count++;
labelCountMap[label17].dists.push(v3);
}
}
});
Object.keys(labelCountMap).forEach(function(label17) {
labelCountMap[label17].dists = labelCountMap[label17].dists.sort(function(a4, b10) {
return a4 - b10;
});
});
return {
nodeIdx: i4,
nodeId: nodes[i4].id,
nodeIdxs: unitNodeIdxs,
neighbors,
neighborNum: unitNodeIdxs.length - 1,
nodeLabelCountMap: labelCountMap
};
};
var findNodePairsRandomly = function findNodePairsRandomly2(k4, nodeNum, maxNodePairNum, kNeighborUnits, spm) {
var nodePairNumEachNode = Math.ceil(maxNodePairNum / nodeNum);
var nodePairMap = {};
var foundNodePairCount = 0;
kNeighborUnits.forEach(function(unit, i4) {
var nodePairForICount = 0;
var outerLoopCount = 0;
var neighbors = unit.nodeIdxs;
var neighborNum = unit.neighborNum - 1;
while (nodePairForICount < nodePairNumEachNode) {
var oidx = neighbors[1 + Math.floor(Math.random() * neighborNum)];
var innerLoopCount = 0;
while (nodePairMap["".concat(i4, "-").concat(oidx)] || nodePairMap["".concat(oidx, "-").concat(i4)]) {
oidx = Math.floor(Math.random() * nodeNum);
innerLoopCount++;
if (innerLoopCount > 2 * nodeNum)
break;
}
if (innerLoopCount < 2 * nodeNum) {
nodePairMap["".concat(i4, "-").concat(oidx)] = {
start: i4,
end: oidx,
distance: spm[i4][oidx]
};
nodePairForICount++;
foundNodePairCount++;
if (foundNodePairCount >= maxNodePairNum)
return nodePairMap;
}
outerLoopCount++;
if (outerLoopCount > 2 * nodeNum)
break;
}
if (nodePairForICount < nodePairNumEachNode) {
var gap = nodePairNumEachNode - nodePairForICount;
nodePairNumEachNode = (nodePairNumEachNode + gap) / (nodeNum - i4 - 1);
}
});
return nodePairMap;
};
var getIntersectNeighborInducedGraph = function getIntersectNeighborInducedGraph2(nodePairMap, neighborUnits, graphData, cachedInducedGraphMap) {
var nodes = graphData.nodes;
if (!cachedInducedGraphMap)
cachedInducedGraphMap = {};
Object.keys(nodePairMap).forEach(function(key) {
var _a6, _b;
if (cachedInducedGraphMap && cachedInducedGraphMap[key])
return;
cachedInducedGraphMap[key] = {
nodes: [],
edges: []
};
var pair = nodePairMap[key];
var startUnitNodeIds = (_a6 = neighborUnits[pair.start]) === null || _a6 === void 0 ? void 0 : _a6.nodeIdxs;
var endUnitNodeIds = (_b = neighborUnits[pair.end]) === null || _b === void 0 ? void 0 : _b.nodeIdxs;
if (!startUnitNodeIds || !endUnitNodeIds)
return;
var endSet = new Set(endUnitNodeIds);
var intersect2 = startUnitNodeIds.filter(function(x6) {
return endSet.has(x6);
});
if (!intersect2 || !intersect2.length)
return;
var intersectIdMap = {};
var intersectLength = intersect2.length;
for (var i4 = 0; i4 < intersectLength; i4++) {
var node = nodes[intersect2[i4]];
cachedInducedGraphMap[key].nodes.push(node);
intersectIdMap[node.id] = true;
}
graphData.edges.forEach(function(edge2) {
if (intersectIdMap[edge2.source] && intersectIdMap[edge2.target])
cachedInducedGraphMap[key].edges.push(edge2);
});
});
return cachedInducedGraphMap;
};
var getMatchedCount = function getMatchedCount2(graph, structure, nodeLabelProp, edgeLabelProp) {
var _a6, _b;
var nodeMap = {};
graph.nodes.forEach(function(node) {
nodeMap[node.id] = node;
});
var count2 = 0;
if (!((_a6 = structure === null || structure === void 0 ? void 0 : structure.edges) === null || _a6 === void 0 ? void 0 : _a6.length) || ((_b = structure === null || structure === void 0 ? void 0 : structure.nodes) === null || _b === void 0 ? void 0 : _b.length) < 2)
return 0;
graph.edges.forEach(function(e4) {
var sourceLabel = nodeMap[e4.source][nodeLabelProp];
var targetLabel = nodeMap[e4.target][nodeLabelProp];
var strNodeLabel1 = structure === null || structure === void 0 ? void 0 : structure.nodes[0][nodeLabelProp];
var strNodeLabel2 = structure === null || structure === void 0 ? void 0 : structure.nodes[1][nodeLabelProp];
var strEdgeLabel = structure === null || structure === void 0 ? void 0 : structure.edges[0][edgeLabelProp];
if (e4[edgeLabelProp] !== strEdgeLabel)
return;
if (sourceLabel === strNodeLabel1 && targetLabel === strNodeLabel2 || sourceLabel === strNodeLabel2 && targetLabel === strNodeLabel1) {
count2++;
}
});
return count2;
};
var findRepresentStructure = function findRepresentStructure2(matchedCountMap, structureNum, structures) {
var maxOffset = Infinity, representClusterType = 0;
var _loop_1 = function _loop_12(i5) {
var countMapI = matchedCountMap[i5];
var sortedGraphKeys = Object.keys(countMapI).sort(function(a4, b10) {
return countMapI[a4] - countMapI[b10];
});
var groupNum = 10;
var clusters = [];
sortedGraphKeys.forEach(function(key, j4) {
if (!clusters[j4 % groupNum])
clusters[j4 % groupNum] = {
graphs: [],
totalCount: 0,
aveCount: 0
};
clusters[j4 % groupNum].graphs.push(key);
clusters[j4 % groupNum].totalCount += countMapI[key];
});
var aveIntraDist = 0;
var aveCounts = [];
clusters.forEach(function(graphsInCluster) {
var aveCount = graphsInCluster.totalCount / graphsInCluster.graphs.length;
graphsInCluster.aveCount = aveCount;
aveCounts.push(aveCount);
var aveIntraPerCluster = 0;
var graphsNum = graphsInCluster.length;
graphsInCluster.graphs.forEach(function(graphKey1, j4) {
var graph1Count = countMapI[graphKey1];
graphsInCluster.graphs.forEach(function(graphKey2, k4) {
if (j4 === k4)
return;
aveIntraPerCluster += Math.abs(graph1Count - countMapI[graphKey2]);
});
});
aveIntraPerCluster /= graphsNum * (graphsNum - 1) / 2;
aveIntraDist += aveIntraPerCluster;
});
aveIntraDist /= clusters.length;
var aveInterDist = 0;
aveCounts.forEach(function(aveCount1, j4) {
aveCounts.forEach(function(aveCount2, k4) {
if (j4 === k4)
return;
aveInterDist += Math.abs(aveCount1 - aveCount2);
});
aveInterDist /= aveCounts.length * (aveCounts.length - 1) / 2;
});
var offset = aveInterDist - aveIntraDist;
if (maxOffset < offset) {
maxOffset = offset;
representClusterType = i5;
}
};
for (var i4 = 0; i4 < structureNum; i4++) {
_loop_1(i4);
}
return {
structure: structures[representClusterType],
structureCountMap: matchedCountMap[representClusterType]
};
};
var getNodeMaps = function getNodeMaps2(nodes, nodeLabelProp) {
var nodeMap = {}, nodeLabelMap = {};
nodes.forEach(function(node, i4) {
nodeMap[node.id] = {
idx: i4,
node,
degree: 0,
inDegree: 0,
outDegree: 0
};
var label17 = node[nodeLabelProp];
if (!nodeLabelMap[label17])
nodeLabelMap[label17] = [];
nodeLabelMap[label17].push(node);
});
return {
nodeMap,
nodeLabelMap
};
};
var getEdgeMaps = function getEdgeMaps2(edges, edgeLabelProp, nodeMap) {
var edgeMap = {}, edgeLabelMap = {};
edges.forEach(function(edge2, i4) {
edgeMap["".concat(uniqueId)] = {
idx: i4,
edge: edge2
};
var label17 = edge2[edgeLabelProp];
if (!edgeLabelMap[label17])
edgeLabelMap[label17] = [];
edgeLabelMap[label17].push(edge2);
var sourceNode = nodeMap[edge2.source];
if (sourceNode) {
sourceNode.degree++;
sourceNode.outDegree++;
}
var targetNode = nodeMap[edge2.target];
if (targetNode) {
targetNode.degree++;
targetNode.inDegree++;
}
});
return {
edgeMap,
edgeLabelMap
};
};
var getSpmMap = function getSpmMap2(nodes, spm, directed) {
var length5 = spm.length;
var map6 = {};
spm.forEach(function(row, i4) {
var start = directed ? 0 : i4 + 1;
var iId = nodes[i4].id;
for (var j4 = start; j4 < length5; j4++) {
if (i4 === j4)
continue;
var jId = nodes[j4].id;
var dist4 = row[j4];
map6["".concat(iId, "-").concat(jId)] = dist4;
if (!directed)
map6["".concat(jId, "-").concat(iId)] = dist4;
}
});
return map6;
};
var getNDSDist = function getNDSDist2(graph, node1, node2, nodeMap, spDist, kNeighborUnits, structure, nodeLabelProp, edgeLabelProp, cachedNDSMap, cachedInterInducedGraph) {
var _a6;
var key = "".concat(node1.id, "-").concat(node2.id);
if (cachedNDSMap && cachedNDSMap[key])
return cachedNDSMap[key];
var interInducedGraph = cachedInterInducedGraph ? cachedInterInducedGraph[key] : void 0;
if (!interInducedGraph) {
var pairMap = (_a6 = {}, _a6[key] = {
start: nodeMap[node1.id].idx,
end: nodeMap[node2.id].idx,
distance: spDist
}, _a6);
cachedInterInducedGraph = getIntersectNeighborInducedGraph(pairMap, kNeighborUnits, graph, cachedInterInducedGraph);
interInducedGraph = cachedInterInducedGraph[key];
}
return getMatchedCount(interInducedGraph, structure, nodeLabelProp, edgeLabelProp);
};
var stashPatternNodeLabelDegreeMap = function stashPatternNodeLabelDegreeMap2(minPatternNodeLabelDegreeMap, neighborLabel, patternNodeMap, patternNodeLabelMap) {
var _a6, _b, _c;
var minPatternNodeLabelDegree = (_a6 = minPatternNodeLabelDegreeMap[neighborLabel]) === null || _a6 === void 0 ? void 0 : _a6.degree;
var minPatternNodeLabelInDegree = (_b = minPatternNodeLabelDegreeMap[neighborLabel]) === null || _b === void 0 ? void 0 : _b.inDegree;
var minPatternNodeLabelOutDegree = (_c = minPatternNodeLabelDegreeMap[neighborLabel]) === null || _c === void 0 ? void 0 : _c.outDegree;
if (minPatternNodeLabelDegreeMap[neighborLabel] === void 0) {
minPatternNodeLabelDegree = Infinity;
minPatternNodeLabelInDegree = Infinity;
minPatternNodeLabelOutDegree = Infinity;
patternNodeLabelMap[neighborLabel].forEach(function(patternNodeWithLabel) {
var patternNodeDegree = patternNodeMap[patternNodeWithLabel.id].degree;
if (minPatternNodeLabelDegree > patternNodeDegree)
minPatternNodeLabelDegree = patternNodeDegree;
var patternNodeInDegree = patternNodeMap[patternNodeWithLabel.id].inDegree;
if (minPatternNodeLabelInDegree > patternNodeInDegree)
minPatternNodeLabelInDegree = patternNodeInDegree;
var patternNodeOutDegree = patternNodeMap[patternNodeWithLabel.id].outDegree;
if (minPatternNodeLabelOutDegree > patternNodeOutDegree)
minPatternNodeLabelOutDegree = patternNodeOutDegree;
});
minPatternNodeLabelDegreeMap[neighborLabel] = {
degree: minPatternNodeLabelDegree,
inDegree: minPatternNodeLabelInDegree,
outDegree: minPatternNodeLabelOutDegree
};
}
return {
minPatternNodeLabelDegree,
minPatternNodeLabelInDegree,
minPatternNodeLabelOutDegree
};
};
var GADDI = function GADDI2(graphData, pattern2, directed, k4, length5, nodeLabelProp, edgeLabelProp) {
var _a6;
if (directed === void 0) {
directed = false;
}
if (nodeLabelProp === void 0) {
nodeLabelProp = "cluster";
}
if (edgeLabelProp === void 0) {
edgeLabelProp = "cluster";
}
if (!graphData || !graphData.nodes)
return;
var nodeNum = graphData.nodes.length;
if (!nodeNum)
return;
var spm = floydWarshall_default(graphData, directed);
var patternSpm = floydWarshall_default(pattern2, directed);
var spmMap = getSpmMap(graphData.nodes, spm, directed);
var patternSpmMap = getSpmMap(pattern2.nodes, patternSpm, directed);
var _b = getNodeMaps(graphData.nodes, nodeLabelProp), nodeMap = _b.nodeMap, nodeLabelMap = _b.nodeLabelMap;
var _c = getNodeMaps(pattern2.nodes, nodeLabelProp), patternNodeMap = _c.nodeMap, patternNodeLabelMap = _c.nodeLabelMap;
getEdgeMaps(graphData.edges, edgeLabelProp, nodeMap);
var patternEdgeLabelMap = getEdgeMaps(pattern2.edges, edgeLabelProp, patternNodeMap).edgeLabelMap;
var patternSpmSpread = [];
patternSpm === null || patternSpm === void 0 ? void 0 : patternSpm.forEach(function(row) {
patternSpmSpread = patternSpmSpread.concat(row);
});
if (!length5)
length5 = Math.max.apply(Math, __spreadArray(__spreadArray([], patternSpmSpread, false), [2], false));
if (!k4)
k4 = length5;
var kNeighborUnits = findKNeighborUnits(graphData, spm, nodeLabelProp, k4);
var patternKNeighborUnits = findKNeighborUnits(pattern2, patternSpm, nodeLabelProp, k4);
var maxNodePairNum = Math.min(100, nodeNum * (nodeNum - 1) / 2);
var nodePairsMap = findNodePairsRandomly(k4, nodeNum, maxNodePairNum, kNeighborUnits, spm);
var intGMap = getIntersectNeighborInducedGraph(nodePairsMap, kNeighborUnits, graphData);
var top = 10, minSupport = 1, minNodeNum = 1, maxNodeNum = 4;
var params = {
graphs: intGMap,
nodeLabelProp,
edgeLabelProp,
minSupport,
minNodeNum,
maxNodeNum,
directed
};
var freStructures = gSpan_default(params).slice(0, top);
var structureNum = freStructures.length;
var matchedCountMap = [];
freStructures.forEach(function(structure, i5) {
matchedCountMap[i5] = {};
Object.keys(intGMap).forEach(function(key) {
var graph = intGMap[key];
var subStructureCount = getMatchedCount(graph, structure, nodeLabelProp, edgeLabelProp);
matchedCountMap[i5][key] = subStructureCount;
});
});
var _d = findRepresentStructure(matchedCountMap, structureNum, freStructures), dsG = _d.structure, ndsDist = _d.structureCountMap;
var beginPNode = pattern2.nodes[0], candidates = [], label17 = (_a6 = pattern2.nodes[0]) === null || _a6 === void 0 ? void 0 : _a6[nodeLabelProp], maxNodeNumWithSameLabel = -Infinity;
pattern2.nodes.forEach(function(node) {
var pLabel = node[nodeLabelProp];
var nodesWithSameLabel = nodeLabelMap[pLabel];
if ((nodesWithSameLabel === null || nodesWithSameLabel === void 0 ? void 0 : nodesWithSameLabel.length) > maxNodeNumWithSameLabel) {
maxNodeNumWithSameLabel = nodesWithSameLabel.length;
candidates = nodesWithSameLabel;
label17 = pLabel;
beginPNode = node;
}
});
var minPatternNodeLabelDegreeMap = {};
var patternIntGraphMap = {}, patternNDSDist = {}, patternNDSDistMap = {};
var patternSpDist = {};
var patternSpDistBack = {};
Object.keys(patternNodeLabelMap).forEach(function(label22, j4) {
patternSpDist[label22] = [];
if (directed) {
patternSpDistBack[label22] = [];
}
var maxDist = -Infinity;
var patternNodesWithLabel2 = patternNodeLabelMap[label22];
var patternNodePairMap = {};
patternNodesWithLabel2.forEach(function(nodeWithLabel2) {
var dist4 = patternSpmMap["".concat(beginPNode.id, "-").concat(nodeWithLabel2.id)];
dist4 && patternSpDist[label22].push(dist4);
if (maxDist < dist4)
maxDist = dist4;
patternNodePairMap["".concat(beginPNode.id, "-").concat(nodeWithLabel2.id)] = {
start: 0,
end: patternNodeMap[nodeWithLabel2.id].idx,
distance: dist4
};
if (directed) {
var distBack = patternSpmMap["".concat(nodeWithLabel2.id, "-").concat(beginPNode.id)];
distBack && patternSpDistBack[label22].push(distBack);
}
});
patternSpDist[label22] = patternSpDist[label22].sort(function(a4, b10) {
return a4 - b10;
});
if (directed)
patternSpDistBack[label22] = patternSpDistBack[label22].sort(function(a4, b10) {
return a4 - b10;
});
patternIntGraphMap = getIntersectNeighborInducedGraph(patternNodePairMap, patternKNeighborUnits, pattern2, patternIntGraphMap);
var currentPatternNDSDistArray = [];
Object.keys(patternNodePairMap).forEach(function(key) {
if (patternNDSDist[key]) {
currentPatternNDSDistArray.push(patternNDSDist[key]);
return;
}
var patternIntGraph = patternIntGraphMap[key];
patternNDSDist[key] = getMatchedCount(patternIntGraph, dsG, nodeLabelProp, edgeLabelProp);
currentPatternNDSDistArray.push(patternNDSDist[key]);
});
currentPatternNDSDistArray = currentPatternNDSDistArray.sort(function(a4, b10) {
return b10 - a4;
});
patternNDSDistMap["".concat(beginPNode.id, "-").concat(label22)] = currentPatternNDSDistArray;
if (label22 === label17)
return;
var candidatesNum = (candidates === null || candidates === void 0 ? void 0 : candidates.length) || 0;
var _loop_4 = function _loop_42(m5) {
var cNode = candidates[m5];
var graphNeighborUnit = kNeighborUnits[nodeMap[cNode.id].idx];
var graphNeighborUnitCountMap = graphNeighborUnit.nodeLabelCountMap[label22];
var patternLabel2Num = patternNodeLabelMap[label22].length;
if (!graphNeighborUnitCountMap || graphNeighborUnitCountMap.count < patternLabel2Num) {
candidates.splice(m5, 1);
return "continue";
}
var prune2Invalid = false;
for (var n3 = 0; n3 < patternLabel2Num; n3++) {
if (graphNeighborUnitCountMap.dists[n3] > patternSpDist[label22][n3]) {
prune2Invalid = true;
break;
}
}
if (prune2Invalid) {
candidates.splice(m5, 1);
return "continue";
}
var cNodePairMap = {};
graphNeighborUnit.neighbors.forEach(function(neighborNode) {
var dist4 = spmMap["".concat(cNode.id, "-").concat(neighborNode.id)];
cNodePairMap["".concat(cNode.id, "-").concat(neighborNode.id)] = {
start: nodeMap[cNode.id].idx,
end: nodeMap[neighborNode.id].idx,
distance: dist4
};
});
intGMap = getIntersectNeighborInducedGraph(cNodePairMap, kNeighborUnits, graphData, intGMap);
var currentNDSDistArray = [];
Object.keys(cNodePairMap).forEach(function(key) {
if (ndsDist[key]) {
currentNDSDistArray.push(ndsDist[key]);
return;
}
var intGraph = intGMap[key];
ndsDist[key] = getMatchedCount(intGraph, dsG, nodeLabelProp, edgeLabelProp);
currentNDSDistArray.push(ndsDist[key]);
});
currentNDSDistArray = currentNDSDistArray.sort(function(a4, b10) {
return b10 - a4;
});
var prune3Invalid = false;
for (var n3 = 0; n3 < patternLabel2Num; n3++) {
if (currentNDSDistArray[n3] < currentPatternNDSDistArray[n3]) {
prune3Invalid = true;
break;
}
}
if (prune3Invalid) {
candidates.splice(m5, 1);
return "continue";
}
};
for (var m4 = candidatesNum - 1; m4 >= 0; m4--) {
_loop_4(m4);
}
});
var candidateGraphs = [];
candidates === null || candidates === void 0 ? void 0 : candidates.forEach(function(candidate) {
var nodeIdx = nodeMap[candidate.id].idx;
var lengthNeighborUnit = findKNeighborUnit(graphData.nodes, spm[nodeIdx], nodeIdx, nodeLabelProp, length5);
var neighborNodes = lengthNeighborUnit.neighbors;
var neighborNum = neighborNodes.length;
var unmatched = false;
for (var i5 = neighborNum - 1; i5 >= 0; i5--) {
if (neighborNodes.length + 1 < pattern2.nodes.length) {
unmatched = true;
return;
}
var neighborNode = neighborNodes[i5];
var neighborLabel = neighborNode[nodeLabelProp];
if (!patternNodeLabelMap[neighborLabel] || !patternNodeLabelMap[neighborLabel].length) {
neighborNodes.splice(i5, 1);
continue;
}
if (!patternSpDist[neighborLabel] || !patternSpDist[neighborLabel].length) {
neighborNodes.splice(i5, 1);
continue;
}
var key = "".concat(candidate.id, "-").concat(neighborNode.id);
var distToCandidate = spmMap[key];
var idx = patternSpDist[neighborLabel].length - 1;
var maxDistWithLabelInPattern = patternSpDist[neighborLabel][idx];
if (distToCandidate > maxDistWithLabelInPattern) {
neighborNodes.splice(i5, 1);
continue;
}
if (directed) {
var keyBack = "".concat(neighborNode.id, "-").concat(candidate.id);
var distFromCandidate = spmMap[keyBack];
idx = patternSpDistBack[neighborLabel].length - 1;
var maxBackDistWithLabelInPattern = patternSpDistBack[neighborLabel][idx];
if (distFromCandidate > maxBackDistWithLabelInPattern) {
neighborNodes.splice(i5, 1);
continue;
}
}
var ndsToCandidate = ndsDist[key] ? ndsDist[key] : getNDSDist(graphData, candidate, neighborNode, nodeMap, distToCandidate, kNeighborUnits, dsG, nodeLabelProp, edgeLabelProp, ndsDist, intGMap);
var patternKey = "".concat(beginPNode.id, "-").concat(neighborLabel);
var minNdsWithLabelInPattern = patternNDSDistMap[patternKey][patternNDSDistMap[patternKey].length - 1];
if (ndsToCandidate < minNdsWithLabelInPattern) {
neighborNodes.splice(i5, 1);
continue;
}
var _a7 = stashPatternNodeLabelDegreeMap(minPatternNodeLabelDegreeMap, neighborLabel, patternNodeMap, patternNodeLabelMap), minPatternNodeLabelDegree = _a7.minPatternNodeLabelDegree, minPatternNodeLabelInDegree = _a7.minPatternNodeLabelInDegree, minPatternNodeLabelOutDegree = _a7.minPatternNodeLabelOutDegree;
if (nodeMap[neighborNode.id].degree < minPatternNodeLabelDegree) {
neighborNodes.splice(i5, 1);
continue;
}
}
if (!unmatched) {
candidateGraphs.push({
nodes: [candidate].concat(neighborNodes)
});
}
});
var undirectedLengthsToBeginPNode = dijkstra_default(pattern2, beginPNode.id, false).length;
var undirectedLengthsToBeginPNodeLabelMap = {};
if (directed) {
Object.keys(undirectedLengthsToBeginPNode).forEach(function(nodeId) {
var nodeLabel = patternNodeMap[nodeId].node[nodeLabelProp];
if (!undirectedLengthsToBeginPNodeLabelMap[nodeLabel])
undirectedLengthsToBeginPNodeLabelMap[nodeLabel] = [undirectedLengthsToBeginPNode[nodeId]];
else
undirectedLengthsToBeginPNodeLabelMap[nodeLabel].push(undirectedLengthsToBeginPNode[nodeId]);
});
Object.keys(undirectedLengthsToBeginPNodeLabelMap).forEach(function(pLabel) {
undirectedLengthsToBeginPNodeLabelMap[pLabel].sort(function(a4, b10) {
return a4 - b10;
});
});
} else {
undirectedLengthsToBeginPNodeLabelMap = patternSpDist;
}
var candidateGraphNum = candidateGraphs.length;
var _loop_2 = function _loop_22(i5) {
var candidateGraph = candidateGraphs[i5];
var candidate = candidateGraph.nodes[0];
var candidateNodeLabelCountMap = {};
var candidateNodeMap = {};
candidateGraph.nodes.forEach(function(node, q4) {
candidateNodeMap[node.id] = {
idx: q4,
node,
degree: 0,
inDegree: 0,
outDegree: 0
};
var cNodeLabel2 = node[nodeLabelProp];
if (!candidateNodeLabelCountMap[cNodeLabel2])
candidateNodeLabelCountMap[cNodeLabel2] = 1;
else
candidateNodeLabelCountMap[cNodeLabel2]++;
});
var candidateEdges = [];
var edgeLabelCountMap = {};
graphData.edges.forEach(function(edge2) {
if (candidateNodeMap[edge2.source] && candidateNodeMap[edge2.target]) {
candidateEdges.push(edge2);
if (!edgeLabelCountMap[edge2[edgeLabelProp]])
edgeLabelCountMap[edge2[edgeLabelProp]] = 1;
else
edgeLabelCountMap[edge2[edgeLabelProp]]++;
candidateNodeMap[edge2.source].degree++;
candidateNodeMap[edge2.target].degree++;
candidateNodeMap[edge2.source].outDegree++;
candidateNodeMap[edge2.target].inDegree++;
}
});
var pattenrEdgeLabelNum = Object.keys(patternEdgeLabelMap).length;
var prunedByEdgeLabel = false;
for (var e4 = 0; e4 < pattenrEdgeLabelNum; e4++) {
var label_1 = Object.keys(patternEdgeLabelMap)[e4];
if (!edgeLabelCountMap[label_1] || edgeLabelCountMap[label_1] < patternEdgeLabelMap[label_1].length) {
prunedByEdgeLabel = true;
break;
}
}
if (prunedByEdgeLabel) {
candidateGraphs.splice(i5, 1);
return "continue";
}
var candidateEdgeNum = candidateEdges.length;
if (candidateEdgeNum < pattern2.edges.length) {
candidateGraphs.splice(i5, 1);
return "break";
}
var candidateGraphInvalid = false;
var _loop_5 = function _loop_52(e6) {
var edge2 = candidateEdges[e6];
var edgeLabel2 = edge2[edgeLabelProp];
var patternEdgesWithLabel = patternEdgeLabelMap[edgeLabel2];
if (!patternEdgesWithLabel || !patternEdgesWithLabel.length) {
edgeLabelCountMap[edgeLabel2]--;
if (patternEdgesWithLabel && edgeLabelCountMap[edgeLabel2] < patternEdgesWithLabel.length) {
candidateGraphInvalid = true;
return "break";
}
candidateEdges.splice(e6, 1);
candidateNodeMap[edge2.source].degree--;
candidateNodeMap[edge2.target].degree--;
candidateNodeMap[edge2.source].outDegree--;
candidateNodeMap[edge2.target].inDegree--;
return "continue";
}
var sourceLabel = candidateNodeMap[edge2.source].node[nodeLabelProp];
var targetLabel = candidateNodeMap[edge2.target].node[nodeLabelProp];
var edgeMatched = false;
patternEdgesWithLabel.forEach(function(patternEdge) {
var patternSource = patternNodeMap[patternEdge.source].node;
var patternTarget = patternNodeMap[patternEdge.target].node;
if (patternSource[nodeLabelProp] === sourceLabel && patternTarget[nodeLabelProp] === targetLabel)
edgeMatched = true;
if (!directed && patternSource[nodeLabelProp] === targetLabel && patternTarget[nodeLabelProp] === sourceLabel)
edgeMatched = true;
});
if (!edgeMatched) {
edgeLabelCountMap[edgeLabel2]--;
if (patternEdgesWithLabel && edgeLabelCountMap[edgeLabel2] < patternEdgesWithLabel.length) {
candidateGraphInvalid = true;
return "break";
}
candidateEdges.splice(e6, 1);
candidateNodeMap[edge2.source].degree--;
candidateNodeMap[edge2.target].degree--;
candidateNodeMap[edge2.source].outDegree--;
candidateNodeMap[edge2.target].inDegree--;
return "continue";
}
};
for (var e4 = candidateEdgeNum - 1; e4 >= 0; e4--) {
var state_2 = _loop_5(e4);
if (state_2 === "break")
break;
}
if (candidateGraphInvalid) {
candidateGraphs.splice(i5, 1);
return "continue";
}
candidateGraph.edges = candidateEdges;
var lengthsToCandidate = dijkstra_default(candidateGraph, candidateGraph.nodes[0].id, false).length;
Object.keys(lengthsToCandidate).reverse().forEach(function(targetId) {
if (targetId === candidateGraph.nodes[0].id || candidateGraphInvalid)
return;
if (lengthsToCandidate[targetId] === Infinity) {
var targetNodeLabel = candidateNodeMap[targetId].node[nodeLabelProp];
candidateNodeLabelCountMap[targetNodeLabel]--;
if (candidateNodeLabelCountMap[targetNodeLabel] < patternNodeLabelMap[targetNodeLabel].length) {
candidateGraphInvalid = true;
return;
}
var idx = candidateGraph.nodes.indexOf(candidateNodeMap[targetId].node);
candidateGraph.nodes.splice(idx, 1);
candidateNodeMap[targetId] = void 0;
return;
}
var nLabel = nodeMap[targetId].node[nodeLabelProp];
if (!undirectedLengthsToBeginPNodeLabelMap[nLabel] || !undirectedLengthsToBeginPNodeLabelMap[nLabel].length || lengthsToCandidate[targetId] > undirectedLengthsToBeginPNodeLabelMap[nLabel][undirectedLengthsToBeginPNodeLabelMap[nLabel].length - 1]) {
var targetNodeLabel = candidateNodeMap[targetId].node[nodeLabelProp];
candidateNodeLabelCountMap[targetNodeLabel]--;
if (candidateNodeLabelCountMap[targetNodeLabel] < patternNodeLabelMap[targetNodeLabel].length) {
candidateGraphInvalid = true;
return;
}
var idx = candidateGraph.nodes.indexOf(candidateNodeMap[targetId].node);
candidateGraph.nodes.splice(idx, 1);
candidateNodeMap[targetId] = void 0;
}
});
if (candidateGraphInvalid) {
candidateGraphs.splice(i5, 1);
return "continue";
}
var degreeChanged = true;
var loopCount = 0;
while (degreeChanged && !candidateGraphInvalid) {
degreeChanged = false;
var condition = directed ? candidateNodeMap[candidate.id].degree < patternNodeMap[beginPNode.id].degree || candidateNodeMap[candidate.id].inDegree < patternNodeMap[beginPNode.id].inDegree || candidateNodeMap[candidate.id].outDegree < patternNodeMap[beginPNode.id].outDegree : candidateNodeMap[candidate.id].degree < patternNodeMap[beginPNode.id].degree;
if (condition) {
candidateGraphInvalid = true;
break;
}
if (candidateNodeLabelCountMap[candidate[nodeLabelProp]] < patternNodeLabelMap[candidate[nodeLabelProp]].length) {
candidateGraphInvalid = true;
break;
}
var currentCandidateNodeNum = candidateGraph.nodes.length;
for (var o3 = currentCandidateNodeNum - 1; o3 >= 0; o3--) {
var cgNode = candidateGraph.nodes[o3];
var nodeDegree = candidateNodeMap[cgNode.id].degree;
var nodeInDegree = candidateNodeMap[cgNode.id].inDegree;
var nodeOutDegree = candidateNodeMap[cgNode.id].outDegree;
var cNodeLabel = cgNode[nodeLabelProp];
var _e = stashPatternNodeLabelDegreeMap(minPatternNodeLabelDegreeMap, cNodeLabel, patternNodeMap, patternNodeLabelMap), minPatternNodeLabelDegree = _e.minPatternNodeLabelDegree, minPatternNodeLabelInDegree = _e.minPatternNodeLabelInDegree, minPatternNodeLabelOutDegree = _e.minPatternNodeLabelOutDegree;
var deleteCondition = directed ? nodeDegree < minPatternNodeLabelDegree || nodeInDegree < minPatternNodeLabelInDegree || nodeOutDegree < minPatternNodeLabelOutDegree : nodeDegree < minPatternNodeLabelDegree;
if (deleteCondition) {
candidateNodeLabelCountMap[cgNode[nodeLabelProp]]--;
if (candidateNodeLabelCountMap[cgNode[nodeLabelProp]] < patternNodeLabelMap[cgNode[nodeLabelProp]].length) {
candidateGraphInvalid = true;
break;
}
candidateGraph.nodes.splice(o3, 1);
candidateNodeMap[cgNode.id] = void 0;
degreeChanged = true;
}
}
if (candidateGraphInvalid || !degreeChanged && loopCount !== 0)
break;
candidateEdgeNum = candidateEdges.length;
for (var y5 = candidateEdgeNum - 1; y5 >= 0; y5--) {
var cedge = candidateEdges[y5];
if (!candidateNodeMap[cedge.source] || !candidateNodeMap[cedge.target]) {
candidateEdges.splice(y5, 1);
var edgeLabel = cedge[edgeLabelProp];
edgeLabelCountMap[edgeLabel]--;
if (candidateNodeMap[cedge.source]) {
candidateNodeMap[cedge.source].degree--;
candidateNodeMap[cedge.source].outDegree--;
}
if (candidateNodeMap[cedge.target]) {
candidateNodeMap[cedge.target].degree--;
candidateNodeMap[cedge.target].inDegree--;
}
if (patternEdgeLabelMap[edgeLabel] && edgeLabelCountMap[edgeLabel] < patternEdgeLabelMap[edgeLabel].length) {
candidateGraphInvalid = true;
break;
}
degreeChanged = true;
}
}
loopCount++;
}
if (candidateGraphInvalid) {
candidateGraphs.splice(i5, 1);
return "continue";
}
if (candidateGraphInvalid || candidateGraph.nodes.length < pattern2.nodes.length || candidateEdges.length < pattern2.edges.length) {
candidateGraphs.splice(i5, 1);
return "continue";
}
};
for (var i4 = candidateGraphNum - 1; i4 >= 0; i4--) {
var state_1 = _loop_2(i4);
if (state_1 === "break")
break;
}
var currentLength = candidateGraphs.length;
var _loop_3 = function _loop_32(i5) {
var cg1 = candidateGraphs[i5];
var cg1EdgeMap = {};
cg1.edges.forEach(function(edge2) {
var key = "".concat(edge2.source, "-").concat(edge2.target, "-").concat(edge2.label);
if (!cg1EdgeMap[key])
cg1EdgeMap[key] = 1;
else
cg1EdgeMap[key]++;
});
var _loop_6 = function _loop_62(j5) {
var cg2 = candidateGraphs[j5];
var cg2EdgeMap = {};
cg2.edges.forEach(function(edge2) {
var key = "".concat(edge2.source, "-").concat(edge2.target, "-").concat(edge2.label);
if (!cg2EdgeMap[key])
cg2EdgeMap[key] = 1;
else
cg2EdgeMap[key]++;
});
var same = true;
if (Object.keys(cg2EdgeMap).length !== Object.keys(cg1EdgeMap).length) {
same = false;
} else {
Object.keys(cg1EdgeMap).forEach(function(key) {
if (cg2EdgeMap[key] !== cg1EdgeMap[key])
same = false;
});
}
if (same) {
candidateGraphs.splice(j5, 1);
}
};
for (var j4 = currentLength - 1; j4 > i5; j4--) {
_loop_6(j4);
}
currentLength = candidateGraphs.length;
};
for (var i4 = 0; i4 <= currentLength - 1; i4++) {
_loop_3(i4);
}
return candidateGraphs;
};
var gaddi_default = GADDI;
// node_modules/@antv/algorithm/es/structs/stack.js
var Stack2 = function() {
function Stack3(maxStep) {
if (maxStep === void 0) {
maxStep = 10;
}
this.linkedList = new linked_list_default();
this.maxStep = maxStep;
}
Object.defineProperty(Stack3.prototype, "length", {
get: function get3() {
return this.linkedList.toArray().length;
},
enumerable: false,
configurable: true
});
Stack3.prototype.isEmpty = function() {
return !this.linkedList.head;
};
Stack3.prototype.isMaxStack = function() {
return this.toArray().length >= this.maxStep;
};
Stack3.prototype.peek = function() {
if (this.isEmpty()) {
return null;
}
return this.linkedList.head.value;
};
Stack3.prototype.push = function(value2) {
this.linkedList.prepend(value2);
if (this.length > this.maxStep) {
this.linkedList.deleteTail();
}
};
Stack3.prototype.pop = function() {
var removeHead = this.linkedList.deleteHead();
return removeHead ? removeHead.value : null;
};
Stack3.prototype.toArray = function() {
return this.linkedList.toArray().map(function(node) {
return node.value;
});
};
Stack3.prototype.clear = function() {
while (!this.isEmpty()) {
this.pop();
}
};
return Stack3;
}();
var stack_default2 = Stack2;
// node_modules/@antv/algorithm/es/index.js
var detectDirectedCycle3 = detect_cycle_default;
var es_default = {
getAdjMatrix: adjacent_matrix_default,
breadthFirstSearch: bfs_default,
connectedComponent: getConnectedComponents,
getDegree: degree_default,
getInDegree,
getOutDegree,
detectCycle: detect_cycle_default,
detectDirectedCycle: detectDirectedCycle3,
detectAllCycles,
detectAllDirectedCycle,
detectAllUndirectedCycle,
depthFirstSearch,
dijkstra: dijkstra_default,
findAllPath,
findShortestPath,
floydWarshall: floydWarshall_default,
labelPropagation: label_propagation_default,
louvain: louvain_default,
iLouvain: i_louvain_default,
kCore: k_core_default,
kMeans: k_means_default,
cosineSimilarity: cosine_similarity_default,
nodesCosineSimilarity: nodes_cosine_similarity_default,
minimumSpanningTree: mts_default,
pageRank: pageRank_default,
getNeighbors,
Stack: stack_default2,
GADDI: gaddi_default
};
// node_modules/@antv/g6-core/es/util/math.js
var math_exports = {};
__export(math_exports, {
Line: () => Line7,
applyMatrix: () => applyMatrix,
compare: () => compare2,
distance: () => distance10,
floydWarshall: () => floydWarshall3,
fractionToLine: () => fractionToLine,
getAdjMatrix: () => getAdjMatrix,
getBBoxBoundLine: () => getBBoxBoundLine,
getCircleCenterByPoints: () => getCircleCenterByPoints,
getCircleIntersectByPoint: () => getCircleIntersectByPoint,
getDegree: () => getDegree,
getEllipseIntersectByPoint: () => getEllipseIntersectByPoint,
getLineIntersect: () => getLineIntersect2,
getPointsCenter: () => getPointsCenter,
getRectIntersectByPoint: () => getRectIntersectByPoint,
intersectBBox: () => intersectBBox3,
invertMatrix: () => invertMatrix,
isPointInPolygon: () => isPointInPolygon,
isPointsOverlap: () => isPointsOverlap,
isPolygonsIntersect: () => isPolygonsIntersect2,
itemIntersectByLine: () => itemIntersectByLine,
move: () => move,
pointLineSquareDist: () => pointLineSquareDist,
pointRectSquareDist: () => pointRectSquareDist,
rotate: () => rotate6,
scale: () => scale10,
scaleMatrix: () => scaleMatrix,
squareDist: () => squareDist,
translate: () => translate4
});
var transform8 = ext_exports.transform;
var compare2 = function compare3(attributeName) {
return function(m4, n3) {
return m4[attributeName] - n3[attributeName];
};
};
var isBetween4 = function isBetween5(value2, min7, max8) {
return value2 >= min7 && value2 <= max8;
};
var getLineIntersect2 = function getLineIntersect3(p0, p1, p22, p32) {
var tolerance3 = 1e-4;
var E2 = {
x: p22.x - p0.x,
y: p22.y - p0.y
};
var D0 = {
x: p1.x - p0.x,
y: p1.y - p0.y
};
var D1 = {
x: p32.x - p22.x,
y: p32.y - p22.y
};
var kross = D0.x * D1.y - D0.y * D1.x;
var sqrKross = kross * kross;
var invertKross = 1 / kross;
var sqrLen0 = D0.x * D0.x + D0.y * D0.y;
var sqrLen1 = D1.x * D1.x + D1.y * D1.y;
if (sqrKross > tolerance3 * sqrLen0 * sqrLen1) {
var s4 = (E2.x * D1.y - E2.y * D1.x) * invertKross;
var t4 = (E2.x * D0.y - E2.y * D0.x) * invertKross;
if (!isBetween4(s4, 0, 1) || !isBetween4(t4, 0, 1))
return null;
return {
x: p0.x + s4 * D0.x,
y: p0.y + s4 * D0.y
};
}
return null;
};
var getRectIntersectByPoint = function getRectIntersectByPoint2(rect3, point2) {
var x6 = rect3.x, y5 = rect3.y, width2 = rect3.width, height = rect3.height;
var cx = x6 + width2 / 2;
var cy = y5 + height / 2;
var points = [];
var center2 = {
x: cx,
y: cy
};
points.push({
x: x6,
y: y5
});
points.push({
x: x6 + width2,
y: y5
});
points.push({
x: x6 + width2,
y: y5 + height
});
points.push({
x: x6,
y: y5 + height
});
points.push({
x: x6,
y: y5
});
var rst = null;
for (var i4 = 1; i4 < points.length; i4++) {
rst = getLineIntersect2(points[i4 - 1], points[i4], center2, point2);
if (rst) {
break;
}
}
return rst;
};
var getCircleIntersectByPoint = function getCircleIntersectByPoint2(circle3, point2) {
var cx = circle3.x, cy = circle3.y, r4 = circle3.r;
var x6 = point2.x, y5 = point2.y;
var dx = x6 - cx;
var dy = y5 - cy;
var d3 = Math.sqrt(dx * dx + dy * dy);
if (d3 < r4) {
return null;
}
var signX = Math.sign(dx);
var signY = Math.sign(dy);
var angle3 = Math.atan(dy / dx);
return {
x: cx + Math.abs(r4 * Math.cos(angle3)) * signX,
y: cy + Math.abs(r4 * Math.sin(angle3)) * signY
};
};
var getEllipseIntersectByPoint = function getEllipseIntersectByPoint2(ellipse, point2) {
var a4 = ellipse.rx;
var b10 = ellipse.ry;
var cx = ellipse.x;
var cy = ellipse.y;
var dx = point2.x - cx;
var dy = point2.y - cy;
var angle3 = Math.atan2(dy / b10, dx / a4);
if (angle3 < 0) {
angle3 += 2 * Math.PI;
}
return {
x: cx + a4 * Math.cos(angle3),
y: cy + b10 * Math.sin(angle3)
};
};
var applyMatrix = function applyMatrix2(point2, matrix, tag) {
if (tag === void 0) {
tag = 1;
}
var vector = [point2.x, point2.y, tag];
if (!matrix || isNaN(matrix[0])) {
matrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
}
vec3_exports.transformMat3(vector, vector, matrix);
return {
x: vector[0],
y: vector[1]
};
};
var invertMatrix = function invertMatrix2(point2, matrix, tag) {
if (tag === void 0) {
tag = 1;
}
if (!matrix || isNaN(matrix[0])) {
matrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
}
var inversedMatrix = mat3_exports.invert([1, 0, 0, 0, 1, 0, 0, 0, 1], matrix);
if (!inversedMatrix) {
inversedMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
}
var vector = [point2.x, point2.y, tag];
vec3_exports.transformMat3(vector, vector, inversedMatrix);
return {
x: vector[0],
y: vector[1]
};
};
var getCircleCenterByPoints = function getCircleCenterByPoints2(p1, p22, p32) {
var a4 = p1.x - p22.x;
var b10 = p1.y - p22.y;
var c5 = p1.x - p32.x;
var d3 = p1.y - p32.y;
var e4 = (p1.x * p1.x - p22.x * p22.x - p22.y * p22.y + p1.y * p1.y) / 2;
var f3 = (p1.x * p1.x - p32.x * p32.x - p32.y * p32.y + p1.y * p1.y) / 2;
var denominator = b10 * c5 - a4 * d3;
return {
x: -(d3 * e4 - b10 * f3) / denominator,
y: -(a4 * f3 - c5 * e4) / denominator
};
};
var distance10 = function distance11(p1, p22) {
var vx = p1.x - p22.x;
var vy = p1.y - p22.y;
return Math.sqrt(vx * vx + vy * vy);
};
var scaleMatrix = function scaleMatrix2(matrix, ratio) {
var result = [];
matrix.forEach(function(row) {
var newRow = [];
row.forEach(function(v3) {
newRow.push(v3 * ratio);
});
result.push(newRow);
});
return result;
};
var floydWarshall3 = function floydWarshall4(adjMatrix3) {
var dist4 = [];
var size2 = adjMatrix3.length;
for (var i4 = 0; i4 < size2; i4 += 1) {
dist4[i4] = [];
for (var j4 = 0; j4 < size2; j4 += 1) {
if (i4 === j4) {
dist4[i4][j4] = 0;
} else if (adjMatrix3[i4][j4] === 0 || !adjMatrix3[i4][j4]) {
dist4[i4][j4] = Infinity;
} else {
dist4[i4][j4] = adjMatrix3[i4][j4];
}
}
}
for (var k4 = 0; k4 < size2; k4 += 1) {
for (var i4 = 0; i4 < size2; i4 += 1) {
for (var j4 = 0; j4 < size2; j4 += 1) {
if (dist4[i4][j4] > dist4[i4][k4] + dist4[k4][j4]) {
dist4[i4][j4] = dist4[i4][k4] + dist4[k4][j4];
}
}
}
}
return dist4;
};
var getAdjMatrix = function getAdjMatrix2(data3, directed) {
var nodes = data3.nodes, edges = data3.edges;
var matrix = [];
var nodeMap = {};
if (!nodes) {
throw new Error("invalid nodes data!");
}
if (nodes) {
nodes.forEach(function(node, i4) {
nodeMap[node.id] = i4;
var row = [];
matrix.push(row);
});
}
if (edges) {
edges.forEach(function(e4) {
var source = e4.source, target = e4.target;
var sIndex = nodeMap[source];
var tIndex = nodeMap[target];
matrix[sIndex][tIndex] = 1;
if (!directed) {
matrix[tIndex][sIndex] = 1;
}
});
}
return matrix;
};
var translate4 = function translate5(group2, vec) {
group2.translate(vec.x, vec.y);
};
var move = function move2(group2, point2) {
var matrix = group2.getMatrix();
if (!matrix) {
matrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
}
var bbox = group2.getCanvasBBox();
var vx = point2.x - bbox.minX;
var vy = point2.y - bbox.minY;
var movedMatrix = transform8(matrix, [["t", vx, vy]]);
group2.setMatrix(movedMatrix);
};
var scale10 = function scale11(group2, ratio) {
var matrix = group2.getMatrix();
if (!matrix) {
matrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
}
var scaleXY = ratio;
if (!is_array_default(ratio)) {
scaleXY = [ratio, ratio];
}
if (is_array_default(ratio) && ratio.length === 1) {
scaleXY = [ratio[0], ratio[0]];
}
matrix = transform8(matrix, [["s", scaleXY[0], scaleXY[1]]]);
group2.setMatrix(matrix);
};
var rotate6 = function rotate7(group2, angle3) {
var matrix = group2.getMatrix();
if (!matrix) {
matrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
}
matrix = transform8(matrix, [["r", angle3]]);
group2.setMatrix(matrix);
};
var getDegree = function getDegree2(n3, nodeIdxMap, edges) {
var degrees = [];
for (var i4 = 0; i4 < n3; i4++) {
degrees[i4] = 0;
}
edges.forEach(function(e4) {
if (e4.source) {
degrees[nodeIdxMap[e4.source]] += 1;
}
if (e4.target) {
degrees[nodeIdxMap[e4.target]] += 1;
}
});
return degrees;
};
function onSegment3(p1, p22, q4) {
if ((q4[0] - p1[0]) * (p22[1] - p1[1]) === (p22[0] - p1[0]) * (q4[1] - p1[1]) && Math.min(p1[0], p22[0]) <= q4[0] && q4[0] <= Math.max(p1[0], p22[0]) && Math.min(p1[1], p22[1]) <= q4[1] && q4[1] <= Math.max(p1[1], p22[1])) {
return true;
}
return false;
}
var isPointInPolygon = function isPointInPolygon2(points, x6, y5) {
var isHit = false;
var n3 = points.length;
var tolerance3 = 1e-6;
function dcmp3(xValue) {
if (Math.abs(xValue) < tolerance3) {
return 0;
}
return xValue < 0 ? -1 : 1;
}
if (n3 <= 2) {
return false;
}
for (var i4 = 0; i4 < n3; i4++) {
var p1 = points[i4];
var p22 = points[(i4 + 1) % n3];
if (onSegment3(p1, p22, [x6, y5])) {
return true;
}
if (dcmp3(p1[1] - y5) > 0 !== dcmp3(p22[1] - y5) > 0 && dcmp3(x6 - (y5 - p1[1]) * (p1[0] - p22[0]) / (p1[1] - p22[1]) - p1[0]) < 0) {
isHit = !isHit;
}
}
return isHit;
};
var intersectBBox3 = function intersectBBox4(box1, box2) {
return !(box2.minX > box1.maxX || box2.maxX < box1.minX || box2.minY > box1.maxY || box2.maxY < box1.minY);
};
var lineIntersectPolygon2 = function lineIntersectPolygon3(lines, line2) {
var isIntersect2 = false;
each_default(lines, function(l4) {
if (getLineIntersect2(l4.from, l4.to, line2.from, line2.to)) {
isIntersect2 = true;
return false;
}
});
return isIntersect2;
};
var isPolygonsIntersect2 = function isPolygonsIntersect3(points1, points2) {
var getBBox5 = function getBBox6(points) {
var xArr = points.map(function(p4) {
return p4[0];
});
var yArr = points.map(function(p4) {
return p4[1];
});
return {
minX: Math.min.apply(null, xArr),
maxX: Math.max.apply(null, xArr),
minY: Math.min.apply(null, yArr),
maxY: Math.max.apply(null, yArr)
};
};
var parseToLines2 = function parseToLines3(points) {
var lines = [];
var count2 = points.length;
for (var i4 = 0; i4 < count2 - 1; i4++) {
var point2 = points[i4];
var next = points[i4 + 1];
lines.push({
from: {
x: point2[0],
y: point2[1]
},
to: {
x: next[0],
y: next[1]
}
});
}
if (lines.length > 1) {
var first = points[0];
var last2 = points[count2 - 1];
lines.push({
from: {
x: last2[0],
y: last2[1]
},
to: {
x: first[0],
y: first[1]
}
});
}
return lines;
};
if (points1.length < 2 || points2.length < 2) {
return false;
}
var bbox1 = getBBox5(points1);
var bbox2 = getBBox5(points2);
if (!intersectBBox3(bbox1, bbox2)) {
return false;
}
var isIn = false;
each_default(points2, function(point2) {
if (isPointInPolygon(points1, point2[0], point2[1])) {
isIn = true;
return false;
}
});
if (isIn) {
return true;
}
each_default(points1, function(point2) {
if (isPointInPolygon(points2, point2[0], point2[1])) {
isIn = true;
return false;
}
});
if (isIn) {
return true;
}
var lines1 = parseToLines2(points1);
var lines2 = parseToLines2(points2);
var isIntersect2 = false;
each_default(lines2, function(line2) {
if (lineIntersectPolygon2(lines1, line2)) {
isIntersect2 = true;
return false;
}
});
return isIntersect2;
};
var Line7 = function() {
function Line9(x1, y1, x22, y22) {
this.x1 = x1;
this.y1 = y1;
this.x2 = x22;
this.y2 = y22;
}
Line9.prototype.getBBox = function() {
var minX = Math.min(this.x1, this.x2);
var minY = Math.min(this.y1, this.y2);
var maxX = Math.max(this.x1, this.x2);
var maxY2 = Math.max(this.y1, this.y2);
var res = {
x: minX,
y: minY,
minX,
minY,
maxX,
maxY: maxY2,
width: maxX - minX,
height: maxY2 - minY
};
return res;
};
return Line9;
}();
var getBBoxBoundLine = function getBBoxBoundLine2(bbox, direction5) {
var bounds = {
top: [bbox.minX, bbox.minY, bbox.maxX, bbox.minY],
left: [bbox.minX, bbox.minY, bbox.minX, bbox.maxY],
bottom: [bbox.minX, bbox.maxY, bbox.maxX, bbox.maxY],
right: [bbox.maxX, bbox.minY, bbox.maxX, bbox.maxY]
};
return bounds[direction5];
};
var fractionAlongLineA = function fractionAlongLineA2(la, lb) {
var uaT = (lb.x2 - lb.x1) * (la.y1 - lb.y1) - (lb.y2 - lb.y1) * (la.x1 - lb.x1);
var ubT = (la.x2 - la.x1) * (la.y1 - lb.y1) - (la.y2 - la.y1) * (la.x1 - lb.x1);
var uB = (lb.y2 - lb.y1) * (la.x2 - la.x1) - (lb.x2 - lb.x1) * (la.y2 - la.y1);
if (uB) {
var ua = uaT / uB;
var ub = ubT / uB;
if (ua >= 0 && ua <= 1 && ub >= 0 && ub <= 1) {
return ua;
}
}
return Number.POSITIVE_INFINITY;
};
var itemIntersectByLine = function itemIntersectByLine2(item, line2) {
var directions = ["top", "left", "bottom", "right"];
var bbox = item.getBBox();
var countIntersections = 0;
var intersections = [];
for (var i4 = 0; i4 < 4; i4++) {
var _a6 = getBBoxBoundLine(bbox, directions[i4]), x1 = _a6[0], y1 = _a6[1], x22 = _a6[2], y22 = _a6[3];
intersections[i4] = getLineIntersect2({
x: line2.x1,
y: line2.y1
}, {
x: line2.x2,
y: line2.y2
}, {
x: x1,
y: y1
}, {
x: x22,
y: y22
});
if (intersections[i4]) {
countIntersections += 1;
}
}
return [intersections, countIntersections];
};
var fractionToLine = function fractionToLine2(item, line2) {
var directions = ["top", "left", "bottom", "right"];
var bbox = item.getBBox();
var minDistance = Number.POSITIVE_INFINITY;
var countIntersections = 0;
for (var i4 = 0; i4 < 4; i4++) {
var _a6 = getBBoxBoundLine(bbox, directions[i4]), x1 = _a6[0], y1 = _a6[1], x22 = _a6[2], y22 = _a6[3];
var testDistance = fractionAlongLineA(line2, new Line7(x1, y1, x22, y22));
testDistance = Math.abs(testDistance - 0.5);
if (testDistance >= 0 && testDistance <= 1) {
countIntersections += 1;
minDistance = testDistance < minDistance ? testDistance : minDistance;
}
}
if (countIntersections === 0)
return -1;
return minDistance;
};
var getPointsCenter = function getPointsCenter2(points) {
var centerX = 0;
var centerY = 0;
if (points.length > 0) {
for (var _i = 0, points_1 = points; _i < points_1.length; _i++) {
var point2 = points_1[_i];
centerX += point2.x;
centerY += point2.y;
}
centerX /= points.length;
centerY /= points.length;
}
return {
x: centerX,
y: centerY
};
};
var squareDist = function squareDist2(a4, b10) {
return Math.pow(a4.x - b10.x, 2) + Math.pow(a4.y - b10.y, 2);
};
var pointLineSquareDist = function pointLineSquareDist2(point2, line2) {
var x1 = line2.x1;
var y1 = line2.y1;
var x22 = line2.x2 - x1;
var y22 = line2.y2 - y1;
var px = point2.x - x1;
var py = point2.y - y1;
var dotprod = px * x22 + py * y22;
var projlenSq;
if (dotprod <= 0) {
projlenSq = 0;
} else {
px = x22 - px;
py = y22 - py;
dotprod = px * x22 + py * y22;
if (dotprod <= 0) {
projlenSq = 0;
} else {
projlenSq = dotprod * dotprod / (x22 * x22 + y22 * y22);
}
}
var lenSq = px * px + py * py - projlenSq;
if (lenSq < 0) {
lenSq = 0;
}
return lenSq;
};
var isPointsOverlap = function isPointsOverlap2(p1, p22, e4) {
if (e4 === void 0) {
e4 = 1e-3;
}
return Math.pow(p1.x - p22.x, 2) + Math.pow(p1.y - p22.y, 2) < Math.pow(e4, 2);
};
var pointRectSquareDist = function pointRectSquareDist2(point2, rect3) {
var isLeft = point2.x < rect3.x;
var isRight = point2.x > rect3.x + rect3.width;
var isTop = point2.y > rect3.y + rect3.height;
var isBottom = point2.y < rect3.y;
var isPointOutside = isLeft || isRight || isTop || isBottom;
if (!isPointOutside) {
return 0;
}
if (isTop && !isLeft && !isRight) {
return Math.pow(rect3.y + rect3.height - point2.y, 2);
}
if (isBottom && !isLeft && !isRight) {
return Math.pow(point2.y - rect3.y, 2);
}
if (isLeft && !isTop && !isBottom) {
return Math.pow(rect3.x - point2.x, 2);
}
if (isRight && !isTop && !isBottom) {
return Math.pow(rect3.x + rect3.width - point2.x, 2);
}
var dx = Math.min(Math.abs(rect3.x - point2.x), Math.abs(rect3.x + rect3.width - point2.x));
var dy = Math.min(Math.abs(rect3.y - point2.y), Math.abs(rect3.y + rect3.height - point2.y));
return dx * dx + dy * dy;
};
// node_modules/@antv/g6-core/es/global.js
var subjectColor = "rgb(95, 149, 255)";
var backColor = "rgb(255, 255, 255)";
var textColor = "rgb(0, 0, 0)";
var activeFill = "rgb(247, 250, 255)";
var nodeMainFill = "rgb(239, 244, 255)";
var comboFill = "rgb(253, 253, 253)";
var disabledFill = "rgb(250, 250, 250)";
var edgeMainStroke = "rgb(224, 224, 224)";
var edgeInactiveStroke = "rgb(234, 234, 234)";
var edgeDisablesStroke = "rgb(245, 245, 245)";
var inactiveStroke = "rgb(191, 213, 255)";
var highlightStroke = "#4572d9";
var highlightFill = "rgb(223, 234, 255)";
var colorSet = {
mainStroke: subjectColor,
mainFill: nodeMainFill,
activeStroke: subjectColor,
activeFill,
inactiveStroke,
inactiveFill: activeFill,
selectedStroke: subjectColor,
selectedFill: backColor,
highlightStroke,
highlightFill,
disableStroke: edgeMainStroke,
disableFill: disabledFill,
edgeMainStroke,
edgeActiveStroke: subjectColor,
edgeInactiveStroke,
edgeSelectedStroke: subjectColor,
edgeHighlightStroke: subjectColor,
edgeDisableStroke: edgeDisablesStroke,
comboMainStroke: edgeMainStroke,
comboMainFill: comboFill,
comboActiveStroke: subjectColor,
comboActiveFill: activeFill,
comboInactiveStroke: edgeMainStroke,
comboInactiveFill: comboFill,
comboSelectedStroke: subjectColor,
comboSelectedFill: comboFill,
comboHighlightStroke: highlightStroke,
comboHighlightFill: comboFill,
comboDisableStroke: edgeInactiveStroke,
comboDisableFill: disabledFill
};
var global_default = {
version: "0.2.4",
rootContainerClassName: "root-container",
nodeContainerClassName: "node-container",
edgeContainerClassName: "edge-container",
comboContainerClassName: "combo-container",
delegateContainerClassName: "delegate-container",
defaultLoopPosition: "top",
nodeLabel: {
style: {
fill: "#000",
fontSize: 12,
textAlign: "center",
textBaseline: "middle"
},
offset: 4
},
defaultNode: {
type: "circle",
style: {
lineWidth: 1,
stroke: colorSet.mainStroke,
fill: nodeMainFill
},
size: 20,
color: colorSet.mainStroke,
linkPoints: {
size: 8,
lineWidth: 1,
fill: colorSet.activeFill,
stroke: colorSet.activeStroke
}
},
nodeStateStyles: {
active: {
fill: colorSet.activeFill,
stroke: colorSet.activeStroke,
lineWidth: 2,
shadowColor: colorSet.mainStroke,
shadowBlur: 10
},
selected: {
fill: colorSet.selectedFill,
stroke: colorSet.selectedStroke,
lineWidth: 4,
shadowColor: colorSet.selectedStroke,
shadowBlur: 10,
"text-shape": {
fontWeight: 500
}
},
highlight: {
fill: colorSet.highlightFill,
stroke: colorSet.highlightStroke,
lineWidth: 2,
"text-shape": {
fontWeight: 500
}
},
inactive: {
fill: colorSet.inactiveFill,
stroke: colorSet.inactiveStroke,
lineWidth: 1
},
disable: {
fill: colorSet.disableFill,
stroke: colorSet.disableStroke,
lineWidth: 1
}
},
edgeLabel: {
style: {
fill: textColor,
textAlign: "center",
textBaseline: "middle",
fontSize: 12
}
},
defaultEdge: {
type: "line",
size: 1,
style: {
stroke: colorSet.edgeMainStroke,
lineAppendWidth: 2
},
color: colorSet.edgeMainStroke
},
edgeStateStyles: {
active: {
stroke: colorSet.edgeActiveStroke,
lineWidth: 1
},
selected: {
stroke: colorSet.edgeSelectedStroke,
lineWidth: 2,
shadowColor: colorSet.edgeSelectedStroke,
shadowBlur: 10,
"text-shape": {
fontWeight: 500
}
},
highlight: {
stroke: colorSet.edgeHighlightStroke,
lineWidth: 2,
"text-shape": {
fontWeight: 500
}
},
inactive: {
stroke: colorSet.edgeInactiveStroke,
lineWidth: 1
},
disable: {
stroke: colorSet.edgeDisableStroke,
lineWidth: 1
}
},
comboLabel: {
style: {
fill: textColor,
textBaseline: "middle",
fontSize: 12
},
refY: 10,
refX: 10
},
defaultCombo: {
type: "circle",
style: {
fill: colorSet.comboMainFill,
lineWidth: 1,
stroke: colorSet.comboMainStroke,
r: 5,
width: 20,
height: 10
},
size: [20, 5],
color: colorSet.comboMainStroke,
padding: [25, 20, 15, 20]
},
comboStateStyles: {
active: {
stroke: colorSet.comboActiveStroke,
lineWidth: 1,
fill: colorSet.comboActiveFill
},
selected: {
stroke: colorSet.comboSelectedStroke,
lineWidth: 2,
fill: colorSet.comboSelectedFill,
shadowColor: colorSet.comboSelectedStroke,
shadowBlur: 10,
"text-shape": {
fontWeight: 500
}
},
highlight: {
stroke: colorSet.comboHighlightStroke,
lineWidth: 2,
fill: colorSet.comboHighlightFill,
"text-shape": {
fontWeight: 500
}
},
inactive: {
stroke: colorSet.comboInactiveStroke,
fill: colorSet.comboInactiveFill,
lineWidth: 1
},
disable: {
stroke: colorSet.comboDisableStroke,
fill: colorSet.comboDisableFill,
lineWidth: 1
}
},
delegateStyle: {
fill: "#F3F9FF",
fillOpacity: 0.5,
stroke: "#1890FF",
strokeOpacity: 0.9,
lineDash: [5, 5]
}
};
// node_modules/@antv/g6-core/es/graph/controller/mode.js
var ModeController = function() {
function ModeController2(graph) {
this.graph = graph;
this.destroyed = false;
this.modes = graph.get("modes") || {
default: []
};
this.formatModes();
this.mode = graph.get("defaultMode") || "default";
this.currentBehaves = [];
this.setMode(this.mode);
}
ModeController2.prototype.formatModes = function() {
var modes = this.modes;
each_default(modes, function(mode) {
each_default(mode, function(behavior, i4) {
if (is_string_default(behavior)) {
mode[i4] = {
type: behavior
};
}
});
});
};
ModeController2.prototype.setBehaviors = function(mode) {
var graph = this.graph;
var behaviors2 = this.modes[mode];
var behaves = [];
var behave;
each_default(behaviors2 || [], function(behavior) {
var BehaviorInstance = behavior_default.getBehavior(behavior.type || behavior);
if (!BehaviorInstance) {
return;
}
behave = new BehaviorInstance(behavior);
if (behave) {
behave.bind(graph);
behaves.push(behave);
}
});
this.currentBehaves = behaves;
};
ModeController2.mergeBehaviors = function(modeBehaviors, behaviors2) {
each_default(behaviors2, function(behavior) {
if (modeBehaviors.indexOf(behavior) < 0) {
if (is_string_default(behavior)) {
behavior = {
type: behavior
};
}
modeBehaviors.push(behavior);
}
});
return modeBehaviors;
};
ModeController2.filterBehaviors = function(modeBehaviors, behaviors2) {
var result = [];
modeBehaviors.forEach(function(behavior) {
var type2 = "";
if (is_string_default(behavior)) {
type2 = behavior;
} else {
type2 = behavior.type;
}
if (behaviors2.indexOf(type2) < 0) {
result.push(behavior);
}
});
return result;
};
ModeController2.prototype.setMode = function(mode) {
var _a6 = this, modes = _a6.modes, graph = _a6.graph;
var current = mode;
var behaviors2 = modes[current];
if (!behaviors2) {
return;
}
graph.emit("beforemodechange", {
mode
});
each_default(this.currentBehaves, function(behave) {
if (behave.delegate)
behave.delegate.remove();
behave.unbind(graph);
});
this.setBehaviors(current);
graph.emit("aftermodechange", {
mode
});
this.mode = mode;
};
ModeController2.prototype.getMode = function() {
return this.mode;
};
ModeController2.prototype.manipulateBehaviors = function(behaviors2, modes, isAdd) {
var _this = this;
var behaves;
if (!is_array_default(behaviors2)) {
behaves = [behaviors2];
} else {
behaves = behaviors2;
}
if (is_array_default(modes)) {
each_default(modes, function(mode) {
if (!_this.modes[mode]) {
if (isAdd) {
_this.modes[mode] = behaves;
}
} else if (isAdd) {
_this.modes[mode] = ModeController2.mergeBehaviors(_this.modes[mode] || [], behaves);
} else {
_this.modes[mode] = ModeController2.filterBehaviors(_this.modes[mode] || [], behaves);
}
});
return this;
}
var currentMode = modes;
if (!modes) {
currentMode = this.mode;
}
if (!this.modes[currentMode]) {
if (isAdd) {
this.modes[currentMode] = behaves;
}
}
if (isAdd) {
this.modes[currentMode] = ModeController2.mergeBehaviors(this.modes[currentMode] || [], behaves);
} else {
this.modes[currentMode] = ModeController2.filterBehaviors(this.modes[currentMode] || [], behaves);
}
this.setMode(this.mode);
return this;
};
ModeController2.prototype.updateBehavior = function(behavior, newCfg, mode) {
if (is_string_default(behavior)) {
behavior = {
type: behavior
};
}
var behaviorSet = [];
if (!mode || mode === this.mode || mode === "default") {
behaviorSet = this.currentBehaves;
if (!behaviorSet || !behaviorSet.length) {
console.warn("Update behavior failed! There is no behaviors in this mode on the graph.");
return this;
}
var length_1 = behaviorSet.length;
for (var i4 = 0; i4 < length_1; i4++) {
var behave = behaviorSet[i4];
if (behave.type === behavior.type) {
behave.updateCfg(newCfg);
return this;
}
if (i4 === length_1 - 1)
console.warn("Update behavior failed! There is no such behavior in the mode");
}
} else {
behaviorSet = this.modes[mode];
if (!behaviorSet || !behaviorSet.length) {
console.warn("Update behavior failed! There is no behaviors in this mode on the graph.");
return this;
}
var length_2 = behaviorSet.length;
for (var i4 = 0; i4 < length_2; i4++) {
var behave = behaviorSet[i4];
if (behave.type === behavior.type || behave === behavior.type) {
if (behave === behavior.type)
behave = {
type: behave
};
Object.assign(behave, newCfg);
behaviorSet[i4] = behave;
return this;
}
if (i4 === length_2 - 1)
console.warn("Update behavior failed! There is no such behavior in the mode");
}
}
return this;
};
ModeController2.prototype.destroy = function() {
this.graph = null;
this.modes = null;
this.currentBehaves = null;
this.destroyed = true;
};
return ModeController2;
}();
var mode_default = ModeController;
// node_modules/@antv/g6-core/es/util/base.js
var base_exports = {};
__export(base_exports, {
calculationItemsBBox: () => calculationItemsBBox,
cloneEvent: () => cloneEvent,
formatPadding: () => formatPadding2,
isNaN: () => isNaN2,
isViewportChanged: () => isViewportChanged,
processParallelEdges: () => processParallelEdges,
uniqueId: () => uniqueId3
});
// node_modules/@antv/g6-core/es/interface/behavior.js
var G6GraphEvent = function(_super) {
__extends(G6GraphEvent2, _super);
function G6GraphEvent2(type2, event) {
var _this = _super.call(this, type2, event) || this;
_this.item = event.item;
_this.canvasX = event.canvasX;
_this.canvasY = event.canvasY;
_this.wheelDelta = event.wheelDelta;
_this.detail = event.detail;
return _this;
}
return G6GraphEvent2;
}(graph_event_default);
// node_modules/@antv/g6-core/es/util/base.js
var uniqueId3 = function uniqueId4(type2) {
return type2 + "-" + Math.random() + Date.now();
};
var formatPadding2 = function formatPadding3(padding3) {
var top = 0;
var left2 = 0;
var right2 = 0;
var bottom = 0;
if (is_number_default(padding3)) {
top = left2 = right2 = bottom = padding3;
} else if (is_string_default(padding3)) {
var intPadding = parseInt(padding3, 10);
top = left2 = right2 = bottom = intPadding;
} else if (is_array_default(padding3)) {
top = padding3[0];
right2 = !is_nil_default(padding3[1]) ? padding3[1] : padding3[0];
bottom = !is_nil_default(padding3[2]) ? padding3[2] : padding3[0];
left2 = !is_nil_default(padding3[3]) ? padding3[3] : right2;
}
return [top, right2, bottom, left2];
};
var cloneEvent = function cloneEvent2(e4) {
var event = new G6GraphEvent(e4.type, e4);
event.clientX = e4.clientX;
event.clientY = e4.clientY;
event.x = e4.x;
event.y = e4.y;
event.target = e4.target;
event.currentTarget = e4.currentTarget;
event.bubbles = true;
event.item = e4.item;
return event;
};
var isViewportChanged = function isViewportChanged2(matrix) {
if (!matrix) {
return false;
}
var MATRIX_LEN = 9;
var ORIGIN_MATRIX2 = [1, 0, 0, 0, 1, 0, 0, 0, 1];
for (var i4 = 0; i4 < MATRIX_LEN; i4++) {
if (matrix[i4] !== ORIGIN_MATRIX2[i4]) {
return true;
}
}
return false;
};
var isNaN2 = function isNaN3(input) {
return Number.isNaN(Number(input));
};
var calculationItemsBBox = function calculationItemsBBox2(items) {
var minx = Infinity;
var maxx = -Infinity;
var miny = Infinity;
var maxy = -Infinity;
for (var i4 = 0; i4 < items.length; i4++) {
var element = items[i4];
var bbox = element.getBBox();
var minX = bbox.minX, minY = bbox.minY, maxX = bbox.maxX, maxY2 = bbox.maxY;
if (minX < minx) {
minx = minX;
}
if (minY < miny) {
miny = minY;
}
if (maxX > maxx) {
maxx = maxX;
}
if (maxY2 > maxy) {
maxy = maxY2;
}
}
var x6 = Math.floor(minx);
var y5 = Math.floor(miny);
var width2 = Math.ceil(maxx) - Math.floor(minx);
var height = Math.ceil(maxy) - Math.floor(miny);
return {
x: x6,
y: y5,
width: width2,
height,
minX: minx,
minY: miny,
maxX: maxx,
maxY: maxy
};
};
var processParallelEdges = function processParallelEdges2(edges, offsetDiff, multiEdgeType, singleEdgeType, loopEdgeType) {
if (offsetDiff === void 0) {
offsetDiff = 15;
}
if (multiEdgeType === void 0) {
multiEdgeType = "quadratic";
}
if (singleEdgeType === void 0) {
singleEdgeType = void 0;
}
if (loopEdgeType === void 0) {
loopEdgeType = void 0;
}
var len5 = edges.length;
var cod = offsetDiff * 2;
var loopPosition = ["top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left"];
var edgeMap = {};
var tags = [];
var reverses = {};
for (var i4 = 0; i4 < len5; i4++) {
var edge2 = edges[i4];
var source = edge2.source, target = edge2.target;
var sourceTarget = source + "-" + target;
if (tags[i4])
continue;
if (!edgeMap[sourceTarget]) {
edgeMap[sourceTarget] = [];
}
tags[i4] = true;
edgeMap[sourceTarget].push(edge2);
for (var j4 = 0; j4 < len5; j4++) {
if (i4 === j4)
continue;
var sedge = edges[j4];
var src = sedge.source;
var dst = sedge.target;
if (!tags[j4]) {
if (source === dst && target === src) {
edgeMap[sourceTarget].push(sedge);
tags[j4] = true;
reverses[src + "|" + dst + "|" + (edgeMap[sourceTarget].length - 1)] = true;
} else if (source === src && target === dst) {
edgeMap[sourceTarget].push(sedge);
tags[j4] = true;
}
}
}
}
for (var key in edgeMap) {
var arcEdges = edgeMap[key];
var length_1 = arcEdges.length;
for (var k4 = 0; k4 < length_1; k4++) {
var current = arcEdges[k4];
if (current.source === current.target) {
if (loopEdgeType)
current.type = loopEdgeType;
current.loopCfg = {
position: loopPosition[k4 % 8],
dist: Math.floor(k4 / 8) * 20 + 50
};
continue;
}
if (length_1 === 1 && singleEdgeType && current.source !== current.target) {
current.type = singleEdgeType;
continue;
}
current.type = multiEdgeType;
var sign = (k4 % 2 === 0 ? 1 : -1) * (reverses[current.source + "|" + current.target + "|" + k4] ? -1 : 1);
if (length_1 % 2 === 1) {
current.curveOffset = sign * Math.ceil(k4 / 2) * cod;
} else {
current.curveOffset = sign * (Math.floor(k4 / 2) * cod + offsetDiff);
}
}
}
return edges;
};
// node_modules/@antv/g6-core/es/graph/controller/view.js
var ViewController = function() {
function ViewController2(graph) {
this.destroyed = false;
this.graph = graph;
this.destroyed = false;
}
ViewController2.prototype.getViewCenter = function() {
var padding3 = this.getFormatPadding();
var graph = this.graph;
var width2 = this.graph.get("width");
var height = graph.get("height");
return {
x: (width2 - padding3[1] - padding3[3]) / 2 + padding3[3],
y: (height - padding3[0] - padding3[2]) / 2 + padding3[0]
};
};
ViewController2.prototype.fitCenter = function() {
var graph = this.graph;
var group2 = graph.get("group");
group2.resetMatrix();
var bbox = group2.getCanvasBBox();
if (bbox.width === 0 || bbox.height === 0)
return;
var viewCenter = this.getViewCenter();
var groupCenter = {
x: bbox.x + bbox.width / 2,
y: bbox.y + bbox.height / 2
};
graph.translate(viewCenter.x - groupCenter.x, viewCenter.y - groupCenter.y);
};
ViewController2.prototype.fitView = function() {
var graph = this.graph;
var padding3 = this.getFormatPadding();
var width2 = graph.get("width");
var height = graph.get("height");
var group2 = graph.get("group");
group2.resetMatrix();
var bbox = group2.getCanvasBBox();
if (bbox.width === 0 || bbox.height === 0)
return;
var viewCenter = this.getViewCenter();
var groupCenter = {
x: bbox.x + bbox.width / 2,
y: bbox.y + bbox.height / 2
};
graph.translate(viewCenter.x - groupCenter.x, viewCenter.y - groupCenter.y);
var w4 = (width2 - padding3[1] - padding3[3]) / bbox.width;
var h3 = (height - padding3[0] - padding3[2]) / bbox.height;
var ratio = w4;
if (w4 > h3) {
ratio = h3;
}
graph.zoom(ratio, viewCenter);
};
ViewController2.prototype.getFormatPadding = function() {
var padding3 = this.graph.get("fitViewPadding");
return formatPadding2(padding3);
};
ViewController2.prototype.focusPoint = function(point2, animate, animateCfg) {
var _this = this;
var viewCenter = this.getViewCenter();
var modelCenter = this.getPointByCanvas(viewCenter.x, viewCenter.y);
var viewportMatrix = this.graph.get("group").getMatrix();
if (!viewportMatrix)
viewportMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
if (animate) {
var dx_1 = (modelCenter.x - point2.x) * viewportMatrix[0];
var dy_1 = (modelCenter.y - point2.y) * viewportMatrix[4];
var lastX_1 = 0;
var lastY_1 = 0;
var newX_1 = 0;
var newY_1 = 0;
this.graph.get("canvas").animate(function(ratio) {
newX_1 = dx_1 * ratio;
newY_1 = dy_1 * ratio;
_this.graph.translate(newX_1 - lastX_1, newY_1 - lastY_1);
lastX_1 = newX_1;
lastY_1 = newY_1;
}, __assign({}, animateCfg));
} else {
this.graph.translate((modelCenter.x - point2.x) * viewportMatrix[0], (modelCenter.y - point2.y) * viewportMatrix[4]);
}
};
ViewController2.prototype.getPointByCanvas = function(canvasX, canvasY) {
var viewportMatrix = this.graph.get("group").getMatrix();
if (!viewportMatrix) {
viewportMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
}
var point2 = invertMatrix({
x: canvasX,
y: canvasY
}, viewportMatrix);
return point2;
};
ViewController2.prototype.getPointByClient = function(clientX, clientY) {
var canvas = this.graph.get("canvas");
var canvasPoint = canvas.getPointByClient(clientX, clientY);
return this.getPointByCanvas(canvasPoint.x, canvasPoint.y);
};
ViewController2.prototype.getClientByPoint = function(x6, y5) {
var canvas = this.graph.get("canvas");
var canvasPoint = this.getCanvasByPoint(x6, y5);
var point2 = canvas.getClientByPoint(canvasPoint.x, canvasPoint.y);
return {
x: point2.x,
y: point2.y
};
};
ViewController2.prototype.getCanvasByPoint = function(x6, y5) {
var viewportMatrix = this.graph.get("group").getMatrix();
if (!viewportMatrix) {
viewportMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
}
return applyMatrix({
x: x6,
y: y5
}, viewportMatrix);
};
ViewController2.prototype.focus = function(item, animate, animateCfg) {
if (is_string_default(item)) {
item = this.graph.findById(item);
}
var group2 = item.get("group");
var matrix = group2.getMatrix();
if (!matrix)
matrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
if (item) {
this.focusPoint({
x: matrix[6],
y: matrix[7]
}, animate, animateCfg);
}
};
ViewController2.prototype.changeSize = function(width2, height) {
var graph = this.graph;
if (!is_number_default(width2) || !is_number_default(height)) {
throw Error("invalid canvas width & height, please make sure width & height type is number");
}
graph.set({
width: width2,
height
});
var canvas = graph.get("canvas");
canvas.changeSize(width2, height);
var plugins = graph.get("plugins");
plugins.forEach(function(plugin) {
if (plugin.get("gridContainer")) {
var minZoom = graph.get("minZoom");
modifyCSS(plugin.get("container"), {
width: width2 + "px",
height: height + "px"
});
modifyCSS(plugin.get("gridContainer"), {
width: width2 / minZoom + "px",
height: height / minZoom + "px",
left: 0,
top: 0
});
}
});
};
ViewController2.prototype.destroy = function() {
this.graph = null;
this.destroyed = false;
};
return ViewController2;
}();
var view_default2 = ViewController;
// node_modules/@antv/g6-core/es/util/graphic.js
var graphic_exports = {};
__export(graphic_exports, {
cloneBesidesImg: () => cloneBesidesImg,
getBBox: () => getBBox2,
getComboBBox: () => getComboBBox,
getLabelPosition: () => getLabelPosition,
getLetterWidth: () => getLetterWidth,
getLoopCfgs: () => getLoopCfgs,
getTextSize: () => getTextSize,
plainCombosToTrees: () => plainCombosToTrees,
reconstructTree: () => reconstructTree,
shouldRefreshEdge: () => shouldRefreshEdge,
traverseTree: () => traverseTree,
traverseTreeUp: () => traverseTreeUp
});
// node_modules/@antv/g6-core/es/util/letterAspectRatio.js
var letterAspectRatio_default = {
" ": 0.3329986572265625,
a: 0.5589996337890625,
A: 0.6569992065429687,
b: 0.58599853515625,
B: 0.6769989013671875,
c: 0.5469985961914062,
C: 0.7279998779296875,
d: 0.58599853515625,
D: 0.705999755859375,
e: 0.554998779296875,
E: 0.63699951171875,
f: 0.37299957275390627,
F: 0.5769989013671875,
g: 0.5909988403320312,
G: 0.7479995727539063,
h: 0.555999755859375,
H: 0.7199996948242188,
i: 0.255999755859375,
I: 0.23699951171875,
j: 0.26699981689453123,
J: 0.5169998168945312,
k: 0.5289993286132812,
K: 0.6899993896484375,
l: 0.23499908447265624,
L: 0.5879989624023437,
m: 0.854998779296875,
M: 0.8819992065429687,
n: 0.5589996337890625,
N: 0.7189987182617188,
o: 0.58599853515625,
O: 0.7669998168945312,
p: 0.58599853515625,
P: 0.6419998168945312,
q: 0.58599853515625,
Q: 0.7669998168945312,
r: 0.3649993896484375,
R: 0.6759994506835938,
s: 0.504998779296875,
S: 0.6319992065429687,
t: 0.354998779296875,
T: 0.6189987182617187,
u: 0.5599990844726562,
U: 0.7139999389648437,
v: 0.48199920654296874,
V: 0.6389999389648438,
w: 0.754998779296875,
W: 0.929998779296875,
x: 0.5089996337890625,
X: 0.63699951171875,
y: 0.4959991455078125,
Y: 0.66199951171875,
z: 0.48699951171875,
Z: 0.6239990234375,
"0": 0.6,
"1": 0.40099945068359377,
"2": 0.6,
"3": 0.6,
"4": 0.6,
"5": 0.6,
"6": 0.6,
"7": 0.5469985961914062,
"8": 0.6,
"9": 0.6,
"[": 0.3329986572265625,
"]": 0.3329986572265625,
",": 0.26399993896484375,
".": 0.26399993896484375,
";": 0.26399993896484375,
":": 0.26399993896484375,
"{": 0.3329986572265625,
"}": 0.3329986572265625,
"\\": 0.5,
"|": 0.19499969482421875,
"=": 0.604998779296875,
"+": 0.604998779296875,
"-": 0.604998779296875,
_: 0.5,
"`": 0.3329986572265625,
" ~": 0.8329986572265625,
"!": 0.3329986572265625,
"@": 0.8579986572265625,
"#": 0.6,
$: 0.6,
"%": 0.9699996948242188,
"^": 0.517999267578125,
"&": 0.7259994506835937,
"*": 0.505999755859375,
"(": 0.3329986572265625,
")": 0.3329986572265625,
"<": 0.604998779296875,
">": 0.604998779296875,
"/": 0.5,
"?": 0.53699951171875
};
// node_modules/@antv/g6-core/es/util/graphic.js
var PI2 = Math.PI;
var sin2 = Math.sin;
var cos2 = Math.cos;
var SELF_LINK_SIN = sin2(PI2 / 8);
var SELF_LINK_COS = cos2(PI2 / 8);
var getBBox2 = function getBBox3(element, group2) {
var bbox = element.getBBox();
var leftTop = {
x: bbox.minX,
y: bbox.minY
};
var rightBottom = {
x: bbox.maxX,
y: bbox.maxY
};
if (group2) {
var matrix = group2.getMatrix();
if (!matrix) {
matrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
}
leftTop = applyMatrix(leftTop, matrix);
rightBottom = applyMatrix(rightBottom, matrix);
}
var lx = leftTop.x, ly = leftTop.y;
var rx = rightBottom.x, ry = rightBottom.y;
return {
x: lx,
y: ly,
minX: lx,
minY: ly,
maxX: rx,
maxY: ry,
width: rx - lx,
height: ry - ly
};
};
var getLoopCfgs = function getLoopCfgs2(cfg) {
var item = cfg.sourceNode || cfg.targetNode;
var container2 = item.get("group");
var containerMatrix = container2.getMatrix();
if (!containerMatrix)
containerMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
var keyShape = item.getKeyShape();
var bbox = keyShape.getBBox();
var loopCfg = cfg.loopCfg || {};
var dist4 = loopCfg.dist || Math.max(bbox.width, bbox.height) * 2;
var position2 = loopCfg.position || global_default.defaultLoopPosition;
var center2 = [containerMatrix[6], containerMatrix[7]];
var startPoint = [cfg.startPoint.x, cfg.startPoint.y];
var endPoint = [cfg.endPoint.x, cfg.endPoint.y];
var rstart = bbox.height / 2;
var rend = bbox.height / 2;
var sinDeltaStart = rstart * SELF_LINK_SIN;
var cosDeltaStart = rstart * SELF_LINK_COS;
var sinDeltaEnd = rend * SELF_LINK_SIN;
var cosDeltaEnd = rend * SELF_LINK_COS;
if (startPoint[0] === endPoint[0] && startPoint[1] === endPoint[1]) {
switch (position2) {
case "top":
startPoint = [center2[0] - sinDeltaStart, center2[1] - cosDeltaStart];
endPoint = [center2[0] + sinDeltaEnd, center2[1] - cosDeltaEnd];
break;
case "top-right":
rstart = bbox.height / 2;
rend = bbox.width / 2;
sinDeltaStart = rstart * SELF_LINK_SIN;
cosDeltaStart = rstart * SELF_LINK_COS;
sinDeltaEnd = rend * SELF_LINK_SIN;
cosDeltaEnd = rend * SELF_LINK_COS;
startPoint = [center2[0] + sinDeltaStart, center2[1] - cosDeltaStart];
endPoint = [center2[0] + cosDeltaEnd, center2[1] - sinDeltaEnd];
break;
case "right":
rstart = bbox.width / 2;
rend = bbox.width / 2;
sinDeltaStart = rstart * SELF_LINK_SIN;
cosDeltaStart = rstart * SELF_LINK_COS;
sinDeltaEnd = rend * SELF_LINK_SIN;
cosDeltaEnd = rend * SELF_LINK_COS;
startPoint = [center2[0] + cosDeltaStart, center2[1] - sinDeltaStart];
endPoint = [center2[0] + cosDeltaEnd, center2[1] + sinDeltaEnd];
break;
case "bottom-right":
rstart = bbox.width / 2;
rend = bbox.height / 2;
sinDeltaStart = rstart * SELF_LINK_SIN;
cosDeltaStart = rstart * SELF_LINK_COS;
sinDeltaEnd = rend * SELF_LINK_SIN;
cosDeltaEnd = rend * SELF_LINK_COS;
startPoint = [center2[0] + cosDeltaStart, center2[1] + sinDeltaStart];
endPoint = [center2[0] + sinDeltaEnd, center2[1] + cosDeltaEnd];
break;
case "bottom":
rstart = bbox.height / 2;
rend = bbox.height / 2;
sinDeltaStart = rstart * SELF_LINK_SIN;
cosDeltaStart = rstart * SELF_LINK_COS;
sinDeltaEnd = rend * SELF_LINK_SIN;
cosDeltaEnd = rend * SELF_LINK_COS;
startPoint = [center2[0] + sinDeltaStart, center2[1] + cosDeltaStart];
endPoint = [center2[0] - sinDeltaEnd, center2[1] + cosDeltaEnd];
break;
case "bottom-left":
rstart = bbox.height / 2;
rend = bbox.width / 2;
sinDeltaStart = rstart * SELF_LINK_SIN;
cosDeltaStart = rstart * SELF_LINK_COS;
sinDeltaEnd = rend * SELF_LINK_SIN;
cosDeltaEnd = rend * SELF_LINK_COS;
startPoint = [center2[0] - sinDeltaStart, center2[1] + cosDeltaStart];
endPoint = [center2[0] - cosDeltaEnd, center2[1] + sinDeltaEnd];
break;
case "left":
rstart = bbox.width / 2;
rend = bbox.width / 2;
sinDeltaStart = rstart * SELF_LINK_SIN;
cosDeltaStart = rstart * SELF_LINK_COS;
sinDeltaEnd = rend * SELF_LINK_SIN;
cosDeltaEnd = rend * SELF_LINK_COS;
startPoint = [center2[0] - cosDeltaStart, center2[1] + sinDeltaStart];
endPoint = [center2[0] - cosDeltaEnd, center2[1] - sinDeltaEnd];
break;
case "top-left":
rstart = bbox.width / 2;
rend = bbox.height / 2;
sinDeltaStart = rstart * SELF_LINK_SIN;
cosDeltaStart = rstart * SELF_LINK_COS;
sinDeltaEnd = rend * SELF_LINK_SIN;
cosDeltaEnd = rend * SELF_LINK_COS;
startPoint = [center2[0] - cosDeltaStart, center2[1] - sinDeltaStart];
endPoint = [center2[0] - sinDeltaEnd, center2[1] - cosDeltaEnd];
break;
default:
rstart = bbox.width / 2;
rend = bbox.width / 2;
sinDeltaStart = rstart * SELF_LINK_SIN;
cosDeltaStart = rstart * SELF_LINK_COS;
sinDeltaEnd = rend * SELF_LINK_SIN;
cosDeltaEnd = rend * SELF_LINK_COS;
startPoint = [center2[0] - sinDeltaStart, center2[1] - cosDeltaStart];
endPoint = [center2[0] + sinDeltaEnd, center2[1] - cosDeltaEnd];
}
if (loopCfg.clockwise === false) {
var swap3 = [startPoint[0], startPoint[1]];
startPoint = [endPoint[0], endPoint[1]];
endPoint = [swap3[0], swap3[1]];
}
}
var startVec = [startPoint[0] - center2[0], startPoint[1] - center2[1]];
var scaleRateStart = (rstart + dist4) / rstart;
var scaleRateEnd = (rend + dist4) / rend;
if (loopCfg.clockwise === false) {
scaleRateStart = (rend + dist4) / rend;
scaleRateEnd = (rstart + dist4) / rstart;
}
var startExtendVec = vec2_exports.scale([0, 0], startVec, scaleRateStart);
var controlPoint1 = [center2[0] + startExtendVec[0], center2[1] + startExtendVec[1]];
var endVec = [endPoint[0] - center2[0], endPoint[1] - center2[1]];
var endExtendVec = vec2_exports.scale([0, 0], endVec, scaleRateEnd);
var controlPoint2 = [center2[0] + endExtendVec[0], center2[1] + endExtendVec[1]];
cfg.startPoint = {
x: startPoint[0],
y: startPoint[1]
};
cfg.endPoint = {
x: endPoint[0],
y: endPoint[1]
};
cfg.controlPoints = [{
x: controlPoint1[0],
y: controlPoint1[1]
}, {
x: controlPoint2[0],
y: controlPoint2[1]
}];
return cfg;
};
var getLabelPosition = function getLabelPosition2(pathShape, percent2, refX, refY, rotate8) {
var TAN_OFFSET = 1e-4;
var vector = [];
var point2 = pathShape.getPoint(percent2);
if (point2 === null) {
return {
x: 0,
y: 0,
angle: 0
};
}
if (percent2 < TAN_OFFSET) {
vector = pathShape.getStartTangent().reverse();
} else if (percent2 > 1 - TAN_OFFSET) {
vector = pathShape.getEndTangent();
} else {
var offsetPoint = pathShape.getPoint(percent2 + TAN_OFFSET);
vector.push([point2.x, point2.y]);
vector.push([offsetPoint.x, offsetPoint.y]);
}
var rad = Math.atan2(vector[1][1] - vector[0][1], vector[1][0] - vector[0][0]);
if (rad < 0) {
rad += PI2 * 2;
}
if (refX) {
point2.x += cos2(rad) * refX;
point2.y += sin2(rad) * refX;
}
if (refY) {
var normal2 = rad - PI2 / 2;
if (rad > 1 / 2 * PI2 && rad < 3 * 1 / 2 * PI2) {
normal2 -= PI2;
}
point2.x += cos2(normal2) * refY;
point2.y += sin2(normal2) * refY;
}
var result = {
x: point2.x,
y: point2.y,
angle: rad
};
if (rotate8) {
if (rad > 1 / 2 * PI2 && rad < 3 * 1 / 2 * PI2) {
rad -= PI2;
}
return __assign({
rotate: rad
}, result);
}
return result;
};
var traverse = function traverse2(data3, fn2) {
if (fn2(data3) === false) {
return false;
}
if (data3 && data3.children) {
for (var i4 = data3.children.length - 1; i4 >= 0; i4--) {
if (!traverse2(data3.children[i4], fn2))
return false;
}
}
return true;
};
var traverseUp = function traverseUp2(data3, fn2) {
if (data3 && data3.children) {
for (var i4 = data3.children.length - 1; i4 >= 0; i4--) {
if (!traverseUp2(data3.children[i4], fn2))
return;
}
}
if (fn2(data3) === false) {
return false;
}
return true;
};
var traverseTree = function traverseTree2(data3, fn2) {
if (typeof fn2 !== "function") {
return;
}
traverse(data3, fn2);
};
var traverseTreeUp = function traverseTreeUp2(data3, fn2) {
if (typeof fn2 !== "function") {
return;
}
traverseUp(data3, fn2);
};
var getLetterWidth = function getLetterWidth2(letter, fontSize) {
return fontSize * (letterAspectRatio_default[letter] || 1);
};
var getTextSize = function getTextSize2(text, fontSize) {
var width2 = 0;
var pattern2 = new RegExp("[\u4E00-\u9FA5]+");
text.split("").forEach(function(letter) {
if (pattern2.test(letter)) {
width2 += fontSize;
} else {
width2 += getLetterWidth(letter, fontSize);
}
});
return [width2, fontSize];
};
var plainCombosToTrees = function plainCombosToTrees2(array, nodes) {
var result = [];
var addedMap = {};
var modelMap = {};
array.forEach(function(d3) {
modelMap[d3.id] = d3;
});
array.forEach(function(d3, i4) {
var cd = clone_default(d3);
cd.itemType = "combo";
cd.children = void 0;
if (cd.parentId === cd.id) {
console.warn("The parentId for combo " + cd.id + " can not be the same as the combo's id");
delete cd.parentId;
} else if (cd.parentId && !modelMap[cd.parentId]) {
console.warn("The parent combo for combo " + cd.id + " does not exist!");
delete cd.parentId;
}
var mappedObj = addedMap[cd.id];
if (mappedObj) {
cd.children = mappedObj.children;
addedMap[cd.id] = cd;
mappedObj = cd;
if (!mappedObj.parentId) {
result.push(mappedObj);
return;
}
var mappedParent = addedMap[mappedObj.parentId];
if (mappedParent) {
if (mappedParent.children)
mappedParent.children.push(cd);
else
mappedParent.children = [cd];
} else {
var parent_1 = {
id: mappedObj.parentId,
children: [mappedObj]
};
addedMap[mappedObj.parentId] = parent_1;
addedMap[cd.id] = cd;
}
return;
}
if (is_string_default(d3.parentId)) {
var parent_2 = addedMap[d3.parentId];
if (parent_2) {
if (parent_2.children)
parent_2.children.push(cd);
else
parent_2.children = [cd];
addedMap[cd.id] = cd;
} else {
var pa = {
id: d3.parentId,
children: [cd]
};
addedMap[pa.id] = pa;
addedMap[cd.id] = cd;
}
} else {
result.push(cd);
addedMap[cd.id] = cd;
}
});
var nodeMap = {};
(nodes || []).forEach(function(node) {
nodeMap[node.id] = node;
var combo = addedMap[node.comboId];
if (combo) {
var cnode = {
id: node.id,
comboId: node.comboId
};
if (combo.children)
combo.children.push(cnode);
else
combo.children = [cnode];
cnode.itemType = "node";
addedMap[node.id] = cnode;
}
});
var maxDepth = 0;
result.forEach(function(tree) {
tree.depth = maxDepth + 10;
traverse(tree, function(child) {
var parent;
var itemType = addedMap[child.id].itemType;
if (itemType === "node") {
parent = addedMap[child.comboId];
} else {
parent = addedMap[child.parentId];
}
if (parent) {
if (itemType === "node")
child.depth = maxDepth + 1;
else
child.depth = maxDepth + 10;
} else {
child.depth = maxDepth + 10;
}
if (maxDepth < child.depth)
maxDepth = child.depth;
var oriNodeModel = nodeMap[child.id];
if (oriNodeModel) {
oriNodeModel.depth = child.depth;
}
return true;
});
});
return result;
};
var reconstructTree = function reconstructTree2(trees, subtreeId, newParentId) {
var brothers = trees;
var subtree;
var comboChildsMap = {
root: {
children: trees
}
};
var foundSubTree = false;
var oldParentId = "root";
(trees || []).forEach(function(tree) {
if (foundSubTree)
return;
if (tree.id === subtreeId) {
subtree = tree;
if (tree.itemType === "combo") {
subtree.parentId = newParentId;
} else {
subtree.comboId = newParentId;
}
foundSubTree = true;
return;
}
traverseTree(tree, function(child) {
comboChildsMap[child.id] = {
children: child.children
};
brothers = comboChildsMap[child.parentId || child.comboId || "root"].children;
if (child && (child.removed || subtreeId === child.id) && brothers) {
oldParentId = child.parentId || child.comboId || "root";
subtree = child;
if (child.itemType === "combo") {
subtree.parentId = newParentId;
} else {
subtree.comboId = newParentId;
}
foundSubTree = true;
return false;
}
return true;
});
});
brothers = comboChildsMap[oldParentId].children;
var index2 = brothers ? brothers.indexOf(subtree) : -1;
if (index2 > -1)
brothers.splice(index2, 1);
if (!foundSubTree) {
subtree = {
id: subtreeId,
itemType: "node",
comboId: newParentId
};
comboChildsMap[subtreeId] = {
children: void 0
};
}
if (subtreeId) {
var found_1 = false;
if (newParentId) {
var newParentDepth_1 = 0;
(trees || []).forEach(function(tree) {
if (found_1)
return;
traverseTree(tree, function(child) {
if (newParentId === child.id) {
found_1 = true;
if (child.children)
child.children.push(subtree);
else
child.children = [subtree];
newParentDepth_1 = child.depth;
if (subtree.itemType === "node")
subtree.depth = newParentDepth_1 + 2;
else
subtree.depth = newParentDepth_1 + 1;
return false;
}
return true;
});
});
} else if ((!newParentId || !found_1) && subtree.itemType !== "node") {
trees.push(subtree);
}
var currentDepth_1 = subtree.depth;
traverseTree(subtree, function(child) {
if (child.itemType === "node")
currentDepth_1 += 2;
else
currentDepth_1 += 1;
child.depth = currentDepth_1;
return true;
});
}
return trees;
};
var getComboBBox = function getComboBBox2(children, graph) {
var comboBBox = {
minX: Infinity,
minY: Infinity,
maxX: -Infinity,
maxY: -Infinity,
x: void 0,
y: void 0,
width: void 0,
height: void 0,
centerX: void 0,
centerY: void 0
};
if (!children || children.length === 0) {
return comboBBox;
}
children.forEach(function(child) {
var childItem = graph.findById(child.id);
if (!childItem || !childItem.isVisible())
return;
childItem.set("bboxCanvasCache", void 0);
var childBBox = childItem.getCanvasBBox();
if (childBBox.x && comboBBox.minX > childBBox.minX)
comboBBox.minX = childBBox.minX;
if (childBBox.y && comboBBox.minY > childBBox.minY)
comboBBox.minY = childBBox.minY;
if (childBBox.x && comboBBox.maxX < childBBox.maxX)
comboBBox.maxX = childBBox.maxX;
if (childBBox.y && comboBBox.maxY < childBBox.maxY)
comboBBox.maxY = childBBox.maxY;
});
comboBBox.x = (comboBBox.minX + comboBBox.maxX) / 2;
comboBBox.y = (comboBBox.minY + comboBBox.maxY) / 2;
comboBBox.width = comboBBox.maxX - comboBBox.minX;
comboBBox.height = comboBBox.maxY - comboBBox.minY;
comboBBox.centerX = (comboBBox.minX + comboBBox.maxX) / 2;
comboBBox.centerY = (comboBBox.minY + comboBBox.maxY) / 2;
Object.keys(comboBBox).forEach(function(key) {
if (comboBBox[key] === Infinity || comboBBox[key] === -Infinity) {
comboBBox[key] = void 0;
}
});
return comboBBox;
};
var shouldRefreshEdge = function shouldRefreshEdge2(cfg) {
var refreshEdge = is_number_default(cfg.x) || is_number_default(cfg.y) || cfg.type || cfg.anchorPoints || cfg.size;
if (cfg.style)
refreshEdge = refreshEdge || is_number_default(cfg.style.r) || is_number_default(cfg.style.width) || is_number_default(cfg.style.height) || is_number_default(cfg.style.rx) || is_number_default(cfg.style.ry);
return refreshEdge;
};
var cloneBesidesImg = function cloneBesidesImg2(obj) {
var clonedObj = {};
Object.keys(obj).forEach(function(key1) {
var obj2 = obj[key1];
if (is_object_default(obj2)) {
var clonedObj2_1 = {};
Object.keys(obj2).forEach(function(key2) {
var v3 = obj2[key2];
if (key2 === "img" && !is_string_default(v3))
return;
clonedObj2_1[key2] = clone_default(v3);
});
clonedObj[key1] = clonedObj2_1;
} else {
clonedObj[key1] = clone_default(obj2);
}
});
return clonedObj;
};
// node_modules/@antv/g6-core/es/element/xml.js
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof5(obj2) {
return typeof obj2;
};
} else {
_typeof = function _typeof5(obj2) {
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
};
}
return _typeof(obj);
}
function looseJSONParse(text) {
if (typeof text !== "string") {
return text;
}
var safeParse = function safeParse2(str9) {
if (typeof str9 !== "string") {
return str9;
}
try {
return JSON.parse(str9.trim());
} catch (e4) {
return str9.trim();
}
};
var firstAttempt = safeParse(text);
if (typeof firstAttempt !== "string") {
return firstAttempt;
}
var tail = function tail2(arr) {
return arr[arr.length - 1];
};
var str8 = text.trim();
var objectStack = [];
var syntaxStack = [];
var isLastPair = function isLastPair2() {
var syntaxes = [];
for (var _i = 0; _i < arguments.length; _i++) {
syntaxes[_i] = arguments[_i];
}
return syntaxes.some(function(syntax) {
return tail(syntaxStack) === syntax;
});
};
var getValueStore = function getValueStore2() {
return tail(objectStack);
};
var rst = null;
var i4 = 0;
var temp = "";
while (i4 < str8.length) {
var nowChar = str8[i4];
var isInString = isLastPair('"', "'");
if (!isInString && !nowChar.trim()) {
i4 += 1;
continue;
}
var isLastTranslate = str8[i4 - 1] === "\\";
var isInObject = isLastPair("}");
var isInArray = isLastPair("]");
var isWaitingValue = isLastPair(",");
var tempArr = getValueStore();
if (isInString) {
if (tail(syntaxStack) === nowChar && !isLastTranslate) {
syntaxStack.pop();
var value2 = safeParse(temp);
tempArr.push(value2);
rst = value2;
temp = "";
} else {
temp += nowChar;
}
} else if (isInArray && nowChar === ",") {
if (temp) {
tempArr.push(safeParse(temp));
temp = "";
}
} else if (isInObject && nowChar === ":") {
syntaxStack.push(",");
if (temp) {
tempArr.push(temp);
temp = "";
}
} else if (isWaitingValue && nowChar === ",") {
if (temp) {
tempArr.push(safeParse(temp));
temp = "";
}
syntaxStack.pop();
} else if (nowChar === "}" && (isInObject || isWaitingValue)) {
if (temp) {
tempArr.push(safeParse(temp));
temp = "";
}
if (isWaitingValue) {
syntaxStack.pop();
}
var obj = {};
for (var c5 = 1; c5 < tempArr.length; c5 += 2) {
obj[tempArr[c5 - 1]] = tempArr[c5];
}
objectStack.pop();
if (objectStack.length) {
tail(objectStack).push(obj);
}
syntaxStack.pop();
rst = obj;
} else if (nowChar === "]" && isInArray) {
if (temp) {
tempArr.push(safeParse(temp));
temp = "";
}
objectStack.pop();
if (objectStack.length) {
tail(objectStack).push(tempArr);
}
syntaxStack.pop();
rst = tempArr;
} else if (nowChar === "{") {
objectStack.push([]);
syntaxStack.push("}");
} else if (nowChar === "[") {
objectStack.push([]);
syntaxStack.push("]");
} else if (nowChar === '"') {
syntaxStack.push('"');
} else if (nowChar === "'") {
syntaxStack.push("'");
} else {
temp += nowChar;
}
i4 += 1;
}
return rst || temp;
}
var keyConvert = function keyConvert2(str8) {
return str8.split("-").reduce(function(a4, b10) {
return a4 + b10.charAt(0).toUpperCase() + b10.slice(1);
});
};
var xmlDataRenderer = function xmlDataRenderer2(xml) {
return function(data3) {
var len5 = xml.length;
var arr = [];
var i4 = 0;
var tmp = "";
while (i4 < len5) {
if (xml[i4] === "{" && xml[i4 + 1] === "{") {
arr.push(tmp);
tmp = "";
i4 += 2;
} else if (xml[i4] === "}" && xml[i4 + 1] === "}") {
if (arr.length) {
var last2 = arr.pop();
tmp = get_default(data3, tmp, last2.endsWith("=") ? '"{' + tmp + '}"' : tmp);
arr.push(last2 + tmp);
}
i4 += 2;
tmp = "";
} else {
tmp += xml[i4];
i4 += 1;
}
}
arr.push(tmp);
return arr.map(function(e4, index2) {
return arr[index2 - 1] && arr[index2 - 1].endsWith("=") ? '"{' + e4 + '}"' : e4;
}).join("");
};
};
function parseXML(xml, cfg) {
var attrs = {};
var keys2 = xml.getAttributeNames && xml.getAttributeNames() || [];
var children = xml.children && Array.from(xml.children).map(function(e4) {
return parseXML(e4, cfg);
});
var rst = {};
var tagName = xml.tagName ? xml.tagName.toLowerCase() : "group";
if (tagName === "text") {
attrs.text = xml.innerText;
}
rst.type = tagName;
if (tagName === "img") {
rst.type = "image";
}
Array.from(keys2).forEach(function(k4) {
var key = keyConvert(k4);
var val = xml.getAttribute(k4);
try {
if (key === "style" || key === "attrs") {
var style = looseJSONParse(val);
attrs = __assign(__assign({}, attrs), style);
} else {
rst[key] = looseJSONParse(val);
}
} catch (e4) {
if (key === "style") {
throw e4;
}
rst[key] = val;
}
});
rst.attrs = attrs;
if (cfg && cfg.style && rst.name && _typeof(cfg.style[rst.name]) === "object") {
rst.attrs = __assign(__assign({}, rst.attrs), cfg.style[rst.name]);
}
if (cfg && cfg.style && rst.keyshape) {
rst.attrs = __assign(__assign({}, rst.attrs), cfg.style);
}
if (children.length) {
rst.children = children;
}
return rst;
}
function getBBox4(node, offset, chilrenBBox) {
var _a6 = node.attrs, attrs = _a6 === void 0 ? {} : _a6;
var bbox = {
x: offset.x || 0,
y: offset.y || 0,
width: chilrenBBox.width || 0,
height: chilrenBBox.height || 0
};
var shapeHeight, shapeWidth;
switch (node.type) {
case "maker":
case "circle":
if (attrs.r) {
shapeWidth = 2 * attrs.r;
shapeHeight = 2 * attrs.r;
}
break;
case "text":
if (attrs.text) {
shapeWidth = getTextSize(attrs.text, attrs.fontSize || 12)[0];
shapeHeight = 16;
bbox.y += shapeHeight;
bbox.height = shapeHeight;
bbox.width = shapeWidth;
node.attrs = __assign({
fontSize: 12,
fill: "#000"
}, attrs);
}
break;
default:
if (attrs.width) {
shapeWidth = attrs.width;
}
if (attrs.height) {
shapeHeight = attrs.height;
}
}
if (shapeHeight >= 0) {
bbox.height = shapeHeight;
}
if (shapeWidth >= 0) {
bbox.width = shapeWidth;
}
if (attrs.marginTop) {
bbox.y += attrs.marginTop;
}
if (attrs.marginLeft) {
bbox.x += attrs.marginLeft;
}
return bbox;
}
function generateTarget(target, lastOffset) {
var _a6;
if (lastOffset === void 0) {
lastOffset = {
x: 0,
y: 0
};
}
var defaultBbox = __assign({
x: 0,
y: 0,
width: 0,
height: 0
}, lastOffset);
if ((_a6 = target.children) === null || _a6 === void 0 ? void 0 : _a6.length) {
var _b = target.attrs, attrs = _b === void 0 ? {} : _b;
var marginTop = attrs.marginTop;
var offset = __assign({}, lastOffset);
if (marginTop) {
offset.y += marginTop;
}
for (var index2 = 0; index2 < target.children.length; index2++) {
target.children[index2].attrs.key = (attrs.key || "root") + " -" + index2 + " ";
var node = generateTarget(target.children[index2], offset);
if (node.bbox) {
var bbox = node.bbox;
if (node.attrs.next === "inline") {
offset.x += node.bbox.width;
} else {
offset.y += node.bbox.height;
}
if (bbox.width + bbox.x > defaultBbox.width) {
defaultBbox.width = bbox.width + bbox.x;
}
if (bbox.height + bbox.y > defaultBbox.height) {
defaultBbox.height = bbox.height + bbox.y;
}
}
}
}
target.bbox = getBBox4(target, lastOffset, defaultBbox);
target.attrs = __assign(__assign({}, target.attrs), target.bbox);
return target;
}
function compareTwoTarget(nowTarget, formerTarget) {
var _a6, _b, _c, _d;
var type2 = (nowTarget || {}).type;
var key = ((formerTarget === null || formerTarget === void 0 ? void 0 : formerTarget.attrs) || {}).key;
if (key && nowTarget) {
nowTarget.attrs.key = key;
}
if (!nowTarget && formerTarget) {
return {
action: "delete",
val: formerTarget,
type: type2,
key
};
}
if (nowTarget && !formerTarget) {
return {
action: "add",
val: nowTarget,
type: type2
};
}
if (!nowTarget && !formerTarget) {
return {
action: "same",
type: type2
};
}
var children = [];
if (((_a6 = nowTarget.children) === null || _a6 === void 0 ? void 0 : _a6.length) > 0 || ((_b = formerTarget.children) === null || _b === void 0 ? void 0 : _b.length) > 0) {
var length_1 = Math.max((_c = nowTarget.children) === null || _c === void 0 ? void 0 : _c.length, (_d = formerTarget.children) === null || _d === void 0 ? void 0 : _d.length);
var formerChilren = formerTarget.children || [];
var nowChilren = nowTarget.children || [];
for (var index2 = 0; index2 < length_1; index2 += 1) {
children.push(compareTwoTarget(nowChilren[index2], formerChilren[index2]));
}
}
var formerKeys = Object.keys(formerTarget.attrs);
var nowKeys = Object.keys(nowTarget.attrs);
if (formerTarget.type !== nowTarget.type) {
return {
action: "restructure",
nowTarget,
formerTarget,
key,
children
};
}
if (formerKeys.filter(function(e4) {
return e4 !== "children";
}).some(function(e4) {
return nowTarget.attrs[e4] !== formerTarget.attrs[e4] || !nowKeys.includes(e4);
})) {
return {
action: "change",
val: nowTarget,
children,
type: type2,
key
};
}
return {
action: "same",
children,
type: type2,
key
};
}
function createNodeFromXML(gen) {
var structures = {};
var compileXML = function compileXML2(cfg) {
var rawStr = typeof gen === "function" ? gen(cfg) : gen;
var target = xmlDataRenderer(rawStr)(cfg);
var xmlParser = document.createElement("div");
xmlParser.innerHTML = target;
var xml = xmlParser.children[0];
var result = generateTarget(parseXML(xml, cfg));
xmlParser.remove();
return result;
};
return {
draw: function draw4(cfg, group2) {
var resultTarget = compileXML(cfg);
var keyshape = group2;
var renderTarget = function renderTarget2(target) {
var _a6 = target.attrs, attrs = _a6 === void 0 ? {} : _a6, bbox = target.bbox, type2 = target.type, children = target.children, rest = __rest(target, ["attrs", "bbox", "type", "children"]);
if (target.type !== "group") {
var shape = group2.addShape(target.type, __assign({
attrs,
origin: {
bbox,
type: type2,
children
}
}, rest));
if (target.keyshape) {
keyshape = shape;
}
}
if (target.children) {
target.children.forEach(function(n3) {
return renderTarget2(n3);
});
}
};
renderTarget(resultTarget);
structures[cfg.id] = [resultTarget];
return keyshape;
},
update: function update15(cfg, node) {
if (!structures[cfg.id]) {
structures[cfg.id] = [];
}
var container2 = node.getContainer();
var children = container2.get("children");
var newTarget = compileXML(cfg);
var lastTarget = structures[cfg.id].pop();
var diffResult = compareTwoTarget(newTarget, lastTarget);
var addShape = function addShape2(shape) {
var _a6;
if (shape.type !== "group") {
container2.addShape(shape.type, {
attrs: shape.attrs
});
}
if ((_a6 = shape.children) === null || _a6 === void 0 ? void 0 : _a6.length) {
shape.children.map(function(e4) {
return addShape2(e4);
});
}
};
var delShape = function delShape2(shape) {
var _a6;
var targetShape = children.find(function(e4) {
return e4.attrs.key === shape.attrs.key;
});
if (targetShape) {
container2.removeChild(targetShape);
}
if ((_a6 = shape.children) === null || _a6 === void 0 ? void 0 : _a6.length) {
shape.children.map(function(e4) {
return delShape2(e4);
});
}
};
var updateTarget = function updateTarget2(target) {
var key = target.key;
if (target.type !== "group") {
var targetShape = children.find(function(e4) {
return e4.attrs.key === key;
});
switch (target.action) {
case "change":
if (targetShape) {
var originAttr = target.val.keyshape ? node.getOriginStyle() : {};
targetShape.attr(__assign(__assign({}, originAttr), target.val.attrs));
}
break;
case "add":
addShape(target.val);
break;
case "delete":
delShape(target.val);
break;
case "restructure":
delShape(target.formerTarget);
addShape(target.nowTarget);
break;
default:
break;
}
}
if (target.children) {
target.children.forEach(function(n3) {
return updateTarget2(n3);
});
}
};
updateTarget(diffResult);
structures[cfg.id].push(newTarget);
},
getAnchorPoints: function getAnchorPoints4() {
return [[0, 0.5], [1, 0.5], [0.5, 1], [0.5, 0]];
}
};
}
// node_modules/@antv/g6-core/es/element/shape.js
var cache2 = {};
function ucfirst(str8) {
if (!cache2[str8]) {
cache2[str8] = upper_first_default(str8);
}
return cache2[str8];
}
var ShapeFactoryBase2 = {
defaultShapeType: "defaultType",
className: null,
getShape: function getShape2(type2) {
var self2 = this;
var shape = self2[type2] || self2[self2.defaultShapeType] || self2["simple-circle"];
return shape;
},
draw: function draw(type2, cfg, group2) {
var shape = this.getShape(type2);
var rst = shape.draw(cfg, group2);
if (shape.afterDraw) {
shape.afterDraw(cfg, group2, rst);
}
return rst;
},
baseUpdate: function baseUpdate(type2, cfg, item) {
var shape = this.getShape(type2);
if (shape.update) {
shape.update(cfg, item);
}
if (shape.afterUpdate) {
shape.afterUpdate(cfg, item);
}
},
setState: function setState(type2, name, value2, item) {
var shape = this.getShape(type2);
shape.setState(name, value2, item);
},
shouldUpdate: function shouldUpdate2(type2) {
var shape = this.getShape(type2);
return !!shape.update;
},
getControlPoints: function getControlPoints(type2, cfg) {
var shape = this.getShape(type2);
return shape.getControlPoints(cfg);
},
getAnchorPoints: function getAnchorPoints(type2, cfg) {
var shape = this.getShape(type2);
return shape.getAnchorPoints(cfg);
}
};
var ShapeFramework = {
options: {},
draw: function draw2(cfg, group2) {
return this.drawShape(cfg, group2);
},
drawShape: function drawShape() {
},
afterDraw: function afterDraw() {
},
afterUpdate: function afterUpdate() {
},
setState: function setState2() {
},
getControlPoints: function getControlPoints2(cfg) {
return cfg.controlPoints;
},
getAnchorPoints: function getAnchorPoints2(cfg) {
var defaultAnchorPoints = this.options.anchorPoints;
var anchorPoints = cfg.anchorPoints || defaultAnchorPoints;
return anchorPoints;
}
};
var Shape2 = function() {
function Shape3() {
}
Shape3.registerFactory = function(factoryType, cfg) {
var className = ucfirst(factoryType);
var factoryBase = ShapeFactoryBase2;
var shapeFactory = __assign(__assign({}, factoryBase), cfg);
Shape3[className] = shapeFactory;
shapeFactory.className = className;
return shapeFactory;
};
Shape3.getFactory = function(factoryType) {
var className = ucfirst(factoryType);
return Shape3[className];
};
Shape3.registerNode = function(shapeType, nodeDefinition, extendShapeType) {
var shapeFactory = Shape3.Node;
var shapeObj;
if (typeof nodeDefinition === "string" || typeof nodeDefinition === "function") {
var autoNodeDefinition = createNodeFromXML(nodeDefinition);
shapeObj = __assign(__assign({}, shapeFactory.getShape("single-node")), autoNodeDefinition);
} else if (nodeDefinition.jsx) {
var jsx = nodeDefinition.jsx;
var autoNodeDefinition = createNodeFromXML(jsx);
shapeObj = __assign(__assign(__assign({}, shapeFactory.getShape("single-node")), autoNodeDefinition), nodeDefinition);
} else {
shapeFactory.getShape(extendShapeType);
var extendShape = extendShapeType ? shapeFactory.getShape(extendShapeType) : ShapeFramework;
shapeObj = __assign(__assign({}, extendShape), nodeDefinition);
}
shapeObj.type = shapeType;
shapeObj.itemType = "node";
shapeFactory[shapeType] = shapeObj;
return shapeObj;
};
Shape3.registerEdge = function(shapeType, edgeDefinition, extendShapeType) {
var shapeFactory = Shape3.Edge;
var extendShape = extendShapeType ? shapeFactory.getShape(extendShapeType) : ShapeFramework;
var shapeObj = __assign(__assign({}, extendShape), edgeDefinition);
shapeObj.type = shapeType;
shapeObj.itemType = "edge";
shapeFactory[shapeType] = shapeObj;
return shapeObj;
};
Shape3.registerCombo = function(shapeType, comboDefinition, extendShapeType) {
var shapeFactory = Shape3.Combo;
var extendShape = extendShapeType ? shapeFactory.getShape(extendShapeType) : ShapeFramework;
var shapeObj = __assign(__assign({}, extendShape), comboDefinition);
shapeObj.type = shapeType;
shapeObj.itemType = "combo";
shapeFactory[shapeType] = shapeObj;
return shapeObj;
};
return Shape3;
}();
var shape_default4 = Shape2;
Shape2.registerFactory("node", {
defaultShapeType: "circle"
});
Shape2.registerFactory("edge", {
defaultShapeType: "line"
});
Shape2.registerFactory("combo", {
defaultShapeType: "circle"
});
// node_modules/@antv/g6-core/es/item/item.js
var CACHE_BBOX = "bboxCache";
var CACHE_CANVAS_BBOX = "bboxCanvasCache";
var ItemBase = function() {
function ItemBase2(cfg) {
this._cfg = {};
this.destroyed = false;
var defaultCfg2 = {
id: void 0,
type: "item",
model: {},
group: void 0,
animate: false,
visible: true,
locked: false,
event: true,
keyShape: void 0,
states: []
};
this._cfg = Object.assign(defaultCfg2, this.getDefaultCfg(), cfg);
var model = this.get("model");
var id = model.id;
var itemType = this.get("type");
if (!id) {
id = uniqueId3(itemType);
this.get("model").id = id;
}
this.set("id", id);
var group2 = cfg.group;
if (group2) {
group2.set("item", this);
group2.set("id", id);
}
this.init();
this.draw();
var shapeType = model.shape || model.type || (itemType === "edge" ? "line" : "circle");
var shapeFactory = this.get("shapeFactory");
if (shapeFactory && shapeFactory[shapeType]) {
var options = shapeFactory[shapeType].options;
if (options && options.stateStyles) {
var styles = this.get("styles") || model.stateStyles;
styles = deep_mix_default({}, options.stateStyles, styles);
this.set("styles", styles);
}
}
}
ItemBase2.prototype.calculateBBox = function() {
var keyShape = this.get("keyShape");
var group2 = this.get("group");
var bbox = getBBox2(keyShape, group2);
bbox.x = bbox.minX;
bbox.y = bbox.minY;
bbox.width = bbox.maxX - bbox.minX;
bbox.height = bbox.maxY - bbox.minY;
bbox.centerX = (bbox.minX + bbox.maxX) / 2;
bbox.centerY = (bbox.minY + bbox.maxY) / 2;
return bbox;
};
ItemBase2.prototype.calculateCanvasBBox = function() {
var keyShape = this.get("keyShape");
var group2 = this.get("group");
var bbox = getBBox2(keyShape, group2);
bbox.x = bbox.minX;
bbox.y = bbox.minY;
bbox.width = bbox.maxX - bbox.minX;
bbox.height = bbox.maxY - bbox.minY;
bbox.centerX = (bbox.minX + bbox.maxX) / 2;
bbox.centerY = (bbox.minY + bbox.maxY) / 2;
return bbox;
};
ItemBase2.prototype.drawInner = function() {
var self2 = this;
var shapeFactory = self2.get("shapeFactory");
var group2 = self2.get("group");
var model = self2.get("model");
group2.clear();
var visible = model.visible;
if (visible !== void 0 && !visible)
self2.changeVisibility(visible);
if (!shapeFactory) {
return;
}
self2.updatePosition(model);
var cfg = self2.getShapeCfg(model);
var shapeType = cfg.type;
var keyShape = shapeFactory.draw(shapeType, cfg, group2);
if (keyShape) {
self2.set("keyShape", keyShape);
keyShape.set("isKeyShape", true);
keyShape.set("draggable", true);
}
this.setOriginStyle();
this.set("currentShape", shapeType);
this.restoreStates(shapeFactory, shapeType);
};
ItemBase2.prototype.setOriginStyle = function(cfg) {
var group2 = this.get("group");
var children = group2.get("children");
var keyShape = this.getKeyShape();
var self2 = this;
var keyShapeName = keyShape.get("name");
if (!this.get("originStyle")) {
var originStyles_1 = {};
each_default(children, function(child) {
var shapeType = child.get("type");
var name = child.get("name");
if (name && name !== keyShapeName) {
originStyles_1[name] = shapeType !== "image" ? clone_default(child.attr()) : self2.getShapeStyleByName(name);
} else {
var keyShapeStyle = self2.getShapeStyleByName();
if (keyShapeStyle.path)
delete keyShapeStyle.path;
if (keyShapeStyle.matrix)
delete keyShapeStyle.matrix;
if (!keyShapeName) {
Object.assign(originStyles_1, keyShapeStyle);
} else {
if (!name) {
var shapeName = uniqueId3("shape");
child.set("name", shapeName);
originStyles_1[shapeName] = shapeType !== "image" ? clone_default(child.attr()) : self2.getShapeStyleByName(name);
} else
originStyles_1[keyShapeName] = keyShapeStyle;
}
}
});
self2.set("originStyle", originStyles_1);
} else {
var styles_1 = this.getOriginStyle();
if (keyShapeName && !styles_1[keyShapeName])
styles_1[keyShapeName] = {};
var currentStatesStyle_1 = this.getCurrentStatesStyle();
each_default(children, function(child) {
var name = child.get("name");
var shapeAttrs = child.attr();
if (name && name !== keyShapeName) {
var shapeStateStyle_1 = currentStatesStyle_1[name];
if (!styles_1[name])
styles_1[name] = {};
if (shapeStateStyle_1) {
Object.keys(shapeAttrs).forEach(function(key) {
var value2 = shapeAttrs[key];
if (value2 !== shapeStateStyle_1[key])
styles_1[name][key] = value2;
});
} else {
styles_1[name] = child.get("type") !== "image" ? clone_default(shapeAttrs) : self2.getShapeStyleByName(name);
}
} else {
var shapeAttrs_1 = child.attr();
var keyShapeStateStyles_1 = __assign(__assign({}, currentStatesStyle_1), currentStatesStyle_1[keyShapeName]);
Object.keys(shapeAttrs_1).forEach(function(key) {
var value2 = shapeAttrs_1[key];
if (keyShapeStateStyles_1[key] !== value2) {
if (keyShapeName)
styles_1[keyShapeName][key] = value2;
else
styles_1[key] = value2;
}
});
}
});
if (styles_1.path)
delete styles_1.path;
if (styles_1.matrix)
delete styles_1.matrix;
if (styles_1.x)
delete styles_1.x;
if (styles_1.y)
delete styles_1.y;
if (styles_1[keyShapeName] && styles_1[keyShapeName].x)
delete styles_1[keyShapeName].x;
if (styles_1[keyShapeName] && styles_1[keyShapeName].y)
delete styles_1[keyShapeName].y;
self2.set("originStyle", styles_1);
}
};
ItemBase2.prototype.restoreStates = function(shapeFactory, shapeType) {
var self2 = this;
var states = self2.get("states");
each_default(states, function(state2) {
shapeFactory.setState(shapeType, state2, true, self2);
});
};
ItemBase2.prototype.init = function() {
var shapeFactory = shape_default4.getFactory(this.get("type"));
this.set("shapeFactory", shapeFactory);
};
ItemBase2.prototype.get = function(key) {
return this._cfg[key];
};
ItemBase2.prototype.set = function(key, val) {
if (is_plain_object_default(key)) {
this._cfg = __assign(__assign({}, this._cfg), key);
} else {
this._cfg[key] = val;
}
};
ItemBase2.prototype.getDefaultCfg = function() {
return {};
};
ItemBase2.prototype.clearCache = function() {
this.set(CACHE_BBOX, null);
this.set(CACHE_CANVAS_BBOX, null);
};
ItemBase2.prototype.beforeDraw = function() {
};
ItemBase2.prototype.afterDraw = function() {
};
ItemBase2.prototype.afterUpdate = function() {
};
ItemBase2.prototype.draw = function() {
this.beforeDraw();
this.drawInner();
this.afterDraw();
};
ItemBase2.prototype.getShapeStyleByName = function(name) {
var group2 = this.get("group");
var currentShape;
if (name) {
currentShape = group2.find(function(element) {
return element.get("name") === name;
});
} else {
currentShape = this.getKeyShape();
}
if (currentShape) {
var styles_2 = {};
each_default(currentShape.attr(), function(val, key) {
if (key !== "img") {
styles_2[key] = val;
}
});
return styles_2;
}
return {};
};
ItemBase2.prototype.getShapeCfg = function(model) {
var styles = this.get("styles");
if (styles) {
var newModel = model;
newModel.style = __assign(__assign({}, styles), model.style);
return newModel;
}
return model;
};
ItemBase2.prototype.getStateStyle = function(state2) {
var styles = this.get("styles");
var stateStyle = styles && styles[state2];
return stateStyle;
};
ItemBase2.prototype.getOriginStyle = function() {
return this.get("originStyle");
};
ItemBase2.prototype.getCurrentStatesStyle = function() {
var self2 = this;
var styles = {};
var states = self2.getStates();
if (!states || !states.length) {
return this.getOriginStyle();
}
each_default(self2.getStates(), function(state2) {
styles = Object.assign(styles, self2.getStateStyle(state2));
});
return styles;
};
ItemBase2.prototype.setState = function(state2, value2) {
var states = this.get("states");
var shapeFactory = this.get("shapeFactory");
var stateName = state2;
var filterStateName = state2;
if (is_string_default(value2)) {
stateName = state2 + ":" + value2;
filterStateName = state2 + ":";
}
var newStates = states;
if (is_boolean_default(value2)) {
var index2 = states.indexOf(filterStateName);
if (value2) {
if (index2 > -1) {
return;
}
states.push(stateName);
} else if (index2 > -1) {
states.splice(index2, 1);
}
} else if (is_string_default(value2)) {
var filterStates = states.filter(function(name) {
return name.includes(filterStateName);
});
if (filterStates.length > 0) {
this.clearStates(filterStates);
}
newStates = newStates.filter(function(name) {
return !name.includes(filterStateName);
});
newStates.push(stateName);
this.set("states", newStates);
}
if (shapeFactory) {
var model = this.get("model");
var type2 = model.type;
shapeFactory.setState(type2, state2, value2, this);
}
};
ItemBase2.prototype.clearStates = function(states) {
var self2 = this;
var originStates = self2.getStates();
var shapeFactory = self2.get("shapeFactory");
var model = self2.get("model");
var shape = model.type;
if (!states) {
states = originStates;
}
if (is_string_default(states)) {
states = [states];
}
var newStates = originStates.filter(function(state2) {
return states.indexOf(state2) === -1;
});
self2.set("states", newStates);
states.forEach(function(state2) {
shapeFactory.setState(shape, state2, false, self2);
});
};
ItemBase2.prototype.getContainer = function() {
return this.get("group");
};
ItemBase2.prototype.getKeyShape = function() {
return this.get("keyShape");
};
ItemBase2.prototype.getModel = function() {
return this.get("model");
};
ItemBase2.prototype.getType = function() {
return this.get("type");
};
ItemBase2.prototype.getID = function() {
return this.get("id");
};
ItemBase2.prototype.isItem = function() {
return true;
};
ItemBase2.prototype.getStates = function() {
return this.get("states");
};
ItemBase2.prototype.hasState = function(state2) {
var states = this.getStates();
return states.indexOf(state2) >= 0;
};
ItemBase2.prototype.refresh = function() {
var model = this.get("model");
this.updatePosition(model);
this.updateShape();
this.afterUpdate();
this.clearCache();
};
ItemBase2.prototype.isOnlyMove = function(cfg) {
return false;
};
ItemBase2.prototype.update = function(cfg, onlyMove) {
if (onlyMove === void 0) {
onlyMove = false;
}
var model = this.get("model");
var oriVisible = model.visible;
var cfgVisible = cfg.visible;
if (oriVisible !== cfgVisible && cfgVisible !== void 0)
this.changeVisibility(cfgVisible);
var originPosition = {
x: model.x,
y: model.y
};
cfg.x = isNaN(cfg.x) ? model.x : cfg.x;
cfg.y = isNaN(cfg.y) ? model.y : cfg.y;
var styles = this.get("styles");
if (cfg.stateStyles) {
var stateStyles = cfg.stateStyles;
mix(styles, stateStyles);
delete cfg.stateStyles;
}
Object.assign(model, cfg);
if (onlyMove) {
this.updatePosition(cfg);
} else {
if (originPosition.x !== cfg.x || originPosition.y !== cfg.y) {
this.updatePosition(cfg);
}
this.updateShape();
}
this.afterUpdate();
this.clearCache();
};
ItemBase2.prototype.updateShape = function() {
var shapeFactory = this.get("shapeFactory");
var model = this.get("model");
var shape = model.type;
if (shapeFactory.shouldUpdate(shape) && shape === this.get("currentShape")) {
var updateCfg2 = this.getShapeCfg(model);
shapeFactory.baseUpdate(shape, updateCfg2, this);
} else {
this.draw();
}
this.setOriginStyle(model);
this.restoreStates(shapeFactory, shape);
};
ItemBase2.prototype.updatePosition = function(cfg) {
var model = this.get("model");
var x6 = is_nil_default(cfg.x) ? model.x : cfg.x;
var y5 = is_nil_default(cfg.y) ? model.y : cfg.y;
var group2 = this.get("group");
if (is_nil_default(x6) || is_nil_default(y5)) {
return false;
}
model.x = x6;
model.y = y5;
var matrix = group2.getMatrix();
if (matrix && matrix[6] === x6 && matrix[7] === y5)
return false;
group2.resetMatrix();
translate4(group2, {
x: x6,
y: y5
});
this.clearCache();
return true;
};
ItemBase2.prototype.getBBox = function() {
var bbox = this.get(CACHE_BBOX);
if (!bbox) {
bbox = this.calculateBBox();
this.set(CACHE_BBOX, bbox);
}
return bbox;
};
ItemBase2.prototype.getCanvasBBox = function() {
var bbox = this.get(CACHE_CANVAS_BBOX);
if (!bbox) {
bbox = this.calculateCanvasBBox();
this.set(CACHE_CANVAS_BBOX, bbox);
}
return bbox;
};
ItemBase2.prototype.toFront = function() {
var group2 = this.get("group");
group2.toFront();
};
ItemBase2.prototype.toBack = function() {
var group2 = this.get("group");
group2.toBack();
};
ItemBase2.prototype.show = function() {
this.changeVisibility(true);
};
ItemBase2.prototype.hide = function() {
this.changeVisibility(false);
};
ItemBase2.prototype.changeVisibility = function(visible) {
var group2 = this.get("group");
if (visible) {
group2.show();
} else {
group2.hide();
}
this.set("visible", visible);
};
ItemBase2.prototype.isVisible = function() {
return this.get("visible");
};
ItemBase2.prototype.enableCapture = function(enable) {
var group2 = this.get("group");
if (group2) {
group2.set("capture", enable);
}
};
ItemBase2.prototype.destroy = function() {
if (!this.destroyed) {
var animate = this.get("animate");
var group2 = this.get("group");
if (animate) {
group2.stopAnimate();
}
this.clearCache();
group2.remove();
this._cfg = null;
this.destroyed = true;
}
};
return ItemBase2;
}();
var item_default = ItemBase;
// node_modules/@antv/g6-core/es/item/edge.js
var END_MAP = {
source: "start",
target: "end"
};
var ITEM_NAME_SUFFIX = "Node";
var POINT_NAME_SUFFIX = "Point";
var ANCHOR_NAME_SUFFIX = "Anchor";
var Edge3 = function(_super) {
__extends(Edge4, _super);
function Edge4() {
return _super !== null && _super.apply(this, arguments) || this;
}
Edge4.prototype.getDefaultCfg = function() {
return {
type: "edge",
sourceNode: null,
targetNode: null,
startPoint: null,
endPoint: null,
linkCenter: false
};
};
Edge4.prototype.setEnd = function(name, value2) {
var pointName = END_MAP[name] + POINT_NAME_SUFFIX;
var itemName = name + ITEM_NAME_SUFFIX;
var preItem = this.get(itemName);
if (preItem && !preItem.destroyed) {
preItem.removeEdge(this);
}
if (is_plain_object_default(value2)) {
this.set(pointName, value2);
this.set(itemName, null);
} else {
value2.addEdge(this);
this.set(itemName, value2);
this.set(pointName, null);
}
};
Edge4.prototype.getLinkPoint = function(name, model, controlPoints) {
var pointName = END_MAP[name] + POINT_NAME_SUFFIX;
var itemName = name + ITEM_NAME_SUFFIX;
var point2 = this.get(pointName);
if (!point2) {
var item = this.get(itemName);
var anchorName = name + ANCHOR_NAME_SUFFIX;
var prePoint = this.getPrePoint(name, controlPoints);
var anchorIndex = model[anchorName];
if (!is_nil_default(anchorIndex)) {
point2 = item.getLinkPointByAnchor(anchorIndex);
}
point2 = point2 || item.getLinkPoint(prePoint);
if (!is_nil_default(point2.index)) {
this.set(name + "AnchorIndex", point2.index);
}
}
return point2;
};
Edge4.prototype.getPrePoint = function(name, controlPoints) {
if (controlPoints && controlPoints.length) {
var index2 = name === "source" ? 0 : controlPoints.length - 1;
return controlPoints[index2];
}
var oppositeName = name === "source" ? "target" : "source";
return this.getEndPoint(oppositeName);
};
Edge4.prototype.getEndPoint = function(name) {
var itemName = name + ITEM_NAME_SUFFIX;
var pointName = END_MAP[name] + POINT_NAME_SUFFIX;
var item = this.get(itemName);
if (item) {
return item.get("model");
}
return this.get(pointName);
};
Edge4.prototype.getControlPointsByCenter = function(model) {
var sourcePoint = this.getEndPoint("source");
var targetPoint = this.getEndPoint("target");
var shapeFactory = this.get("shapeFactory");
var type2 = model.type;
return shapeFactory.getControlPoints(type2, {
startPoint: sourcePoint,
endPoint: targetPoint
});
};
Edge4.prototype.getEndCenter = function(name) {
var itemName = name + ITEM_NAME_SUFFIX;
var pointName = END_MAP[name] + POINT_NAME_SUFFIX;
var item = this.get(itemName);
if (item) {
var bbox = item.getBBox();
return {
x: bbox.centerX,
y: bbox.centerY
};
}
return this.get(pointName);
};
Edge4.prototype.init = function() {
_super.prototype.init.call(this);
this.setSource(this.get("source"));
this.setTarget(this.get("target"));
};
Edge4.prototype.getShapeCfg = function(model) {
var self2 = this;
var linkCenter = self2.get("linkCenter");
var cfg = _super.prototype.getShapeCfg.call(this, model);
if (linkCenter) {
cfg.startPoint = self2.getEndCenter("source");
cfg.endPoint = self2.getEndCenter("target");
} else {
var controlPoints = cfg.controlPoints || self2.getControlPointsByCenter(cfg);
cfg.startPoint = self2.getLinkPoint("source", model, controlPoints);
cfg.endPoint = self2.getLinkPoint("target", model, controlPoints);
}
cfg.sourceNode = self2.get("sourceNode");
cfg.targetNode = self2.get("targetNode");
return cfg;
};
Edge4.prototype.getModel = function() {
var out = this.get("model");
var sourceItem = this.get("source" + ITEM_NAME_SUFFIX);
var targetItem = this.get("target" + ITEM_NAME_SUFFIX);
if (sourceItem) {
delete out["source" + ITEM_NAME_SUFFIX];
} else {
out.source = this.get("start" + POINT_NAME_SUFFIX);
}
if (targetItem) {
delete out["target" + ITEM_NAME_SUFFIX];
} else {
out.target = this.get("end" + POINT_NAME_SUFFIX);
}
if (!is_string_default(out.source) && !is_plain_object_default(out.source)) {
out.source = out.source.getID();
}
if (!is_string_default(out.target) && !is_plain_object_default(out.target)) {
out.target = out.target.getID();
}
return out;
};
Edge4.prototype.setSource = function(source) {
this.setEnd("source", source);
this.set("source", source);
};
Edge4.prototype.setTarget = function(target) {
this.setEnd("target", target);
this.set("target", target);
};
Edge4.prototype.getSource = function() {
return this.get("source");
};
Edge4.prototype.getTarget = function() {
return this.get("target");
};
Edge4.prototype.updatePosition = function() {
return false;
};
Edge4.prototype.update = function(cfg, onlyMove) {
if (onlyMove === void 0) {
onlyMove = false;
}
var model = this.get("model");
var oriVisible = model.visible;
var cfgVisible = cfg.visible;
if (oriVisible !== cfgVisible && cfgVisible !== void 0)
this.changeVisibility(cfgVisible);
var styles = this.get("styles");
if (cfg.stateStyles) {
var stateStyles = cfg.stateStyles;
mix(styles, stateStyles);
delete cfg.stateStyles;
}
Object.assign(model, cfg);
this.updateShape();
this.afterUpdate();
this.clearCache();
};
Edge4.prototype.destroy = function() {
var sourceItem = this.get("source" + ITEM_NAME_SUFFIX);
var targetItem = this.get("target" + ITEM_NAME_SUFFIX);
if (sourceItem && !sourceItem.destroyed) {
sourceItem.removeEdge(this);
}
if (targetItem && !targetItem.destroyed) {
targetItem.removeEdge(this);
}
_super.prototype.destroy.call(this);
};
return Edge4;
}(item_default);
var edge_default2 = Edge3;
// node_modules/@antv/g6-core/es/item/node.js
var CACHE_ANCHOR_POINTS = "anchorPointsCache";
var CACHE_BBOX2 = "bboxCache";
var Node4 = function(_super) {
__extends(Node5, _super);
function Node5() {
return _super !== null && _super.apply(this, arguments) || this;
}
Node5.prototype.getNearestPoint = function(points, curPoint) {
var index2 = 0;
var nearestPoint2 = points[0];
var minDistance = distance10(points[0], curPoint);
for (var i4 = 0; i4 < points.length; i4++) {
var point2 = points[i4];
var dis = distance10(point2, curPoint);
if (dis < minDistance) {
nearestPoint2 = point2;
minDistance = dis;
index2 = i4;
}
}
nearestPoint2.anchorIndex = index2;
return nearestPoint2;
};
Node5.prototype.getDefaultCfg = function() {
return {
type: "node",
edges: []
};
};
Node5.prototype.getEdges = function() {
return this.get("edges");
};
Node5.prototype.getInEdges = function() {
var self2 = this;
return this.get("edges").filter(function(edge2) {
return edge2.get("target") === self2;
});
};
Node5.prototype.getOutEdges = function() {
var self2 = this;
return this.get("edges").filter(function(edge2) {
return edge2.get("source") === self2;
});
};
Node5.prototype.getNeighbors = function(type2) {
var _this = this;
var edges = this.get("edges");
if (type2 === "target") {
var neighhborsConverter_1 = function neighhborsConverter_12(edge2) {
return edge2.getSource() === _this;
};
return edges.filter(neighhborsConverter_1).map(function(edge2) {
return edge2.getTarget();
});
}
if (type2 === "source") {
var neighhborsConverter_2 = function neighhborsConverter_22(edge2) {
return edge2.getTarget() === _this;
};
return edges.filter(neighhborsConverter_2).map(function(edge2) {
return edge2.getSource();
});
}
var neighhborsConverter = function neighhborsConverter2(edge2) {
return edge2.getSource() === _this ? edge2.getTarget() : edge2.getSource();
};
return edges.map(neighhborsConverter);
};
Node5.prototype.getLinkPointByAnchor = function(index2) {
var anchorPoints = this.getAnchorPoints();
return anchorPoints[index2];
};
Node5.prototype.getLinkPoint = function(point2) {
var keyShape = this.get("keyShape");
var type2 = keyShape.get("type");
var itemType = this.get("type");
var centerX;
var centerY;
var bbox = this.getBBox();
if (itemType === "combo") {
centerX = bbox.centerX || (bbox.maxX + bbox.minX) / 2;
centerY = bbox.centerY || (bbox.maxY + bbox.minY) / 2;
} else {
centerX = bbox.centerX;
centerY = bbox.centerY;
}
var anchorPoints = this.getAnchorPoints();
var intersectPoint;
switch (type2) {
case "circle":
intersectPoint = getCircleIntersectByPoint({
x: centerX,
y: centerY,
r: bbox.width / 2
}, point2);
break;
case "ellipse":
intersectPoint = getEllipseIntersectByPoint({
x: centerX,
y: centerY,
rx: bbox.width / 2,
ry: bbox.height / 2
}, point2);
break;
default:
intersectPoint = getRectIntersectByPoint(bbox, point2);
}
var linkPoint = intersectPoint;
if (anchorPoints.length) {
if (!linkPoint) {
linkPoint = point2;
}
linkPoint = this.getNearestPoint(anchorPoints, linkPoint);
}
if (!linkPoint) {
linkPoint = {
x: centerX,
y: centerY
};
}
return linkPoint;
};
Node5.prototype.getAnchorPoints = function() {
var anchorPoints = this.get(CACHE_ANCHOR_POINTS);
if (!anchorPoints) {
anchorPoints = [];
var shapeFactory = this.get("shapeFactory");
var bbox_1 = this.getBBox();
var model = this.get("model");
var shapeCfg = this.getShapeCfg(model);
var type2 = model.type;
var points = shapeFactory.getAnchorPoints(type2, shapeCfg) || [];
each_default(points, function(pointArr, index2) {
var point2 = {
x: bbox_1.minX + pointArr[0] * bbox_1.width,
y: bbox_1.minY + pointArr[1] * bbox_1.height,
anchorIndex: index2
};
anchorPoints.push(point2);
});
this.set(CACHE_ANCHOR_POINTS, anchorPoints);
}
return anchorPoints;
};
Node5.prototype.addEdge = function(edge2) {
this.get("edges").push(edge2);
};
Node5.prototype.lock = function() {
this.set("locked", true);
};
Node5.prototype.unlock = function() {
this.set("locked", false);
};
Node5.prototype.hasLocked = function() {
return this.get("locked");
};
Node5.prototype.removeEdge = function(edge2) {
var edges = this.getEdges();
var index2 = edges.indexOf(edge2);
if (index2 > -1) {
edges.splice(index2, 1);
}
};
Node5.prototype.clearCache = function() {
this.set(CACHE_BBOX2, null);
this.set(CACHE_ANCHOR_POINTS, null);
};
Node5.prototype.isOnlyMove = function(cfg) {
if (!cfg) {
return false;
}
var existX = !is_nil_default(cfg.x);
var existY = !is_nil_default(cfg.y);
var keys2 = Object.keys(cfg);
return keys2.length === 1 && (existX || existY) || keys2.length === 2 && existX && existY;
};
return Node5;
}(item_default);
var node_default = Node4;
// node_modules/@antv/g6-core/es/item/combo.js
var CACHE_BBOX3 = "bboxCache";
var CACHE_CANVAS_BBOX2 = "bboxCanvasCache";
var CACHE_SIZE = "sizeCache";
var CACHE_ANCHOR_POINTS2 = "anchorPointsCache";
var Combo = function(_super) {
__extends(Combo2, _super);
function Combo2() {
return _super !== null && _super.apply(this, arguments) || this;
}
Combo2.prototype.getDefaultCfg = function() {
return {
type: "combo",
nodes: [],
edges: [],
combos: []
};
};
Combo2.prototype.getShapeCfg = function(model) {
var styles = this.get("styles");
var bbox = this.get("bbox");
if (styles && bbox) {
var newModel = model;
var size2 = {
r: Math.hypot(bbox.height, bbox.width) / 2 || global_default.defaultCombo.size[0] / 2,
width: bbox.width || global_default.defaultCombo.size[0],
height: bbox.height || global_default.defaultCombo.size[1]
};
newModel.style = __assign(__assign(__assign({}, styles), model.style), size2);
var padding3 = model.padding || global_default.defaultCombo.padding;
if (is_number_default(padding3)) {
size2.r += padding3;
size2.width += padding3 * 2;
size2.height += padding3 * 2;
} else {
size2.r += padding3[0];
size2.width += padding3[1] + padding3[3] || padding3[1] * 2;
size2.height += padding3[0] + padding3[2] || padding3[0] * 2;
}
this.set(CACHE_SIZE, size2);
return newModel;
}
return model;
};
Combo2.prototype.calculateCanvasBBox = function() {
if (this.destroyed)
return;
var keyShape = this.get("keyShape");
var group2 = this.get("group");
var bbox = getBBox2(keyShape, group2);
bbox.centerX = (bbox.minX + bbox.maxX) / 2;
bbox.centerY = (bbox.minY + bbox.maxY) / 2;
var cacheSize = this.get(CACHE_SIZE);
var cacheBBox = this.get(CACHE_BBOX3) || {};
var oriX = cacheBBox.x;
var oriY = cacheBBox.x;
if (cacheSize) {
cacheSize.width = Math.max(cacheSize.width, bbox.width);
cacheSize.height = Math.max(cacheSize.height, bbox.height);
var type2 = keyShape.get("type");
if (type2 === "circle") {
bbox.width = cacheSize.r * 2;
bbox.height = cacheSize.r * 2;
} else {
bbox.width = cacheSize.width;
bbox.height = cacheSize.height;
}
bbox.minX = bbox.centerX - bbox.width / 2;
bbox.minY = bbox.centerY - bbox.height / 2;
bbox.maxX = bbox.centerX + bbox.width / 2;
bbox.maxY = bbox.centerY + bbox.height / 2;
} else {
bbox.width = bbox.maxX - bbox.minX;
bbox.height = bbox.maxY - bbox.minY;
bbox.centerX = (bbox.minX + bbox.maxX) / 2;
bbox.centerY = (bbox.minY + bbox.maxY) / 2;
}
bbox.x = bbox.minX;
bbox.y = bbox.minY;
if (bbox.x !== oriX || bbox.y !== oriY)
this.set(CACHE_ANCHOR_POINTS2, null);
return bbox;
};
Combo2.prototype.getChildren = function() {
var self2 = this;
return {
nodes: self2.getNodes(),
combos: self2.getCombos()
};
};
Combo2.prototype.getNodes = function() {
var self2 = this;
return self2.get("nodes");
};
Combo2.prototype.getCombos = function() {
var self2 = this;
return self2.get("combos");
};
Combo2.prototype.addChild = function(item) {
var self2 = this;
var itemType = item.getType();
switch (itemType) {
case "node":
self2.addNode(item);
break;
case "combo":
self2.addCombo(item);
break;
default:
console.warn("Only node or combo items are allowed to be added into a combo");
return false;
}
return true;
};
Combo2.prototype.addCombo = function(combo) {
var self2 = this;
self2.get("combos").push(combo);
return true;
};
Combo2.prototype.addNode = function(node) {
var self2 = this;
self2.get("nodes").push(node);
return true;
};
Combo2.prototype.removeChild = function(item) {
var self2 = this;
var itemType = item.getType();
switch (itemType) {
case "node":
self2.removeNode(item);
break;
case "combo":
self2.removeCombo(item);
break;
default:
console.warn("Only node or combo items are allowed to be added into a combo");
return false;
}
return true;
};
Combo2.prototype.removeCombo = function(combo) {
if (!combo)
return;
var combos = this.getCombos();
var index2 = combos.indexOf(combo);
if (index2 > -1) {
combos.splice(index2, 1);
return true;
}
return false;
};
Combo2.prototype.removeNode = function(node) {
if (!node)
return;
var nodes = this.getNodes();
var index2 = nodes.indexOf(node);
if (index2 > -1) {
nodes.splice(index2, 1);
return true;
}
return false;
};
Combo2.prototype.isOnlyMove = function(cfg) {
return false;
};
Combo2.prototype.getBBox = function() {
this.set(CACHE_CANVAS_BBOX2, null);
var bbox = this.calculateCanvasBBox();
return bbox;
};
Combo2.prototype.clearCache = function() {
this.set(CACHE_BBOX3, null);
this.set(CACHE_CANVAS_BBOX2, null);
this.set(CACHE_ANCHOR_POINTS2, null);
};
Combo2.prototype.destroy = function() {
if (!this.destroyed) {
var animate = this.get("animate");
var group2 = this.get("group");
if (animate) {
group2.stopAnimate();
}
this.clearCache();
this.set(CACHE_SIZE, null);
this.set("bbox", null);
group2.remove();
this._cfg = null;
this.destroyed = true;
}
};
return Combo2;
}(node_default);
var combo_default = Combo;
// node_modules/@antv/g6-core/es/graph/controller/item.js
var NODE = "node";
var EDGE = "edge";
var VEDGE = "vedge";
var COMBO = "combo";
var CFG_PREFIX = "default";
var MAPPER_SUFFIX = "Mapper";
var STATE_SUFFIX = "stateStyles";
var ItemController = function() {
function ItemController2(graph) {
this.graph = graph;
this.destroyed = false;
}
ItemController2.prototype.addItem = function(type2, model) {
var _this = this;
var graph = this.graph;
var vType = type2 === VEDGE ? EDGE : type2;
var parent = graph.get(vType + "Group") || graph.get("group");
var upperType = upper_first_default(vType);
var item = null;
var styles = graph.get(vType + upper_first_default(STATE_SUFFIX)) || {};
var defaultModel = graph.get(CFG_PREFIX + upperType);
if (model[STATE_SUFFIX]) {
styles = model[STATE_SUFFIX];
}
if (defaultModel) {
each_default(defaultModel, function(val, cfg) {
if (is_object_default(val) && !is_array_default(val)) {
model[cfg] = deep_mix_default({}, val, model[cfg]);
} else if (is_array_default(val)) {
model[cfg] = model[cfg] || clone_default(defaultModel[cfg]);
} else {
model[cfg] = model[cfg] || defaultModel[cfg];
}
});
}
var mapper = graph.get(vType + MAPPER_SUFFIX);
if (mapper) {
var mappedModel_1 = mapper(model);
if (mappedModel_1[STATE_SUFFIX]) {
styles = mappedModel_1[STATE_SUFFIX];
delete mappedModel_1[STATE_SUFFIX];
}
each_default(mappedModel_1, function(val, cfg) {
if (is_object_default(val) && !is_array_default(val)) {
model[cfg] = deep_mix_default({}, model[cfg], val);
} else {
model[cfg] = mappedModel_1[cfg] || model[cfg];
}
});
}
graph.emit("beforeadditem", {
type: type2,
model
});
if (type2 === EDGE || type2 === VEDGE) {
var source = void 0;
var target = void 0;
source = model.source;
target = model.target;
if (source && is_string_default(source)) {
source = graph.findById(source);
}
if (target && is_string_default(target)) {
target = graph.findById(target);
}
if (!source || !target) {
console.warn("The source or target node of edge " + model.id + " does not exist!");
return;
}
if (source.getType && source.getType() === "combo") {
model.isComboEdge = true;
}
if (target.getType && target.getType() === "combo") {
model.isComboEdge = true;
}
item = new edge_default2({
model,
source,
target,
styles,
linkCenter: graph.get("linkCenter"),
group: parent.addGroup()
});
} else if (type2 === NODE) {
item = new node_default({
model,
styles,
group: parent.addGroup()
});
} else if (type2 === COMBO) {
var children = model.children;
var comboBBox = getComboBBox(children, graph);
model.x = comboBBox.x || model.x || Math.random() * 100;
model.y = comboBBox.y || model.y || Math.random() * 100;
var comboGroup = parent.addGroup();
comboGroup.setZIndex(model.depth);
item = new combo_default({
model,
styles,
bbox: comboBBox,
group: comboGroup
});
var comboModel_1 = item.getModel();
(children || []).forEach(function(child) {
var childItem = graph.findById(child.id);
item.addChild(childItem);
child.depth = comboModel_1.depth + 2;
});
if (model.collapsed) {
setTimeout(function() {
graph.collapseCombo(item);
_this.updateCombo(item, []);
}, 250);
}
}
if (item) {
graph.get(type2 + "s").push(item);
graph.get("itemMap")[item.get("id")] = item;
graph.emit("afteradditem", {
item,
model
});
return item;
}
};
ItemController2.prototype.updateItem = function(item, cfg) {
var _a6, _b;
var graph = this.graph;
if (is_string_default(item)) {
item = graph.findById(item);
}
if (!item || item.destroyed) {
return;
}
var type2 = "";
if (item.getType)
type2 = item.getType();
var mapper = graph.get(type2 + MAPPER_SUFFIX);
var model = item.getModel();
var isOnlyMove = item.isOnlyMove(cfg);
if (mapper) {
var result = deep_mix_default({}, model, cfg);
var mappedModel = mapper(result);
var newModel = deep_mix_default({}, model, mappedModel, cfg);
if (mappedModel[STATE_SUFFIX]) {
item.set("styles", newModel[STATE_SUFFIX]);
delete newModel[STATE_SUFFIX];
}
each_default(newModel, function(val, key) {
cfg[key] = val;
});
} else {
each_default(cfg, function(val, key) {
if (model[key]) {
if (is_object_default(val) && !is_array_default(val)) {
cfg[key] = __assign(__assign({}, model[key]), cfg[key]);
}
}
});
}
graph.emit("beforeupdateitem", {
item,
cfg
});
if (type2 === EDGE) {
if (cfg.source) {
var source = cfg.source;
if (is_string_default(source)) {
source = graph.findById(source);
}
item.setSource(source);
}
if (cfg.target) {
var target = cfg.target;
if (is_string_default(target)) {
target = graph.findById(target);
}
item.setTarget(target);
}
item.update(cfg);
}
if (type2 === NODE || type2 === COMBO) {
item.update(cfg, isOnlyMove);
var edges_1 = item.getEdges();
var refreshEdge = shouldRefreshEdge(cfg);
if (refreshEdge && type2 === NODE)
each_default(edges_1, function(edge2) {
edge2.refresh();
});
else if (refreshEdge && type2 === COMBO) {
var shapeFactory = item.get("shapeFactory");
var shapeType = model.type || "circle";
var comboAnimate = model.animate === void 0 || cfg.animate === void 0 ? (_b = (_a6 = shapeFactory[shapeType]) === null || _a6 === void 0 ? void 0 : _a6.options) === null || _b === void 0 ? void 0 : _b.animate : model.animate || cfg.animate;
if (comboAnimate) {
setTimeout(function() {
if (!item || item.destroyed)
return;
var keyShape = item.getKeyShape();
if (!keyShape || keyShape.destroyed)
return;
each_default(edges_1, function(edge2) {
if (edge2 && !edge2.destroyed)
edge2.refresh();
});
}, 201);
} else {
each_default(edges_1, function(edge2) {
edge2.refresh();
});
}
}
}
graph.emit("afterupdateitem", {
item,
cfg
});
};
ItemController2.prototype.updateCombo = function(combo, children) {
var _a6, _b;
var graph = this.graph;
if (is_string_default(combo)) {
combo = graph.findById(combo);
}
if (!combo || combo.destroyed) {
return;
}
var comboBBox = getComboBBox(children, graph);
combo.set("bbox", comboBBox);
combo.update({
x: comboBBox.x,
y: comboBBox.y
});
var combEdges = combo.getEdges() || [];
var length5 = combEdges.length;
var model = combo.getModel();
var shapeFactory = combo.get("shapeFactory");
var shapeType = model.type || "circle";
var comboAnimate = model.animate === void 0 ? (_b = (_a6 = shapeFactory[shapeType]) === null || _a6 === void 0 ? void 0 : _a6.options) === null || _b === void 0 ? void 0 : _b.animate : model.animate;
if (comboAnimate) {
setTimeout(function() {
if (!combo || combo.destroyed)
return;
var keyShape = combo.getKeyShape();
if (!keyShape || keyShape.destroyed)
return;
for (var i5 = 0; i5 < length5; i5++) {
var edge3 = combEdges[i5];
if (edge3 && !edge3.destroyed)
edge3.refresh();
}
}, 201);
} else {
for (var i4 = 0; i4 < length5; i4++) {
var edge2 = combEdges[i4];
if (edge2 && !edge2.destroyed)
edge2.refresh();
}
}
};
ItemController2.prototype.collapseCombo = function(combo) {
var graph = this.graph;
if (is_string_default(combo)) {
combo = graph.findById(combo);
}
var children = combo.getChildren();
children.nodes.forEach(function(node) {
graph.hideItem(node);
});
children.combos.forEach(function(c5) {
graph.hideItem(c5);
});
};
ItemController2.prototype.expandCombo = function(combo) {
var graph = this.graph;
if (is_string_default(combo)) {
combo = graph.findById(combo);
}
var children = combo.getChildren();
children.nodes.forEach(function(node) {
graph.showItem(node);
});
children.combos.forEach(function(c5) {
if (c5.getModel().collapsed) {
c5.show();
} else {
graph.showItem(c5);
}
});
};
ItemController2.prototype.removeItem = function(item) {
var _this = this;
var graph = this.graph;
if (is_string_default(item)) {
item = graph.findById(item);
}
if (!item || item.destroyed) {
return;
}
var itemModel = clone_default(item.getModel());
graph.emit("beforeremoveitem", {
item: itemModel
});
var type2 = "";
if (item.getType)
type2 = item.getType();
var items = graph.get(type2 + "s");
var index2 = items.indexOf(item);
if (index2 > -1)
items.splice(index2, 1);
if (type2 === EDGE) {
var vitems = graph.get("v" + type2 + "s");
var vindex = vitems.indexOf(item);
if (vindex > -1)
vitems.splice(vindex, 1);
}
var itemId = item.get("id");
var itemMap = graph.get("itemMap");
delete itemMap[itemId];
var comboTrees = graph.get("comboTrees");
var id = item.get("id");
if (type2 === NODE) {
var comboId = item.getModel().comboId;
if (comboTrees && comboId) {
var brothers_1 = comboTrees;
var found_1 = false;
comboTrees.forEach(function(ctree) {
if (found_1)
return;
traverseTree(ctree, function(combo) {
if (combo.id === id && brothers_1) {
var bidx = brothers_1.indexOf(combo);
brothers_1.splice(bidx, 1);
found_1 = true;
return false;
}
brothers_1 = combo.children;
return true;
});
});
}
var edges = item.getEdges();
for (var i4 = edges.length - 1; i4 >= 0; i4--) {
graph.removeItem(edges[i4], false);
}
if (comboId)
graph.updateCombo(comboId);
} else if (type2 === COMBO) {
var parentId = item.getModel().parentId;
var comboInTree_1;
var found_2 = false;
(comboTrees || []).forEach(function(ctree) {
if (found_2)
return;
traverseTree(ctree, function(combo) {
if (combo.id === id) {
comboInTree_1 = combo;
found_2 = true;
return false;
}
return true;
});
});
comboInTree_1.removed = true;
if (comboInTree_1 && comboInTree_1.children) {
comboInTree_1.children.forEach(function(child) {
_this.removeItem(child.id);
});
}
var edges = item.getEdges();
for (var i4 = edges.length; i4 >= 0; i4--) {
graph.removeItem(edges[i4], false);
}
if (parentId)
graph.updateCombo(parentId);
}
item.destroy();
graph.emit("afterremoveitem", {
item: itemModel
});
};
ItemController2.prototype.setItemState = function(item, state2, value2) {
var graph = this.graph;
var stateName = state2;
if (is_string_default(value2)) {
stateName = state2 + ":" + value2;
}
if (item.hasState(stateName) === value2 && value2 || is_string_default(value2) && item.hasState(stateName)) {
return;
}
graph.emit("beforeitemstatechange", {
item,
state: stateName,
enabled: value2
});
item.setState(state2, value2);
graph.autoPaint();
graph.emit("afteritemstatechange", {
item,
state: stateName,
enabled: value2
});
};
ItemController2.prototype.priorityState = function(item, state2) {
var graph = this.graph;
var currentItem = item;
if (is_string_default(item)) {
currentItem = graph.findById(item);
}
this.setItemState(currentItem, state2, false);
this.setItemState(currentItem, state2, true);
};
ItemController2.prototype.clearItemStates = function(item, states) {
var graph = this.graph;
if (is_string_default(item)) {
item = graph.findById(item);
}
graph.emit("beforeitemstatesclear", {
item,
states
});
item.clearStates(states);
graph.emit("afteritemstatesclear", {
item,
states
});
};
ItemController2.prototype.refreshItem = function(item) {
var graph = this.graph;
if (is_string_default(item)) {
item = graph.findById(item);
}
graph.emit("beforeitemrefresh", {
item
});
item.refresh();
graph.emit("afteritemrefresh", {
item
});
};
ItemController2.prototype.addCombos = function(comboTrees, comboModels) {
var _this = this;
var graph = this.graph;
(comboTrees || []).forEach(function(ctree) {
traverseTreeUp(ctree, function(child) {
var comboModel;
comboModels.forEach(function(model) {
if (model.id === child.id) {
model.children = child.children;
model.depth = child.depth;
comboModel = model;
}
});
if (comboModel) {
_this.addItem("combo", comboModel);
}
return true;
});
});
var comboGroup = graph.get("comboGroup");
if (comboGroup)
comboGroup.sort();
};
ItemController2.prototype.changeItemVisibility = function(item, visible) {
var _this = this;
var graph = this.graph;
if (is_string_default(item)) {
item = graph.findById(item);
}
if (!item) {
console.warn("The item to be shown or hidden does not exist!");
return;
}
graph.emit("beforeitemvisibilitychange", {
item,
visible
});
item.changeVisibility(visible);
if (item.getType && item.getType() === NODE) {
var edges = item.getEdges();
each_default(edges, function(edge2) {
if (visible && !(edge2.get("source").isVisible() && edge2.get("target").isVisible())) {
return;
}
_this.changeItemVisibility(edge2, visible);
});
} else if (item.getType && item.getType() === COMBO) {
var comboTrees = graph.get("comboTrees");
var id_1 = item.get("id");
var children_1 = [];
var found_3 = false;
(comboTrees || []).forEach(function(ctree) {
if (found_3)
return;
if (!ctree.children || ctree.children.length === 0)
return;
traverseTree(ctree, function(combo) {
if (combo.id === id_1) {
children_1 = combo.children;
found_3 = true;
return false;
}
return true;
});
});
if (children_1) {
children_1.forEach(function(child) {
var childItem = graph.findById(child.id);
_this.changeItemVisibility(childItem, visible);
});
}
var edges = item.getEdges();
each_default(edges, function(edge2) {
if (visible && !(edge2.get("source").isVisible() && edge2.get("target").isVisible())) {
return;
}
_this.changeItemVisibility(edge2, visible);
});
}
graph.emit("afteritemvisibilitychange", {
item,
visible
});
return item;
};
ItemController2.prototype.destroy = function() {
this.graph = null;
this.destroyed = true;
};
return ItemController2;
}();
var item_default2 = ItemController;
// node_modules/@antv/g6-core/es/graph/controller/state.js
var timer2 = null;
var StateController = function() {
function StateController2(graph) {
this.graph = graph;
this.cachedStates = {
enabled: {},
disabled: {}
};
this.destroyed = false;
}
StateController2.checkCache = function(item, state2, cache3) {
if (!cache3[state2]) {
return;
}
var index2 = cache3[state2].indexOf(item);
if (index2 >= 0) {
cache3[state2].splice(index2, 1);
}
};
StateController2.cacheState = function(item, state2, states) {
if (!states[state2]) {
states[state2] = [];
}
states[state2].push(item);
};
StateController2.prototype.updateState = function(item, state2, enabled) {
var _this = this;
var checkCache = StateController2.checkCache, cacheState = StateController2.cacheState;
if (item.destroyed) {
return;
}
var cachedStates = this.cachedStates;
var enabledStates = cachedStates.enabled;
var disabledStates = cachedStates.disabled;
if (enabled) {
checkCache(item, state2, disabledStates);
cacheState(item, state2, enabledStates);
} else {
checkCache(item, state2, enabledStates);
cacheState(item, state2, disabledStates);
}
if (timer2) {
clearTimeout(timer2);
}
timer2 = setTimeout(function() {
timer2 = null;
_this.updateGraphStates();
}, 16);
};
StateController2.prototype.updateStates = function(item, states, enabled) {
var _this = this;
if (is_string_default(states)) {
this.updateState(item, states, enabled);
} else {
states.forEach(function(state2) {
_this.updateState(item, state2, enabled);
});
}
};
StateController2.prototype.updateGraphStates = function() {
var states = this.graph.get("states");
var cachedStates = this.cachedStates;
each_default(cachedStates.disabled, function(val, key) {
if (states[key]) {
states[key] = states[key].filter(function(item) {
return val.indexOf(item) < 0 && !val.destroyed;
});
}
});
each_default(cachedStates.enabled, function(val, key) {
if (!states[key]) {
states[key] = val;
} else {
var map_1 = {};
states[key].forEach(function(item) {
if (!item.destroyed) {
map_1[item.get("id")] = true;
}
});
val.forEach(function(item) {
if (!item.destroyed) {
var id = item.get("id");
if (!map_1[id]) {
map_1[id] = true;
states[key].push(item);
}
}
});
}
});
this.graph.emit("graphstatechange", {
states
});
this.cachedStates = {
enabled: {},
disabled: {}
};
};
StateController2.prototype.destroy = function() {
this.graph = null;
this.cachedStates = null;
if (timer2) {
clearTimeout(timer2);
}
timer2 = null;
this.destroyed = true;
};
return StateController2;
}();
var state_default2 = StateController;
// node_modules/@antv/g6-core/es/util/path.js
var path_exports2 = {};
__export(path_exports2, {
getClosedSpline: () => getClosedSpline,
getControlPoint: () => getControlPoint,
getSpline: () => getSpline2,
paddedHull: () => paddedHull,
pathToPoints: () => pathToPoints2,
pointsToPolygon: () => pointsToPolygon,
roundedHull: () => roundedHull
});
var substitute2 = function substitute3(str8, o3) {
if (!str8 || !o3) {
return str8;
}
return str8.replace(/\\?\{([^{}]+)\}/g, function(match, name) {
if (match.charAt(0) === "\\") {
return match.slice(1);
}
var res = o3[name];
if (res === 0)
res = "0";
return res || "";
});
};
var getSpline2 = function getSpline3(points) {
var data3 = [];
if (points.length < 2) {
throw new Error("point length must largn than 2, now it's " + points.length);
}
for (var _i = 0, points_1 = points; _i < points_1.length; _i++) {
var point2 = points_1[_i];
var x6 = point2.x, y5 = point2.y;
data3.push(x6);
data3.push(y5);
}
var spliePath = catmull_rom_2_bezier_default(data3);
spliePath.unshift(["M", points[0].x, points[0].y]);
return spliePath;
};
var getControlPoint = function getControlPoint2(startPoint, endPoint, percent2, offset) {
if (percent2 === void 0) {
percent2 = 0;
}
if (offset === void 0) {
offset = 0;
}
var point2 = {
x: (1 - percent2) * startPoint.x + percent2 * endPoint.x,
y: (1 - percent2) * startPoint.y + percent2 * endPoint.y
};
var tangent = [0, 0];
vec2_exports.normalize(tangent, [endPoint.x - startPoint.x, endPoint.y - startPoint.y]);
if (!tangent || !tangent[0] && !tangent[1]) {
tangent = [0, 0];
}
var perpendicular = [-tangent[1] * offset, tangent[0] * offset];
point2.x += perpendicular[0];
point2.y += perpendicular[1];
return point2;
};
var pointsToPolygon = function pointsToPolygon2(points, z3) {
var length5 = points.length;
if (!length5) {
return "";
}
var path = "";
var str8 = "";
for (var i4 = 0; i4 < length5; i4++) {
var item = points[i4];
if (i4 === 0) {
str8 = "M{x} {y}";
} else {
str8 = "L{x} {y}";
}
path += substitute2(str8, item);
}
if (z3) {
path += "Z";
}
return path;
};
var pathToPoints2 = function pathToPoints3(path) {
var points = [];
path.forEach(function(seg) {
var command = seg[0];
if (command !== "A") {
for (var i4 = 1; i4 < seg.length; i4 = i4 + 2) {
points.push([seg[i4], seg[i4 + 1]]);
}
} else {
var length_1 = seg.length;
points.push([seg[length_1 - 2], seg[length_1 - 1]]);
}
});
return points;
};
var getClosedSpline = function getClosedSpline2(points) {
if (points.length < 2) {
throw new Error("point length must largn than 2, now it's " + points.length);
}
var first = points[0];
var second = points[1];
var last2 = points[points.length - 1];
var lastSecond = points[points.length - 2];
points.unshift(last2);
points.unshift(lastSecond);
points.push(first);
points.push(second);
var closedPath = [];
for (var i4 = 1; i4 < points.length - 2; i4 += 1) {
var x0 = points[i4 - 1].x;
var y0 = points[i4 - 1].y;
var x1 = points[i4].x;
var y1 = points[i4].y;
var x22 = points[i4 + 1].x;
var y22 = points[i4 + 1].y;
var x32 = i4 !== points.length - 2 ? points[i4 + 2].x : x22;
var y32 = i4 !== points.length - 2 ? points[i4 + 2].y : y22;
var cp1x = x1 + (x22 - x0) / 6;
var cp1y = y1 + (y22 - y0) / 6;
var cp2x = x22 - (x32 - x1) / 6;
var cp2y = y22 - (y32 - y1) / 6;
closedPath.push(["C", cp1x, cp1y, cp2x, cp2y, x22, y22]);
}
closedPath.unshift(["M", last2.x, last2.y]);
return closedPath;
};
var vecScaleTo = function vecScaleTo2(v3, length5) {
return vec2_exports.scale([0, 0], vec2_exports.normalize([0, 0], v3), length5);
};
var unitNormal = function unitNormal2(p0, p1) {
var n3 = [p0[1] - p1[1], p1[0] - p0[0]];
var nLength = Math.sqrt(n3[0] * n3[0] + n3[1] * n3[1]);
if (nLength === 0) {
throw new Error("p0 should not be equal to p1");
}
return [n3[0] / nLength, n3[1] / nLength];
};
var vecFrom = function vecFrom2(p0, p1) {
return [p1[0] - p0[0], p1[1] - p0[1]];
};
function roundedHull(polyPoints, padding3) {
var roundedHull1 = function roundedHull12(points) {
var p12 = [points[0][0], points[0][1] - padding3];
var p22 = [points[0][0], points[0][1] + padding3];
return "M " + p12 + " A " + padding3 + "," + padding3 + ",0,0,0," + p22 + " A " + padding3 + "," + padding3 + ",0,0,0," + p12;
};
var roundedHull2 = function roundedHull22(points) {
var offsetVector = vec2_exports.scale([0, 0], unitNormal(points[0], points[1]), padding3);
var invOffsetVector = vec2_exports.scale([0, 0], offsetVector, -1);
var p02 = vec2_exports.add([0, 0], points[0], offsetVector);
var p12 = vec2_exports.add([0, 0], points[1], offsetVector);
var p22 = vec2_exports.add([0, 0], points[1], invOffsetVector);
var p32 = vec2_exports.add([0, 0], points[0], invOffsetVector);
return "M " + p02 + " L " + p12 + " A " + [padding3, padding3, "0,0,0", p22].join(",") + " L " + p32 + " A " + [padding3, padding3, "0,0,0", p02].join(",");
};
if (!polyPoints || polyPoints.length < 1)
return "";
if (polyPoints.length === 1)
return roundedHull1(polyPoints);
if (polyPoints.length === 2)
return roundedHull2(polyPoints);
var segments = new Array(polyPoints.length);
for (var segmentIndex = 0; segmentIndex < segments.length; ++segmentIndex) {
var p0 = segmentIndex === 0 ? polyPoints[polyPoints.length - 1] : polyPoints[segmentIndex - 1];
var p1 = polyPoints[segmentIndex];
var offset = vec2_exports.scale([0, 0], unitNormal(p0, p1), padding3);
segments[segmentIndex] = [vec2_exports.add([0, 0], p0, offset), vec2_exports.add([0, 0], p1, offset)];
}
var arcData = "A " + [padding3, padding3, "0,0,0,"].join(",");
segments = segments.map(function(segment, index2) {
var pathFragment = "";
if (index2 === 0) {
pathFragment = "M " + segments[segments.length - 1][1] + " ";
}
pathFragment += arcData + segment[0] + " L " + segment[1];
return pathFragment;
});
return segments.join(" ");
}
function paddedHull(polyPoints, padding3) {
var pointCount = polyPoints.length;
var smoothHull1 = function smoothHull12(points) {
var p1 = [points[0][0], points[0][1] - padding3];
var p22 = [points[0][0], points[0][1] + padding3];
return "M " + p1 + " A " + [padding3, padding3, "0,0,0", p22].join(",") + " A " + [padding3, padding3, "0,0,0", p1].join(",");
};
var smoothHull2 = function smoothHull22(points) {
var v3 = vecFrom(points[0], points[1]);
var extensionVec2 = vecScaleTo(v3, padding3);
var extension0 = vec2_exports.add([0, 0], points[0], vec2_exports.scale([0, 0], extensionVec2, -1));
var extension1 = vec2_exports.add([0, 0], points[1], extensionVec2);
var tangentHalfLength = 1.2 * padding3;
var controlDelta = vecScaleTo(vec2_exports.normalize([0, 0], v3), tangentHalfLength);
var invControlDelta = vec2_exports.scale([0, 0], controlDelta, -1);
var control0 = vec2_exports.add([0, 0], extension0, invControlDelta);
var control1 = vec2_exports.add([0, 0], extension1, invControlDelta);
var control3 = vec2_exports.add([0, 0], extension0, controlDelta);
return "M " + extension0 + " C " + [control0, control1, extension1].join(",") + " S " + [control3, extension0].join(",") + " Z";
};
if (!polyPoints || pointCount < 1)
return "";
if (pointCount === 1)
return smoothHull1(polyPoints);
if (pointCount === 2)
return smoothHull2(polyPoints);
var hullPoints = polyPoints.map(function(point2, index2) {
var pNext = polyPoints[(index2 + 1) % pointCount];
return {
p: point2,
v: vec2_exports.normalize([0, 0], vecFrom(point2, pNext))
};
});
for (var i4 = 0; i4 < hullPoints.length; ++i4) {
var priorIndex = i4 > 0 ? i4 - 1 : pointCount - 1;
var extensionVec = vec2_exports.normalize([0, 0], vec2_exports.add([0, 0], hullPoints[priorIndex].v, vec2_exports.scale([0, 0], hullPoints[i4].v, -1)));
hullPoints[i4].p = vec2_exports.add([0, 0], hullPoints[i4].p, vec2_exports.scale([0, 0], extensionVec, padding3));
}
return hullPoints.map(function(obj) {
var point2 = obj.p;
return {
x: point2[0],
y: point2[1]
};
});
}
// node_modules/@antv/g6-core/es/element/hull/convexHull.js
var cross4 = function cross5(a4, b10, o3) {
return (a4.y - o3.y) * (b10.x - o3.x) - (a4.x - o3.x) * (b10.y - o3.y);
};
var genConvexHull = function genConvexHull2(items) {
var points = items.map(function(item) {
return {
x: item.getModel().x,
y: item.getModel().y
};
});
points.sort(function(a4, b10) {
return a4.x === b10.x ? a4.y - b10.y : a4.x - b10.x;
});
if (points.length === 1) {
return points;
}
var lower = [];
for (var i4 = 0; i4 < points.length; i4++) {
while (lower.length >= 2 && cross4(lower[lower.length - 2], lower[lower.length - 1], points[i4]) <= 0) {
lower.pop();
}
lower.push(points[i4]);
}
var upper = [];
for (var i4 = points.length - 1; i4 >= 0; i4--) {
while (upper.length >= 2 && cross4(upper[upper.length - 2], upper[upper.length - 1], points[i4]) <= 0) {
upper.pop();
}
upper.push(points[i4]);
}
upper.pop();
lower.pop();
var strictHull = lower.concat(upper);
return strictHull;
};
// node_modules/@antv/g6-core/es/element/hull/bubbleset.js
var defaultOps = {
maxRoutingIterations: 100,
maxMarchingIterations: 100,
pixelGroupSize: 2,
edgeR0: 10,
edgeR1: 10,
nodeR0: 5,
nodeR1: 10,
morphBuffer: 5,
threshold: 1e-3,
skip: 16,
nodeInfluenceFactor: 1,
edgeInfluenceFactor: 1,
negativeNodeInfluenceFactor: -0.5
};
function MarchingSquares(contour, potentialArea, threshold) {
var marched = false;
var getVal = function getVal2(x6, y5) {
return potentialArea.cells[x6 + y5 * potentialArea.width];
};
var getState = function getState2(x6, y5) {
var squareVal = 0;
if (getVal(x6 - 1, y5 - 1) >= threshold) {
squareVal += 1;
}
if (getVal(x6, y5 - 1) > threshold) {
squareVal += 2;
}
if (getVal(x6 - 1, y5) > threshold) {
squareVal += 4;
}
if (getVal(x6, y5) > threshold) {
squareVal += 8;
}
return squareVal;
};
var doMarch = function doMarch2(xPos, yPos) {
var x6 = xPos;
var y5 = yPos;
var prevX;
var prevY;
for (var i4 = 0; i4 < potentialArea.width * potentialArea.height; i4++) {
prevX = x6;
prevY = y5;
if (contour.findIndex(function(item) {
return item.x === x6 && item.y === y5;
}) > -1) {
if (contour[0].x !== x6 || contour[0].y !== y5) {
} else {
return true;
}
} else {
contour.push({
x: x6,
y: y5
});
}
var state2 = getState(x6, y5);
switch (state2) {
case -1:
console.warn("Marched out of bounds");
return true;
case 0:
case 3:
case 2:
case 7:
x6++;
break;
case 12:
case 14:
case 4:
x6--;
break;
case 6:
if (prevX === 0) {
if (prevY === -1) {
x6 -= 1;
} else {
x6 += 1;
}
}
break;
case 1:
case 13:
case 5:
y5--;
break;
case 9:
if (prevX === 1) {
if (prevY === 0) {
y5 -= 1;
} else {
y5 += 1;
}
}
break;
case 10:
case 8:
case 11:
y5++;
break;
default:
console.warn("Marching squares invalid state: " + state2);
return true;
}
}
};
this.march = function() {
for (var x6 = 0; x6 < potentialArea.width && !marched; x6 += 1) {
for (var y5 = 0; y5 < potentialArea.height && !marched; y5 += 1) {
if (getVal(x6, y5) > threshold && getState(x6, y5) !== 15) {
marched = doMarch(x6, y5);
}
}
}
return marched;
};
}
var initGridCells = function initGridCells2(width2, height, pixelGroupSize) {
var scaleWidth = Math.ceil(width2 / pixelGroupSize);
var scaleHeight = Math.ceil(height / pixelGroupSize);
var gridCells = new Float32Array(Math.max(0, scaleWidth * scaleHeight)).fill(0);
return {
cells: gridCells,
width: scaleWidth,
height: scaleHeight
};
};
var pickBestNeighbor = function pickBestNeighbor2(item, visited, nonMembers) {
var closestNeighbour = null;
var minCost = Number.POSITIVE_INFINITY;
visited.forEach(function(neighbourItem) {
var itemP = {
x: item.getModel().x,
y: item.getModel().y
};
var neighbourItemP = {
x: neighbourItem.getModel().x,
y: neighbourItem.getModel().y
};
var dist4 = squareDist(itemP, neighbourItemP);
var directLine = new Line7(itemP.x, itemP.y, neighbourItemP.x, neighbourItemP.y);
var numberObstacles = nonMembers.reduce(function(count2, _item) {
if (fractionToLine(_item, directLine) > 0) {
return count2 + 1;
}
return count2;
}, 0);
if (dist4 * Math.pow(numberObstacles + 1, 2) < minCost) {
closestNeighbour = neighbourItem;
minCost = dist4 * Math.pow(numberObstacles + 1, 2);
}
});
return closestNeighbour;
};
var getIntersectItem = function getIntersectItem2(items, line2) {
var minDistance = Number.POSITIVE_INFINITY;
var closestItem = null;
items.forEach(function(item) {
var distance15 = fractionToLine(item, line2);
if (distance15 >= 0 && distance15 < minDistance) {
closestItem = item;
minDistance = distance15;
}
});
return closestItem;
};
var computeRoute = function computeRoute2(directLine, nonMembers, maxRoutingIterations, morphBuffer) {
var checkedLines = [];
var linesToCheck = [];
linesToCheck.push(directLine);
var hasIntersection = true;
var iterations = 0;
var pointExists = function pointExists2(point2, lines) {
var flag = false;
lines.forEach(function(line2) {
if (flag)
return;
if (isPointsOverlap(point2, {
x: line2.x1,
y: line2.y1
}) || isPointsOverlap(point2, {
x: line2.x2,
y: line2.y2
})) {
flag = true;
}
});
return flag;
};
var isPointInNonMembers = function isPointInNonMembers2(point2, _nonMembers) {
for (var _i = 0, _nonMembers_1 = _nonMembers; _i < _nonMembers_1.length; _i++) {
var item = _nonMembers_1[_i];
var bbox = item.getBBox();
var itemContour = [[bbox.x, bbox.y], [bbox.x + bbox.width, bbox.y], [bbox.x, bbox.y + bbox.height], [bbox.x + bbox.width, bbox.y + bbox.height]];
if (isPointInPolygon(itemContour, point2.x, point2.y)) {
return true;
}
}
return false;
};
while (hasIntersection && iterations < maxRoutingIterations) {
hasIntersection = false;
var _loop_1 = function _loop_12() {
var line2 = linesToCheck.pop();
var closestItem = getIntersectItem(nonMembers, line2);
if (closestItem) {
var _a6 = itemIntersectByLine(closestItem, line2), intersections_1 = _a6[0], countIntersections = _a6[1];
if (countIntersections === 2) {
var testReroute = function testReroute2(isFirst) {
var tempMorphBuffer = morphBuffer;
var virtualNode = rerouteLine(closestItem, tempMorphBuffer, intersections_1, isFirst);
var exist = pointExists(virtualNode, linesToCheck) || pointExists(virtualNode, checkedLines);
var pointInside = isPointInNonMembers(virtualNode, nonMembers);
while (!exist && pointInside && tempMorphBuffer >= 1) {
tempMorphBuffer /= 1.5;
virtualNode = rerouteLine(closestItem, tempMorphBuffer, intersections_1, isFirst);
exist = pointExists(virtualNode, linesToCheck) || pointExists(virtualNode, checkedLines);
pointInside = isPointInNonMembers(virtualNode, nonMembers);
}
if (virtualNode && !exist && (!isFirst || !pointInside)) {
linesToCheck.push(new Line7(line2.x1, line2.y1, virtualNode.x, virtualNode.y));
linesToCheck.push(new Line7(virtualNode.x, virtualNode.y, line2.x2, line2.y2));
hasIntersection = true;
}
};
testReroute(true);
if (!hasIntersection) {
testReroute(false);
}
}
}
if (!hasIntersection) {
checkedLines.push(line2);
}
iterations += 1;
};
while (!hasIntersection && linesToCheck.length) {
_loop_1();
}
}
while (linesToCheck.length) {
checkedLines.push(linesToCheck.pop());
}
return checkedLines;
};
function getRoute(item, nonMembers, visited, maxRoutingIterations, morphBuffer) {
var optimalNeighbor = pickBestNeighbor(item, visited, nonMembers);
if (optimalNeighbor === null) {
return [];
}
var mergeLines = function mergeLines2(checkedLines2) {
var finalRoute2 = [];
while (checkedLines2.length > 0) {
var line1 = checkedLines2.pop();
if (checkedLines2.length === 0) {
finalRoute2.push(line1);
break;
}
var line2 = checkedLines2.pop();
var mergeLine = new Line7(line1.x1, line1.y1, line2.x2, line2.y2);
var closestItem = getIntersectItem(nonMembers, mergeLine);
if (!closestItem) {
checkedLines2.push(mergeLine);
} else {
finalRoute2.push(line1);
checkedLines2.push(line2);
}
}
return finalRoute2;
};
var directLine = new Line7(item.getModel().x, item.getModel().y, optimalNeighbor.getModel().x, optimalNeighbor.getModel().y);
var checkedLines = computeRoute(directLine, nonMembers, maxRoutingIterations, morphBuffer);
var finalRoute = mergeLines(checkedLines);
return finalRoute;
}
var genBubbleSet = function genBubbleSet2(members, nonMembers, ops) {
var options = Object.assign(defaultOps, ops);
var centroid = getPointsCenter(members.map(function(item) {
return {
x: item.getModel().x,
y: item.getModel().y
};
}));
members = members.sort(function(a4, b10) {
return squareDist({
x: a4.getModel().x,
y: a4.getModel().y
}, centroid) - squareDist({
x: b10.getModel().x,
y: b10.getModel().y
}, centroid);
});
var visited = [];
var virtualEdges = [];
members.forEach(function(item) {
var lines = getRoute(item, nonMembers, visited, options.maxRoutingIterations, options.morphBuffer);
lines.forEach(function(l4) {
virtualEdges.push(l4);
});
visited.push(item);
});
var activeRegion = getActiveRregion(members, virtualEdges, options.nodeR0);
var potentialArea = initGridCells(activeRegion.width, activeRegion.height, options.pixelGroupSize);
var contour = [];
var hull = [];
for (var iterations = 0; iterations < options.maxMarchingIterations; iterations++) {
fillPotentialArea(members, nonMembers, virtualEdges, activeRegion, potentialArea, options);
contour = [];
hull = [];
if (!new MarchingSquares(contour, potentialArea, options.threshold).march())
continue;
var marchedPath = contour.map(function(point2) {
return {
x: Math.round(point2.x * options.pixelGroupSize + activeRegion.minX),
y: Math.round(point2.y * options.pixelGroupSize + activeRegion.minY)
};
});
if (marchedPath) {
var size2 = marchedPath.length;
if (options.skip > 1) {
size2 = Math.floor(marchedPath.length / options.skip);
while (size2 < 3 && options.skip > 1) {
options.skip -= 1;
size2 = Math.floor(marchedPath.length / options.skip);
}
}
for (var i4 = 0, j4 = 0; j4 < size2; j4 += 1, i4 += options.skip) {
hull.push({
x: marchedPath[i4].x,
y: marchedPath[i4].y
});
}
}
var isContourValid = function isContourValid2() {
for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
var item = members_1[_i];
var hullPoints = hull.map(function(point2) {
return [point2.x, point2.y];
});
if (!isPointInPolygon(hullPoints, item.getBBox().centerX, item.getBBox().centerY))
return false;
}
return true;
};
if (hull && isContourValid()) {
return hull;
}
options.threshold *= 0.9;
if (iterations <= options.maxMarchingIterations * 0.5) {
options.memberInfluenceFactor *= 1.2;
options.edgeInfluenceFactor *= 1.2;
} else if (options.nonMemberInfluenceFactor !== 0 && nonMembers.length > 0) {
options.nonMemberInfluenceFactor *= 0.8;
} else {
break;
}
}
return hull;
};
function getActiveRregion(members, edges, offset) {
var activeRegion = {
minX: Number.POSITIVE_INFINITY,
minY: Number.POSITIVE_INFINITY,
maxX: Number.NEGATIVE_INFINITY,
maxY: Number.NEGATIVE_INFINITY,
width: 0,
height: 0,
x: 0,
y: 0
};
var bboxes = [];
members.forEach(function(item) {
bboxes.push(item.getBBox());
});
edges.forEach(function(l4) {
bboxes.push(l4.getBBox());
});
for (var _i = 0, bboxes_1 = bboxes; _i < bboxes_1.length; _i++) {
var bbox = bboxes_1[_i];
activeRegion.minX = (bbox.minX < activeRegion.minX ? bbox.minX : activeRegion.minX) - offset;
activeRegion.minY = (bbox.minY < activeRegion.minY ? bbox.minY : activeRegion.minY) - offset;
activeRegion.maxX = (bbox.maxX > activeRegion.maxX ? bbox.maxX : activeRegion.maxX) + offset;
activeRegion.maxY = (bbox.maxY > activeRegion.maxY ? bbox.maxY : activeRegion.maxY) + offset;
}
activeRegion.width = activeRegion.maxX - activeRegion.minX;
activeRegion.height = activeRegion.maxY - activeRegion.minY;
activeRegion.x = activeRegion.minX;
activeRegion.y = activeRegion.minY;
return activeRegion;
}
function fillPotentialArea(members, nonMembers, edges, activeRegion, potentialArea, options) {
function pos2GridIx3(x6, offset) {
var gridIx = Math.floor((x6 - offset) / options.pixelGroupSize);
return gridIx < 0 ? 0 : gridIx;
}
function gridIx2Pos(x6, offset) {
return x6 * options.pixelGroupSize + offset;
}
var nodeInfA = (options.nodeR0 - options.nodeR1) * (options.nodeR0 - options.nodeR1);
var edgeInfA = (options.edgeR0 - options.edgeR1) * (options.edgeR0 - options.edgeR1);
var getAffectedRegion = function getAffectedRegion2(bbox, thresholdR) {
var startX = Math.min(pos2GridIx3(bbox.minX, thresholdR + activeRegion.minX), potentialArea.width);
var startY = Math.min(pos2GridIx3(bbox.minY, thresholdR + activeRegion.minY), potentialArea.height);
var endX = Math.min(pos2GridIx3(bbox.maxX, -thresholdR + activeRegion.minX), potentialArea.width);
var endY = Math.min(pos2GridIx3(bbox.maxY, -thresholdR + activeRegion.minY), potentialArea.height);
return [startX, startY, endX, endY];
};
var addItemInfluence = function addItemInfluence2(item, influenceFactor) {
var bbox = item.getBBox();
var _a6 = getAffectedRegion(bbox, options.nodeR1), startX = _a6[0], startY = _a6[1], endX = _a6[2], endY = _a6[3];
for (var y5 = startY; y5 < endY; y5 += 1) {
for (var x6 = startX; x6 < endX; x6 += 1) {
if (influenceFactor < 0 && potentialArea[x6 + y5 * potentialArea.width] <= 0) {
continue;
}
var tempX = gridIx2Pos(x6, activeRegion.minX);
var tempY = gridIx2Pos(y5, activeRegion.minY);
var distanceSq = pointRectSquareDist({
x: tempX,
y: tempY
}, {
x: bbox.minX,
y: bbox.minY,
width: bbox.width,
height: bbox.height
});
if (distanceSq < Math.pow(options.nodeR1, 2)) {
var dr = Math.sqrt(distanceSq) - options.nodeR1;
potentialArea.cells[x6 + y5 * potentialArea.width] += influenceFactor * dr * dr;
}
}
}
};
var addEdgeInfluence = function addEdgeInfluence2(line2, influenceFactor) {
var bbox = line2.getBBox();
var _a6 = getAffectedRegion(bbox, options.edgeR1), startX = _a6[0], startY = _a6[1], endX = _a6[2], endY = _a6[3];
for (var y5 = startY; y5 < endY; y5 += 1) {
for (var x6 = startX; x6 < endX; x6 += 1) {
if (influenceFactor < 0 && potentialArea.cells[x6 + y5 * potentialArea.width] <= 0) {
continue;
}
var tempX = gridIx2Pos(x6, activeRegion.minX);
var tempY = gridIx2Pos(y5, activeRegion.minY);
var minDistanceSq = pointLineSquareDist({
x: tempX,
y: tempY
}, line2);
if (minDistanceSq < Math.pow(options.edgeR1, 2)) {
var mdr = Math.sqrt(minDistanceSq) - options.edgeR1;
potentialArea.cells[x6 + y5 * potentialArea.width] += influenceFactor * mdr * mdr;
}
}
}
};
if (options.nodeInfluenceFactor) {
members.forEach(function(item) {
addItemInfluence(item, options.nodeInfluenceFactor / nodeInfA);
});
}
if (options.edgeInfluenceFactor) {
edges.forEach(function(edge2) {
addEdgeInfluence(edge2, options.edgeInfluenceFactor / edgeInfA);
});
}
if (options.negativeNodeInfluenceFactor) {
nonMembers.forEach(function(item) {
addItemInfluence(item, options.negativeNodeInfluenceFactor / nodeInfA);
});
}
}
function rerouteLine(item, buffer, intersections, wrapNormal) {
var bbox = item.getBBox();
var topIntersect = intersections[0], leftIntersect = intersections[1], bottomIntersect = intersections[2], rightIntersect = intersections[3];
var cornerPos = {
topLeft: {
x: bbox.minX - buffer,
y: bbox.minY - buffer
},
topRight: {
x: bbox.maxX + buffer,
y: bbox.minY - buffer
},
bottomLeft: {
x: bbox.minX - buffer,
y: bbox.maxY + buffer
},
bottomRight: {
x: bbox.maxX + buffer,
y: bbox.maxY + buffer
}
};
var totalArea = bbox.height * bbox.width;
function calcHalfArea(intersect1, intersect2) {
return bbox.width * ((intersect1.y - bbox.minY + (intersect2.y - bbox.minY)) * 0.5);
}
if (leftIntersect) {
if (topIntersect)
return wrapNormal ? cornerPos.topLeft : cornerPos.bottomRight;
if (bottomIntersect)
return wrapNormal ? cornerPos.bottomLeft : cornerPos.topRight;
var topArea = calcHalfArea(leftIntersect, rightIntersect);
if (topArea < totalArea * 0.5) {
if (leftIntersect.y > rightIntersect.y)
return wrapNormal ? cornerPos.topLeft : cornerPos.bottomRight;
return wrapNormal ? cornerPos.topRight : cornerPos.bottomLeft;
}
if (leftIntersect.y < rightIntersect.y)
return wrapNormal ? cornerPos.bottomLeft : cornerPos.topRight;
return wrapNormal ? cornerPos.bottomRight : cornerPos.topLeft;
}
if (rightIntersect) {
if (topIntersect)
return wrapNormal ? cornerPos.topRight : cornerPos.bottomLeft;
if (bottomIntersect)
return wrapNormal ? cornerPos.bottomRight : cornerPos.topLeft;
}
var leftArea = calcHalfArea(topIntersect, bottomIntersect);
if (leftArea < totalArea * 0.5) {
if (topIntersect.x > bottomIntersect.x)
return wrapNormal ? cornerPos.topLeft : cornerPos.bottomRight;
return wrapNormal ? cornerPos.bottomLeft : cornerPos.topRight;
}
if (topIntersect.x < bottomIntersect.x)
return wrapNormal ? cornerPos.topRight : cornerPos.bottomLeft;
return wrapNormal ? cornerPos.bottomRight : cornerPos.topLeft;
}
// node_modules/@antv/g6-core/es/item/hull.js
var Hull = function() {
function Hull2(graph, cfg) {
this.cfg = deep_mix_default(this.getDefaultCfg(), cfg);
this.graph = graph;
this.id = this.cfg.id;
this.group = this.cfg.group;
this.members = this.cfg.members.map(function(item) {
return is_string_default(item) ? graph.findById(item) : item;
});
this.nonMembers = this.cfg.nonMembers.map(function(item) {
return is_string_default(item) ? graph.findById(item) : item;
});
this.setPadding();
this.setType();
this.path = this.calcPath(this.members, this.nonMembers);
this.render();
}
Hull2.prototype.getDefaultCfg = function() {
return {
id: "g6-hull",
type: "round-convex",
members: [],
nonMembers: [],
style: {
fill: "lightblue",
stroke: "blue",
opacity: 0.2
},
padding: 10
};
};
Hull2.prototype.setPadding = function() {
var nodeSize = this.members.length && this.members[0].getKeyShape().getCanvasBBox().width / 2;
this.padding = this.cfg.padding > 0 ? this.cfg.padding + nodeSize : 10 + nodeSize;
this.cfg.bubbleCfg = {
nodeR0: this.padding - nodeSize,
nodeR1: this.padding - nodeSize,
morphBuffer: this.padding - nodeSize
};
};
Hull2.prototype.setType = function() {
this.type = this.cfg.type;
if (this.members.length < 3) {
this.type = "round-convex";
}
if (this.type !== "round-convex" && this.type !== "smooth-convex" && this.type !== "bubble") {
console.warn("The hull type should be either round-convex, smooth-convex or bubble, round-convex is used by default.");
this.type = "round-convex";
}
};
Hull2.prototype.calcPath = function(members, nonMembers) {
var contour, path, hull;
switch (this.type) {
case "round-convex":
contour = genConvexHull(members);
hull = roundedHull(contour.map(function(p4) {
return [p4.x, p4.y];
}), this.padding);
path = parsePathString2(hull);
break;
case "smooth-convex":
contour = genConvexHull(members);
if (contour.length === 2) {
hull = roundedHull(contour.map(function(p4) {
return [p4.x, p4.y];
}), this.padding);
path = parsePathString2(hull);
} else if (contour.length > 2) {
hull = paddedHull(contour.map(function(p4) {
return [p4.x, p4.y];
}), this.padding);
path = getClosedSpline(hull);
}
break;
case "bubble":
contour = genBubbleSet(members, nonMembers, this.cfg.bubbleCfg);
path = contour.length >= 2 && getClosedSpline(contour);
break;
default:
}
return path;
};
Hull2.prototype.render = function() {
this.group.addShape("path", {
attrs: __assign({
path: this.path
}, this.cfg.style),
id: this.id,
name: this.cfg.id
});
this.group.toBack();
};
Hull2.prototype.addMember = function(item) {
if (!item)
return;
if (is_string_default(item))
item = this.graph.findById(item);
this.members.push(item);
var index2 = this.nonMembers.indexOf(item);
if (index2 > -1) {
this.nonMembers.splice(index2, 1);
}
this.updateData(this.members, this.nonMembers);
return true;
};
Hull2.prototype.addNonMember = function(item) {
if (!item)
return;
if (is_string_default(item))
item = this.graph.findById(item);
this.nonMembers.push(item);
var index2 = this.members.indexOf(item);
if (index2 > -1) {
this.members.splice(index2, 1);
}
this.updateData(this.members, this.nonMembers);
return true;
};
Hull2.prototype.removeMember = function(item) {
if (!item)
return;
if (is_string_default(item))
item = this.graph.findById(item);
var index2 = this.members.indexOf(item);
if (index2 > -1) {
this.members.splice(index2, 1);
this.updateData(this.members, this.nonMembers);
return true;
}
return false;
};
Hull2.prototype.removeNonMember = function(item) {
if (!item)
return;
if (is_string_default(item))
item = this.graph.findById(item);
var index2 = this.nonMembers.indexOf(item);
if (index2 > -1) {
this.nonMembers.splice(index2, 1);
this.updateData(this.members, this.nonMembers);
return true;
}
return false;
};
Hull2.prototype.updateData = function(members, nonMembers) {
var _this = this;
this.group.findById(this.id).remove();
if (members)
this.members = members.map(function(item) {
return is_string_default(item) ? _this.graph.findById(item) : item;
});
if (nonMembers)
this.nonMembers = nonMembers.map(function(item) {
return is_string_default(item) ? _this.graph.findById(item) : item;
});
this.path = this.calcPath(this.members, this.nonMembers);
this.render();
};
Hull2.prototype.updateStyle = function(cfg) {
var path = this.group.findById(this.id);
path.attr(__assign({}, cfg));
};
Hull2.prototype.updateCfg = function(cfg) {
var _this = this;
this.cfg = deep_mix_default(this.cfg, cfg);
this.id = this.cfg.id;
this.group = this.cfg.group;
if (cfg.members) {
this.members = this.cfg.members.map(function(item) {
return is_string_default(item) ? _this.graph.findById(item) : item;
});
}
if (cfg.nonMembers) {
this.nonMembers = this.cfg.nonMembers.map(function(item) {
return is_string_default(item) ? _this.graph.findById(item) : item;
});
}
this.setPadding();
this.setType();
this.path = this.calcPath(this.members, this.nonMembers);
this.render();
};
Hull2.prototype.contain = function(item) {
var _this = this;
var nodeItem;
if (is_string_default(item)) {
nodeItem = this.graph.findById(item);
} else {
nodeItem = item;
}
var shapePoints;
var shape = nodeItem.getKeyShape();
if (nodeItem.get("type") === "path") {
shapePoints = pathToPoints2(shape.attr("path"));
} else {
var shapeBBox = shape.getCanvasBBox();
shapePoints = [[shapeBBox.minX, shapeBBox.minY], [shapeBBox.maxX, shapeBBox.minY], [shapeBBox.maxX, shapeBBox.maxY], [shapeBBox.minX, shapeBBox.maxY]];
}
shapePoints = shapePoints.map(function(canvasPoint) {
var point2 = _this.graph.getPointByCanvas(canvasPoint[0], canvasPoint[1]);
return [point2.x, point2.y];
});
return isPolygonsIntersect2(shapePoints, pathToPoints2(this.path));
};
Hull2.prototype.destroy = function() {
this.group.remove();
this.cfg = null;
};
return Hull2;
}();
var hull_default = Hull;
// node_modules/@antv/g6-core/es/graph/graph.js
var transform9 = ext_exports.transform;
var NODE2 = "node";
var AbstractGraph = function(_super) {
__extends(AbstractGraph2, _super);
function AbstractGraph2(cfg) {
var _this = _super.call(this) || this;
_this.cfg = deep_mix_default(_this.getDefaultCfg(), cfg);
_this.init();
_this.animating = false;
_this.destroyed = false;
if (_this.cfg.enabledStack) {
_this.undoStack = new stack_default2(_this.cfg.maxStep);
_this.redoStack = new stack_default2(_this.cfg.maxStep);
}
return _this;
}
AbstractGraph2.prototype.init = function() {
this.initCanvas();
var viewController = new view_default2(this);
var modeController = new mode_default(this);
var itemController = new item_default2(this);
var stateController = new state_default2(this);
this.set({
viewController,
modeController,
itemController,
stateController
});
this.initLayoutController();
this.initEventController();
this.initGroups();
this.initPlugins();
};
AbstractGraph2.prototype.initGroups = function() {
var canvas = this.get("canvas");
var el = this.get("canvas").get("el");
var id = el.id;
var group2 = canvas.addGroup({
id: id + "-root",
className: global_default.rootContainerClassName
});
if (this.get("groupByTypes")) {
var edgeGroup = group2.addGroup({
id: id + "-edge",
className: global_default.edgeContainerClassName
});
var nodeGroup = group2.addGroup({
id: id + "-node",
className: global_default.nodeContainerClassName
});
var comboGroup = group2.addGroup({
id: id + "-combo",
className: global_default.comboContainerClassName
});
comboGroup.toBack();
this.set({
nodeGroup,
edgeGroup,
comboGroup
});
}
var delegateGroup = group2.addGroup({
id: id + "-delegate",
className: global_default.delegateContainerClassName
});
this.set({
delegateGroup
});
this.set("group", group2);
};
AbstractGraph2.prototype.getDefaultCfg = function() {
return {
container: void 0,
width: void 0,
height: void 0,
renderer: "canvas",
modes: {},
plugins: [],
data: {},
fitViewPadding: 10,
minZoom: 0.2,
maxZoom: 10,
event: true,
groupByTypes: true,
directed: false,
autoPaint: true,
nodes: [],
edges: [],
combos: [],
vedges: [],
itemMap: {},
linkCenter: false,
defaultNode: {},
defaultEdge: {},
nodeStateStyles: {},
edgeStateStyles: {},
states: {},
animate: false,
animateCfg: {
onFrame: void 0,
duration: 500,
easing: "easeLinear"
},
callback: void 0,
enabledStack: false,
maxStep: 10,
tooltips: []
};
};
AbstractGraph2.prototype.set = function(key, val) {
if (is_plain_object_default(key)) {
this.cfg = __assign(__assign({}, this.cfg), key);
} else {
this.cfg[key] = val;
}
return this;
};
AbstractGraph2.prototype.get = function(key) {
return this.cfg[key];
};
AbstractGraph2.prototype.getGroup = function() {
return this.get("group");
};
AbstractGraph2.prototype.getContainer = function() {
return this.get("container");
};
AbstractGraph2.prototype.getMinZoom = function() {
return this.get("minZoom");
};
AbstractGraph2.prototype.setMinZoom = function(ratio) {
return this.set("minZoom", ratio);
};
AbstractGraph2.prototype.getMaxZoom = function() {
return this.get("maxZoom");
};
AbstractGraph2.prototype.setMaxZoom = function(ratio) {
return this.set("maxZoom", ratio);
};
AbstractGraph2.prototype.getWidth = function() {
return this.get("width");
};
AbstractGraph2.prototype.getHeight = function() {
return this.get("height");
};
AbstractGraph2.prototype.clearItemStates = function(item, states) {
if (is_string_default(item)) {
item = this.findById(item);
}
var itemController = this.get("itemController");
if (!states) {
states = item.get("states");
}
itemController.clearItemStates(item, states);
var stateController = this.get("stateController");
stateController.updateStates(item, states, false);
};
AbstractGraph2.prototype.node = function(nodeFn) {
if (typeof nodeFn === "function") {
this.set("nodeMapper", nodeFn);
}
};
AbstractGraph2.prototype.edge = function(edgeFn) {
if (typeof edgeFn === "function") {
this.set("edgeMapper", edgeFn);
}
};
AbstractGraph2.prototype.combo = function(comboFn) {
if (typeof comboFn === "function") {
this.set("comboMapper", comboFn);
}
};
AbstractGraph2.prototype.findById = function(id) {
return this.get("itemMap")[id];
};
AbstractGraph2.prototype.find = function(type2, fn2) {
var result;
var items = this.get(type2 + "s");
each_default(items, function(item, i4) {
if (fn2(item, i4)) {
result = item;
return result;
}
});
return result;
};
AbstractGraph2.prototype.findAll = function(type2, fn2) {
var result = [];
each_default(this.get(type2 + "s"), function(item, i4) {
if (fn2(item, i4)) {
result.push(item);
}
});
return result;
};
AbstractGraph2.prototype.findAllByState = function(type2, state2) {
return this.findAll(type2, function(item) {
return item.hasState(state2);
});
};
AbstractGraph2.prototype.translate = function(dx, dy) {
var group2 = this.get("group");
var matrix = clone_default(group2.getMatrix());
if (!matrix) {
matrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
}
matrix = transform9(matrix, [["t", dx, dy]]);
group2.setMatrix(matrix);
this.emit("viewportchange", {
action: "translate",
matrix: group2.getMatrix()
});
this.autoPaint();
};
AbstractGraph2.prototype.moveTo = function(x6, y5) {
var group2 = this.get("group");
move(group2, {
x: x6,
y: y5
});
this.emit("viewportchange", {
action: "move",
matrix: group2.getMatrix()
});
};
AbstractGraph2.prototype.fitView = function(padding3) {
if (padding3) {
this.set("fitViewPadding", padding3);
}
var viewController = this.get("viewController");
viewController.fitView();
this.autoPaint();
};
AbstractGraph2.prototype.fitCenter = function() {
var viewController = this.get("viewController");
viewController.fitCenter();
this.autoPaint();
};
AbstractGraph2.prototype.addBehaviors = function(behaviors2, modes) {
var modeController = this.get("modeController");
modeController.manipulateBehaviors(behaviors2, modes, true);
return this;
};
AbstractGraph2.prototype.removeBehaviors = function(behaviors2, modes) {
var modeController = this.get("modeController");
modeController.manipulateBehaviors(behaviors2, modes, false);
return this;
};
AbstractGraph2.prototype.updateBehavior = function(behavior, newCfg, mode) {
var modeController = this.get("modeController");
modeController.updateBehavior(behavior, newCfg, mode);
return this;
};
AbstractGraph2.prototype.zoom = function(ratio, center2) {
var group2 = this.get("group");
var matrix = clone_default(group2.getMatrix());
var minZoom = this.get("minZoom");
var maxZoom = this.get("maxZoom");
if (!matrix) {
matrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
}
if (center2) {
matrix = transform9(matrix, [["t", -center2.x, -center2.y], ["s", ratio, ratio], ["t", center2.x, center2.y]]);
} else {
matrix = transform9(matrix, [["s", ratio, ratio]]);
}
if (minZoom && matrix[0] < minZoom || maxZoom && matrix[0] > maxZoom) {
return;
}
group2.setMatrix(matrix);
this.emit("viewportchange", {
action: "zoom",
matrix
});
this.autoPaint();
};
AbstractGraph2.prototype.zoomTo = function(toRatio, center2) {
var ratio = toRatio / this.getZoom();
this.zoom(ratio, center2);
};
AbstractGraph2.prototype.focusItem = function(item, animate, animateCfg) {
var viewController = this.get("viewController");
var isAnimate = false;
if (animate)
isAnimate = true;
else if (animate === void 0)
isAnimate = this.get("animate");
var curAniamteCfg = {};
if (animateCfg)
curAniamteCfg = animateCfg;
else if (animateCfg === void 0)
curAniamteCfg = this.get("animateCfg");
viewController.focus(item, isAnimate, curAniamteCfg);
this.autoPaint();
};
AbstractGraph2.prototype.autoPaint = function() {
if (this.get("autoPaint")) {
this.paint();
}
};
AbstractGraph2.prototype.paint = function() {
this.emit("beforepaint");
this.get("canvas").draw();
this.emit("afterpaint");
};
AbstractGraph2.prototype.getPointByClient = function(clientX, clientY) {
var viewController = this.get("viewController");
return viewController.getPointByClient(clientX, clientY);
};
AbstractGraph2.prototype.getClientByPoint = function(x6, y5) {
var viewController = this.get("viewController");
return viewController.getClientByPoint(x6, y5);
};
AbstractGraph2.prototype.getPointByCanvas = function(canvasX, canvasY) {
var viewController = this.get("viewController");
return viewController.getPointByCanvas(canvasX, canvasY);
};
AbstractGraph2.prototype.getCanvasByPoint = function(x6, y5) {
var viewController = this.get("viewController");
return viewController.getCanvasByPoint(x6, y5);
};
AbstractGraph2.prototype.getGraphCenterPoint = function() {
var bbox = this.get("group").getCanvasBBox();
return {
x: (bbox.minX + bbox.maxX) / 2,
y: (bbox.minY + bbox.maxY) / 2
};
};
AbstractGraph2.prototype.getViewPortCenterPoint = function() {
return this.getPointByCanvas(this.get("width") / 2, this.get("height") / 2);
};
AbstractGraph2.prototype.showItem = function(item, stack) {
if (stack === void 0) {
stack = true;
}
var itemController = this.get("itemController");
var object = itemController.changeItemVisibility(item, true);
if (stack && this.get("enabledStack")) {
var id = object.getID();
var type2 = object.getType();
var before = {};
var after = {};
switch (type2) {
case "node":
before.nodes = [{
id,
visible: false
}];
after.nodes = [{
id,
visible: true
}];
break;
case "edge":
before.nodes = [{
id,
visible: false
}];
after.edges = [{
id,
visible: true
}];
break;
case "combo":
before.nodes = [{
id,
visible: false
}];
after.combos = [{
id,
visible: true
}];
break;
default:
break;
}
this.pushStack("visible", {
before,
after
});
}
};
AbstractGraph2.prototype.hideItem = function(item, stack) {
if (stack === void 0) {
stack = true;
}
var itemController = this.get("itemController");
var object = itemController.changeItemVisibility(item, false);
if (stack && this.get("enabledStack")) {
var id = object.getID();
var type2 = object.getType();
var before = {};
var after = {};
switch (type2) {
case "node":
before.nodes = [{
id,
visible: true
}];
after.nodes = [{
id,
visible: false
}];
break;
case "edge":
before.nodes = [{
id,
visible: true
}];
after.edges = [{
id,
visible: false
}];
break;
case "combo":
before.nodes = [{
id,
visible: true
}];
after.combos = [{
id,
visible: false
}];
break;
default:
break;
}
this.pushStack("visible", {
before,
after
});
}
};
AbstractGraph2.prototype.refreshItem = function(item) {
var itemController = this.get("itemController");
itemController.refreshItem(item);
};
AbstractGraph2.prototype.setAutoPaint = function(auto) {
var self2 = this;
self2.set("autoPaint", auto);
var canvas = self2.get("canvas");
canvas.set("autoDraw", auto);
};
AbstractGraph2.prototype.remove = function(item, stack) {
if (stack === void 0) {
stack = true;
}
this.removeItem(item, stack);
};
AbstractGraph2.prototype.removeItem = function(item, stack) {
if (stack === void 0) {
stack = true;
}
var nodeItem = item;
if (is_string_default(item))
nodeItem = this.findById(item);
if (!nodeItem && is_string_default(item)) {
console.warn("The item to be removed does not exist!");
} else if (nodeItem) {
var type2 = "";
if (nodeItem.getType)
type2 = nodeItem.getType();
if (stack && this.get("enabledStack")) {
var deletedModel = __assign(__assign({}, nodeItem.getModel()), {
itemType: type2
});
var before = {};
switch (type2) {
case "node": {
before.nodes = [deletedModel];
before.edges = [];
var edges = nodeItem.getEdges();
for (var i4 = edges.length - 1; i4 >= 0; i4--) {
before.edges.push(__assign(__assign({}, edges[i4].getModel()), {
itemType: "edge"
}));
}
break;
}
case "edge":
before.edges = [deletedModel];
break;
case "combo":
before.combos = [deletedModel];
break;
default:
break;
}
this.pushStack("delete", {
before,
after: {}
});
}
if (type2 === "node") {
var model = nodeItem.getModel();
if (model.comboId) {
this.updateComboTree(nodeItem);
}
}
var itemController = this.get("itemController");
itemController.removeItem(nodeItem);
if (type2 === "combo") {
var newComboTrees = reconstructTree(this.get("comboTrees"));
this.set("comboTrees", newComboTrees);
}
}
};
AbstractGraph2.prototype.addItem = function(type2, model, stack, sortCombo) {
if (stack === void 0) {
stack = true;
}
if (sortCombo === void 0) {
sortCombo = true;
}
var currentComboSorted = this.get("comboSorted");
this.set("comboSorted", currentComboSorted && !sortCombo);
var itemController = this.get("itemController");
if (model.id && this.findById(model.id)) {
console.warn("This item exists already. Be sure the id %c" + model.id + "%c is unique.", "font-size: 20px; color: red;", "");
return;
}
var item;
var comboTrees = this.get("comboTrees");
if (!comboTrees)
comboTrees = [];
if (type2 === "combo") {
var itemMap_1 = this.get("itemMap");
var foundParent_1 = false;
comboTrees.forEach(function(ctree) {
if (foundParent_1)
return;
traverseTreeUp(ctree, function(child) {
if (model.parentId === child.id) {
foundParent_1 = true;
var newCombo2 = __assign({
id: model.id,
depth: child.depth + 2
}, model);
if (child.children)
child.children.push(newCombo2);
else
child.children = [newCombo2];
model.depth = newCombo2.depth;
item = itemController.addItem(type2, model);
}
var childItem = itemMap_1[child.id];
if (foundParent_1 && childItem && childItem.getType && childItem.getType() === "combo") {
itemController.updateCombo(childItem, child.children);
}
return true;
});
});
if (!foundParent_1) {
var newCombo = __assign({
id: model.id,
depth: 0
}, model);
model.depth = newCombo.depth;
comboTrees.push(newCombo);
item = itemController.addItem(type2, model);
}
this.set("comboTrees", comboTrees);
} else if (type2 === "node" && is_string_default(model.comboId) && comboTrees) {
var parentCombo = this.findById(model.comboId);
if (parentCombo && parentCombo.getType && parentCombo.getType() !== "combo") {
console.warn("'" + model.comboId + "' is not a id of a combo in the graph, the node will be added without combo.");
}
item = itemController.addItem(type2, model);
var itemMap_2 = this.get("itemMap");
var foundParent_2 = false, foundNode_1 = false;
(comboTrees || []).forEach(function(ctree) {
if (foundNode_1 || foundParent_2)
return;
traverseTreeUp(ctree, function(child) {
if (child.id === model.id) {
foundNode_1 = true;
return false;
}
if (model.comboId === child.id && !foundNode_1) {
foundParent_2 = true;
var cloneNode = clone_default(model);
cloneNode.itemType = "node";
if (child.children)
child.children.push(cloneNode);
else
child.children = [cloneNode];
model.depth = child.depth + 1;
}
if (foundParent_2 && itemMap_2[child.id].getType && itemMap_2[child.id].getType() === "combo") {
itemController.updateCombo(itemMap_2[child.id], child.children);
}
return true;
});
});
} else {
item = itemController.addItem(type2, model);
}
if (type2 === "node" && model.comboId || type2 === "combo" && model.parentId) {
var parentCombo = this.findById(model.comboId || model.parentId);
if (parentCombo && parentCombo.getType && parentCombo.getType() === "combo")
parentCombo.addChild(item);
}
var combos = this.get("combos");
if (combos && combos.length > 0) {
this.sortCombos();
}
this.autoPaint();
if (stack && this.get("enabledStack")) {
var addedModel = __assign(__assign({}, item.getModel()), {
itemType: type2
});
var after = {};
switch (type2) {
case "node":
after.nodes = [addedModel];
break;
case "edge":
after.edges = [addedModel];
break;
case "combo":
after.combos = [addedModel];
break;
default:
break;
}
this.pushStack("add", {
before: {},
after
});
}
return item;
};
AbstractGraph2.prototype.add = function(type2, model, stack, sortCombo) {
if (stack === void 0) {
stack = true;
}
if (sortCombo === void 0) {
sortCombo = true;
}
return this.addItem(type2, model, stack, sortCombo);
};
AbstractGraph2.prototype.updateItem = function(item, cfg, stack) {
var _this = this;
if (stack === void 0) {
stack = true;
}
var itemController = this.get("itemController");
var currentItem;
if (is_string_default(item)) {
currentItem = this.findById(item);
} else {
currentItem = item;
}
var UnupdateModel = clone_default(currentItem.getModel());
var type2 = "";
if (currentItem.getType)
type2 = currentItem.getType();
var states = __spreadArray([], currentItem.getStates());
if (type2 === "combo") {
each_default(states, function(state2) {
return _this.setItemState(currentItem, state2, false);
});
}
itemController.updateItem(currentItem, cfg);
if (type2 === "combo") {
each_default(states, function(state2) {
return _this.setItemState(currentItem, state2, true);
});
}
if (stack && this.get("enabledStack")) {
var before = {
nodes: [],
edges: [],
combos: []
};
var after = {
nodes: [],
edges: [],
combos: []
};
var afterModel = __assign({
id: UnupdateModel.id
}, cfg);
switch (type2) {
case "node":
before.nodes.push(UnupdateModel);
after.nodes.push(afterModel);
break;
case "edge":
before.edges.push(UnupdateModel);
after.edges.push(afterModel);
break;
case "combo":
before.combos.push(UnupdateModel);
after.combos.push(afterModel);
break;
default:
break;
}
if (type2 === "node") {
before.nodes.push(UnupdateModel);
}
this.pushStack("update", {
before,
after
});
}
};
AbstractGraph2.prototype.update = function(item, cfg, stack) {
if (stack === void 0) {
stack = true;
}
this.updateItem(item, cfg, stack);
};
AbstractGraph2.prototype.setItemState = function(item, state2, value2) {
if (is_string_default(item)) {
item = this.findById(item);
}
var itemController = this.get("itemController");
itemController.setItemState(item, state2, value2);
var stateController = this.get("stateController");
if (is_string_default(value2)) {
stateController.updateState(item, state2 + ":" + value2, true);
} else {
stateController.updateState(item, state2, value2);
}
};
AbstractGraph2.prototype.priorityState = function(item, state2) {
var itemController = this.get("itemController");
itemController.priorityState(item, state2);
};
AbstractGraph2.prototype.data = function(data3) {
this.set("data", data3);
};
AbstractGraph2.prototype.render = function() {
var self2 = this;
this.set("comboSorted", false);
var data3 = this.get("data");
if (this.get("enabledStack")) {
this.clearStack();
}
if (!data3) {
throw new Error("data must be defined first");
}
var _a6 = data3.nodes, nodes = _a6 === void 0 ? [] : _a6, _b = data3.edges, edges = _b === void 0 ? [] : _b, _c = data3.combos, combos = _c === void 0 ? [] : _c;
this.clear(true);
this.emit("beforerender");
each_default(nodes, function(node) {
self2.add("node", node, false, false);
});
if (combos && combos.length !== 0) {
var comboTrees = plainCombosToTrees(combos, nodes);
this.set("comboTrees", comboTrees);
self2.addCombos(combos);
}
each_default(edges, function(edge2) {
self2.add("edge", edge2, false, false);
});
var animate = self2.get("animate");
if (self2.get("fitView") || self2.get("fitCenter")) {
self2.set("animate", false);
}
var layoutController = self2.get("layoutController");
if (layoutController) {
layoutController.layout(success);
if (this.destroyed)
return;
} else {
if (self2.get("fitView")) {
self2.fitView();
}
if (self2.get("fitCenter")) {
self2.fitCenter();
}
self2.emit("afterrender");
self2.set("animate", animate);
}
function success() {
if (self2.get("fitView")) {
self2.fitView();
} else if (self2.get("fitCenter")) {
self2.fitCenter();
}
self2.autoPaint();
self2.emit("afterrender");
if (self2.get("fitView") || self2.get("fitCenter")) {
self2.set("animate", animate);
}
}
if (!this.get("groupByTypes")) {
if (combos && combos.length !== 0) {
this.sortCombos();
} else {
if (data3.nodes && data3.edges && data3.nodes.length < data3.edges.length) {
var nodesArr = this.getNodes();
nodesArr.forEach(function(node) {
node.toFront();
});
} else {
var edgesArr = this.getEdges();
edgesArr.forEach(function(edge2) {
edge2.toBack();
});
}
}
}
if (this.get("enabledStack")) {
this.pushStack("render");
}
};
AbstractGraph2.prototype.read = function(data3) {
this.data(data3);
this.render();
};
AbstractGraph2.prototype.diffItems = function(type2, items, models) {
var self2 = this;
var item;
var itemMap = this.get("itemMap");
each_default(models, function(model) {
item = itemMap[model.id];
if (item) {
if (self2.get("animate") && type2 === NODE2) {
var containerMatrix = item.getContainer().getMatrix();
if (!containerMatrix)
containerMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
item.set("originAttrs", {
x: containerMatrix[6],
y: containerMatrix[7]
});
}
self2.updateItem(item, model, false);
} else {
item = self2.addItem(type2, model, false);
}
if (item)
items[type2 + "s"].push(item);
});
};
AbstractGraph2.prototype.changeData = function(data3, stack) {
if (stack === void 0) {
stack = true;
}
var self2 = this;
if (!data3) {
return this;
}
if (stack && this.get("enabledStack")) {
this.pushStack("changedata", {
before: self2.save(),
after: data3
});
}
this.set("comboSorted", false);
this.removeHulls();
this.getNodes().map(function(node) {
return self2.clearItemStates(node);
});
this.getEdges().map(function(edge2) {
return self2.clearItemStates(edge2);
});
var canvas = this.get("canvas");
var localRefresh = canvas.get("localRefresh");
canvas.set("localRefresh", false);
if (!self2.get("data")) {
self2.data(data3);
self2.render();
}
var itemMap = this.get("itemMap");
var items = {
nodes: [],
edges: []
};
var combosData = data3.combos;
if (combosData) {
var comboTrees = plainCombosToTrees(combosData, data3.nodes);
this.set("comboTrees", comboTrees);
}
this.diffItems("node", items, data3.nodes);
each_default(itemMap, function(item, id) {
itemMap[id].getModel().depth = 0;
if (item.getType && item.getType() === "edge")
return;
if (item.getType && item.getType() === "combo") {
delete itemMap[id];
item.destroy();
} else if (items.nodes.indexOf(item) < 0) {
delete itemMap[id];
self2.remove(item, false);
}
});
var comboItems = this.getCombos();
var combosLength = comboItems.length;
for (var i4 = combosLength - 1; i4 >= 0; i4--) {
if (comboItems[i4].destroyed) {
comboItems.splice(i4, 1);
}
}
if (combosData) {
self2.addCombos(combosData);
if (!this.get("groupByTypes")) {
this.sortCombos();
}
}
this.diffItems("edge", items, data3.edges);
each_default(itemMap, function(item, id) {
if (item.getType && (item.getType() === "node" || item.getType() === "combo"))
return;
if (items.edges.indexOf(item) < 0) {
delete itemMap[id];
self2.remove(item, false);
}
});
this.set({
nodes: items.nodes,
edges: items.edges
});
var layoutController = this.get("layoutController");
if (layoutController) {
layoutController.changeData();
if (self2.get("animate") && !layoutController.getLayoutType()) {
self2.positionsAnimate();
} else {
self2.autoPaint();
}
}
setTimeout(function() {
canvas.set("localRefresh", localRefresh);
}, 16);
return this;
};
AbstractGraph2.prototype.addCombos = function(combos) {
var self2 = this;
var comboTrees = self2.get("comboTrees");
var itemController = this.get("itemController");
itemController.addCombos(comboTrees, combos);
};
AbstractGraph2.prototype.createCombo = function(combo, children) {
var _this = this;
this.set("comboSorted", false);
var comboId = "";
var comboConfig;
if (!combo)
return;
if (is_string_default(combo)) {
comboId = combo;
comboConfig = {
id: combo
};
} else {
comboId = combo.id;
if (!comboId) {
console.warn("Create combo failed. Please assign a unique string id for the adding combo.");
return;
}
comboConfig = combo;
}
var trees = children.map(function(elementId) {
var item = _this.findById(elementId);
var type2 = "";
if (item.getType)
type2 = item.getType();
var cItem = {
id: item.getID(),
itemType: type2
};
if (type2 === "combo") {
cItem.parentId = comboId;
} else if (type2 === "node") {
cItem.comboId = comboId;
}
return cItem;
});
comboConfig.children = trees;
this.addItem("combo", comboConfig, false);
this.set("comboSorted", false);
var comboTrees = this.get("comboTrees");
(comboTrees || []).forEach(function(ctree) {
traverseTreeUp(ctree, function(child) {
if (child.id === comboId) {
child.itemType = "combo";
child.children = trees;
return false;
}
return true;
});
});
if (comboTrees) {
this.sortCombos();
}
};
AbstractGraph2.prototype.uncombo = function(combo) {
var _this = this;
var self2 = this;
var comboItem = combo;
if (is_string_default(combo)) {
comboItem = this.findById(combo);
}
if (!comboItem || comboItem.getType && comboItem.getType() !== "combo") {
console.warn("The item is not a combo!");
return;
}
var parentId = comboItem.getModel().parentId;
var comboTrees = self2.get("comboTrees");
if (!comboTrees)
comboTrees = [];
var itemMap = this.get("itemMap");
var comboId = comboItem.get("id");
var treeToBeUncombo;
var brothers = [];
var comboItems = this.get("combos");
var parentItem = this.findById(parentId);
comboTrees.forEach(function(ctree) {
if (treeToBeUncombo)
return;
traverseTreeUp(ctree, function(subtree) {
if (subtree.id === comboId) {
treeToBeUncombo = subtree;
var edges = comboItem.getEdges();
edges.forEach(function(edge2) {
_this.removeItem(edge2, false);
});
var index3 = comboItems.indexOf(combo);
comboItems.splice(index3, 1);
delete itemMap[comboId];
comboItem.destroy();
}
if (parentId && treeToBeUncombo && subtree.id === parentId) {
parentItem.removeCombo(comboItem);
brothers = subtree.children;
var index3 = brothers.indexOf(treeToBeUncombo);
if (index3 !== -1) {
brothers.splice(index3, 1);
}
treeToBeUncombo.children.forEach(function(child) {
var item = _this.findById(child.id);
var childModel = item.getModel();
if (item.getType && item.getType() === "combo") {
child.parentId = parentId;
delete child.comboId;
childModel.parentId = parentId;
delete childModel.comboId;
} else if (item.getType && item.getType() === "node") {
child.comboId = parentId;
childModel.comboId = parentId;
}
parentItem.addChild(item);
brothers.push(child);
});
return false;
}
return true;
});
});
if (!parentId && treeToBeUncombo) {
var index2 = comboTrees.indexOf(treeToBeUncombo);
comboTrees.splice(index2, 1);
treeToBeUncombo.children.forEach(function(child) {
child.parentId = void 0;
var childModel = _this.findById(child.id).getModel();
childModel.parentId = void 0;
if (child.itemType !== "node")
comboTrees.push(child);
});
}
};
AbstractGraph2.prototype.updateCombos = function() {
var _this = this;
var self2 = this;
var comboTrees = this.get("comboTrees");
var itemController = self2.get("itemController");
var itemMap = self2.get("itemMap");
(comboTrees || []).forEach(function(ctree) {
traverseTreeUp(ctree, function(child) {
if (!child) {
return true;
}
var childItem = itemMap[child.id];
if (childItem && childItem.getType && childItem.getType() === "combo") {
var states = __spreadArray([], childItem.getStates());
each_default(states, function(state2) {
return _this.setItemState(childItem, state2, false);
});
itemController.updateCombo(childItem, child.children);
each_default(states, function(state2) {
return _this.setItemState(childItem, state2, true);
});
}
return true;
});
});
self2.sortCombos();
};
AbstractGraph2.prototype.updateCombo = function(combo) {
var _this = this;
var self2 = this;
var comboItem = combo;
var comboId;
if (is_string_default(combo)) {
comboItem = this.findById(combo);
}
if (!comboItem || comboItem.getType && comboItem.getType() !== "combo") {
console.warn("The item to be updated is not a combo!");
return;
}
comboId = comboItem.get("id");
var comboTrees = this.get("comboTrees");
var itemController = self2.get("itemController");
var itemMap = self2.get("itemMap");
(comboTrees || []).forEach(function(ctree) {
traverseTreeUp(ctree, function(child) {
if (!child) {
return true;
}
var childItem = itemMap[child.id];
if (comboId === child.id && childItem && childItem.getType && childItem.getType() === "combo") {
var states = __spreadArray([], childItem.getStates());
each_default(states, function(state2) {
if (childItem.getStateStyle(state2)) {
_this.setItemState(childItem, state2, false);
}
});
itemController.updateCombo(childItem, child.children);
each_default(states, function(state2) {
if (childItem.getStateStyle(state2)) {
_this.setItemState(childItem, state2, true);
}
});
if (comboId)
comboId = child.parentId;
}
return true;
});
});
};
AbstractGraph2.prototype.updateComboTree = function(item, parentId, stack) {
if (stack === void 0) {
stack = true;
}
var self2 = this;
this.set("comboSorted", false);
var uItem;
if (is_string_default(item)) {
uItem = self2.findById(item);
} else {
uItem = item;
}
var model = uItem.getModel();
var oldParentId = model.comboId || model.parentId;
var type2 = "";
if (uItem.getType)
type2 = uItem.getType();
if (parentId && type2 === "combo") {
var comboTrees = this.get("comboTrees");
var valid_1 = true;
var itemSubTree_1;
(comboTrees || []).forEach(function(ctree) {
if (itemSubTree_1)
return;
traverseTree(ctree, function(subTree) {
if (itemSubTree_1)
return;
if (subTree.id === uItem.getID()) {
itemSubTree_1 = subTree;
}
return true;
});
});
traverseTree(itemSubTree_1, function(subTree) {
if (subTree.id === parentId) {
valid_1 = false;
return false;
}
return true;
});
if (!valid_1) {
console.warn("Failed to update the combo tree! The parentId points to a descendant of the combo!");
return;
}
}
if (stack && this.get("enabledStack")) {
var beforeData = {}, afterData = {};
if (type2 === "combo") {
beforeData.combos = [{
id: model.id,
parentId: model.parentId
}];
afterData.combos = [{
id: model.id,
parentId
}];
} else if (type2 === "node") {
beforeData.nodes = [{
id: model.id,
parentId: model.comboId
}];
afterData.nodes = [{
id: model.id,
parentId
}];
}
this.pushStack("updateComboTree", {
before: beforeData,
after: afterData
});
}
if (model.parentId || model.comboId) {
var combo = this.findById(model.parentId || model.comboId);
if (combo) {
combo.removeChild(uItem);
}
}
if (type2 === "combo") {
model.parentId = parentId;
} else if (type2 === "node") {
model.comboId = parentId;
}
if (parentId) {
var parentCombo = this.findById(parentId);
if (parentCombo) {
parentCombo.addChild(uItem);
}
}
if (oldParentId) {
var parentCombo = this.findById(oldParentId);
if (parentCombo) {
parentCombo.removeChild(uItem);
}
}
var newComboTrees = reconstructTree(this.get("comboTrees"), model.id, parentId);
this.set("comboTrees", newComboTrees);
this.updateCombos();
};
AbstractGraph2.prototype.save = function() {
var nodes = [];
var edges = [];
var combos = [];
each_default(this.get("nodes"), function(node) {
nodes.push(node.getModel());
});
each_default(this.get("edges"), function(edge2) {
edges.push(edge2.getModel());
});
each_default(this.get("combos"), function(combo) {
combos.push(combo.getModel());
});
return {
nodes,
edges,
combos
};
};
AbstractGraph2.prototype.changeSize = function(width2, height) {
var viewController = this.get("viewController");
viewController.changeSize(width2, height);
return this;
};
AbstractGraph2.prototype.refresh = function() {
var self2 = this;
self2.emit("beforegraphrefresh");
if (self2.get("animate")) {
self2.positionsAnimate();
} else {
var nodes = self2.get("nodes");
var edges = self2.get("edges");
var vedges = self2.get("edges");
each_default(nodes, function(node) {
node.refresh();
});
each_default(edges, function(edge2) {
edge2.refresh();
});
each_default(vedges, function(vedge) {
vedge.refresh();
});
}
self2.emit("aftergraphrefresh");
self2.autoPaint();
};
AbstractGraph2.prototype.getNodes = function() {
return this.get("nodes");
};
AbstractGraph2.prototype.getEdges = function() {
return this.get("edges");
};
AbstractGraph2.prototype.getCombos = function() {
return this.get("combos");
};
AbstractGraph2.prototype.getComboChildren = function(combo) {
if (is_string_default(combo)) {
combo = this.findById(combo);
}
if (!combo || combo.getType && combo.getType() !== "combo") {
console.warn("The combo does not exist!");
return;
}
return combo.getChildren();
};
AbstractGraph2.prototype.positionsAnimate = function() {
var self2 = this;
self2.emit("beforeanimate");
var animateCfg = self2.get("animateCfg");
var onFrame = animateCfg.onFrame;
var nodes = self2.getNodes();
var toNodes = nodes.map(function(node) {
var model = node.getModel();
return {
id: model.id,
x: model.x,
y: model.y
};
});
if (self2.isAnimating()) {
self2.stopAnimate();
}
var canvas = self2.get("canvas");
canvas.animate(function(ratio) {
each_default(toNodes, function(data3) {
var node = self2.findById(data3.id);
if (!node || node.destroyed) {
return;
}
var originAttrs = node.get("originAttrs");
var model = node.get("model");
if (!originAttrs) {
var containerMatrix = node.getContainer().getMatrix();
if (!containerMatrix)
containerMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
originAttrs = {
x: containerMatrix[6],
y: containerMatrix[7]
};
node.set("originAttrs", originAttrs);
}
if (onFrame) {
var attrs = onFrame(node, ratio, data3, originAttrs);
node.set("model", Object.assign(model, attrs));
} else {
model.x = originAttrs.x + (data3.x - originAttrs.x) * ratio;
model.y = originAttrs.y + (data3.y - originAttrs.y) * ratio;
}
});
self2.refreshPositions();
}, {
duration: animateCfg.duration,
easing: animateCfg.easing,
callback: function callback() {
each_default(nodes, function(node) {
node.set("originAttrs", null);
});
if (animateCfg.callback) {
animateCfg.callback();
}
self2.emit("afteranimate");
self2.animating = false;
}
});
};
AbstractGraph2.prototype.refreshPositions = function() {
var self2 = this;
self2.emit("beforegraphrefreshposition");
var nodes = self2.get("nodes");
var edges = self2.get("edges");
var vedges = self2.get("vedges");
var combos = self2.get("combos");
var model;
var updatedNodes = {};
var nodeChangeMap = {};
each_default(nodes, function(node) {
model = node.getModel();
var originAttrs = node.get("originAttrs");
if (originAttrs && model.x === originAttrs.x && model.y === originAttrs.y) {
return;
}
var changed = node.updatePosition({
x: model.x,
y: model.y
});
updatedNodes[model.id] = changed;
if (model.comboId)
updatedNodes[model.comboId] = updatedNodes[model.comboId] || changed;
});
if (combos && combos.length !== 0) {
self2.updateCombos();
}
each_default(edges, function(edge2) {
var sourceModel = edge2.getSource().getModel();
var targetModel = edge2.getTarget().getModel();
if (updatedNodes[sourceModel.id] || updatedNodes[targetModel.id] || edge2.getModel().isComboEdge) {
edge2.refresh();
}
});
each_default(vedges, function(vedge) {
vedge.refresh();
});
self2.emit("aftergraphrefreshposition");
self2.autoPaint();
};
AbstractGraph2.prototype.stopAnimate = function() {
this.get("canvas").stopAnimate();
};
AbstractGraph2.prototype.isAnimating = function() {
return this.animating;
};
AbstractGraph2.prototype.getZoom = function() {
var matrix = this.get("group").getMatrix();
return matrix ? matrix[0] : 1;
};
AbstractGraph2.prototype.getCurrentMode = function() {
var modeController = this.get("modeController");
return modeController.getMode();
};
AbstractGraph2.prototype.setMode = function(mode) {
var modeController = this.get("modeController");
modeController.setMode(mode);
return this;
};
AbstractGraph2.prototype.clear = function(avoidEmit) {
if (avoidEmit === void 0) {
avoidEmit = false;
}
var canvas = this.get("canvas");
canvas.clear();
this.initGroups();
this.set({
itemMap: {},
nodes: [],
edges: [],
groups: [],
combos: [],
comboTrees: []
});
if (!avoidEmit)
this.emit("afterrender");
return this;
};
AbstractGraph2.prototype.updateLayout = function(cfg) {
var layoutController = this.get("layoutController");
if (is_string_default(cfg)) {
cfg = {
type: cfg
};
}
var oriLayoutCfg = this.get("layout");
var layoutCfg = {};
Object.assign(layoutCfg, oriLayoutCfg, cfg);
this.set("layout", layoutCfg);
if (layoutController.isLayoutTypeSame(layoutCfg) && layoutCfg.gpuEnabled === oriLayoutCfg.gpuEnabled) {
layoutController.updateLayoutCfg(layoutCfg);
} else {
layoutController.changeLayout(layoutCfg);
}
};
AbstractGraph2.prototype.destroyLayout = function() {
var layoutController = this.get("layoutController");
layoutController.destroyLayout();
};
AbstractGraph2.prototype.layout = function() {
var layoutController = this.get("layoutController");
var layoutCfg = this.get("layout");
if (!layoutCfg || !layoutController)
return;
if (layoutCfg.workerEnabled) {
layoutController.layout();
return;
}
if (layoutController.layoutMethod) {
layoutController.relayout(true);
} else {
layoutController.layout();
}
};
AbstractGraph2.prototype.collapseCombo = function(combo) {
var _this = this;
if (is_string_default(combo)) {
combo = this.findById(combo);
}
if (!combo) {
console.warn("The combo to be collapsed does not exist!");
return;
}
this.emit("beforecollapseexpandcombo", {
action: "expand",
item: combo
});
var comboModel = combo.getModel();
var itemController = this.get("itemController");
itemController.collapseCombo(combo);
comboModel.collapsed = true;
var edges = this.getEdges().concat(this.get("vedges"));
var cnodes = [];
var ccombos = [];
var comboTrees = this.get("comboTrees");
var found = false;
var brothers = {};
(comboTrees || []).forEach(function(ctree) {
brothers[ctree.id] = ctree;
});
(comboTrees || []).forEach(function(ctree) {
if (found)
return;
traverseTree(ctree, function(subTree) {
if (found && brothers[subTree.id])
return false;
if (comboModel.parentId === subTree.id) {
brothers = {};
subTree.children.forEach(function(child) {
brothers[child.id] = child;
});
} else if (comboModel.id === subTree.id) {
found = true;
}
if (found) {
var item = _this.findById(subTree.id);
if (item && item.getType && item.getType() === "combo") {
cnodes = cnodes.concat(item.getNodes());
ccombos = ccombos.concat(item.getCombos());
}
}
return true;
});
});
var edgeWeightMap = {};
var addedVEdges = [];
edges.forEach(function(edge2) {
if (edge2.isVisible() && !edge2.getModel().isVEdge)
return;
var source = edge2.getSource();
var target = edge2.getTarget();
if ((cnodes.includes(source) || ccombos.includes(source)) && !cnodes.includes(target) && !ccombos.includes(target) || source.getModel().id === comboModel.id) {
var edgeModel = edge2.getModel();
if (edgeModel.isVEdge) {
_this.removeItem(edge2, false);
return;
}
var targetModel = target.getModel();
while (!target.isVisible()) {
target = _this.findById(targetModel.parentId || targetModel.comboId);
if (!target || !targetModel.parentId && !targetModel.comboId)
return;
targetModel = target.getModel();
}
var targetId = targetModel.id;
if (edgeWeightMap[comboModel.id + "-" + targetId]) {
edgeWeightMap[comboModel.id + "-" + targetId] += edgeModel.size || 1;
return;
}
var vedge = _this.addItem("vedge", {
source: comboModel.id,
target: targetId,
isVEdge: true
}, false);
edgeWeightMap[comboModel.id + "-" + targetId] = edgeModel.size || 1;
addedVEdges.push(vedge);
} else if (!cnodes.includes(source) && !ccombos.includes(source) && (cnodes.includes(target) || ccombos.includes(target)) || target.getModel().id === comboModel.id) {
var edgeModel = edge2.getModel();
if (edgeModel.isVEdge) {
_this.removeItem(edge2, false);
return;
}
var sourceModel = source.getModel();
while (!source.isVisible()) {
source = _this.findById(sourceModel.parentId || sourceModel.comboId);
if (!source || !sourceModel.parentId && !sourceModel.comboId)
return;
sourceModel = source.getModel();
}
var sourceId = sourceModel.id;
if (edgeWeightMap[sourceId + "-" + comboModel.id]) {
edgeWeightMap[sourceId + "-" + comboModel.id] += edgeModel.size || 1;
return;
}
var vedge = _this.addItem("vedge", {
target: comboModel.id,
source: sourceId,
isVEdge: true
}, false);
edgeWeightMap[sourceId + "-" + comboModel.id] = edgeModel.size || 1;
addedVEdges.push(vedge);
}
});
addedVEdges.forEach(function(vedge) {
var vedgeModel = vedge.getModel();
_this.updateItem(vedge, {
size: edgeWeightMap[vedgeModel.source + "-" + vedgeModel.target]
}, false);
});
this.emit("aftercollapseexpandcombo", {
action: "collapse",
item: combo
});
};
AbstractGraph2.prototype.expandCombo = function(combo) {
var _this = this;
if (is_string_default(combo)) {
combo = this.findById(combo);
}
if (!combo || combo.getType && combo.getType() !== "combo") {
console.warn("The combo to be collapsed does not exist!");
return;
}
this.emit("beforecollapseexpandcombo", {
action: "expand",
item: combo
});
var comboModel = combo.getModel();
var itemController = this.get("itemController");
itemController.expandCombo(combo);
comboModel.collapsed = false;
var edges = this.getEdges().concat(this.get("vedges"));
var cnodes = [];
var ccombos = [];
var comboTrees = this.get("comboTrees");
var found = false;
var brothers = {};
(comboTrees || []).forEach(function(ctree) {
brothers[ctree.id] = ctree;
});
(comboTrees || []).forEach(function(ctree) {
if (found)
return;
traverseTree(ctree, function(subTree) {
if (found && brothers[subTree.id]) {
return false;
}
if (comboModel.parentId === subTree.id) {
brothers = {};
subTree.children.forEach(function(child) {
brothers[child.id] = child;
});
} else if (comboModel.id === subTree.id) {
found = true;
}
if (found) {
var item = _this.findById(subTree.id);
if (item && item.getType && item.getType() === "combo") {
cnodes = cnodes.concat(item.getNodes());
ccombos = ccombos.concat(item.getCombos());
}
}
return true;
});
});
var edgeWeightMap = {};
var addedVEdges = {};
edges.forEach(function(edge2) {
if (edge2.isVisible() && !edge2.getModel().isVEdge)
return;
var source = edge2.getSource();
var target = edge2.getTarget();
var sourceId = source.get("id");
var targetId = target.get("id");
if ((cnodes.includes(source) || ccombos.includes(source)) && !cnodes.includes(target) && !ccombos.includes(target) || sourceId === comboModel.id) {
if (edge2.getModel().isVEdge) {
_this.removeItem(edge2, false);
return;
}
var targetModel = target.getModel();
while (!target.isVisible()) {
target = _this.findById(targetModel.comboId || targetModel.parentId);
if (!target || !targetModel.parentId && !targetModel.comboId) {
return;
}
targetModel = target.getModel();
}
targetId = targetModel.id;
var sourceModel = source.getModel();
while (!source.isVisible()) {
source = _this.findById(sourceModel.comboId || sourceModel.parentId);
if (!source || !sourceModel.parentId && !sourceModel.comboId) {
return;
}
if (sourceModel.comboId === comboModel.id || sourceModel.parentId === comboModel.id) {
break;
}
sourceModel = source.getModel();
}
sourceId = sourceModel.id;
if (targetId) {
var vedgeId = sourceId + "-" + targetId;
if (edgeWeightMap[vedgeId]) {
edgeWeightMap[vedgeId] += edge2.getModel().size || 1;
_this.updateItem(addedVEdges[vedgeId], {
size: edgeWeightMap[vedgeId]
}, false);
return;
}
var vedge = _this.addItem("vedge", {
source: sourceId,
target: targetId,
isVEdge: true
}, false);
edgeWeightMap[vedgeId] = edge2.getModel().size || 1;
addedVEdges[vedgeId] = vedge;
}
} else if (!cnodes.includes(source) && !ccombos.includes(source) && (cnodes.includes(target) || ccombos.includes(target)) || targetId === comboModel.id) {
if (edge2.getModel().isVEdge) {
_this.removeItem(edge2, false);
return;
}
var sourceModel = source.getModel();
while (!source.isVisible()) {
source = _this.findById(sourceModel.comboId || sourceModel.parentId);
if (!source || !sourceModel.parentId && !sourceModel.comboId) {
return;
}
sourceModel = source.getModel();
}
sourceId = sourceModel.id;
var targetModel = target.getModel();
while (!target.isVisible()) {
target = _this.findById(targetModel.comboId || targetModel.parentId);
if (!target || !targetModel.parentId && !targetModel.comboId) {
return;
}
if (targetModel.comboId === comboModel.id || targetModel.parentId === comboModel.id) {
break;
}
targetModel = target.getModel();
}
targetId = targetModel.id;
if (sourceId) {
var vedgeId = sourceId + "-" + targetId;
if (edgeWeightMap[vedgeId]) {
edgeWeightMap[vedgeId] += edge2.getModel().size || 1;
_this.updateItem(addedVEdges[vedgeId], {
size: edgeWeightMap[vedgeId]
}, false);
return;
}
var vedge = _this.addItem("vedge", {
target: targetId,
source: sourceId,
isVEdge: true
}, false);
edgeWeightMap[vedgeId] = edge2.getModel().size || 1;
addedVEdges[vedgeId] = vedge;
}
} else if ((cnodes.includes(source) || ccombos.includes(source)) && (cnodes.includes(target) || ccombos.includes(target))) {
if (source.isVisible() && target.isVisible()) {
edge2.show();
}
}
});
this.emit("aftercollapseexpandcombo", {
action: "expand",
item: combo
});
};
AbstractGraph2.prototype.collapseExpandCombo = function(combo) {
if (is_string_default(combo)) {
combo = this.findById(combo);
}
if (combo.getType && combo.getType() !== "combo")
return;
var comboModel = combo.getModel();
var parentItem = this.findById(comboModel.parentId);
while (parentItem) {
var parentModel = parentItem.getModel();
if (parentModel.collapsed) {
console.warn("Fail to expand the combo since it's ancestor combo is collapsed.");
parentItem = void 0;
return;
}
parentItem = this.findById(parentModel.parentId);
}
var collapsed = comboModel.collapsed;
if (collapsed) {
this.expandCombo(combo);
} else {
this.collapseCombo(combo);
}
this.updateCombo(combo);
};
AbstractGraph2.prototype.sortCombos = function() {
var _this = this;
var comboSorted = this.get("comboSorted");
if (comboSorted)
return;
this.set("comboSorted", true);
var depthMap = [];
var dataDepthMap = {};
var comboTrees = this.get("comboTrees");
(comboTrees || []).forEach(function(cTree) {
traverseTree(cTree, function(child) {
if (depthMap[child.depth])
depthMap[child.depth].push(child.id);
else
depthMap[child.depth] = [child.id];
dataDepthMap[child.id] = child.depth;
return true;
});
});
var edges = this.getEdges().concat(this.get("vedges"));
(edges || []).forEach(function(edgeItem) {
var edge2 = edgeItem.getModel();
var sourceDepth = dataDepthMap[edge2.source] || 0;
var targetDepth2 = dataDepthMap[edge2.target] || 0;
var depth = Math.max(sourceDepth, targetDepth2);
if (depthMap[depth])
depthMap[depth].push(edge2.id);
else
depthMap[depth] = [edge2.id];
});
depthMap.forEach(function(array) {
if (!array || !array.length)
return;
for (var i4 = array.length - 1; i4 >= 0; i4--) {
var item = _this.findById(array[i4]);
if (item)
item.toFront();
}
});
};
AbstractGraph2.prototype.getNeighbors = function(node, type2) {
var item = node;
if (is_string_default(node)) {
item = this.findById(node);
}
return item.getNeighbors(type2);
};
AbstractGraph2.prototype.getNodeDegree = function(node, type2, refresh) {
if (type2 === void 0) {
type2 = void 0;
}
if (refresh === void 0) {
refresh = false;
}
var item = node;
if (is_string_default(node)) {
item = this.findById(node);
}
var degrees = this.get("degrees");
if (!degrees || refresh) {
degrees = degree_default(this.save());
this.set("degrees", degrees);
}
var nodeDegrees = degrees[item.getID()];
var res = 0;
if (!nodeDegrees) {
return 0;
}
switch (type2) {
case "in":
res = nodeDegrees.inDegree;
break;
case "out":
res = nodeDegrees.outDegree;
break;
case "all":
res = nodeDegrees;
break;
default:
res = nodeDegrees.degree;
break;
}
return res;
};
AbstractGraph2.prototype.getUndoStack = function() {
return this.undoStack;
};
AbstractGraph2.prototype.getRedoStack = function() {
return this.redoStack;
};
AbstractGraph2.prototype.getStackData = function() {
if (!this.get("enabledStack")) {
return null;
}
return {
undoStack: this.undoStack.toArray(),
redoStack: this.redoStack.toArray()
};
};
AbstractGraph2.prototype.clearStack = function() {
if (this.get("enabledStack")) {
this.undoStack.clear();
this.redoStack.clear();
}
};
AbstractGraph2.prototype.pushStack = function(action, data3, stackType) {
if (action === void 0) {
action = "update";
}
if (stackType === void 0) {
stackType = "undo";
}
if (!this.get("enabledStack")) {
console.warn("\u8BF7\u5148\u542F\u7528 undo & redo \u529F\u80FD\uFF0C\u5728\u5B9E\u4F8B\u5316 Graph \u65F6\u5019\u914D\u7F6E enabledStack: true !");
return;
}
var stackData = data3 ? clone_default(data3) : {
before: {},
after: clone_default(this.save())
};
if (stackType === "redo") {
this.redoStack.push({
action,
data: stackData
});
} else {
this.undoStack.push({
action,
data: stackData
});
}
this.emit("stackchange", {
undoStack: this.undoStack,
redoStack: this.redoStack
});
};
AbstractGraph2.prototype.getAdjMatrix = function(cache3, directed) {
if (cache3 === void 0) {
cache3 = true;
}
if (directed === void 0)
directed = this.get("directed");
var currentAdjMatrix = this.get("adjMatrix");
if (!currentAdjMatrix || !cache3) {
currentAdjMatrix = adjacent_matrix_default(this.save(), directed);
this.set("adjMatrix", currentAdjMatrix);
}
return currentAdjMatrix;
};
AbstractGraph2.prototype.getShortestPathMatrix = function(cache3, directed) {
if (cache3 === void 0) {
cache3 = true;
}
if (directed === void 0)
directed = this.get("directed");
var currentAdjMatrix = this.get("adjMatrix");
var currentShourtestPathMatrix = this.get("shortestPathMatrix");
if (!currentAdjMatrix || !cache3) {
currentAdjMatrix = adjacent_matrix_default(this.save(), directed);
this.set("adjMatrix", currentAdjMatrix);
}
if (!currentShourtestPathMatrix || !cache3) {
currentShourtestPathMatrix = floydWarshall_default(this.save(), directed);
this.set("shortestPathMatrix", currentShourtestPathMatrix);
}
return currentShourtestPathMatrix;
};
AbstractGraph2.prototype.on = function(eventName, callback, once) {
return _super.prototype.on.call(this, eventName, callback, once);
};
AbstractGraph2.prototype.destroy = function() {
this.clear();
this.clearStack();
this.get("itemController").destroy();
this.get("modeController").destroy();
this.get("viewController").destroy();
this.get("stateController").destroy();
this.get("canvas").destroy();
this.cfg = null;
this.destroyed = true;
this.redoStack = null;
this.undoStack = null;
};
AbstractGraph2.prototype.createHull = function(cfg) {
if (!cfg.members || cfg.members.length < 1) {
console.warn("Create hull failed! The members is empty.");
return;
}
var parent = this.get("hullGroup");
var hullMap = this.get("hullMap");
if (!hullMap) {
hullMap = {};
this.set("hullMap", hullMap);
}
if (!parent || parent.get("destroyed")) {
parent = this.get("group").addGroup({
id: "hullGroup"
});
parent.toBack();
this.set("hullGroup", parent);
}
if (hullMap[cfg.id]) {
console.warn("Existed hull id.");
return hullMap[cfg.id];
}
var group2 = parent.addGroup({
id: cfg.id + "-container"
});
var hull = new hull_default(this, __assign(__assign({}, cfg), {
group: group2
}));
var hullId = hull.id;
hullMap[hullId] = hull;
return hull;
};
AbstractGraph2.prototype.getHulls = function() {
return this.get("hullMap");
};
AbstractGraph2.prototype.getHullById = function(hullId) {
return this.get("hullMap")[hullId];
};
AbstractGraph2.prototype.removeHull = function(hull) {
var hullInstance;
if (is_string_default(hull)) {
hullInstance = this.getHullById(hull);
} else {
hullInstance = hull;
}
var hullMap = this.get("hullMap");
delete hullMap[hullInstance.id];
hullInstance.destroy();
};
AbstractGraph2.prototype.removeHulls = function() {
var hulls = this.getHulls();
if (!hulls || !Object.keys(hulls).length)
return;
Object.keys(hulls).forEach(function(key) {
var hull = hulls[key];
hull.destroy();
});
this.set("hullMap", {});
};
return AbstractGraph2;
}(esm_default);
var graph_default = AbstractGraph;
// node_modules/@antv/g6-core/es/element/shapeBase.js
function _typeof2(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof2 = function _typeof5(obj2) {
return typeof obj2;
};
} else {
_typeof2 = function _typeof5(obj2) {
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
};
}
return _typeof2(obj);
}
var transform10 = ext_exports.transform;
var CLS_SHAPE_SUFFIX = "-shape";
var CLS_LABEL_SUFFIX = "-label";
var ARROWS = ["startArrow", "endArrow"];
var SHAPE_DEFAULT_ATTRS = {
lineWidth: 1,
stroke: void 0,
fill: void 0,
lineAppendWidth: 1,
opacity: void 0,
strokeOpacity: void 0,
fillOpacity: void 0,
x: 0,
y: 0,
r: 10,
width: 20,
height: 20,
shadowColor: void 0,
shadowBlur: 0,
shadowOffsetX: 0,
shadowOffsetY: 0
};
var PATH_SHAPE_DEFAULT_ATTRS = {
lineWidth: 1,
stroke: "#000",
lineDash: void 0,
startArrow: false,
endArrow: false,
opacity: void 0,
strokeOpacity: void 0,
fillOpacity: void 0,
shadowColor: void 0,
shadowBlur: 0,
shadowOffsetX: 0,
shadowOffsetY: 0
};
var SHAPES_DEFAULT_ATTRS = {
edge: PATH_SHAPE_DEFAULT_ATTRS,
node: SHAPE_DEFAULT_ATTRS,
combo: SHAPE_DEFAULT_ATTRS
};
var CLS_LABEL_BG_SUFFIX = "-label-bg";
var shapeBase = {
options: {},
itemType: "",
type: "",
getCustomConfig: function getCustomConfig(cfg) {
return {};
},
getOptions: function getOptions(cfg) {
return deep_mix_default({
labelCfg: {
style: {
fontFamily: typeof window !== "undefined" ? window.getComputedStyle(document.body, null).getPropertyValue("font-family") || "Arial, sans-serif" : "Arial, sans-serif"
}
},
descriptionCfg: {
style: {
fontFamily: typeof window !== "undefined" ? window.getComputedStyle(document.body, null).getPropertyValue("font-family") || "Arial, sans-serif" : "Arial, sans-serif"
}
}
}, this.options, this.getCustomConfig(cfg) || {}, cfg);
},
draw: function draw3(cfg, group2) {
var shape = this.drawShape(cfg, group2);
shape.set("className", this.itemType + CLS_SHAPE_SUFFIX);
if (cfg.label) {
var label17 = this.drawLabel(cfg, group2);
label17.set("className", this.itemType + CLS_LABEL_SUFFIX);
}
return shape;
},
afterDraw: function afterDraw2(cfg, group2, keyShape) {
},
drawShape: function drawShape2(cfg, group2) {
return null;
},
drawLabel: function drawLabel(cfg, group2) {
var defaultLabelCfg3 = this.getOptions(cfg).labelCfg;
var labelCfg = defaultLabelCfg3 || {};
var labelStyle = this.getLabelStyle(cfg, labelCfg, group2);
var rotate8 = labelStyle.rotate;
delete labelStyle.rotate;
var label17 = group2.addShape("text", {
attrs: labelStyle,
draggable: true,
className: "text-shape",
name: "text-shape"
});
if (rotate8) {
var labelBBox = label17.getBBox();
var labelMatrix = label17.getMatrix();
if (!labelMatrix) {
labelMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
}
if (labelStyle.rotateCenter) {
switch (labelStyle.rotateCenter) {
case "center":
labelMatrix = transform10(labelMatrix, [["t", -labelBBox.width / 2, -labelBBox.height / 2], ["r", rotate8], ["t", labelBBox.width / 2, labelBBox.height / 2]]);
break;
case "lefttop":
labelMatrix = transform10(labelMatrix, [["t", -labelStyle.x, -labelStyle.y], ["r", rotate8], ["t", labelStyle.x, labelStyle.y]]);
break;
case "leftcenter":
labelMatrix = transform10(labelMatrix, [["t", -labelStyle.x, -labelStyle.y - labelBBox.height / 2], ["r", rotate8], ["t", labelStyle.x, labelStyle.y + labelBBox.height / 2]]);
break;
default:
labelMatrix = transform10(labelMatrix, [["t", -labelBBox.width / 2, -labelBBox.height / 2], ["r", rotate8], ["t", labelBBox.width / 2, labelBBox.height / 2]]);
break;
}
} else {
labelMatrix = transform10(labelMatrix, [["t", -labelStyle.x, -labelStyle.y - labelBBox.height / 2], ["r", rotate8], ["t", labelStyle.x, labelStyle.y + labelBBox.height / 2]]);
}
label17.setMatrix(labelMatrix);
}
if (labelStyle.background) {
var rect3 = this.drawLabelBg(cfg, group2, label17);
var labelBgClassname = this.itemType + CLS_LABEL_BG_SUFFIX;
rect3.set("classname", labelBgClassname);
label17.toFront();
}
return label17;
},
drawLabelBg: function drawLabelBg(cfg, group2, label17) {
var defaultLabelCfg3 = this.options.labelCfg;
var labelCfg = mix({}, defaultLabelCfg3, cfg.labelCfg);
var style = this.getLabelBgStyleByPosition(label17, cfg, labelCfg, group2);
var rect3 = group2.addShape("rect", {
name: "text-bg-shape",
attrs: style
});
return rect3;
},
getLabelStyleByPosition: function getLabelStyleByPosition(cfg, labelCfg, group2) {
return {
text: cfg.label
};
},
getLabelBgStyleByPosition: function getLabelBgStyleByPosition(label17, cfg, labelCfg, group2) {
return {};
},
getLabelStyle: function getLabelStyle(cfg, labelCfg, group2) {
var calculateStyle = this.getLabelStyleByPosition(cfg, labelCfg, group2);
var attrName = this.itemType + "Label";
var defaultStyle = global_default[attrName] ? global_default[attrName].style : null;
var labelStyle = __assign(__assign(__assign({}, defaultStyle), calculateStyle), labelCfg.style);
return labelStyle;
},
getShapeStyle: function getShapeStyle(cfg) {
return cfg.style;
},
update: function update2(cfg, item) {
this.updateShapeStyle(cfg, item);
this.updateLabel(cfg, item);
},
updateShapeStyle: function updateShapeStyle(cfg, item) {
var group2 = item.getContainer();
var shape = item.getKeyShape();
var shapeStyle = mix({}, shape.attr(), cfg.style);
var _loop_1 = function _loop_12(key2) {
var _a6;
var style = shapeStyle[key2];
if (is_plain_object_default(style)) {
var subShape = group2.find(function(element) {
return element.get("name") === key2;
});
if (subShape) {
subShape.attr(style);
}
} else {
shape.attr((_a6 = {}, _a6[key2] = style, _a6));
}
};
for (var key in shapeStyle) {
_loop_1(key);
}
},
updateLabel: function updateLabel2(cfg, item) {
var group2 = item.getContainer();
var defaultLabelCfg3 = this.getOptions({}).labelCfg;
var labelClassName = this.itemType + CLS_LABEL_SUFFIX;
var label17 = group2.find(function(element) {
return element.get("className") === labelClassName;
});
var labelBgClassname = this.itemType + CLS_LABEL_BG_SUFFIX;
var labelBg = group2.find(function(element) {
return element.get("classname") === labelBgClassname;
});
if (cfg.label || cfg.label === "") {
if (!label17) {
var newLabel = this.drawLabel(cfg, group2);
newLabel.set("className", labelClassName);
} else {
var currentLabelCfg = {};
if (item.getModel) {
currentLabelCfg = item.getModel().labelCfg;
}
var labelCfg = deep_mix_default({}, defaultLabelCfg3, currentLabelCfg, cfg.labelCfg);
var calculateStyle = this.getLabelStyleByPosition(cfg, labelCfg, group2);
var cfgStyle = cfg.labelCfg ? cfg.labelCfg.style : void 0;
var cfgBgStyle = labelCfg.style && labelCfg.style.background;
var labelStyle = __assign(__assign(__assign({}, label17.attr()), calculateStyle), cfgStyle);
var rotate8 = labelStyle.rotate;
delete labelStyle.rotate;
if (rotate8) {
var rotateMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
rotateMatrix = transform10(rotateMatrix, [["t", -labelStyle.x, -labelStyle.y], ["r", rotate8], ["t", labelStyle.x, labelStyle.y]]);
label17.resetMatrix();
label17.attr(__assign(__assign({}, labelStyle), {
matrix: rotateMatrix
}));
} else {
label17.resetMatrix();
label17.attr(labelStyle);
}
if (!labelBg) {
if (labelStyle.background) {
labelBg = this.drawLabelBg(cfg, group2, label17);
labelBg.set("classname", labelBgClassname);
label17.toFront();
}
} else if (labelStyle.background) {
var calculateBgStyle = this.getLabelBgStyleByPosition(label17, cfg, labelCfg, group2);
var labelBgStyle = __assign(__assign({}, calculateBgStyle), cfgBgStyle);
labelBg.resetMatrix();
if (rotate8) {
var bgRotateMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
bgRotateMatrix = transform10(bgRotateMatrix, [["t", -labelBgStyle.x, -labelBgStyle.y], ["r", rotate8], ["t", labelBgStyle.x, labelBgStyle.y]]);
labelBgStyle.matrix = bgRotateMatrix;
}
labelBg.attr(labelBgStyle);
} else {
group2.removeChild(labelBg);
}
}
}
},
afterUpdate: function afterUpdate2(cfg, item) {
},
setState: function setState3(name, value2, item) {
var _a6, _b;
var shape = item.get("keyShape");
if (!shape) {
return;
}
var type2 = item.getType();
var stateName = is_boolean_default(value2) ? name : name + ":" + value2;
var shapeStateStyle = this.getStateStyle(stateName, item);
var itemStateStyle = item.getStateStyle(stateName);
if (!itemStateStyle && !shapeStateStyle) {
return;
}
var styles = mix({}, itemStateStyle || shapeStateStyle);
var group2 = item.getContainer();
var keptAttrs = {
x: 1,
y: 1,
cx: 1,
cy: 1
};
if (type2 === "combo") {
keptAttrs.r = 1;
keptAttrs.width = 1;
keptAttrs.height = 1;
}
if (value2) {
var _loop_2 = function _loop_22(key2) {
var _c;
var style = styles[key2];
if (is_plain_object_default(style) && !ARROWS.includes(key2)) {
var subShape = group2.find(function(element) {
return element.get("name") === key2;
});
if (subShape) {
subShape.attr(style);
}
} else {
shape.attr((_c = {}, _c[key2] = style, _c));
}
};
for (var key in styles) {
_loop_2(key);
}
} else {
var enableStatesStyle = cloneBesidesImg(item.getCurrentStatesStyle());
var model = item.getModel();
var originStyle_1 = mix({}, model.style, cloneBesidesImg(item.getOriginStyle()));
var keyShapeName_1 = shape.get("name");
var shapeAttrs_1 = shape.attr();
var keyShapeStyles_1 = {};
Object.keys(shapeAttrs_1).forEach(function(key2) {
if (key2 === "img")
return;
var attr = shapeAttrs_1[key2];
if (attr && _typeof2(attr) === "object") {
keyShapeStyles_1[key2] = clone_default(attr);
} else {
keyShapeStyles_1[key2] = attr;
}
});
var filtetDisableStatesStyle = {};
var _loop_3 = function _loop_32(p5) {
var style = styles[p5];
if (is_plain_object_default(style) && !ARROWS.includes(p5)) {
var subShape_1 = group2.find(function(element) {
return element.get("name") === p5;
});
if (subShape_1) {
var subShapeStyles_1 = clone_default(subShape_1.attr());
each_default(style, function(v3, key2) {
if (p5 === keyShapeName_1 && keyShapeStyles_1[key2] && !keptAttrs[key2]) {
delete keyShapeStyles_1[key2];
var value_1 = originStyle_1[p5][key2] || SHAPES_DEFAULT_ATTRS[type2][key2];
shape.attr(key2, value_1);
} else if (subShapeStyles_1[key2] || subShapeStyles_1[key2] === 0) {
delete subShapeStyles_1[key2];
var value_2 = originStyle_1[p5][key2] || SHAPES_DEFAULT_ATTRS[type2][key2];
subShape_1.attr(key2, value_2);
}
});
filtetDisableStatesStyle[p5] = subShapeStyles_1;
}
} else {
if (keyShapeStyles_1[p5] && !keptAttrs[p5]) {
delete keyShapeStyles_1[p5];
var value_3 = originStyle_1[p5] || (originStyle_1[keyShapeName_1] ? originStyle_1[keyShapeName_1][p5] : void 0) || SHAPES_DEFAULT_ATTRS[type2][p5];
shape.attr(p5, value_3);
}
}
};
for (var p4 in styles) {
_loop_3(p4);
}
if (!keyShapeName_1) {
mix(filtetDisableStatesStyle, keyShapeStyles_1);
} else {
filtetDisableStatesStyle[keyShapeName_1] = keyShapeStyles_1;
}
for (var key in enableStatesStyle) {
if (keptAttrs[key])
continue;
var enableStyle = enableStatesStyle[key];
if (!is_plain_object_default(enableStyle) || ARROWS.includes(key)) {
if (!keyShapeName_1) {
mix(originStyle_1, (_a6 = {}, _a6[key] = enableStyle, _a6));
} else {
mix(originStyle_1[keyShapeName_1], (_b = {}, _b[key] = enableStyle, _b));
delete originStyle_1[key];
}
delete enableStatesStyle[key];
}
}
var originstyles = {};
deep_mix_default(originstyles, originStyle_1, filtetDisableStatesStyle, enableStatesStyle);
var keyShapeSetted = false;
var _loop_4 = function _loop_42(originKey2) {
var _d, _e;
var style = originstyles[originKey2];
if (is_plain_object_default(style) && !ARROWS.includes(originKey2)) {
var subShape = group2.find(function(element) {
return element.get("name") === originKey2;
});
if (subShape) {
if (originKey2 === keyShapeName_1) {
if (type2 === "combo") {
delete style.r;
delete style.width;
delete style.height;
}
keyShapeSetted = true;
}
subShape.attr(style);
}
} else if (!keyShapeSetted) {
var value_4 = style || SHAPES_DEFAULT_ATTRS[type2][originKey2];
if (type2 === "combo") {
if (!keyShapeName_1) {
shape.attr((_d = {}, _d[originKey2] = value_4, _d));
}
} else {
shape.attr((_e = {}, _e[originKey2] = value_4, _e));
}
}
};
for (var originKey in originstyles) {
_loop_4(originKey);
}
}
},
getStateStyle: function getStateStyle(name, item) {
var model = item.getModel();
var type2 = item.getType();
var _a6 = this.getOptions(model), stateStyles = _a6.stateStyles, _b = _a6.style, style = _b === void 0 ? {} : _b;
var modelStateStyle = model.stateStyles ? model.stateStyles[name] : stateStyles && stateStyles[name];
if (type2 === "combo") {
return clone_default(modelStateStyle);
}
return mix({}, style, modelStateStyle);
},
getControlPoints: function getControlPoints3(cfg) {
return cfg.controlPoints;
},
getAnchorPoints: function getAnchorPoints3(cfg) {
var anchorPoints = this.getOptions(cfg).anchorPoints;
return anchorPoints;
}
};
// node_modules/@antv/g6-core/es/element/node.js
var singleNode = {
itemType: "node",
shapeType: "single-node",
labelPosition: "center",
offset: global_default.nodeLabel.offset,
getSize: function getSize2(cfg) {
var size2 = cfg.size || this.getOptions({}).size || global_default.defaultNode.size;
if (is_array_default(size2) && size2.length === 1) {
size2 = [size2[0], size2[0]];
}
if (!is_array_default(size2)) {
size2 = [size2, size2];
}
return size2;
},
getLabelStyleByPosition: function getLabelStyleByPosition2(cfg, labelCfg) {
var labelPosition = labelCfg.position || this.labelPosition;
if (labelPosition === "center") {
return {
x: 0,
y: 0,
text: cfg.label
};
}
var offset = labelCfg.offset;
if (is_nil_default(offset)) {
offset = this.offset;
}
var size2 = this.getSize(cfg);
var width2 = size2[0];
var height = size2[1];
var style;
switch (labelPosition) {
case "top":
style = {
x: 0,
y: 0 - height / 2 - offset,
textBaseline: "bottom"
};
break;
case "bottom":
style = {
x: 0,
y: height / 2 + offset,
textBaseline: "top"
};
break;
case "left":
style = {
x: 0 - width2 / 2 - offset,
y: 0,
textAlign: "right"
};
break;
default:
style = {
x: width2 / 2 + offset,
y: 0,
textAlign: "left"
};
break;
}
style.text = cfg.label;
return style;
},
getLabelBgStyleByPosition: function getLabelBgStyleByPosition2(label17, cfg, labelCfg, group2) {
if (!label17) {
return {};
}
var bbox = label17.getBBox();
var backgroundStyle = labelCfg.style && labelCfg.style.background;
if (!backgroundStyle) {
return {};
}
var padding3 = formatPadding2(backgroundStyle.padding);
var backgroundWidth = bbox.width + padding3[1] + padding3[3];
var backgroundHeight = bbox.height + padding3[0] + padding3[2];
var offset = labelCfg.offset;
if (is_nil_default(offset)) {
offset = this.offset;
}
var style;
style = {
x: bbox.minX - padding3[3],
y: bbox.minY - padding3[0]
};
style = __assign(__assign(__assign({}, style), backgroundStyle), {
width: backgroundWidth,
height: backgroundHeight
});
return style;
},
drawShape: function drawShape3(cfg, group2) {
var shapeType = this.shapeType;
var style = this.getShapeStyle(cfg);
var shape = group2.addShape(shapeType, {
attrs: style,
draggable: true,
name: "node-shape"
});
return shape;
},
updateLinkPoints: function updateLinkPoints(cfg, group2) {
var defaultLinkPoints = this.getOptions(cfg).linkPoints;
var markLeft = group2.find(function(element) {
return element.get("className") === "link-point-left";
});
var markRight = group2.find(function(element) {
return element.get("className") === "link-point-right";
});
var markTop = group2.find(function(element) {
return element.get("className") === "link-point-top";
});
var markBottom = group2.find(function(element) {
return element.get("className") === "link-point-bottom";
});
var currentLinkPoints;
if (markLeft) {
currentLinkPoints = markLeft.attr();
}
if (markRight && !currentLinkPoints) {
currentLinkPoints = markRight.attr();
}
if (markTop && !currentLinkPoints) {
currentLinkPoints = markTop.attr();
}
if (markBottom && !currentLinkPoints) {
currentLinkPoints = markBottom.attr();
}
if (!currentLinkPoints)
currentLinkPoints = defaultLinkPoints;
var linkPoints = mix({}, currentLinkPoints, cfg.linkPoints);
var markFill = linkPoints.fill, markStroke = linkPoints.stroke, borderWidth = linkPoints.lineWidth;
var markSize = linkPoints.size / 2;
if (!markSize)
markSize = linkPoints.r;
var _a6 = cfg.linkPoints ? cfg.linkPoints : {
left: void 0,
right: void 0,
top: void 0,
bottom: void 0
}, left2 = _a6.left, right2 = _a6.right, top = _a6.top, bottom = _a6.bottom;
var size2 = this.getSize(cfg);
var width2 = size2[0];
var height = size2[1];
var styles = {
r: markSize,
fill: markFill,
stroke: markStroke,
lineWidth: borderWidth
};
if (markLeft) {
if (!left2 && left2 !== void 0) {
markLeft.remove();
} else {
markLeft.attr(__assign(__assign({}, styles), {
x: -width2 / 2,
y: 0
}));
}
} else if (left2) {
group2.addShape("circle", {
attrs: __assign(__assign({}, styles), {
x: -width2 / 2,
y: 0
}),
className: "link-point-left",
name: "link-point-left",
isAnchorPoint: true
});
}
if (markRight) {
if (!right2 && right2 !== void 0) {
markRight.remove();
}
markRight.attr(__assign(__assign({}, styles), {
x: width2 / 2,
y: 0
}));
} else if (right2) {
group2.addShape("circle", {
attrs: __assign(__assign({}, styles), {
x: width2 / 2,
y: 0
}),
className: "link-point-right",
name: "link-point-right",
isAnchorPoint: true
});
}
if (markTop) {
if (!top && top !== void 0) {
markTop.remove();
}
markTop.attr(__assign(__assign({}, styles), {
x: 0,
y: -height / 2
}));
} else if (top) {
group2.addShape("circle", {
attrs: __assign(__assign({}, styles), {
x: 0,
y: -height / 2
}),
className: "link-point-top",
name: "link-point-top",
isAnchorPoint: true
});
}
if (markBottom) {
if (!bottom && bottom !== void 0) {
markBottom.remove();
} else {
markBottom.attr(__assign(__assign({}, styles), {
x: 0,
y: height / 2
}));
}
} else if (bottom) {
group2.addShape("circle", {
attrs: __assign(__assign({}, styles), {
x: 0,
y: height / 2
}),
className: "link-point-bottom",
name: "link-point-bottom",
isAnchorPoint: true
});
}
},
updateShape: function updateShape(cfg, item, keyShapeStyle, hasIcon) {
var keyShape = item.get("keyShape");
keyShape.attr(__assign({}, keyShapeStyle));
this.updateLabel(cfg, item);
if (hasIcon) {
this.updateIcon(cfg, item);
}
},
updateIcon: function updateIcon(cfg, item) {
var _this = this;
var group2 = item.getContainer();
var icon = this.getOptions(cfg).icon;
var show = (cfg.icon ? cfg.icon : {
show: void 0
}).show;
var iconShape = group2.find(function(element) {
return element.get("className") === _this.type + "-icon";
});
if (iconShape) {
if (show || show === void 0) {
var iconConfig = mix({}, iconShape.attr(), icon);
var w4 = iconConfig.width, h3 = iconConfig.height;
iconShape.attr(__assign(__assign({}, iconConfig), {
x: -w4 / 2,
y: -h3 / 2
}));
} else {
iconShape.remove();
}
} else if (show) {
var w4 = icon.width, h3 = icon.height;
group2.addShape("image", {
attrs: __assign(__assign({}, icon), {
x: -w4 / 2,
y: -h3 / 2
}),
className: this.type + "-icon",
name: this.type + "-icon"
});
var labelShape = group2.find(function(element) {
return element.get("className") === "node-label";
});
if (labelShape) {
labelShape.toFront();
}
}
}
};
var singleNodeDef = __assign(__assign({}, shapeBase), singleNode);
shape_default4.registerNode("single-node", singleNodeDef);
// node_modules/@antv/g6-core/es/element/edge.js
var CLS_SHAPE = "edge-shape";
function revertAlign(labelPosition) {
var textAlign = labelPosition;
if (labelPosition === "start") {
textAlign = "end";
} else if (labelPosition === "end") {
textAlign = "start";
}
return textAlign;
}
var singleEdge = {
itemType: "edge",
labelPosition: "center",
refX: 0,
refY: 0,
labelAutoRotate: false,
options: {
size: global_default.defaultEdge.size,
style: {
x: 0,
y: 0,
stroke: global_default.defaultEdge.style.stroke,
lineAppendWidth: global_default.defaultEdge.style.lineAppendWidth
},
labelCfg: {
style: {
fill: global_default.edgeLabel.style.fill,
fontSize: global_default.edgeLabel.style.fontSize
}
},
stateStyles: __assign({}, global_default.edgeStateStyles)
},
getPath: function getPath5(points) {
var path = [];
each_default(points, function(point2, index2) {
if (index2 === 0) {
path.push(["M", point2.x, point2.y]);
} else {
path.push(["L", point2.x, point2.y]);
}
});
return path;
},
getShapeStyle: function getShapeStyle2(cfg) {
var defaultStyle = this.options.style;
var strokeStyle = {
stroke: cfg.color
};
var style = mix({}, defaultStyle, strokeStyle, cfg.style);
var size2 = cfg.size || global_default.defaultEdge.size;
cfg = this.getPathPoints(cfg);
var startPoint = cfg.startPoint, endPoint = cfg.endPoint;
var controlPoints = this.getControlPoints(cfg);
var points = [startPoint];
if (controlPoints) {
points = points.concat(controlPoints);
}
points.push(endPoint);
var path = this.getPath(points);
var styles = mix({}, global_default.defaultEdge.style, {
stroke: global_default.defaultEdge.color,
lineWidth: size2,
path
}, style);
return styles;
},
updateShapeStyle: function updateShapeStyle2(cfg, item) {
var group2 = item.getContainer();
var strokeStyle = {
stroke: cfg.color
};
var shape = group2.find(function(element) {
return element.get("className") === "edge-shape";
}) || item.getKeyShape();
var size2 = cfg.size;
cfg = this.getPathPoints(cfg);
var startPoint = cfg.startPoint, endPoint = cfg.endPoint;
var controlPoints = this.getControlPoints(cfg);
var points = [startPoint];
if (controlPoints) {
points = points.concat(controlPoints);
}
points.push(endPoint);
var currentAttr = shape.attr();
var previousStyle = mix({}, strokeStyle, currentAttr, cfg.style);
var source = cfg.sourceNode;
var target = cfg.targetNode;
var routeCfg = {
radius: previousStyle.radius
};
if (!controlPoints) {
routeCfg = {
source,
target,
offset: previousStyle.offset,
radius: previousStyle.radius
};
}
if (currentAttr.endArrow && previousStyle.endArrow === false) {
cfg.style.endArrow = {
path: ""
};
}
if (currentAttr.startArrow && previousStyle.startArrow === false) {
}
var path = this.getPath(points, routeCfg);
var style = mix(strokeStyle, shape.attr(), {
lineWidth: size2,
path
}, cfg.style);
if (shape) {
shape.attr(style);
}
},
getLabelStyleByPosition: function getLabelStyleByPosition3(cfg, labelCfg, group2) {
var labelPosition = labelCfg.position || this.labelPosition;
var style = {};
var pathShape = group2 && group2.find(function(element) {
return element.get("className") === CLS_SHAPE;
});
var pointPercent;
if (labelPosition === "start") {
pointPercent = 0;
} else if (labelPosition === "end") {
pointPercent = 1;
} else {
pointPercent = 0.5;
}
var offsetX = labelCfg.refX || this.refX;
var offsetY = labelCfg.refY || this.refY;
if (cfg.startPoint.x === cfg.endPoint.x && cfg.startPoint.y === cfg.endPoint.y) {
style.x = cfg.startPoint.x + offsetX;
style.y = cfg.startPoint.y + offsetY;
style.text = cfg.label;
return style;
}
var autoRotate;
if (is_nil_default(labelCfg.autoRotate))
autoRotate = this.labelAutoRotate;
else
autoRotate = labelCfg.autoRotate;
var offsetStyle = getLabelPosition(pathShape, pointPercent, offsetX, offsetY, autoRotate);
style.x = offsetStyle.x;
style.y = offsetStyle.y;
style.rotate = offsetStyle.rotate;
style.textAlign = this._getTextAlign(labelPosition, offsetStyle.angle);
style.text = cfg.label;
return style;
},
getLabelBgStyleByPosition: function getLabelBgStyleByPosition3(label17, cfg, labelCfg, group2) {
if (!label17) {
return {};
}
var bbox = label17.getBBox();
var backgroundStyle = labelCfg.style && labelCfg.style.background;
if (!backgroundStyle) {
return {};
}
var padding3 = backgroundStyle.padding;
var backgroundWidth = bbox.width + padding3[1] + padding3[3];
var backgroundHeight = bbox.height + padding3[0] + padding3[2];
var labelPosition = labelCfg.position || this.labelPosition;
var style = __assign(__assign({}, backgroundStyle), {
width: backgroundWidth,
height: backgroundHeight,
x: bbox.minX - padding3[2],
y: bbox.minY - padding3[0],
rotate: 0
});
var autoRotate;
if (is_nil_default(labelCfg.autoRotate))
autoRotate = this.labelAutoRotate;
else
autoRotate = labelCfg.autoRotate;
var pathShape = group2 && group2.find(function(element) {
return element.get("className") === CLS_SHAPE;
});
var pointPercent;
if (labelPosition === "start") {
pointPercent = 0;
} else if (labelPosition === "end") {
pointPercent = 1;
} else {
pointPercent = 0.5;
}
var offsetX = labelCfg.refX || this.refX;
var offsetY = labelCfg.refY || this.refY;
if (cfg.startPoint.x === cfg.endPoint.x && cfg.startPoint.y === cfg.endPoint.y) {
style.x = cfg.startPoint.x + offsetX - backgroundWidth / 2;
style.y = cfg.startPoint.y + offsetY - backgroundHeight / 2;
return style;
}
var offsetStyle = getLabelPosition(pathShape, pointPercent, offsetX - backgroundWidth / 2, offsetY + backgroundHeight / 2, autoRotate);
var rad = offsetStyle.angle;
if (rad > 1 / 2 * Math.PI && rad < 3 * 1 / 2 * Math.PI) {
offsetStyle = getLabelPosition(pathShape, pointPercent, offsetX + backgroundWidth / 2, offsetY + backgroundHeight / 2, autoRotate);
}
if (autoRotate) {
style.x = offsetStyle.x;
style.y = offsetStyle.y;
}
style.rotate = offsetStyle.rotate;
return style;
},
_getTextAlign: function _getTextAlign(labelPosition, angle3) {
var textAlign = "center";
if (!angle3) {
return labelPosition;
}
angle3 = angle3 % (Math.PI * 2);
if (labelPosition !== "center") {
if (angle3 >= 0 && angle3 <= Math.PI / 2 || angle3 >= 3 / 2 * Math.PI && angle3 < 2 * Math.PI) {
textAlign = labelPosition;
} else {
textAlign = revertAlign(labelPosition);
}
}
return textAlign;
},
getControlPoints: function getControlPoints4(cfg) {
return cfg.controlPoints;
},
getPathPoints: function getPathPoints2(cfg) {
return cfg;
},
drawShape: function drawShape4(cfg, group2) {
var shapeStyle = this.getShapeStyle(cfg);
var shape = group2.addShape("path", {
className: CLS_SHAPE,
name: CLS_SHAPE,
attrs: shapeStyle
});
return shape;
},
drawLabel: function drawLabel2(cfg, group2) {
var defaultLabelCfg3 = this.options.labelCfg;
var defaultFontFamily;
if (typeof window !== "undefined")
defaultFontFamily = window.getComputedStyle(document.body, null).getPropertyValue("font-family") || "Arial, sans-serif";
else
defaultFontFamily = "Arial, sans-serif";
var labelCfg = deep_mix_default({
fontFamily: defaultFontFamily
}, defaultLabelCfg3, cfg.labelCfg);
var labelStyle = this.getLabelStyle(cfg, labelCfg, group2);
var rotate8 = labelStyle.rotate;
delete labelStyle.rotate;
var label17 = group2.addShape("text", {
attrs: labelStyle,
name: "text-shape"
});
if (rotate8) {
label17.rotateAtStart(rotate8);
}
if (labelStyle.background) {
var rect3 = this.drawLabelBg(cfg, group2, label17);
var labelBgClassname = this.itemType + CLS_LABEL_BG_SUFFIX;
rect3.set("classname", labelBgClassname);
label17.toFront();
}
return label17;
},
drawLabelBg: function drawLabelBg2(cfg, group2, label17) {
var defaultLabelCfg3 = this.options.labelCfg;
var labelCfg = deep_mix_default({}, defaultLabelCfg3, cfg.labelCfg);
var labelStyle = this.getLabelStyle(cfg, labelCfg, group2);
var rotate8 = labelStyle.rotate;
var style = this.getLabelBgStyleByPosition(label17, cfg, labelCfg, group2);
delete style.rotate;
var rect3 = group2.addShape("rect", {
name: "text-bg-shape",
attrs: style
});
if (rotate8)
rect3.rotateAtStart(rotate8);
return rect3;
}
};
var singleEdgeDef = __assign(__assign({}, shapeBase), singleEdge);
shape_default4.registerEdge("single-edge", singleEdgeDef);
shape_default4.registerEdge("line", {
getControlPoints: function getControlPoints5() {
return void 0;
}
}, "single-edge");
shape_default4.registerEdge("spline", {
getPath: function getPath6(points) {
var path = getSpline2(points);
return path;
}
}, "single-edge");
shape_default4.registerEdge("arc", {
curveOffset: 20,
clockwise: 1,
getControlPoints: function getControlPoints6(cfg) {
var startPoint = cfg.startPoint, endPoint = cfg.endPoint;
var midPoint = {
x: (startPoint.x + endPoint.x) / 2,
y: (startPoint.y + endPoint.y) / 2
};
var center2;
var arcPoint;
if (cfg.controlPoints !== void 0) {
arcPoint = cfg.controlPoints[0];
center2 = getCircleCenterByPoints(startPoint, arcPoint, endPoint);
if (startPoint.x <= endPoint.x && startPoint.y > endPoint.y) {
this.clockwise = center2.x > arcPoint.x ? 0 : 1;
} else if (startPoint.x <= endPoint.x && startPoint.y < endPoint.y) {
this.clockwise = center2.x > arcPoint.x ? 1 : 0;
} else if (startPoint.x > endPoint.x && startPoint.y <= endPoint.y) {
this.clockwise = center2.y < arcPoint.y ? 0 : 1;
} else {
this.clockwise = center2.y < arcPoint.y ? 1 : 0;
}
if ((arcPoint.x - startPoint.x) / (arcPoint.y - startPoint.y) === (endPoint.x - startPoint.x) / (endPoint.y - startPoint.y)) {
return [];
}
} else {
if (cfg.curveOffset === void 0) {
cfg.curveOffset = this.curveOffset;
}
if (is_array_default(cfg.curveOffset)) {
cfg.curveOffset = cfg.curveOffset[0];
}
if (cfg.curveOffset < 0) {
this.clockwise = 0;
} else {
this.clockwise = 1;
}
var vec = {
x: endPoint.x - startPoint.x,
y: endPoint.y - startPoint.y
};
var edgeAngle = Math.atan2(vec.y, vec.x);
arcPoint = {
x: cfg.curveOffset * Math.cos(-Math.PI / 2 + edgeAngle) + midPoint.x,
y: cfg.curveOffset * Math.sin(-Math.PI / 2 + edgeAngle) + midPoint.y
};
center2 = getCircleCenterByPoints(startPoint, arcPoint, endPoint);
}
var radius = distance10(startPoint, center2);
var controlPoints = [{
x: radius,
y: radius
}];
return controlPoints;
},
getPath: function getPath7(points) {
var path = [];
path.push(["M", points[0].x, points[0].y]);
if (points.length === 2) {
path.push(["L", points[1].x, points[1].y]);
} else {
path.push(["A", points[1].x, points[1].y, 0, 0, this.clockwise, points[2].x, points[2].y]);
}
return path;
}
}, "single-edge");
shape_default4.registerEdge("quadratic", {
curvePosition: 0.5,
curveOffset: -20,
getControlPoints: function getControlPoints7(cfg) {
var controlPoints = cfg.controlPoints;
if (!controlPoints || !controlPoints.length) {
var startPoint = cfg.startPoint, endPoint = cfg.endPoint;
if (cfg.curveOffset === void 0)
cfg.curveOffset = this.curveOffset;
if (cfg.curvePosition === void 0)
cfg.curvePosition = this.curvePosition;
if (is_array_default(this.curveOffset))
cfg.curveOffset = cfg.curveOffset[0];
if (is_array_default(this.curvePosition))
cfg.curvePosition = cfg.curveOffset[0];
var innerPoint = getControlPoint(startPoint, endPoint, cfg.curvePosition, cfg.curveOffset);
controlPoints = [innerPoint];
}
return controlPoints;
},
getPath: function getPath8(points) {
var path = [];
path.push(["M", points[0].x, points[0].y]);
path.push(["Q", points[1].x, points[1].y, points[2].x, points[2].y]);
return path;
}
}, "single-edge");
shape_default4.registerEdge("cubic", {
curvePosition: [1 / 2, 1 / 2],
curveOffset: [-20, 20],
getControlPoints: function getControlPoints8(cfg) {
var controlPoints = cfg.controlPoints;
if (cfg.curveOffset === void 0)
cfg.curveOffset = this.curveOffset;
if (cfg.curvePosition === void 0)
cfg.curvePosition = this.curvePosition;
if (is_number_default(cfg.curveOffset))
cfg.curveOffset = [cfg.curveOffset, -cfg.curveOffset];
if (is_number_default(cfg.curvePosition))
cfg.curvePosition = [cfg.curvePosition, 1 - cfg.curvePosition];
if (!controlPoints || !controlPoints.length || controlPoints.length < 2) {
var startPoint = cfg.startPoint, endPoint = cfg.endPoint;
var innerPoint1 = getControlPoint(startPoint, endPoint, cfg.curvePosition[0], cfg.curveOffset[0]);
var innerPoint2 = getControlPoint(startPoint, endPoint, cfg.curvePosition[1], cfg.curveOffset[1]);
controlPoints = [innerPoint1, innerPoint2];
}
return controlPoints;
},
getPath: function getPath9(points) {
var path = [];
path.push(["M", points[0].x, points[0].y]);
path.push(["C", points[1].x, points[1].y, points[2].x, points[2].y, points[3].x, points[3].y]);
return path;
}
}, "single-edge");
shape_default4.registerEdge("cubic-vertical", {
curvePosition: [1 / 2, 1 / 2],
minCurveOffset: [0, 0],
curveOffset: void 0,
getControlPoints: function getControlPoints9(cfg) {
var startPoint = cfg.startPoint, endPoint = cfg.endPoint;
if (cfg.curvePosition === void 0)
cfg.curvePosition = this.curvePosition;
if (cfg.curveOffset === void 0)
cfg.curveOffset = this.curveOffset;
if (cfg.minCurveOffset === void 0)
cfg.minCurveOffset = this.minCurveOffset;
if (is_number_default(cfg.curveOffset))
cfg.curveOffset = [cfg.curveOffset, -cfg.curveOffset];
if (is_number_default(cfg.minCurveOffset))
cfg.minCurveOffset = [cfg.minCurveOffset, -cfg.minCurveOffset];
if (is_number_default(cfg.curvePosition))
cfg.curvePosition = [cfg.curvePosition, 1 - cfg.curvePosition];
var yDist = endPoint.y - startPoint.y;
var curveOffset = [0, 0];
if (cfg.curveOffset) {
curveOffset = cfg.curveOffset;
} else if (Math.abs(yDist) < Math.abs(cfg.minCurveOffset[0])) {
curveOffset = cfg.minCurveOffset;
}
var innerPoint1 = {
x: startPoint.x,
y: startPoint.y + yDist * this.curvePosition[0] + curveOffset[0]
};
var innerPoint2 = {
x: endPoint.x,
y: endPoint.y - yDist * this.curvePosition[1] + curveOffset[1]
};
return [innerPoint1, innerPoint2];
}
}, "cubic");
shape_default4.registerEdge("cubic-horizontal", {
curvePosition: [1 / 2, 1 / 2],
minCurveOffset: [0, 0],
curveOffset: void 0,
getControlPoints: function getControlPoints10(cfg) {
var startPoint = cfg.startPoint, endPoint = cfg.endPoint;
if (cfg.curvePosition === void 0)
cfg.curvePosition = this.curvePosition;
if (cfg.curveOffset === void 0)
cfg.curveOffset = this.curveOffset;
if (cfg.minCurveOffset === void 0)
cfg.minCurveOffset = this.minCurveOffset;
if (is_number_default(cfg.curveOffset))
cfg.curveOffset = [cfg.curveOffset, -cfg.curveOffset];
if (is_number_default(cfg.minCurveOffset))
cfg.minCurveOffset = [cfg.minCurveOffset, -cfg.minCurveOffset];
if (is_number_default(cfg.curvePosition))
cfg.curvePosition = [cfg.curvePosition, 1 - cfg.curvePosition];
var xDist = endPoint.x - startPoint.x;
var curveOffset = [0, 0];
if (cfg.curveOffset) {
curveOffset = cfg.curveOffset;
} else if (Math.abs(xDist) < Math.abs(cfg.minCurveOffset[0])) {
curveOffset = cfg.minCurveOffset;
}
var innerPoint1 = {
x: startPoint.x + xDist * this.curvePosition[0] + curveOffset[0],
y: startPoint.y
};
var innerPoint2 = {
x: endPoint.x - xDist * this.curvePosition[1] + curveOffset[1],
y: endPoint.y
};
var controlPoints = [innerPoint1, innerPoint2];
return controlPoints;
}
}, "cubic");
shape_default4.registerEdge("loop", {
getPathPoints: function getPathPoints3(cfg) {
return getLoopCfgs(cfg);
},
getControlPoints: function getControlPoints11(cfg) {
return cfg.controlPoints;
},
afterDraw: function afterDraw3(cfg) {
cfg.controlPoints = void 0;
},
afterUpdate: function afterUpdate3(cfg) {
cfg.controlPoints = void 0;
}
}, "cubic");
// node_modules/@antv/g6-core/es/element/combo.js
var singleCombo = {
itemType: "combo",
shapeType: "single-combo",
labelPosition: "top",
refX: global_default.comboLabel.refX,
refY: global_default.comboLabel.refY,
options: {
style: {
stroke: global_default.defaultCombo.style.stroke,
fill: global_default.defaultCombo.style.fill,
lineWidth: global_default.defaultCombo.style.lineWidth
},
labelCfg: {
style: {
fill: global_default.comboLabel.style.fill,
fontSize: global_default.comboLabel.style.fontSize
}
},
stateStyles: __assign({}, global_default.comboStateStyles)
},
getSize: function getSize3(cfg) {
var size2 = clone_default(cfg.size || this.options.size || global_default.defaultCombo.size);
if (is_array_default(size2) && size2.length === 1) {
size2 = [size2[0], size2[0]];
}
if (!is_array_default(size2)) {
size2 = [size2, size2];
}
return size2;
},
getLabelStyleByPosition: function getLabelStyleByPosition4(cfg, labelCfg) {
var labelPosition = labelCfg.position || this.labelPosition;
var cfgStyle = cfg.style;
var padding3 = cfg.padding || this.options.padding;
if (is_array_default(padding3))
padding3 = padding3[0];
var refX = labelCfg.refX, refY = labelCfg.refY;
if (is_nil_default(refX)) {
refX = this.refX;
}
if (is_nil_default(refY)) {
refY = this.refY;
}
var size2 = this.getSize(cfg);
var r4 = Math.max(cfgStyle.r, size2[0] / 2) || size2[0] / 2;
var dis = r4 + padding3;
var style;
switch (labelPosition) {
case "top":
style = {
x: 0,
y: -dis - refY,
textBaseline: "bottom",
textAlign: "center"
};
break;
case "bottom":
style = {
x: 0,
y: dis + refY,
textBaseline: "bottom",
textAlign: "center"
};
break;
case "left":
style = {
x: -dis + refX,
y: 0,
textAlign: "left"
};
break;
case "center":
style = {
x: 0,
y: 0,
text: cfg.label,
textAlign: "center"
};
break;
default:
style = {
x: dis + refX,
y: 0,
textAlign: "right"
};
break;
}
style.text = cfg.label;
return style;
},
drawShape: function drawShape5(cfg, group2) {
var shapeType = this.shapeType;
var style = this.getShapeStyle(cfg);
var shape = group2.addShape(shapeType, {
attrs: style,
draggable: true,
name: "combo-shape"
});
return shape;
},
updateShape: function updateShape2(cfg, item, keyShapeStyle) {
var keyShape = item.get("keyShape");
var animate = cfg.animate === void 0 ? this.options.animate : cfg.animate;
if (animate && keyShape.animate) {
keyShape.animate(keyShapeStyle, {
duration: 200,
easing: "easeLinear"
});
} else {
keyShape.attr(__assign({}, keyShapeStyle));
}
this.updateLabel(cfg, item);
}
};
var singleComboDef = __assign(__assign({}, shapeBase), singleCombo);
shape_default4.registerCombo("single-combo", singleComboDef);
// node_modules/@antv/g6-core/es/element/combos/circle.js
shape_default4.registerCombo("circle", {
options: {
size: [global_default.defaultCombo.size[0], global_default.defaultCombo.size[0]],
padding: global_default.defaultCombo.padding[0],
animate: true,
style: {
stroke: global_default.defaultCombo.style.stroke,
fill: global_default.defaultCombo.style.fill,
lineWidth: global_default.defaultCombo.style.lineWidth
},
labelCfg: {
style: {
fill: global_default.comboLabel.style.fill,
fontSize: global_default.comboLabel.style.fontSize
},
refX: 0,
refY: 0
},
stateStyles: __assign({}, global_default.comboStateStyles)
},
shapeType: "circle",
labelPosition: "top",
drawShape: function drawShape6(cfg, group2) {
var style = this.getShapeStyle(cfg);
delete style.height;
delete style.width;
var keyShape = group2.addShape("circle", {
attrs: style,
className: "circle-combo",
name: "circle-combo",
draggable: true
});
return keyShape;
},
getShapeStyle: function getShapeStyle3(cfg) {
var defaultStyle = this.options.style;
var padding3 = cfg.padding || this.options.padding;
if (is_array_default(padding3))
padding3 = padding3[0];
var strokeStyle = {
stroke: cfg.color
};
var style = mix({}, defaultStyle, strokeStyle, cfg.style);
var r4;
if (cfg.fixSize) {
r4 = is_number_default(cfg.fixSize) ? cfg.fixSize : cfg.fixSize[0];
} else {
var size2 = this.getSize(cfg);
if (!is_number_default(style.r) || isNaN(style.r))
r4 = size2[0] / 2 || global_default.defaultCombo.style.r;
else
r4 = Math.max(style.r, size2[0] / 2) || size2[0] / 2;
}
style.r = r4 + padding3;
var styles = __assign({
x: 0,
y: 0
}, style);
if (cfg.style)
cfg.style.r = r4;
else {
cfg.style = {
r: r4
};
}
return styles;
},
update: function update3(cfg, item) {
var size2 = this.getSize(cfg);
var padding3 = cfg.padding || this.options.padding;
if (is_array_default(padding3))
padding3 = padding3[0];
var cfgStyle = clone_default(cfg.style);
var r4;
if (cfg.fixSize) {
r4 = is_number_default(cfg.fixSize) ? cfg.fixSize : cfg.fixSize[0];
} else {
r4 = Math.max(cfgStyle.r, size2[0] / 2) || size2[0] / 2;
}
cfgStyle.r = r4 + padding3;
var itemCacheSize = item.get("sizeCache");
if (itemCacheSize) {
itemCacheSize.r = cfgStyle.r;
}
var strokeStyle = {
stroke: cfg.color
};
var keyShape = item.get("keyShape");
var style = mix({}, keyShape.attr(), strokeStyle, cfgStyle);
if (cfg.style)
cfg.style.r = r4;
else {
cfg.style = {
r: r4
};
}
this.updateShape(cfg, item, style, true);
}
}, "single-combo");
// node_modules/@antv/g6-core/es/element/combos/rect.js
shape_default4.registerCombo("rect", {
options: {
size: [40, 5],
padding: [25, 20, 15, 20],
animate: true,
style: {
radius: 0,
stroke: global_default.defaultCombo.style.stroke,
fill: global_default.defaultCombo.style.fill,
lineWidth: global_default.defaultCombo.style.lineWidth
},
labelCfg: {
style: {
fill: global_default.comboLabel.style.fill,
fontSize: global_default.comboLabel.style.fontSize
}
},
anchorPoints: [[0, 0.5], [1, 0.5]],
stateStyles: __assign({}, global_default.comboStateStyles)
},
shapeType: "rect",
labelPosition: "top",
drawShape: function drawShape7(cfg, group2) {
var style = this.getShapeStyle(cfg);
var keyShape = group2.addShape("rect", {
attrs: style,
className: "rect-combo",
name: "rect-combo",
draggable: true
});
return keyShape;
},
getLabelStyleByPosition: function getLabelStyleByPosition5(cfg, labelCfg) {
var labelPosition = labelCfg.position || this.labelPosition;
var cfgStyle = cfg.style;
var padding3 = cfg.padding || this.options.padding;
if (is_number_default(padding3))
padding3 = [padding3, padding3, padding3, padding3];
var refX = labelCfg.refX, refY = labelCfg.refY;
if (is_nil_default(refX)) {
refX = this.refX;
}
if (is_nil_default(refY)) {
refY = this.refY;
}
var leftDis = cfgStyle.width / 2 + padding3[3];
var topDis = cfgStyle.height / 2 + padding3[0];
var style;
switch (labelPosition) {
case "top":
style = {
x: 0 - leftDis + refX,
y: 0 - topDis + refY,
textBaseline: "top",
textAlign: "left"
};
break;
case "bottom":
style = {
x: 0,
y: topDis + refY,
textBaseline: "bottom",
textAlign: "center"
};
break;
case "left":
style = {
x: 0 - leftDis + refY,
y: 0,
textAlign: "left"
};
break;
case "center":
style = {
x: 0,
y: 0,
text: cfg.label,
textAlign: "center"
};
break;
default:
style = {
x: leftDis + refX,
y: 0,
textAlign: "right"
};
break;
}
style.text = cfg.label;
return style;
},
getShapeStyle: function getShapeStyle4(cfg) {
var defaultStyle = this.options.style;
var padding3 = cfg.padding || this.options.padding;
if (is_number_default(padding3))
padding3 = [padding3, padding3, padding3, padding3];
var strokeStyle = {
stroke: cfg.color
};
var style = mix({}, defaultStyle, strokeStyle, cfg.style);
var size2 = this.getSize(cfg);
var width2;
var height;
var fixSize = cfg.collapsed && cfg.fixCollapseSize ? cfg.fixCollapseSize : cfg.fixSize;
if (fixSize) {
if (is_number_default(fixSize)) {
width2 = fixSize;
height = fixSize;
} else {
width2 = fixSize[0];
height = fixSize[1];
}
} else {
if (!is_number_default(style.width) || isNaN(style.width))
width2 = size2[0] || global_default.defaultCombo.style.width;
else
width2 = Math.max(style.width, size2[0]) || size2[0];
if (!is_number_default(style.height) || isNaN(style.height))
height = size2[1] || global_default.defaultCombo.style.height;
else
height = Math.max(style.height, size2[1]) || size2[1];
}
var x6 = -width2 / 2 - padding3[3];
var y5 = -height / 2 - padding3[0];
style.width = width2 + padding3[1] + padding3[3];
style.height = height + padding3[0] + padding3[2];
var styles = __assign({
x: x6,
y: y5
}, style);
if (!cfg.style) {
cfg.style = {
width: width2,
height
};
} else {
cfg.style.width = width2;
cfg.style.height = height;
}
return styles;
},
update: function update4(cfg, item) {
var size2 = this.getSize(cfg);
var padding3 = cfg.padding || this.options.padding;
if (is_number_default(padding3))
padding3 = [padding3, padding3, padding3, padding3];
var cfgStyle = clone_default(cfg.style);
var width2, height;
var fixSize = cfg.collapsed && cfg.fixCollapseSize ? cfg.fixCollapseSize : cfg.fixSize;
if (fixSize) {
if (is_number_default(fixSize)) {
width2 = fixSize;
height = fixSize;
} else {
width2 = fixSize[0];
height = fixSize[1];
}
} else {
width2 = Math.max(cfgStyle.width, size2[0]) || size2[0];
height = Math.max(cfgStyle.height, size2[1]) || size2[1];
}
cfgStyle.width = width2 + padding3[1] + padding3[3];
cfgStyle.height = height + padding3[0] + padding3[2];
var itemCacheSize = item.get("sizeCache");
if (itemCacheSize) {
itemCacheSize.width = cfgStyle.width;
itemCacheSize.height = cfgStyle.height;
}
cfgStyle.x = -width2 / 2 - padding3[3];
cfgStyle.y = -height / 2 - padding3[0];
var strokeStyle = {
stroke: cfg.color
};
var keyShape = item.get("keyShape");
var style = mix({}, keyShape.attr(), strokeStyle, cfgStyle);
if (cfg.style) {
cfg.style.width = width2;
cfg.style.height = height;
} else {
cfg.style = {
width: width2,
height
};
}
this.updateShape(cfg, item, style, false);
},
updateShape: function updateShape3(cfg, item, keyShapeStyle) {
var keyShape = item.get("keyShape");
var animate = cfg.animate === void 0 ? this.options.animate : cfg.animate;
if (animate && keyShape.animate) {
keyShape.animate(keyShapeStyle, {
duration: 200,
easing: "easeLinear"
});
} else {
keyShape.attr(__assign({}, keyShapeStyle));
}
this.updateLabel(cfg, item);
}
}, "single-combo");
// node_modules/@antv/g6-core/es/element/nodes/simple-circle.js
shape_default4.registerNode("simple-circle", {
options: {
size: global_default.defaultNode.size,
style: {
x: 0,
y: 0,
stroke: global_default.defaultNode.style.stroke,
fill: global_default.defaultNode.style.fill,
lineWidth: global_default.defaultNode.style.lineWidth
},
labelCfg: {
style: {
fill: global_default.nodeLabel.style.fill,
fontSize: global_default.nodeLabel.style.fontSize
}
},
stateStyles: __assign({}, global_default.nodeStateStyles)
},
shapeType: "simple-circle",
labelPosition: "center",
drawShape: function drawShape8(cfg, group2) {
var style = this.getShapeStyle(cfg);
var keyShape = group2.addShape("circle", {
attrs: style,
className: this.type + "-keyShape",
draggable: true
});
return keyShape;
},
getShapeStyle: function getShapeStyle5(cfg) {
var defaultStyle = this.getOptions(cfg).style;
var strokeStyle = {
stroke: cfg.color
};
var style = deep_mix_default({}, defaultStyle, strokeStyle);
var size2 = this.getSize(cfg);
var r4 = size2[0] / 2;
var styles = __assign({
x: 0,
y: 0,
r: r4
}, style);
return styles;
},
update: function update5(cfg, item) {
var size2 = this.getSize(cfg);
var strokeStyle = {
stroke: cfg.color,
r: size2[0] / 2
};
var keyShape = item.get("keyShape");
var style = deep_mix_default({}, keyShape.attr(), strokeStyle, cfg.style);
this.updateShape(cfg, item, style, true);
}
}, "single-node");
// node_modules/@antv/g6-core/es/element/nodes/simple-rect.js
shape_default4.registerNode("simple-rect", {
options: {
size: [100, 30],
style: {
radius: 0,
stroke: global_default.defaultNode.style.stroke,
fill: global_default.defaultNode.style.fill,
lineWidth: global_default.defaultNode.style.lineWidth
},
labelCfg: {
style: {
fill: global_default.nodeLabel.style.fill,
fontSize: global_default.nodeLabel.style.fontSize
}
},
anchorPoints: [[0, 0.5], [1, 0.5]],
stateStyles: __assign({}, global_default.nodeStateStyles)
},
shapeType: "simple-rect",
labelPosition: "center",
drawShape: function drawShape9(cfg, group2) {
var style = this.getShapeStyle(cfg);
var keyShape = group2.addShape("rect", {
attrs: style,
className: this.type + "-keyShape",
name: this.type + "-keyShape",
draggable: true
});
return keyShape;
},
getShapeStyle: function getShapeStyle6(cfg) {
var defaultStyle = this.getOptions(cfg).style;
var strokeStyle = {
stroke: cfg.color
};
var style = mix({}, defaultStyle, strokeStyle);
var size2 = this.getSize(cfg);
var width2 = style.width || size2[0];
var height = style.height || size2[1];
var styles = __assign({
x: -width2 / 2,
y: -height / 2,
width: width2,
height
}, style);
return styles;
},
update: function update6(cfg, item) {
var group2 = item.getContainer();
var defaultStyle = this.getOptions({}).style;
var size2 = this.getSize(cfg);
var keyShape = item.get("keyShape");
if (!cfg.size) {
size2[0] = keyShape.attr("width") || defaultStyle.width;
size2[1] = keyShape.attr("height") || defaultStyle.height;
}
var strokeStyle = {
stroke: cfg.color,
x: -size2[0] / 2,
y: -size2[1] / 2,
width: size2[0],
height: size2[1]
};
var style = mix({}, defaultStyle, keyShape.attr(), strokeStyle);
style = mix(style, cfg.style);
this.updateShape(cfg, item, style, false);
}
}, "single-node");
// node_modules/@antv/g6-core/es/element/nodes/image.js
shape_default4.registerNode("image", {
options: {
img: "https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*eD7nT6tmYgAAAAAAAAAAAABkARQnAQ",
size: 200,
clipCfg: {
show: false,
type: "circle",
r: 50,
rx: 50,
ry: 35,
width: 50,
height: 35,
points: [[30, 12], [12, 30], [30, 48], [48, 30]],
path: [["M", 25, 25], ["L", 50, 25], ["A", 12.5, 12.5, 0, 1, 1, 50, 50], ["A", 12.5, 12.5, 0, 1, 0, 50, 50], ["L", 25, 75], ["Z"]],
x: 0,
y: 0
}
},
shapeType: "image",
labelPosition: "bottom",
drawShape: function drawShape10(cfg, group2) {
var shapeType = this.shapeType;
var style = this.getShapeStyle(cfg);
delete style.fill;
var shape = group2.addShape(shapeType, {
attrs: style,
className: this.type + "-keyShape",
name: this.type + "-keyShape",
draggable: true
});
this.drawClip(cfg, shape);
return shape;
},
drawClip: function drawClip(cfg, shape) {
var clip = this.getOptions(cfg).clipCfg;
if (!clip.show) {
return;
}
var type2 = clip.type, x6 = clip.x, y5 = clip.y, style = clip.style;
if (type2 === "circle") {
var r4 = clip.r;
shape.setClip({
type: "circle",
attrs: __assign({
r: r4,
x: x6,
y: y5
}, style)
});
} else if (type2 === "rect") {
var width2 = clip.width, height = clip.height;
var rectX = x6 - width2 / 2;
var rectY = y5 - height / 2;
shape.setClip({
type: "rect",
attrs: __assign({
x: rectX,
y: rectY,
width: width2,
height
}, style)
});
} else if (type2 === "ellipse") {
var rx = clip.rx, ry = clip.ry;
shape.setClip({
type: "ellipse",
attrs: __assign({
x: x6,
y: y5,
rx,
ry
}, style)
});
} else if (type2 === "polygon") {
var points = clip.points;
shape.setClip({
type: "polygon",
attrs: __assign({
points
}, style)
});
} else if (type2 === "path") {
var path = clip.path;
shape.setClip({
type: "path",
attrs: __assign({
path
}, style)
});
}
},
getShapeStyle: function getShapeStyle7(cfg) {
var defaultStyle = this.getOptions(cfg).style;
var size2 = this.getSize(cfg);
var img = this.getOptions(cfg).img;
var width2 = size2[0];
var height = size2[1];
if (defaultStyle) {
width2 = defaultStyle.width || size2[0];
height = defaultStyle.height || size2[1];
}
var style = __assign({
x: -width2 / 2,
y: -height / 2,
width: width2,
height,
img
}, defaultStyle);
return style;
},
updateShapeStyle: function updateShapeStyle3(cfg, item) {
var group2 = item.getContainer();
var shapeClassName = this.itemType + "-shape";
var shape = group2.find(function(element) {
return element.get("className") === shapeClassName;
}) || item.getKeyShape();
var shapeStyle = this.getShapeStyle(cfg);
if (shape) {
shape.attr(shapeStyle);
}
}
}, "single-node");
// node_modules/@antv/g6-core/es/element/arrow.js
var arrow_default2 = {
triangle: function triangle2(width2, length5, d3) {
if (width2 === void 0) {
width2 = 10;
}
if (length5 === void 0) {
length5 = 15;
}
if (d3 === void 0) {
d3 = 0;
}
var begin = d3 * 2;
var path = "M " + begin + ",0 L " + (begin + length5) + ",-" + width2 / 2 + " L " + (begin + length5) + "," + width2 / 2 + " Z";
return path;
},
vee: function vee(width2, length5, d3) {
if (width2 === void 0) {
width2 = 15;
}
if (length5 === void 0) {
length5 = 20;
}
if (d3 === void 0) {
d3 = 0;
}
var begin = d3 * 2;
var path = "M " + begin + ",0 L " + (begin + length5) + ",-" + width2 / 2 + "\n L " + (begin + 2 * length5 / 3) + ",0 L " + (begin + length5) + "," + width2 / 2 + " Z";
return path;
},
circle: function circle2(r4, d3) {
if (r4 === void 0) {
r4 = 5;
}
if (d3 === void 0) {
d3 = 0;
}
var begin = d3 * 2;
var path = "M " + begin + ", 0\n a " + r4 + "," + r4 + " 0 1,0 " + r4 * 2 + ",0\n a " + r4 + "," + r4 + " 0 1,0 " + -r4 * 2 + ",0";
return path;
},
rect: function rect2(width2, length5, d3) {
if (width2 === void 0) {
width2 = 10;
}
if (length5 === void 0) {
length5 = 10;
}
if (d3 === void 0) {
d3 = 0;
}
var begin = d3 * 2;
var path = "M " + begin + "," + -width2 / 2 + " \n L " + (begin + length5) + "," + -width2 / 2 + " \n L " + (begin + length5) + "," + width2 / 2 + " \n L " + begin + "," + width2 / 2 + " Z";
return path;
},
diamond: function diamond2(width2, length5, d3) {
if (width2 === void 0) {
width2 = 15;
}
if (length5 === void 0) {
length5 = 15;
}
if (d3 === void 0) {
d3 = 0;
}
var begin = d3 * 2;
var path = "M " + begin + ",0 \n L " + (begin + length5 / 2) + "," + -width2 / 2 + " \n L " + (begin + length5) + ",0 \n L " + (begin + length5 / 2) + "," + width2 / 2 + " Z";
return path;
},
triangleRect: function triangleRect(tWidth, tLength, rWidth, rLength, gap, d3) {
if (tWidth === void 0) {
tWidth = 15;
}
if (tLength === void 0) {
tLength = 15;
}
if (rWidth === void 0) {
rWidth = 15;
}
if (rLength === void 0) {
rLength = 3;
}
if (gap === void 0) {
gap = 5;
}
if (d3 === void 0) {
d3 = 0;
}
var begin = d3 * 2;
var rectBegin = begin + tLength + gap;
var path = "M " + begin + ",0 L " + (begin + tLength) + ",-" + tWidth / 2 + " L " + (begin + tLength) + "," + tWidth / 2 + " Z\n M " + rectBegin + ", -" + rWidth / 2 + "\n L " + (rectBegin + rLength) + " -" + rWidth / 2 + "\n L " + (rectBegin + rLength) + " " + rWidth / 2 + "\n L " + rectBegin + " " + rWidth / 2 + "\n Z";
return path;
}
};
// node_modules/@antv/g6-core/es/element/marker.js
var marker_default3 = {
collapse: function collapse(x6, y5, r4) {
return [["M", x6 - r4, y5], ["a", r4, r4, 0, 1, 0, r4 * 2, 0], ["a", r4, r4, 0, 1, 0, -r4 * 2, 0], ["M", x6 - r4 + 4, y5], ["L", x6 + r4 - 4, y5]];
},
expand: function expand(x6, y5, r4) {
return [["M", x6 - r4, y5], ["a", r4, r4, 0, 1, 0, r4 * 2, 0], ["a", r4, r4, 0, 1, 0, -r4 * 2, 0], ["M", x6 - r4 + 4, y5], ["L", x6 - r4 + 2 * r4 - 4, y5], ["M", x6 - r4 + r4, y5 - r4 + 4], ["L", x6, y5 + r4 - 4]];
},
upTriangle: function upTriangle(x6, y5, r4) {
var l1 = r4 * Math.cos(Math.PI / 6);
var l22 = r4 * Math.sin(Math.PI / 6);
return [["M", x6 - l1, y5 + l22], ["L", x6 + l1, y5 + l22], ["L", x6, y5 - r4], ["Z"]];
},
downTriangle: function downTriangle(x6, y5, r4) {
var l1 = r4 * Math.cos(Math.PI / 6);
var l22 = r4 * Math.sin(Math.PI / 6);
return [["M", x6 - l1, y5 - l22], ["L", x6 + l1, y5 - l22], ["L", x6, y5 + r4], ["Z"]];
}
};
// node_modules/@antv/g6-core/es/element/index.js
var element_default3 = shape_default4;
// node_modules/@antv/g6-core/es/util/index.js
var transform11 = ext_exports.transform;
var Util2 = __assign(__assign(__assign(__assign(__assign({}, base_exports), graphic_exports), path_exports2), math_exports), {
transform: transform11,
mat3: mat3_exports
});
var util_default = Util2;
// node_modules/@antv/g6-core/es/graph/controller/layout.js
var LayoutController = function() {
function LayoutController3(graph) {
this.graph = graph;
this.layoutCfg = graph.get("layout") || {};
this.layoutType = this.getLayoutType();
this.layoutMethods = [];
this.initLayout();
}
LayoutController3.prototype.initLayout = function() {
};
LayoutController3.prototype.getLayoutType = function() {
return this.getLayoutCfgType(this.layoutCfg);
};
LayoutController3.prototype.getLayoutCfgType = function(layoutCfg) {
var type2 = layoutCfg.type;
if (type2) {
return type2;
}
var pipes = layoutCfg.pipes;
if (Array.isArray(pipes)) {
return pipes.map(function(pipe) {
return (pipe === null || pipe === void 0 ? void 0 : pipe.type) || "";
});
}
return null;
};
LayoutController3.prototype.isLayoutTypeSame = function(cfg) {
var current = this.getLayoutCfgType(cfg);
if (Array.isArray(this.layoutType)) {
return this.layoutType.every(function(type2, index2) {
return type2 === current[index2];
});
}
return (cfg === null || cfg === void 0 ? void 0 : cfg.type) === this.layoutType;
};
LayoutController3.prototype.refreshLayout = function() {
var graph = this.graph;
if (!graph)
return;
if (graph.get("animate")) {
graph.positionsAnimate();
} else {
graph.refreshPositions();
}
};
LayoutController3.prototype.changeLayout = function(cfg) {
this.layoutCfg = cfg;
this.destoryLayoutMethods();
this.layout();
};
LayoutController3.prototype.changeData = function() {
this.destoryLayoutMethods();
this.layout();
};
LayoutController3.prototype.destoryLayoutMethods = function() {
var layoutMethods = this.layoutMethods;
layoutMethods === null || layoutMethods === void 0 ? void 0 : layoutMethods.forEach(function(layoutMethod) {
layoutMethod.destroy();
});
this.layoutMethods = [];
};
LayoutController3.prototype.destroyLayout = function() {
var graph = this.graph;
this.destoryLayoutMethods();
graph.set("layout", void 0);
this.layoutCfg = void 0;
this.layoutType = void 0;
this.layoutMethods = void 0;
};
LayoutController3.prototype.setDataFromGraph = function() {
var nodes = [];
var hiddenNodes = [];
var edges = [];
var hiddenEdges = [];
var comboEdges = [];
var combos = [];
var hiddenCombos = [];
var nodeItems = this.graph.getNodes();
var edgeItems = this.graph.getEdges();
var comboItems = this.graph.getCombos();
var nodeLength = nodeItems.length;
for (var i4 = 0; i4 < nodeLength; i4++) {
var nodeItem = nodeItems[i4];
if (!nodeItem || nodeItem.destroyed)
continue;
var model = nodeItem.getModel();
if (!nodeItem.isVisible()) {
hiddenNodes.push(model);
continue;
}
nodes.push(model);
}
var edgeLength = edgeItems.length;
for (var i4 = 0; i4 < edgeLength; i4++) {
var edgeItem = edgeItems[i4];
if (!edgeItem || edgeItem.destroyed)
continue;
var model = edgeItem.getModel();
if (!edgeItem.isVisible()) {
hiddenEdges.push(model);
continue;
}
if (!model.isComboEdge)
edges.push(model);
else
comboEdges.push(model);
}
var comboLength = comboItems.length;
for (var i4 = 0; i4 < comboLength; i4++) {
var comboItem = comboItems[i4];
if (comboItem.destroyed)
continue;
var model = comboItem.getModel();
if (!comboItem.isVisible()) {
hiddenEdges.push(model);
continue;
}
combos.push(model);
}
return {
nodes,
hiddenNodes,
edges,
hiddenEdges,
combos,
hiddenCombos,
comboEdges
};
};
LayoutController3.prototype.reLayoutMethod = function(layoutMethod, layoutCfg) {
var _this = this;
return new Promise(function(reslove, reject) {
var graph = _this.graph;
var layoutType = layoutCfg === null || layoutCfg === void 0 ? void 0 : layoutCfg.type;
layoutCfg.onLayoutEnd = function() {
graph.emit("aftersublayout", {
type: layoutType
});
reslove();
};
layoutMethod.init(_this.data);
if (layoutType === "force") {
layoutMethod.ticking = false;
layoutMethod.forceSimulation.stop();
}
graph.emit("beforesublayout", {
type: layoutType
});
layoutMethod.execute();
if (layoutMethod.isCustomLayout && layoutCfg.onLayoutEnd)
layoutCfg.onLayoutEnd();
});
};
LayoutController3.prototype.relayout = function(reloadData) {
var _this = this;
var _a6 = this, graph = _a6.graph, layoutMethods = _a6.layoutMethods, layoutCfg = _a6.layoutCfg;
if (reloadData) {
this.data = this.setDataFromGraph();
var nodes = this.data.nodes;
if (!nodes) {
return false;
}
this.initPositions(layoutCfg.center, nodes);
}
graph.emit("beforelayout");
var start = Promise.resolve();
layoutMethods === null || layoutMethods === void 0 ? void 0 : layoutMethods.forEach(function(layoutMethod, index2) {
var currentCfg = layoutCfg[index2];
start = start.then(function() {
return _this.reLayoutMethod(layoutMethod, currentCfg);
});
});
start.then(function() {
if (layoutCfg.onAllLayoutEnd)
layoutCfg.onAllLayoutEnd();
}).catch(function(error) {
console.warn("relayout failed", error);
});
};
LayoutController3.prototype.filterLayoutData = function(data3, cfg) {
var nodes = data3.nodes, edges = data3.edges, rest = __rest(data3, ["nodes", "edges"]);
if (!nodes) {
return data3;
}
var nodesFilter;
var edegsFilter;
if (is_function_default(cfg === null || cfg === void 0 ? void 0 : cfg.nodesFilter)) {
nodesFilter = cfg.nodesFilter;
} else {
nodesFilter = function nodesFilter2() {
return true;
};
}
if (is_function_default(cfg === null || cfg === void 0 ? void 0 : cfg.edgesFilter)) {
edegsFilter = cfg.edgesFilter;
} else {
var nodesMap_1 = nodes.reduce(function(acc, cur) {
acc[cur.id] = true;
return acc;
}, {});
edegsFilter = function edegsFilter2(edge2) {
return nodesMap_1[edge2.source] && nodesMap_1[edge2.target];
};
}
return __assign({
nodes: nodes.filter(nodesFilter),
edges: edges.filter(edegsFilter)
}, rest);
};
LayoutController3.prototype.getLayoutBBox = function(nodes) {
var graph = this.graph;
var graphGroupNodes = group_by_default(graph.getNodes(), function(n3) {
return n3.getModel().layoutOrder;
});
var layoutNodes2 = Object.values(graphGroupNodes).map(function(value2) {
var bbox = calculationItemsBBox(value2);
bbox.size = [bbox.width, bbox.height];
return bbox;
});
var groupNodes = Object.values(group_by_default(nodes, "layoutOrder"));
return {
groupNodes,
layoutNodes: layoutNodes2
};
};
LayoutController3.prototype.layoutAnimate = function() {
};
LayoutController3.prototype.moveToZero = function() {
var graph = this.graph;
var data3 = graph.get("data");
var nodes = data3.nodes;
if (nodes[0].x === void 0 || nodes[0].x === null || isNaN2(nodes[0].x)) {
return;
}
var meanCenter = [0, 0];
var nodeLength = nodes.length;
for (var i4 = 0; i4 < nodeLength; i4++) {
var node = nodes[i4];
meanCenter[0] += node.x;
meanCenter[1] += node.y;
}
meanCenter[0] /= nodes.length;
meanCenter[1] /= nodes.length;
for (var i4 = 0; i4 < nodeLength; i4++) {
var node = nodes[i4];
node.x -= meanCenter[0];
node.y -= meanCenter[1];
}
};
LayoutController3.prototype.initPositions = function(center2, nodes) {
var graph = this.graph;
if (!nodes) {
return false;
}
var nodeLength = nodes ? nodes.length : 0;
if (!nodeLength)
return;
var width2 = graph.get("width") * 0.85;
var height = graph.get("height") * 0.85;
var horiNum = Math.ceil(Math.sqrt(nodeLength) * (width2 / height));
var vertiNum = Math.ceil(nodeLength / horiNum);
var horiGap = width2 / (horiNum - 1);
var vertiGap = height / (vertiNum - 1);
if (!isFinite(horiGap) || !horiGap)
horiGap = 0;
if (!isFinite(vertiGap) || !horiGap)
vertiGap = 0;
var beginX = center2[0] - width2 / 2;
var beginY = center2[1] - height / 2;
var allHavePos = true;
for (var i4 = 0; i4 < nodeLength; i4++) {
var node = nodes[i4];
if (isNaN2(node.x)) {
allHavePos = false;
node.x = i4 % horiNum * horiGap + beginX;
}
if (isNaN2(node.y)) {
allHavePos = false;
node.y = Math.floor(i4 / horiNum) * vertiGap + beginY;
}
}
return allHavePos;
};
LayoutController3.prototype.destroy = function() {
this.graph = null;
this.destoryLayoutMethods();
this.destroyed = true;
};
return LayoutController3;
}();
var layout_default = LayoutController;
// node_modules/@antv/g6-core/es/graph/controller/event.js
var EventController2 = function() {
function EventController4(graph) {
this.graph = graph;
this.destroyed = false;
this.initEvents();
}
return EventController4;
}();
var event_default2 = EventController2;
// node_modules/@antv/g6-core/es/types/index.js
var G6Event;
(function(G6Event2) {
G6Event2["CLICK"] = "click";
G6Event2["DBLCLICK"] = "dblclick";
G6Event2["MOUSEDOWN"] = "mousedown";
G6Event2["MOUDEUP"] = "mouseup";
G6Event2["CONTEXTMENU"] = "contextmenu";
G6Event2["MOUSEENTER"] = "mouseenter";
G6Event2["MOUSEOUT"] = "mouseout";
G6Event2["MOUSEOVER"] = "mouseover";
G6Event2["MOUSEMOVE"] = "mousemove";
G6Event2["MOUSELEAVE"] = "mouseleave";
G6Event2["DRAGSTART"] = "dragstart";
G6Event2["DRAGEND"] = "dragend";
G6Event2["DRAG"] = "drag";
G6Event2["DRAGENTER"] = "dragenter";
G6Event2["DRAGLEAVE"] = "dragleave";
G6Event2["DRAGOVER"] = "dragover";
G6Event2["DRAGOUT"] = "dragout";
G6Event2["DDROP"] = "drop";
G6Event2["KEYUP"] = "keyup";
G6Event2["KEYDOWN"] = "keydown";
G6Event2["WHEEL"] = "wheel";
G6Event2["FOCUS"] = "focus";
G6Event2["BLUR"] = "blur";
G6Event2["TOUCHSTART"] = "touchstart";
G6Event2["TOUCHMOVE"] = "touchmove";
G6Event2["TOUCHEND"] = "touchend";
G6Event2["NODE_CONTEXTMENU"] = "node:contextmenu";
G6Event2["NODE_CLICK"] = "node:click";
G6Event2["NODE_DBLCLICK"] = "node:dblclick";
G6Event2["NODE_MOUSEDOWN"] = "node:mousedown";
G6Event2["NODE_MOUSEUP"] = "node:mouseup";
G6Event2["NODE_MOUSEENTER"] = "node:mouseenter";
G6Event2["NODE_MOUSELEAVE"] = "node:mouseleave";
G6Event2["NODE_MOUSEMOVE"] = "node:mousemove";
G6Event2["NODE_MOUSEOUT"] = "node:mouseout";
G6Event2["NODE_MOUSEOVER"] = "node:mouseover";
G6Event2["NODE_DROP"] = "node:drop";
G6Event2["NODE_DRAGOVER"] = "node:dragover";
G6Event2["NODE_DRAGENTER"] = "node:dragenter";
G6Event2["NODE_DRAGLEAVE"] = "node:dragleave";
G6Event2["NODE_DRAGSTART"] = "node:dragstart";
G6Event2["NODE_DRAG"] = "node:drag";
G6Event2["NODE_DRAGEND"] = "node:dragend";
G6Event2["COMBO_CONTEXTMENU"] = "combo:contextmenu";
G6Event2["COMBO_CLICK"] = "combo:click";
G6Event2["COMBO_DBLCLICK"] = "combo:dblclick";
G6Event2["COMBO_MOUSEDOWN"] = "combo:mousedown";
G6Event2["COMBO_MOUSEUP"] = "combo:mouseup";
G6Event2["COMBO_MOUSEENTER"] = "combo:mouseenter";
G6Event2["COMBO_MOUSELEAVE"] = "combo:mouseleave";
G6Event2["COMBO_MOUSEMOVE"] = "combo:mousemove";
G6Event2["COMBO_MOUSEOUT"] = "combo:mouseout";
G6Event2["COMBO_MOUSEOVER"] = "combo:mouseover";
G6Event2["COMBO_DROP"] = "combo:drop";
G6Event2["COMBO_DRAGOVER"] = "combo:dragover";
G6Event2["COMBO_DRAGENTER"] = "combo:dragenter";
G6Event2["COMBO_DRAGLEAVE"] = "combo:dragleave";
G6Event2["COMBO_DRAGSTART"] = "combo:dragstart";
G6Event2["COMBO_DRAG"] = "combo:drag";
G6Event2["COMBO_DRAGEND"] = "combo:dragend";
G6Event2["EDGE_CONTEXTMENU"] = "edge:contextmenu";
G6Event2["EDGE_CLICK"] = "edge:click";
G6Event2["EDGE_DBLCLICK"] = "edge:dblclick";
G6Event2["EDGE_MOUSEDOWN"] = "edge:mousedown";
G6Event2["EDGE_MOUSEUP"] = "edge:mouseup";
G6Event2["EDGE_MOUSEENTER"] = "edge:mouseenter";
G6Event2["EDGE_MOUSELEAVE"] = "edge:mouseleave";
G6Event2["EDGE_MOUSEMOVE"] = "edge:mousemove";
G6Event2["EDGE_MOUSEOUT"] = "edge:mouseout";
G6Event2["EDGE_MOUSEOVER"] = "edge:mouseover";
G6Event2["EDGE_DROP"] = "edge:drop";
G6Event2["EDGE_DRAGOVER"] = "edge:dragover";
G6Event2["EDGE_DRAGENTER"] = "edge:dragenter";
G6Event2["EDGE_DRAGLEAVE"] = "edge:dragleave";
G6Event2["CANVAS_CONTEXTMENU"] = "canvas:contextmenu";
G6Event2["CANVAS_CLICK"] = "canvas:click";
G6Event2["CANVAS_DBLCLICK"] = "canvas:dblclick";
G6Event2["CANVAS_MOUSEDOWN"] = "canvas:mousedown";
G6Event2["CANVAS_MOUSEUP"] = "canvas:mouseup";
G6Event2["CANVAS_MOUSEENTER"] = "canvas:mouseenter";
G6Event2["CANVAS_MOUSELEAVE"] = "canvas:mouseleave";
G6Event2["CANVAS_MOUSEMOVE"] = "canvas:mousemove";
G6Event2["CANVAS_MOUSEOUT"] = "canvas:mouseout";
G6Event2["CANVAS_MOUSEOVER"] = "canvas:mouseover";
G6Event2["CANVAS_DROP"] = "canvas:drop";
G6Event2["CANVAS_DRAGENTER"] = "canvas:dragenter";
G6Event2["CANVAS_DRAGLEAVE"] = "canvas:dragleave";
G6Event2["CANVAS_DRAGSTART"] = "canvas:dragstart";
G6Event2["CANVAS_DRAG"] = "canvas:drag";
G6Event2["CANVAS_DRAGEND"] = "canvas:dragend";
G6Event2["BEFORERENDER"] = "beforerender";
G6Event2["AFTERRENDER"] = "afterrender";
G6Event2["BEFOREADDITEM"] = "beforeadditem";
G6Event2["AFTERADDITEM"] = "afteradditem";
G6Event2["BEFOREREMOVEITEM"] = "beforeremoveitem";
G6Event2["AFTERREMOVEITEM"] = "afterremoveitem";
G6Event2["BEFOREUPDATEITEM"] = "beforeupdateitem";
G6Event2["AFTERUPDATEITEM"] = "afterupdateitem";
G6Event2["BEFOREITEMVISIBILITYCHANGE"] = "beforeitemvisibilitychange";
G6Event2["AFTERITEMVISIBILITYCHANGE"] = "afteritemvisibilitychange";
G6Event2["BEFOREITEMSTATECHANGE"] = "beforeitemstatechange";
G6Event2["AFTERITEMSTATECHANGE"] = "afteritemstatechange";
G6Event2["BEFOREITEMREFRESH"] = "beforeitemrefresh";
G6Event2["AFTERITEMREFRESH"] = "afteritemrefresh";
G6Event2["BEFOREITEMSTATESCLEAR"] = "beforeitemstatesclear";
G6Event2["AFTERITEMSTATESCLEAR"] = "afteritemstatesclear";
G6Event2["BEFOREMODECHANGE"] = "beforemodechange";
G6Event2["AFTERMODECHANGE"] = "aftermodechange";
G6Event2["BEFORELAYOUT"] = "beforelayout";
G6Event2["AFTERLAYOUT"] = "afterlayout";
G6Event2["BEFORECREATEEDGE"] = "beforecreateedge";
G6Event2["AFTERCREATEEDGE"] = "aftercreateedge";
G6Event2["BEFOREGRAPHREFRESHPOSITION"] = "beforegraphrefreshposition";
G6Event2["AFTERGRAPHREFRESHPOSITION"] = "aftergraphrefreshposition";
G6Event2["BEFOREGRAPHREFRESH"] = "beforegraphrefresh";
G6Event2["AFTERGRAPHREFRESH"] = "aftergraphrefresh";
G6Event2["BEFOREANIMATE"] = "beforeanimate";
G6Event2["AFTERANIMATE"] = "afteranimate";
G6Event2["BEFOREPAINT"] = "beforepaint";
G6Event2["AFTERPAINT"] = "afterpaint";
G6Event2["BEFORECOLLAPSEEXPANDCOMBO"] = "beforecollapseexpandcombo";
G6Event2["AFTERCOLLAPSEEXPANDCOMBO"] = "aftercollapseexpandcombo";
G6Event2["GRAPHSTATECHANGE"] = "graphstatechange";
G6Event2["AFTERACTIVATERELATIONS"] = "afteractivaterelations";
G6Event2["NODESELECTCHANGE"] = "nodeselectchange";
G6Event2["TOOLTIPCHANGE"] = "tooltipchange";
G6Event2["WHEELZOOM"] = "wheelzoom";
G6Event2["VIEWPORTCHANGE"] = "viewportchange";
G6Event2["DRAGNODEEND"] = "dragnodeend";
G6Event2["STACKCHANGE"] = "stackchange";
})(G6Event || (G6Event = {}));
// node_modules/@antv/g6-core/es/index.js
var registerNode = element_default3.registerNode;
var registerEdge = element_default3.registerEdge;
var registerCombo = element_default3.registerCombo;
var registerBehavior = behavior_default2.registerBehavior;
var BaseGlobal = global_default;
var es_default2 = {
version: global_default.version,
AbstractGraph: graph_default,
BaseGlobal,
Util: util_default,
Shape: element_default3,
Node: node_default,
Edge: edge_default2,
Combo: combo_default,
Hull: hull_default,
registerNode: element_default3.registerNode,
registerEdge: element_default3.registerEdge,
registerCombo: element_default3.registerCombo,
registerBehavior: behavior_default2.registerBehavior,
Arrow: arrow_default2,
Marker: marker_default3,
AbstractLayout: layout_default,
AbstractEvent: event_default2
};
// node_modules/@antv/g6-pc/node_modules/@antv/matrix-util/esm/ext.js
var ext_exports3 = {};
__export(ext_exports3, {
angleTo: () => angleTo2,
direction: () => direction2,
leftRotate: () => leftRotate2,
leftScale: () => leftScale2,
leftTranslate: () => leftTranslate2,
transform: () => transform12,
vertical: () => vertical2
});
function leftTranslate2(out, a4, v3) {
var transMat = [0, 0, 0, 0, 0, 0, 0, 0, 0];
mat3_exports.fromTranslation(transMat, v3);
return mat3_exports.multiply(out, transMat, a4);
}
function leftRotate2(out, a4, rad) {
var rotateMat = [0, 0, 0, 0, 0, 0, 0, 0, 0];
mat3_exports.fromRotation(rotateMat, rad);
return mat3_exports.multiply(out, rotateMat, a4);
}
function leftScale2(out, a4, v3) {
var scaleMat = [0, 0, 0, 0, 0, 0, 0, 0, 0];
mat3_exports.fromScaling(scaleMat, v3);
return mat3_exports.multiply(out, scaleMat, a4);
}
function leftMultiply2(out, a4, a1) {
return mat3_exports.multiply(out, a1, a4);
}
function transform12(m4, actions) {
var matrix = m4 ? [].concat(m4) : [1, 0, 0, 0, 1, 0, 0, 0, 1];
for (var i4 = 0, len5 = actions.length; i4 < len5; i4++) {
var action = actions[i4];
switch (action[0]) {
case "t":
leftTranslate2(matrix, matrix, [action[1], action[2]]);
break;
case "s":
leftScale2(matrix, matrix, [action[1], action[2]]);
break;
case "r":
leftRotate2(matrix, matrix, action[1]);
break;
case "m":
leftMultiply2(matrix, matrix, action[1]);
break;
default:
break;
}
}
return matrix;
}
function direction2(v1, v22) {
return v1[0] * v22[1] - v22[0] * v1[1];
}
function angleTo2(v1, v22, direct) {
var ang = vec2_exports.angle(v1, v22);
var angleLargeThanPI = direction2(v1, v22) >= 0;
if (direct) {
if (angleLargeThanPI) {
return Math.PI * 2 - ang;
}
return ang;
}
if (angleLargeThanPI) {
return ang;
}
return Math.PI * 2 - ang;
}
function vertical2(out, v3, flag) {
if (flag) {
out[0] = v3[1];
out[1] = -1 * v3[0];
} else {
out[0] = -1 * v3[1];
out[1] = v3[0];
}
return out;
}
// node_modules/@antv/g6-pc/es/util/color.js
var color_exports = {};
__export(color_exports, {
getColorSetsBySubjectColors: () => getColorSetsBySubjectColors,
getColorsWithSubjectColor: () => getColorsWithSubjectColor,
mixColor: () => mixColor
});
var import_color6 = __toModule(require_color());
// node_modules/@ant-design/colors/dist/index.esm.js
var import_tinycolor2 = __toModule(require_tinycolor());
var hueStep = 2;
var saturationStep = 0.16;
var saturationStep2 = 0.05;
var brightnessStep1 = 0.05;
var brightnessStep2 = 0.15;
var lightColorCount = 5;
var darkColorCount = 4;
var darkColorMap = [{
index: 7,
opacity: 0.15
}, {
index: 6,
opacity: 0.25
}, {
index: 5,
opacity: 0.3
}, {
index: 5,
opacity: 0.45
}, {
index: 5,
opacity: 0.65
}, {
index: 5,
opacity: 0.85
}, {
index: 4,
opacity: 0.9
}, {
index: 3,
opacity: 0.95
}, {
index: 2,
opacity: 0.97
}, {
index: 1,
opacity: 0.98
}];
function getHue(hsv, i4, light) {
var hue;
if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
hue = light ? Math.round(hsv.h) - hueStep * i4 : Math.round(hsv.h) + hueStep * i4;
} else {
hue = light ? Math.round(hsv.h) + hueStep * i4 : Math.round(hsv.h) - hueStep * i4;
}
if (hue < 0) {
hue += 360;
} else if (hue >= 360) {
hue -= 360;
}
return hue;
}
function getSaturation(hsv, i4, light) {
if (hsv.h === 0 && hsv.s === 0) {
return hsv.s;
}
var saturation;
if (light) {
saturation = hsv.s - saturationStep * i4;
} else if (i4 === darkColorCount) {
saturation = hsv.s + saturationStep;
} else {
saturation = hsv.s + saturationStep2 * i4;
}
if (saturation > 1) {
saturation = 1;
}
if (light && i4 === lightColorCount && saturation > 0.1) {
saturation = 0.1;
}
if (saturation < 0.06) {
saturation = 0.06;
}
return Number(saturation.toFixed(2));
}
function getValue2(hsv, i4, light) {
var value2;
if (light) {
value2 = hsv.v + brightnessStep1 * i4;
} else {
value2 = hsv.v - brightnessStep2 * i4;
}
if (value2 > 1) {
value2 = 1;
}
return Number(value2.toFixed(2));
}
function generate(color4) {
var opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
var patterns = [];
var pColor = (0, import_tinycolor2.default)(color4);
for (var i4 = lightColorCount; i4 > 0; i4 -= 1) {
var hsv = pColor.toHsv();
var colorString = (0, import_tinycolor2.default)({
h: getHue(hsv, i4, true),
s: getSaturation(hsv, i4, true),
v: getValue2(hsv, i4, true)
}).toHexString();
patterns.push(colorString);
}
patterns.push(pColor.toHexString());
for (var _i = 1; _i <= darkColorCount; _i += 1) {
var _hsv = pColor.toHsv();
var _colorString = (0, import_tinycolor2.default)({
h: getHue(_hsv, _i),
s: getSaturation(_hsv, _i),
v: getValue2(_hsv, _i)
}).toHexString();
patterns.push(_colorString);
}
if (opts.theme === "dark") {
return darkColorMap.map(function(_ref2) {
var index2 = _ref2.index, opacity = _ref2.opacity;
var darkColorString = import_tinycolor2.default.mix(opts.backgroundColor || "#141414", patterns[index2], opacity * 100).toHexString();
return darkColorString;
});
}
return patterns;
}
var presetPrimaryColors = {
red: "#F5222D",
volcano: "#FA541C",
orange: "#FA8C16",
gold: "#FAAD14",
yellow: "#FADB14",
lime: "#A0D911",
green: "#52C41A",
cyan: "#13C2C2",
blue: "#1890FF",
geekblue: "#2F54EB",
purple: "#722ED1",
magenta: "#EB2F96",
grey: "#666666"
};
var presetPalettes = {};
var presetDarkPalettes = {};
Object.keys(presetPrimaryColors).forEach(function(key) {
presetPalettes[key] = generate(presetPrimaryColors[key]);
presetPalettes[key].primary = presetPalettes[key][5];
presetDarkPalettes[key] = generate(presetPrimaryColors[key], {
theme: "dark",
backgroundColor: "#141414"
});
presetDarkPalettes[key].primary = presetDarkPalettes[key][5];
});
var red = presetPalettes.red;
var volcano = presetPalettes.volcano;
var gold = presetPalettes.gold;
var orange = presetPalettes.orange;
var yellow = presetPalettes.yellow;
var lime = presetPalettes.lime;
var green = presetPalettes.green;
var cyan = presetPalettes.cyan;
var blue = presetPalettes.blue;
var geekblue = presetPalettes.geekblue;
var purple = presetPalettes.purple;
var magenta = presetPalettes.magenta;
var grey = presetPalettes.grey;
// node_modules/@antv/g6-pc/es/util/color.js
var mixColor = function mixColor2(backColor3, frontColor, frontAlpha) {
var bc = (0, import_color6.default)(backColor3);
var fc = (0, import_color6.default)(frontColor);
return (0, import_color6.default)([(1 - frontAlpha) * bc.red() + frontAlpha * fc.red(), (1 - frontAlpha) * bc.green() + frontAlpha * fc.green(), (1 - frontAlpha) * bc.blue() + frontAlpha * fc.blue()]).rgb();
};
var getColorsWithDefaultTheme = function getColorsWithDefaultTheme2(subjectColor3, backColor3, disableColor) {
if (backColor3 === void 0) {
backColor3 = "#fff";
}
if (disableColor === void 0) {
disableColor = "rgb(150, 150, 150)";
}
var subjectColor005 = mixColor(backColor3, subjectColor3, 0.05).rgb().toString();
var subjectColor01 = mixColor(backColor3, subjectColor3, 0.1).rgb().toString();
var subjectColor02 = mixColor(backColor3, subjectColor3, 0.2).rgb().toString();
var subjectColor04 = mixColor(backColor3, subjectColor3, 0.4).rgb().toString();
var disableColor002 = mixColor(backColor3, disableColor, 0.02).rgb().toString();
var disableColor005 = mixColor(backColor3, disableColor, 0.05).rgb().toString();
var disableColor01 = mixColor(backColor3, disableColor, 0.1).rgb().toString();
var disableColor02 = mixColor(backColor3, disableColor, 0.2).rgb().toString();
var disableColor03 = mixColor(backColor3, disableColor, 0.3).rgb().toString();
var paletteFromSubject = generate(subjectColor3, {
theme: "default",
backgroundColor: backColor3
});
var subjectHex = (0, import_color6.default)(subjectColor3).hex().toLowerCase();
var subjectIdx = paletteFromSubject.indexOf(subjectHex);
var deeperSubject = subjectColor3;
if (subjectIdx !== -1) {
deeperSubject = paletteFromSubject[subjectIdx + 1];
}
return {
mainStroke: subjectColor3,
mainFill: subjectColor01,
activeStroke: subjectColor3,
activeFill: subjectColor005,
inactiveStroke: subjectColor04,
inactiveFill: subjectColor005,
selectedStroke: subjectColor3,
selectedFill: backColor3,
highlightStroke: deeperSubject,
highlightFill: subjectColor02,
disableStroke: disableColor03,
disableFill: disableColor005,
edgeMainStroke: disableColor03,
edgeActiveStroke: subjectColor3,
edgeInactiveStroke: disableColor02,
edgeSelectedStroke: subjectColor3,
edgeHighlightStroke: subjectColor3,
edgeDisableStroke: disableColor01,
comboMainStroke: disableColor03,
comboMainFill: disableColor002,
comboActiveStroke: subjectColor3,
comboActiveFill: subjectColor005,
comboInactiveStroke: disableColor03,
comboInactiveFill: disableColor002,
comboSelectedStroke: subjectColor3,
comboSelectedFill: disableColor002,
comboHighlightStroke: deeperSubject,
comboHighlightFill: disableColor002,
comboDisableStroke: disableColor02,
comboDisableFill: disableColor005
};
};
var getColorsWithDarkTheme = function getColorsWithDarkTheme2(subjectColor3, backColor3, disableColor) {
if (backColor3 === void 0) {
backColor3 = "#fff";
}
if (disableColor === void 0) {
disableColor = "#777";
}
var subjectColor02 = mixColor(backColor3, subjectColor3, 0.2).rgb().toString();
var subjectColor03 = mixColor(backColor3, subjectColor3, 0.3).rgb().toString();
var subjectColor06 = mixColor(backColor3, subjectColor3, 0.6).rgb().toString();
var subjectColor08 = mixColor(backColor3, subjectColor3, 0.8).rgb().toString();
var disableColor02 = mixColor(backColor3, disableColor, 0.2).rgb().toString();
var disableColor025 = mixColor(backColor3, disableColor, 0.25).rgb().toString();
var disableColor03 = mixColor(backColor3, disableColor, 0.3).rgb().toString();
var disableColor04 = mixColor(backColor3, disableColor, 0.4).rgb().toString();
var disableColor05 = mixColor(backColor3, disableColor, 0.5).rgb().toString();
var paletteFromSubject = generate(subjectColor3, {
theme: "dark",
backgroundColor: backColor3
});
var subjectHex = (0, import_color6.default)(subjectColor3).hex().toLowerCase();
var subjectIdx = paletteFromSubject.indexOf(subjectHex);
var deeperSubject = subjectColor3;
if (subjectIdx !== -1) {
deeperSubject = paletteFromSubject[subjectIdx + 1];
}
return {
mainStroke: subjectColor08,
mainFill: subjectColor02,
activeStroke: subjectColor3,
activeFill: subjectColor03,
inactiveStroke: subjectColor08,
inactiveFill: subjectColor02,
selectedStroke: subjectColor3,
selectedFill: subjectColor02,
highlightStroke: subjectColor3,
highlightFill: subjectColor06,
disableStroke: disableColor05,
disableFill: disableColor025,
edgeMainStroke: disableColor,
edgeActiveStroke: subjectColor3,
edgeInactiveStroke: disableColor,
edgeSelectedStroke: subjectColor3,
edgeHighlightStroke: subjectColor3,
edgeDisableStroke: disableColor03,
comboMainStroke: disableColor04,
comboMainFill: disableColor025,
comboActiveStroke: subjectColor3,
comboActiveFill: disableColor02,
comboInactiveStroke: disableColor04,
comboInactiveFill: disableColor025,
comboSelectedStroke: subjectColor3,
comboSelectedFill: disableColor02,
comboHighlightStroke: deeperSubject,
comboHighlightFill: disableColor025,
comboDisableStroke: disableColor04,
comboDisableFill: disableColor02
};
};
var getColorsWithSubjectColor = function getColorsWithSubjectColor2(subjectColor3, backColor3, theme4, disableColor) {
if (backColor3 === void 0) {
backColor3 = "#fff";
}
if (theme4 === void 0) {
theme4 = "default";
}
if (disableColor === void 0) {
disableColor = "rgb(150, 150, 150)";
}
if (theme4 === "default")
return getColorsWithDefaultTheme(subjectColor3, backColor3, "rgb(150, 150, 150)");
return getColorsWithDarkTheme(subjectColor3, backColor3, "#777");
};
var getColorSetsBySubjectColors = function getColorSetsBySubjectColors2(subjectColors, backColor3, theme4, disableColor) {
if (backColor3 === void 0) {
backColor3 = "#fff";
}
if (theme4 === void 0) {
theme4 = "default";
}
if (disableColor === void 0) {
disableColor = "rgb(150, 150, 150)";
}
var sets = [];
subjectColors.forEach(function(sColor) {
sets.push(getColorsWithSubjectColor(sColor, backColor3, theme4, disableColor));
});
return sets;
};
// node_modules/@antv/g6-pc/es/global.js
var subjectColor2 = "rgb(95, 149, 255)";
var backColor2 = "rgb(255, 255, 255)";
var textColor2 = "rgb(0, 0, 0)";
var colorSet2 = getColorsWithSubjectColor(subjectColor2, backColor2);
var global_default2 = {
version: "0.2.4",
rootContainerClassName: "root-container",
nodeContainerClassName: "node-container",
edgeContainerClassName: "edge-container",
comboContainerClassName: "combo-container",
delegateContainerClassName: "delegate-container",
defaultLoopPosition: "top",
nodeLabel: {
style: {
fill: "#000",
fontSize: 12,
textAlign: "center",
textBaseline: "middle"
},
offset: 4
},
defaultNode: {
type: "circle",
style: {
lineWidth: 1,
stroke: colorSet2.mainStroke,
fill: colorSet2.mainFill
},
size: 20,
color: colorSet2.mainStroke,
linkPoints: {
size: 8,
lineWidth: 1,
fill: colorSet2.activeFill,
stroke: colorSet2.activeStroke
}
},
nodeStateStyles: {
active: {
fill: colorSet2.activeFill,
stroke: colorSet2.activeStroke,
lineWidth: 2,
shadowColor: colorSet2.mainStroke,
shadowBlur: 10
},
selected: {
fill: colorSet2.selectedFill,
stroke: colorSet2.selectedStroke,
lineWidth: 4,
shadowColor: colorSet2.selectedStroke,
shadowBlur: 10,
"text-shape": {
fontWeight: 500
}
},
highlight: {
fill: colorSet2.highlightFill,
stroke: colorSet2.highlightStroke,
lineWidth: 2,
"text-shape": {
fontWeight: 500
}
},
inactive: {
fill: colorSet2.inactiveFill,
stroke: colorSet2.inactiveStroke,
lineWidth: 1
},
disable: {
fill: colorSet2.disableFill,
stroke: colorSet2.disableStroke,
lineWidth: 1
}
},
edgeLabel: {
style: {
fill: textColor2,
textAlign: "center",
textBaseline: "middle",
fontSize: 12
}
},
defaultEdge: {
type: "line",
size: 1,
style: {
stroke: colorSet2.edgeMainStroke,
lineAppendWidth: 2
},
color: colorSet2.edgeMainStroke
},
edgeStateStyles: {
active: {
stroke: colorSet2.edgeActiveStroke,
lineWidth: 1
},
selected: {
stroke: colorSet2.edgeSelectedStroke,
lineWidth: 2,
shadowColor: colorSet2.edgeSelectedStroke,
shadowBlur: 10,
"text-shape": {
fontWeight: 500
}
},
highlight: {
stroke: colorSet2.edgeHighlightStroke,
lineWidth: 2,
"text-shape": {
fontWeight: 500
}
},
inactive: {
stroke: colorSet2.edgeInactiveStroke,
lineWidth: 1
},
disable: {
stroke: colorSet2.edgeDisableStroke,
lineWidth: 1
}
},
comboLabel: {
style: {
fill: textColor2,
textBaseline: "middle",
fontSize: 12
},
refY: 10,
refX: 10
},
defaultCombo: {
type: "circle",
style: {
fill: colorSet2.comboMainFill,
lineWidth: 1,
stroke: colorSet2.comboMainStroke,
r: 5,
width: 20,
height: 10
},
size: [20, 5],
color: colorSet2.comboMainStroke,
padding: [25, 20, 15, 20]
},
comboStateStyles: {
active: {
stroke: colorSet2.comboActiveStroke,
lineWidth: 1,
fill: colorSet2.comboActiveFill
},
selected: {
stroke: colorSet2.comboSelectedStroke,
lineWidth: 2,
fill: colorSet2.comboSelectedFill,
shadowColor: colorSet2.comboSelectedStroke,
shadowBlur: 10,
"text-shape": {
fontWeight: 500
}
},
highlight: {
stroke: colorSet2.comboHighlightStroke,
lineWidth: 2,
fill: colorSet2.comboHighlightFill,
"text-shape": {
fontWeight: 500
}
},
inactive: {
stroke: colorSet2.comboInactiveStroke,
fill: colorSet2.comboInactiveFill,
lineWidth: 1
},
disable: {
stroke: colorSet2.comboDisableStroke,
fill: colorSet2.comboDisableFill,
lineWidth: 1
}
},
delegateStyle: {
fill: "#F3F9FF",
fillOpacity: 0.5,
stroke: "#1890FF",
strokeOpacity: 0.9,
lineDash: [5, 5]
},
textWaterMarkerConfig: {
width: 150,
height: 100,
compatible: false,
text: {
x: 0,
y: 60,
lineHeight: 20,
rotate: 20,
fontSize: 14,
fontFamily: "Microsoft YaHei",
fill: "rgba(0, 0, 0, 0.1)",
baseline: "Middle"
}
},
imageWaterMarkerConfig: {
width: 150,
height: 130,
compatible: false,
image: {
x: 0,
y: 0,
width: 30,
height: 20,
rotate: 0
}
},
waterMarkerImage: "https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg"
};
// node_modules/@antv/g6-pc/es/graph/controller/event.js
var cloneEvent3 = util_default.cloneEvent;
var isViewportChanged3 = util_default.isViewportChanged;
var EventController3 = function(_super) {
__extends(EventController4, _super);
function EventController4(graph) {
var _this = _super.call(this, graph) || this;
_this.extendEvents = [];
_this.dragging = false;
_this.preItem = null;
_this.graph = graph;
_this.destroyed = false;
_this.initEvents();
return _this;
}
EventController4.prototype.initEvents = function() {
var _a6 = this, graph = _a6.graph, _b = _a6.extendEvents, extendEvents = _b === void 0 ? [] : _b;
var canvas = graph.get("canvas");
var el = canvas.get("el");
var canvasHandler = wrap_behavior_default(this, "onCanvasEvents");
var originHandler = wrap_behavior_default(this, "onExtendEvents");
var wheelHandler = wrap_behavior_default(this, "onWheelEvent");
canvas.off("*").on("*", canvasHandler);
this.canvasHandler = canvasHandler;
extendEvents.push(addEventListener(el, "DOMMouseScroll", wheelHandler));
extendEvents.push(addEventListener(el, "mousewheel", wheelHandler));
if (typeof window !== "undefined") {
extendEvents.push(addEventListener(window, "keydown", originHandler));
extendEvents.push(addEventListener(window, "keyup", originHandler));
extendEvents.push(addEventListener(window, "focus", originHandler));
}
};
EventController4.getItemRoot = function(shape) {
while (shape && !shape.get("item")) {
shape = shape.get("parent");
}
return shape;
};
EventController4.prototype.onCanvasEvents = function(evt) {
var graph = this.graph;
var canvas = graph.get("canvas");
var target = evt.target;
var eventType = evt.type;
evt.canvasX = evt.x;
evt.canvasY = evt.y;
var point2 = {
x: evt.canvasX,
y: evt.canvasY
};
var group2 = graph.get("group");
var matrix = group2.getMatrix();
if (!matrix) {
matrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
}
if (isViewportChanged3(matrix)) {
point2 = graph.getPointByClient(evt.clientX, evt.clientY);
}
evt.x = point2.x;
evt.y = point2.y;
evt.currentTarget = graph;
if (target === canvas) {
if (eventType === "mousemove") {
this.handleMouseMove(evt, "canvas");
}
evt.target = canvas;
evt.item = null;
graph.emit(eventType, evt);
graph.emit("canvas:" + eventType, evt);
return;
}
var itemShape = EventController4.getItemRoot(target);
if (!itemShape) {
graph.emit(eventType, evt);
return;
}
var item = itemShape.get("item");
if (item.destroyed) {
return;
}
var type2 = item.getType();
evt.target = target;
evt.item = item;
if (evt.canvasX === evt.x && evt.canvasY === evt.y) {
var canvasPoint = graph.getCanvasByPoint(evt.x, evt.y);
evt.canvasX = canvasPoint.x;
evt.canvasY = canvasPoint.y;
}
graph.emit(eventType, evt);
if (evt.name && !evt.name.includes(":"))
graph.emit(type2 + ":" + eventType, evt);
else
graph.emit(evt.name, evt);
if (eventType === "dragstart") {
this.dragging = true;
}
if (eventType === "dragend") {
this.dragging = false;
}
if (eventType === "mousemove") {
this.handleMouseMove(evt, type2);
}
};
EventController4.prototype.onExtendEvents = function(evt) {
this.graph.emit(evt.type, evt);
};
EventController4.prototype.onWheelEvent = function(evt) {
if (is_nil_default(evt.wheelDelta)) {
evt.wheelDelta = -evt.detail;
}
this.graph.emit("wheel", evt);
};
EventController4.prototype.handleMouseMove = function(evt, type2) {
var _a6 = this, graph = _a6.graph, preItem = _a6.preItem;
var canvas = graph.get("canvas");
var item = evt.target === canvas ? null : evt.item;
evt = cloneEvent3(evt);
if (preItem && preItem !== item && !preItem.destroyed) {
evt.item = preItem;
this.emitCustomEvent(preItem.getType(), "mouseleave", evt);
if (this.dragging) {
this.emitCustomEvent(preItem.getType(), "dragleave", evt);
}
}
if (item && preItem !== item) {
evt.item = item;
this.emitCustomEvent(type2, "mouseenter", evt);
if (this.dragging) {
this.emitCustomEvent(type2, "dragenter", evt);
}
}
this.preItem = item;
};
EventController4.prototype.emitCustomEvent = function(itemType, eventType, evt) {
evt.type = eventType;
this.graph.emit(itemType + ":" + eventType, evt);
};
EventController4.prototype.destroy = function() {
var _a6 = this, graph = _a6.graph, canvasHandler = _a6.canvasHandler, extendEvents = _a6.extendEvents;
var canvas = graph.get("canvas");
canvas.off("*", canvasHandler);
each_default(extendEvents, function(event) {
event.remove();
});
this.dragging = false;
this.preItem = null;
this.extendEvents.length = 0;
this.canvasHandler = null;
this.destroyed = true;
};
return EventController4;
}(event_default2);
var event_default3 = EventController3;
// node_modules/@antv/layout/es/layout/base.js
var Base3 = class {
constructor() {
this.nodes = [];
this.edges = [];
this.combos = [];
this.positions = [];
this.destroyed = false;
this.onLayoutEnd = () => {
};
}
layout(data3) {
this.init(data3);
return this.execute(true);
}
init(data3) {
this.nodes = data3.nodes || [];
this.edges = data3.edges || [];
this.combos = data3.combos || [];
}
execute(reloadData) {
}
executeWithWorker() {
}
getDefaultCfg() {
return {};
}
updateCfg(cfg) {
if (cfg) {
Object.assign(this, cfg);
}
}
getType() {
return "base";
}
destroy() {
this.nodes = null;
this.edges = null;
this.combos = null;
this.positions = null;
this.destroyed = true;
}
};
// node_modules/@antv/layout/es/util/string.js
var isString = (val) => typeof val === "string";
var cacheStringFunction = (fn2) => {
const cache3 = Object.create(null);
return (str8) => {
const hit = cache3[str8];
return hit || (cache3[str8] = fn2(str8));
};
};
var camelizeRE = /-(\w)/g;
var camelize = cacheStringFunction((str8) => {
return str8.replace(camelizeRE, (_8, c5) => c5 ? c5.toUpperCase() : "");
});
// node_modules/@antv/layout/es/util/array.js
var isArray2 = Array.isArray;
// node_modules/@antv/layout/es/util/number.js
var isNumber3 = (val) => typeof val === "number";
var isNaN4 = (num) => Number.isNaN(Number(num));
// node_modules/@antv/layout/es/util/object.js
var isObject2 = (val) => val !== null && typeof val === "object";
var clone9 = (target) => {
if (target === null) {
return target;
}
if (target instanceof Date) {
return new Date(target.getTime());
}
if (target instanceof Array) {
const cp = [];
target.forEach((v3) => {
cp.push(v3);
});
return cp.map((n3) => clone9(n3));
}
if (typeof target === "object" && target !== {}) {
const cp = Object.assign({}, target);
Object.keys(cp).forEach((k4) => {
cp[k4] = clone9(cp[k4]);
});
return cp;
}
return target;
};
// node_modules/@antv/layout/es/util/math.js
var getEdgeTerminal = (edge2, type2) => {
const terminal = edge2[type2];
if (isObject2(terminal)) {
return terminal.cell;
}
return terminal;
};
var getDegree3 = (n3, nodeIdxMap, edges) => {
const degrees = [];
for (let i4 = 0; i4 < n3; i4++) {
degrees[i4] = 0;
}
if (!edges)
return degrees;
edges.forEach((e4) => {
const source = getEdgeTerminal(e4, "source");
const target = getEdgeTerminal(e4, "target");
if (source) {
degrees[nodeIdxMap[source]] += 1;
}
if (target) {
degrees[nodeIdxMap[target]] += 1;
}
});
return degrees;
};
var floydWarshall5 = (adjMatrix3) => {
const dist4 = [];
const size2 = adjMatrix3.length;
for (let i4 = 0; i4 < size2; i4 += 1) {
dist4[i4] = [];
for (let j4 = 0; j4 < size2; j4 += 1) {
if (i4 === j4) {
dist4[i4][j4] = 0;
} else if (adjMatrix3[i4][j4] === 0 || !adjMatrix3[i4][j4]) {
dist4[i4][j4] = Infinity;
} else {
dist4[i4][j4] = adjMatrix3[i4][j4];
}
}
}
for (let k4 = 0; k4 < size2; k4 += 1) {
for (let i4 = 0; i4 < size2; i4 += 1) {
for (let j4 = 0; j4 < size2; j4 += 1) {
if (dist4[i4][j4] > dist4[i4][k4] + dist4[k4][j4]) {
dist4[i4][j4] = dist4[i4][k4] + dist4[k4][j4];
}
}
}
}
return dist4;
};
var getAdjMatrix3 = (data3, directed) => {
const { nodes, edges } = data3;
const matrix = [];
const nodeMap = {};
if (!nodes) {
throw new Error("invalid nodes data!");
}
if (nodes) {
nodes.forEach((node, i4) => {
nodeMap[node.id] = i4;
const row = [];
matrix.push(row);
});
}
if (edges) {
edges.forEach((e4) => {
const source = getEdgeTerminal(e4, "source");
const target = getEdgeTerminal(e4, "target");
const sIndex = nodeMap[source];
const tIndex = nodeMap[target];
matrix[sIndex][tIndex] = 1;
if (!directed) {
matrix[tIndex][sIndex] = 1;
}
});
}
return matrix;
};
var scaleMatrix3 = (matrix, ratio) => {
const result = [];
matrix.forEach((row) => {
const newRow = [];
row.forEach((v3) => {
newRow.push(v3 * ratio);
});
result.push(newRow);
});
return result;
};
var traverseUp3 = (data3, fn2) => {
if (data3 && data3.children) {
for (let i4 = data3.children.length - 1; i4 >= 0; i4--) {
if (!traverseUp3(data3.children[i4], fn2))
return;
}
}
if (!fn2(data3)) {
return false;
}
return true;
};
var traverseTreeUp3 = (data3, fn2) => {
if (typeof fn2 !== "function") {
return;
}
traverseUp3(data3, fn2);
};
// node_modules/@antv/layout/es/util/function.js
var isFunction = (val) => typeof val === "function";
// node_modules/@antv/layout/es/registy/index.js
var map5 = new Map();
var registerLayout = (name, layoutOverride) => {
if (map5.get(name)) {
console.warn(`The layout with the name ${name} exists already, it will be overridden`);
}
if (isObject2(layoutOverride)) {
class GLayout extends Base3 {
constructor(cfg) {
super();
const self2 = this;
const props = {};
const defaultCfg2 = self2.getDefaultCfg();
Object.assign(props, defaultCfg2, layoutOverride, cfg);
Object.keys(props).forEach((key) => {
const value2 = props[key];
self2[key] = value2;
});
}
}
map5.set(name, GLayout);
} else {
map5.set(name, layoutOverride);
}
return map5.get(name);
};
// node_modules/@antv/layout/es/layout/grid.js
var GridLayout = class extends Base3 {
constructor(options) {
super();
this.begin = [0, 0];
this.preventOverlap = true;
this.preventOverlapPadding = 10;
this.condense = false;
this.sortBy = "degree";
this.nodeSize = 30;
this.nodes = [];
this.edges = [];
this.width = 300;
this.height = 300;
this.row = 0;
this.col = 0;
this.cellWidth = 0;
this.cellHeight = 0;
this.cellUsed = {};
this.id2manPos = {};
this.onLayoutEnd = () => {
};
this.updateCfg(options);
}
getDefaultCfg() {
return {
begin: [0, 0],
preventOverlap: true,
preventOverlapPadding: 10,
condense: false,
rows: void 0,
cols: void 0,
position: void 0,
sortBy: "degree",
nodeSize: 30
};
}
execute() {
const self2 = this;
const nodes = self2.nodes;
const edges = self2.edges;
const n3 = nodes.length;
const begin = self2.begin;
if (n3 === 0) {
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return {
nodes,
edges
};
}
if (n3 === 1) {
nodes[0].x = begin[0];
nodes[0].y = begin[1];
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return {
nodes,
edges
};
}
const layoutNodes2 = [];
nodes.forEach((node) => {
layoutNodes2.push(node);
});
const nodeIdxMap = {};
layoutNodes2.forEach((node, i4) => {
nodeIdxMap[node.id] = i4;
});
if (self2.sortBy === "degree" || !isString(self2.sortBy) || layoutNodes2[0][self2.sortBy] === void 0) {
self2.sortBy = "degree";
if (isNaN4(nodes[0].degree)) {
const values2 = getDegree3(layoutNodes2.length, nodeIdxMap, edges);
layoutNodes2.forEach((node, i4) => {
node.degree = values2[i4];
});
}
}
layoutNodes2.sort((n1, n22) => n22[self2.sortBy] - n1[self2.sortBy]);
if (!self2.width && typeof window !== "undefined") {
self2.width = window.innerWidth;
}
if (!self2.height && typeof window !== "undefined") {
self2.height = window.innerHeight;
}
const oRows = self2.rows;
const oCols = self2.cols != null ? self2.cols : self2.columns;
self2.cells = n3;
if (oRows != null && oCols != null) {
self2.rows = oRows;
self2.cols = oCols;
} else if (oRows != null && oCols == null) {
self2.rows = oRows;
self2.cols = Math.ceil(self2.cells / self2.rows);
} else if (oRows == null && oCols != null) {
self2.cols = oCols;
self2.rows = Math.ceil(self2.cells / self2.cols);
} else {
self2.splits = Math.sqrt(self2.cells * self2.height / self2.width);
self2.rows = Math.round(self2.splits);
self2.cols = Math.round(self2.width / self2.height * self2.splits);
}
if (self2.cols * self2.rows > self2.cells) {
const sm = self2.small();
const lg = self2.large();
if ((sm - 1) * lg >= self2.cells) {
self2.small(sm - 1);
} else if ((lg - 1) * sm >= self2.cells) {
self2.large(lg - 1);
}
} else {
while (self2.cols * self2.rows < self2.cells) {
const sm = self2.small();
const lg = self2.large();
if ((lg + 1) * sm >= self2.cells) {
self2.large(lg + 1);
} else {
self2.small(sm + 1);
}
}
}
self2.cellWidth = self2.width / self2.cols;
self2.cellHeight = self2.height / self2.rows;
if (self2.condense) {
self2.cellWidth = 0;
self2.cellHeight = 0;
}
if (self2.preventOverlap) {
layoutNodes2.forEach((node) => {
if (!node.x || !node.y) {
node.x = 0;
node.y = 0;
}
let nodew;
let nodeh;
if (isArray2(node.size)) {
nodew = node.size[0];
nodeh = node.size[1];
} else if (isNumber3(node.size)) {
nodew = node.size;
nodeh = node.size;
} else if (isObject2(node.size)) {
nodew = node.size.width;
nodeh = node.size.height;
}
if (nodew === void 0 || nodeh === void 0) {
if (isArray2(self2.nodeSize)) {
nodew = self2.nodeSize[0];
nodeh = self2.nodeSize[1];
} else if (isNumber3(self2.nodeSize)) {
nodew = self2.nodeSize;
nodeh = self2.nodeSize;
} else {
nodew = 30;
nodeh = 30;
}
}
const p4 = self2.preventOverlapPadding;
const w4 = nodew + p4;
const h3 = nodeh + p4;
self2.cellWidth = Math.max(self2.cellWidth, w4);
self2.cellHeight = Math.max(self2.cellHeight, h3);
});
}
self2.cellUsed = {};
self2.row = 0;
self2.col = 0;
self2.id2manPos = {};
for (let i4 = 0; i4 < layoutNodes2.length; i4++) {
const node = layoutNodes2[i4];
let rcPos;
if (self2.position) {
rcPos = self2.position(node);
}
if (rcPos && (rcPos.row !== void 0 || rcPos.col !== void 0)) {
const pos = {
row: rcPos.row,
col: rcPos.col
};
if (pos.col === void 0) {
pos.col = 0;
while (self2.used(pos.row, pos.col)) {
pos.col++;
}
} else if (pos.row === void 0) {
pos.row = 0;
while (self2.used(pos.row, pos.col)) {
pos.row++;
}
}
self2.id2manPos[node.id] = pos;
self2.use(pos.row, pos.col);
}
self2.getPos(node);
}
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return {
edges,
nodes: layoutNodes2
};
}
small(val) {
const self2 = this;
let res;
const rows = self2.rows || 5;
const cols = self2.cols || 5;
if (val == null) {
res = Math.min(rows, cols);
} else {
const min7 = Math.min(rows, cols);
if (min7 === self2.rows) {
self2.rows = val;
} else {
self2.cols = val;
}
}
return res;
}
large(val) {
const self2 = this;
let res;
const rows = self2.rows || 5;
const cols = self2.cols || 5;
if (val == null) {
res = Math.max(rows, cols);
} else {
const max8 = Math.max(rows, cols);
if (max8 === self2.rows) {
self2.rows = val;
} else {
self2.cols = val;
}
}
return res;
}
used(row, col) {
const self2 = this;
return self2.cellUsed[`c-${row}-${col}`] || false;
}
use(row, col) {
const self2 = this;
self2.cellUsed[`c-${row}-${col}`] = true;
}
moveToNextCell() {
const self2 = this;
const cols = self2.cols || 5;
self2.col++;
if (self2.col >= cols) {
self2.col = 0;
self2.row++;
}
}
getPos(node) {
const self2 = this;
const begin = self2.begin;
const cellWidth = self2.cellWidth;
const cellHeight = self2.cellHeight;
let x6;
let y5;
const rcPos = self2.id2manPos[node.id];
if (rcPos) {
x6 = rcPos.col * cellWidth + cellWidth / 2 + begin[0];
y5 = rcPos.row * cellHeight + cellHeight / 2 + begin[1];
} else {
while (self2.used(self2.row, self2.col)) {
self2.moveToNextCell();
}
x6 = self2.col * cellWidth + cellWidth / 2 + begin[0];
y5 = self2.row * cellHeight + cellHeight / 2 + begin[1];
self2.use(self2.row, self2.col);
self2.moveToNextCell();
}
node.x = x6;
node.y = y5;
}
getType() {
return "grid";
}
};
// node_modules/@antv/layout/es/layout/random.js
var RandomLayout = class extends Base3 {
constructor(options) {
super();
this.center = [0, 0];
this.width = 300;
this.height = 300;
this.nodes = [];
this.edges = [];
this.onLayoutEnd = () => {
};
this.updateCfg(options);
}
getDefaultCfg() {
return {
center: [0, 0],
width: 300,
height: 300
};
}
execute() {
const self2 = this;
const nodes = self2.nodes;
const layoutScale = 0.9;
const center2 = self2.center;
if (!self2.width && typeof window !== "undefined") {
self2.width = window.innerWidth;
}
if (!self2.height && typeof window !== "undefined") {
self2.height = window.innerHeight;
}
if (nodes) {
nodes.forEach((node) => {
node.x = (Math.random() - 0.5) * layoutScale * self2.width + center2[0];
node.y = (Math.random() - 0.5) * layoutScale * self2.height + center2[1];
});
}
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return {
nodes,
edges: this.edges
};
}
getType() {
return "random";
}
};
// node_modules/@antv/layout/es/layout/gForce.js
var proccessToFunc = (value2, defaultV) => {
let func;
if (!value2) {
func = (d3) => {
return defaultV || 1;
};
} else if (isNumber3(value2)) {
func = (d3) => {
return value2;
};
} else {
func = value2;
}
return func;
};
var GForceLayout = class extends Base3 {
constructor(options) {
super();
this.maxIteration = 1e3;
this.workerEnabled = false;
this.edgeStrength = 200;
this.nodeStrength = 1e3;
this.coulombDisScale = 5e-3;
this.damping = 0.9;
this.maxSpeed = 1e3;
this.minMovement = 0.5;
this.interval = 0.02;
this.factor = 1;
this.linkDistance = 1;
this.gravity = 10;
this.preventOverlap = true;
this.tick = () => {
};
this.nodes = [];
this.edges = [];
this.width = 300;
this.height = 300;
this.nodeMap = {};
this.nodeIdxMap = {};
this.updateCfg(options);
}
getDefaultCfg() {
return {
maxIteration: 500,
gravity: 10,
enableTick: true
};
}
execute() {
var _a6, _b;
const self2 = this;
const nodes = self2.nodes;
if (self2.timeInterval !== void 0 && typeof window !== "undefined") {
window.clearInterval(self2.timeInterval);
}
if (!nodes || nodes.length === 0) {
(_a6 = self2.onLayoutEnd) === null || _a6 === void 0 ? void 0 : _a6.call(self2);
return;
}
if (!self2.width && typeof window !== "undefined") {
self2.width = window.innerWidth;
}
if (!self2.height && typeof window !== "undefined") {
self2.height = window.innerHeight;
}
if (!self2.center) {
self2.center = [self2.width / 2, self2.height / 2];
}
const center2 = self2.center;
if (nodes.length === 1) {
nodes[0].x = center2[0];
nodes[0].y = center2[1];
(_b = self2.onLayoutEnd) === null || _b === void 0 ? void 0 : _b.call(self2);
return;
}
const nodeMap = {};
const nodeIdxMap = {};
nodes.forEach((node, i4) => {
if (!isNumber3(node.x))
node.x = Math.random() * self2.width;
if (!isNumber3(node.y))
node.y = Math.random() * self2.height;
nodeMap[node.id] = node;
nodeIdxMap[node.id] = i4;
});
self2.nodeMap = nodeMap;
self2.nodeIdxMap = nodeIdxMap;
self2.linkDistance = proccessToFunc(self2.linkDistance, 1);
self2.nodeStrength = proccessToFunc(self2.nodeStrength, 1);
self2.edgeStrength = proccessToFunc(self2.edgeStrength, 1);
const nodeSize = self2.nodeSize;
let nodeSizeFunc;
if (self2.preventOverlap) {
const nodeSpacing = self2.nodeSpacing;
let nodeSpacingFunc;
if (isNumber3(nodeSpacing)) {
nodeSpacingFunc = () => nodeSpacing;
} else if (isFunction(nodeSpacing)) {
nodeSpacingFunc = nodeSpacing;
} else {
nodeSpacingFunc = () => 0;
}
if (!nodeSize) {
nodeSizeFunc = (d3) => {
if (d3.size) {
if (isArray2(d3.size)) {
const res = d3.size[0] > d3.size[1] ? d3.size[0] : d3.size[1];
return res + nodeSpacingFunc(d3);
}
if (isObject2(d3.size)) {
const res = d3.size.width > d3.size.height ? d3.size.width : d3.size.height;
return res + nodeSpacingFunc(d3);
}
return d3.size + nodeSpacingFunc(d3);
}
return 10 + nodeSpacingFunc(d3);
};
} else if (isArray2(nodeSize)) {
nodeSizeFunc = (d3) => {
const res = nodeSize[0] > nodeSize[1] ? nodeSize[0] : nodeSize[1];
return res + nodeSpacingFunc(d3);
};
} else {
nodeSizeFunc = (d3) => nodeSize + nodeSpacingFunc(d3);
}
}
self2.nodeSize = nodeSizeFunc;
const edges = self2.edges;
self2.degrees = getDegree3(nodes.length, self2.nodeIdxMap, edges);
if (!self2.getMass) {
self2.getMass = (d3) => {
const mass = self2.degrees[self2.nodeIdxMap[d3.id]] || 1;
return mass;
};
}
self2.run();
}
run() {
var _a6;
const self2 = this;
const { maxIteration, nodes, workerEnabled, minMovement } = self2;
if (!nodes)
return;
if (workerEnabled) {
for (let i4 = 0; i4 < maxIteration; i4++) {
const previousPos = self2.runOneStep(i4);
if (self2.reachMoveThreshold(nodes, previousPos, minMovement)) {
break;
}
}
(_a6 = self2.onLayoutEnd) === null || _a6 === void 0 ? void 0 : _a6.call(self2);
} else {
if (typeof window === "undefined")
return;
let iter = 0;
this.timeInterval = window.setInterval(() => {
var _a7, _b;
if (!nodes)
return;
const previousPos = self2.runOneStep(iter) || [];
if (self2.reachMoveThreshold(nodes, previousPos, minMovement)) {
(_a7 = self2.onLayoutEnd) === null || _a7 === void 0 ? void 0 : _a7.call(self2);
window.clearInterval(self2.timeInterval);
}
iter++;
if (iter >= maxIteration) {
(_b = self2.onLayoutEnd) === null || _b === void 0 ? void 0 : _b.call(self2);
window.clearInterval(self2.timeInterval);
}
}, 0);
}
}
reachMoveThreshold(nodes, previousPos, minMovement) {
let movement = 0;
nodes.forEach((node, j4) => {
const vx = node.x - previousPos[j4].x;
const vy = node.y - previousPos[j4].y;
movement += Math.sqrt(vx * vx + vy * vy);
});
movement /= nodes.length;
return movement < minMovement;
}
runOneStep(iter) {
var _a6;
const self2 = this;
const { nodes, edges } = self2;
const accArray = [];
const velArray = [];
if (!nodes)
return;
nodes.forEach((_8, i4) => {
accArray[2 * i4] = 0;
accArray[2 * i4 + 1] = 0;
velArray[2 * i4] = 0;
velArray[2 * i4 + 1] = 0;
});
self2.calRepulsive(accArray, nodes);
if (edges)
self2.calAttractive(accArray, edges);
self2.calGravity(accArray, nodes);
const stepInterval = Math.max(0.02, self2.interval - iter * 2e-3);
self2.updateVelocity(accArray, velArray, stepInterval, nodes);
const previousPos = [];
nodes.forEach((node) => {
previousPos.push({
x: node.x,
y: node.y
});
});
self2.updatePosition(velArray, stepInterval, nodes);
(_a6 = self2.tick) === null || _a6 === void 0 ? void 0 : _a6.call(self2);
return previousPos;
}
calRepulsive(accArray, nodes) {
const self2 = this;
const getMass = self2.getMass;
const nodeStrength = self2.nodeStrength;
const factor = self2.factor;
const coulombDisScale = self2.coulombDisScale;
const preventOverlap = self2.preventOverlap;
const nodeSize = self2.nodeSize;
nodes.forEach((ni, i4) => {
const massi = getMass ? getMass(ni) : 1;
nodes.forEach((nj, j4) => {
if (i4 >= j4)
return;
const vecX = ni.x - nj.x;
const vecY = ni.y - nj.y;
const vecLength = Math.sqrt(vecX * vecX + vecY * vecY) + 0.01;
const nVecLength = (vecLength + 0.1) * coulombDisScale;
const direX = vecX / vecLength;
const direY = vecY / vecLength;
const param = (nodeStrength(ni) + nodeStrength(nj)) / 2 * factor / (nVecLength * nVecLength);
const massj = getMass ? getMass(nj) : 1;
accArray[2 * i4] += direX * param;
accArray[2 * i4 + 1] += direY * param;
accArray[2 * j4] -= direX * param;
accArray[2 * j4 + 1] -= direY * param;
if (preventOverlap && vecLength < (nodeSize(ni) + nodeSize(nj)) / 2) {
const paramOverlap = (nodeStrength(ni) + nodeStrength(nj)) / 2 / (vecLength * vecLength);
accArray[2 * i4] += direX * paramOverlap / massi;
accArray[2 * i4 + 1] += direY * paramOverlap / massi;
accArray[2 * j4] -= direX * paramOverlap / massj;
accArray[2 * j4 + 1] -= direY * paramOverlap / massj;
}
});
});
}
calAttractive(accArray, edges) {
const self2 = this;
const nodeMap = self2.nodeMap;
const nodeIdxMap = self2.nodeIdxMap;
const linkDistance = self2.linkDistance;
const edgeStrength = self2.edgeStrength;
const getMass = self2.getMass;
edges.forEach((edge2, i4) => {
const source = getEdgeTerminal(edge2, "source");
const target = getEdgeTerminal(edge2, "target");
const sourceNode = nodeMap[source];
const targetNode = nodeMap[target];
const vecX = targetNode.x - sourceNode.x;
const vecY = targetNode.y - sourceNode.y;
const vecLength = Math.sqrt(vecX * vecX + vecY * vecY) + 0.01;
const direX = vecX / vecLength;
const direY = vecY / vecLength;
const length5 = linkDistance(edge2) || 1;
const diff2 = length5 - vecLength;
const param = diff2 * edgeStrength(edge2);
const sourceIdx = nodeIdxMap[source];
const targetIdx = nodeIdxMap[target];
const massSource = getMass ? getMass(sourceNode) : 1;
const massTarget = getMass ? getMass(targetNode) : 1;
accArray[2 * sourceIdx] -= direX * param / massSource;
accArray[2 * sourceIdx + 1] -= direY * param / massSource;
accArray[2 * targetIdx] += direX * param / massTarget;
accArray[2 * targetIdx + 1] += direY * param / massTarget;
});
}
calGravity(accArray, nodes) {
const self2 = this;
const center2 = self2.center;
const defaultGravity = self2.gravity;
const degrees = self2.degrees;
const nodeLength = nodes.length;
for (let i4 = 0; i4 < nodeLength; i4++) {
const node = nodes[i4];
let vecX = node.x - center2[0];
let vecY = node.y - center2[1];
let gravity = defaultGravity;
if (self2.getCenter) {
const customCenterOpt = self2.getCenter(node, degrees[i4]);
if (customCenterOpt && isNumber3(customCenterOpt[0]) && isNumber3(customCenterOpt[1]) && isNumber3(customCenterOpt[2])) {
vecX = node.x - customCenterOpt[0];
vecY = node.y - customCenterOpt[1];
gravity = customCenterOpt[2];
}
}
if (!gravity)
continue;
accArray[2 * i4] -= gravity * vecX;
accArray[2 * i4 + 1] -= gravity * vecY;
}
}
updateVelocity(accArray, velArray, stepInterval, nodes) {
const self2 = this;
const param = stepInterval * self2.damping;
nodes.forEach((node, i4) => {
let vx = accArray[2 * i4] * param || 0.01;
let vy = accArray[2 * i4 + 1] * param || 0.01;
const vLength = Math.sqrt(vx * vx + vy * vy);
if (vLength > self2.maxSpeed) {
const param2 = self2.maxSpeed / vLength;
vx = param2 * vx;
vy = param2 * vy;
}
velArray[2 * i4] = vx;
velArray[2 * i4 + 1] = vy;
});
}
updatePosition(velArray, stepInterval, nodes) {
nodes.forEach((node, i4) => {
if (isNumber3(node.fx) && isNumber3(node.fy)) {
node.x = node.fx;
node.y = node.fy;
return;
}
const distX = velArray[2 * i4] * stepInterval;
const distY = velArray[2 * i4 + 1] * stepInterval;
node.x += distX;
node.y += distY;
});
}
stop() {
if (this.timeInterval && typeof window !== "undefined") {
window.clearInterval(this.timeInterval);
}
}
destroy() {
const self2 = this;
self2.stop();
self2.tick = null;
self2.nodes = null;
self2.edges = null;
self2.destroyed = true;
}
getType() {
return "gForce";
}
};
// node_modules/d3-force/src/center.js
function center_default(x6, y5) {
var nodes, strength = 1;
if (x6 == null)
x6 = 0;
if (y5 == null)
y5 = 0;
function force() {
var i4, n3 = nodes.length, node, sx = 0, sy = 0;
for (i4 = 0; i4 < n3; ++i4) {
node = nodes[i4], sx += node.x, sy += node.y;
}
for (sx = (sx / n3 - x6) * strength, sy = (sy / n3 - y5) * strength, i4 = 0; i4 < n3; ++i4) {
node = nodes[i4], node.x -= sx, node.y -= sy;
}
}
force.initialize = function(_8) {
nodes = _8;
};
force.x = function(_8) {
return arguments.length ? (x6 = +_8, force) : x6;
};
force.y = function(_8) {
return arguments.length ? (y5 = +_8, force) : y5;
};
force.strength = function(_8) {
return arguments.length ? (strength = +_8, force) : strength;
};
return force;
}
// node_modules/d3-quadtree/src/add.js
function add_default(d3) {
const x6 = +this._x.call(null, d3), y5 = +this._y.call(null, d3);
return add7(this.cover(x6, y5), x6, y5, d3);
}
function add7(tree, x6, y5, d3) {
if (isNaN(x6) || isNaN(y5))
return tree;
var parent, node = tree._root, leaf = { data: d3 }, x0 = tree._x0, y0 = tree._y0, x1 = tree._x1, y1 = tree._y1, xm, ym, xp, yp, right2, bottom, i4, j4;
if (!node)
return tree._root = leaf, tree;
while (node.length) {
if (right2 = x6 >= (xm = (x0 + x1) / 2))
x0 = xm;
else
x1 = xm;
if (bottom = y5 >= (ym = (y0 + y1) / 2))
y0 = ym;
else
y1 = ym;
if (parent = node, !(node = node[i4 = bottom << 1 | right2]))
return parent[i4] = leaf, tree;
}
xp = +tree._x.call(null, node.data);
yp = +tree._y.call(null, node.data);
if (x6 === xp && y5 === yp)
return leaf.next = node, parent ? parent[i4] = leaf : tree._root = leaf, tree;
do {
parent = parent ? parent[i4] = new Array(4) : tree._root = new Array(4);
if (right2 = x6 >= (xm = (x0 + x1) / 2))
x0 = xm;
else
x1 = xm;
if (bottom = y5 >= (ym = (y0 + y1) / 2))
y0 = ym;
else
y1 = ym;
} while ((i4 = bottom << 1 | right2) === (j4 = (yp >= ym) << 1 | xp >= xm));
return parent[j4] = node, parent[i4] = leaf, tree;
}
function addAll(data3) {
var d3, i4, n3 = data3.length, x6, y5, xz = new Array(n3), yz = new Array(n3), x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;
for (i4 = 0; i4 < n3; ++i4) {
if (isNaN(x6 = +this._x.call(null, d3 = data3[i4])) || isNaN(y5 = +this._y.call(null, d3)))
continue;
xz[i4] = x6;
yz[i4] = y5;
if (x6 < x0)
x0 = x6;
if (x6 > x1)
x1 = x6;
if (y5 < y0)
y0 = y5;
if (y5 > y1)
y1 = y5;
}
if (x0 > x1 || y0 > y1)
return this;
this.cover(x0, y0).cover(x1, y1);
for (i4 = 0; i4 < n3; ++i4) {
add7(this, xz[i4], yz[i4], data3[i4]);
}
return this;
}
// node_modules/d3-quadtree/src/cover.js
function cover_default(x6, y5) {
if (isNaN(x6 = +x6) || isNaN(y5 = +y5))
return this;
var x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1;
if (isNaN(x0)) {
x1 = (x0 = Math.floor(x6)) + 1;
y1 = (y0 = Math.floor(y5)) + 1;
} else {
var z3 = x1 - x0 || 1, node = this._root, parent, i4;
while (x0 > x6 || x6 >= x1 || y0 > y5 || y5 >= y1) {
i4 = (y5 < y0) << 1 | x6 < x0;
parent = new Array(4), parent[i4] = node, node = parent, z3 *= 2;
switch (i4) {
case 0:
x1 = x0 + z3, y1 = y0 + z3;
break;
case 1:
x0 = x1 - z3, y1 = y0 + z3;
break;
case 2:
x1 = x0 + z3, y0 = y1 - z3;
break;
case 3:
x0 = x1 - z3, y0 = y1 - z3;
break;
}
}
if (this._root && this._root.length)
this._root = node;
}
this._x0 = x0;
this._y0 = y0;
this._x1 = x1;
this._y1 = y1;
return this;
}
// node_modules/d3-quadtree/src/data.js
function data_default() {
var data3 = [];
this.visit(function(node) {
if (!node.length)
do
data3.push(node.data);
while (node = node.next);
});
return data3;
}
// node_modules/d3-quadtree/src/extent.js
function extent_default(_8) {
return arguments.length ? this.cover(+_8[0][0], +_8[0][1]).cover(+_8[1][0], +_8[1][1]) : isNaN(this._x0) ? void 0 : [[this._x0, this._y0], [this._x1, this._y1]];
}
// node_modules/d3-quadtree/src/quad.js
function quad_default(node, x0, y0, x1, y1) {
this.node = node;
this.x0 = x0;
this.y0 = y0;
this.x1 = x1;
this.y1 = y1;
}
// node_modules/d3-quadtree/src/find.js
function find_default3(x6, y5, radius) {
var data3, x0 = this._x0, y0 = this._y0, x1, y1, x22, y22, x32 = this._x1, y32 = this._y1, quads = [], node = this._root, q4, i4;
if (node)
quads.push(new quad_default(node, x0, y0, x32, y32));
if (radius == null)
radius = Infinity;
else {
x0 = x6 - radius, y0 = y5 - radius;
x32 = x6 + radius, y32 = y5 + radius;
radius *= radius;
}
while (q4 = quads.pop()) {
if (!(node = q4.node) || (x1 = q4.x0) > x32 || (y1 = q4.y0) > y32 || (x22 = q4.x1) < x0 || (y22 = q4.y1) < y0)
continue;
if (node.length) {
var xm = (x1 + x22) / 2, ym = (y1 + y22) / 2;
quads.push(new quad_default(node[3], xm, ym, x22, y22), new quad_default(node[2], x1, ym, xm, y22), new quad_default(node[1], xm, y1, x22, ym), new quad_default(node[0], x1, y1, xm, ym));
if (i4 = (y5 >= ym) << 1 | x6 >= xm) {
q4 = quads[quads.length - 1];
quads[quads.length - 1] = quads[quads.length - 1 - i4];
quads[quads.length - 1 - i4] = q4;
}
} else {
var dx = x6 - +this._x.call(null, node.data), dy = y5 - +this._y.call(null, node.data), d22 = dx * dx + dy * dy;
if (d22 < radius) {
var d3 = Math.sqrt(radius = d22);
x0 = x6 - d3, y0 = y5 - d3;
x32 = x6 + d3, y32 = y5 + d3;
data3 = node.data;
}
}
}
return data3;
}
// node_modules/d3-quadtree/src/remove.js
function remove_default2(d3) {
if (isNaN(x6 = +this._x.call(null, d3)) || isNaN(y5 = +this._y.call(null, d3)))
return this;
var parent, node = this._root, retainer, previous, next, x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1, x6, y5, xm, ym, right2, bottom, i4, j4;
if (!node)
return this;
if (node.length)
while (true) {
if (right2 = x6 >= (xm = (x0 + x1) / 2))
x0 = xm;
else
x1 = xm;
if (bottom = y5 >= (ym = (y0 + y1) / 2))
y0 = ym;
else
y1 = ym;
if (!(parent = node, node = node[i4 = bottom << 1 | right2]))
return this;
if (!node.length)
break;
if (parent[i4 + 1 & 3] || parent[i4 + 2 & 3] || parent[i4 + 3 & 3])
retainer = parent, j4 = i4;
}
while (node.data !== d3)
if (!(previous = node, node = node.next))
return this;
if (next = node.next)
delete node.next;
if (previous)
return next ? previous.next = next : delete previous.next, this;
if (!parent)
return this._root = next, this;
next ? parent[i4] = next : delete parent[i4];
if ((node = parent[0] || parent[1] || parent[2] || parent[3]) && node === (parent[3] || parent[2] || parent[1] || parent[0]) && !node.length) {
if (retainer)
retainer[j4] = node;
else
this._root = node;
}
return this;
}
function removeAll(data3) {
for (var i4 = 0, n3 = data3.length; i4 < n3; ++i4)
this.remove(data3[i4]);
return this;
}
// node_modules/d3-quadtree/src/root.js
function root_default() {
return this._root;
}
// node_modules/d3-quadtree/src/size.js
function size_default2() {
var size2 = 0;
this.visit(function(node) {
if (!node.length)
do
++size2;
while (node = node.next);
});
return size2;
}
// node_modules/d3-quadtree/src/visit.js
function visit_default(callback) {
var quads = [], q4, node = this._root, child, x0, y0, x1, y1;
if (node)
quads.push(new quad_default(node, this._x0, this._y0, this._x1, this._y1));
while (q4 = quads.pop()) {
if (!callback(node = q4.node, x0 = q4.x0, y0 = q4.y0, x1 = q4.x1, y1 = q4.y1) && node.length) {
var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
if (child = node[3])
quads.push(new quad_default(child, xm, ym, x1, y1));
if (child = node[2])
quads.push(new quad_default(child, x0, ym, xm, y1));
if (child = node[1])
quads.push(new quad_default(child, xm, y0, x1, ym));
if (child = node[0])
quads.push(new quad_default(child, x0, y0, xm, ym));
}
}
return this;
}
// node_modules/d3-quadtree/src/visitAfter.js
function visitAfter_default(callback) {
var quads = [], next = [], q4;
if (this._root)
quads.push(new quad_default(this._root, this._x0, this._y0, this._x1, this._y1));
while (q4 = quads.pop()) {
var node = q4.node;
if (node.length) {
var child, x0 = q4.x0, y0 = q4.y0, x1 = q4.x1, y1 = q4.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
if (child = node[0])
quads.push(new quad_default(child, x0, y0, xm, ym));
if (child = node[1])
quads.push(new quad_default(child, xm, y0, x1, ym));
if (child = node[2])
quads.push(new quad_default(child, x0, ym, xm, y1));
if (child = node[3])
quads.push(new quad_default(child, xm, ym, x1, y1));
}
next.push(q4);
}
while (q4 = next.pop()) {
callback(q4.node, q4.x0, q4.y0, q4.x1, q4.y1);
}
return this;
}
// node_modules/d3-quadtree/src/x.js
function defaultX(d3) {
return d3[0];
}
function x_default(_8) {
return arguments.length ? (this._x = _8, this) : this._x;
}
// node_modules/d3-quadtree/src/y.js
function defaultY(d3) {
return d3[1];
}
function y_default(_8) {
return arguments.length ? (this._y = _8, this) : this._y;
}
// node_modules/d3-quadtree/src/quadtree.js
function quadtree(nodes, x6, y5) {
var tree = new Quadtree(x6 == null ? defaultX : x6, y5 == null ? defaultY : y5, NaN, NaN, NaN, NaN);
return nodes == null ? tree : tree.addAll(nodes);
}
function Quadtree(x6, y5, x0, y0, x1, y1) {
this._x = x6;
this._y = y5;
this._x0 = x0;
this._y0 = y0;
this._x1 = x1;
this._y1 = y1;
this._root = void 0;
}
function leaf_copy(leaf) {
var copy8 = { data: leaf.data }, next = copy8;
while (leaf = leaf.next)
next = next.next = { data: leaf.data };
return copy8;
}
var treeProto = quadtree.prototype = Quadtree.prototype;
treeProto.copy = function() {
var copy8 = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), node = this._root, nodes, child;
if (!node)
return copy8;
if (!node.length)
return copy8._root = leaf_copy(node), copy8;
nodes = [{ source: node, target: copy8._root = new Array(4) }];
while (node = nodes.pop()) {
for (var i4 = 0; i4 < 4; ++i4) {
if (child = node.source[i4]) {
if (child.length)
nodes.push({ source: child, target: node.target[i4] = new Array(4) });
else
node.target[i4] = leaf_copy(child);
}
}
}
return copy8;
};
treeProto.add = add_default;
treeProto.addAll = addAll;
treeProto.cover = cover_default;
treeProto.data = data_default;
treeProto.extent = extent_default;
treeProto.find = find_default3;
treeProto.remove = remove_default2;
treeProto.removeAll = removeAll;
treeProto.root = root_default;
treeProto.size = size_default2;
treeProto.visit = visit_default;
treeProto.visitAfter = visitAfter_default;
treeProto.x = x_default;
treeProto.y = y_default;
// node_modules/d3-force/src/constant.js
function constant_default3(x6) {
return function() {
return x6;
};
}
// node_modules/d3-force/src/jiggle.js
function jiggle_default(random5) {
return (random5() - 0.5) * 1e-6;
}
// node_modules/d3-force/src/collide.js
function x4(d3) {
return d3.x + d3.vx;
}
function y3(d3) {
return d3.y + d3.vy;
}
function collide_default(radius) {
var nodes, radii, random5, strength = 1, iterations = 1;
if (typeof radius !== "function")
radius = constant_default3(radius == null ? 1 : +radius);
function force() {
var i4, n3 = nodes.length, tree, node, xi, yi, ri, ri2;
for (var k4 = 0; k4 < iterations; ++k4) {
tree = quadtree(nodes, x4, y3).visitAfter(prepare);
for (i4 = 0; i4 < n3; ++i4) {
node = nodes[i4];
ri = radii[node.index], ri2 = ri * ri;
xi = node.x + node.vx;
yi = node.y + node.vy;
tree.visit(apply);
}
}
function apply(quad, x0, y0, x1, y1) {
var data3 = quad.data, rj = quad.r, r4 = ri + rj;
if (data3) {
if (data3.index > node.index) {
var x6 = xi - data3.x - data3.vx, y5 = yi - data3.y - data3.vy, l4 = x6 * x6 + y5 * y5;
if (l4 < r4 * r4) {
if (x6 === 0)
x6 = jiggle_default(random5), l4 += x6 * x6;
if (y5 === 0)
y5 = jiggle_default(random5), l4 += y5 * y5;
l4 = (r4 - (l4 = Math.sqrt(l4))) / l4 * strength;
node.vx += (x6 *= l4) * (r4 = (rj *= rj) / (ri2 + rj));
node.vy += (y5 *= l4) * r4;
data3.vx -= x6 * (r4 = 1 - r4);
data3.vy -= y5 * r4;
}
}
return;
}
return x0 > xi + r4 || x1 < xi - r4 || y0 > yi + r4 || y1 < yi - r4;
}
}
function prepare(quad) {
if (quad.data)
return quad.r = radii[quad.data.index];
for (var i4 = quad.r = 0; i4 < 4; ++i4) {
if (quad[i4] && quad[i4].r > quad.r) {
quad.r = quad[i4].r;
}
}
}
function initialize() {
if (!nodes)
return;
var i4, n3 = nodes.length, node;
radii = new Array(n3);
for (i4 = 0; i4 < n3; ++i4)
node = nodes[i4], radii[node.index] = +radius(node, i4, nodes);
}
force.initialize = function(_nodes, _random) {
nodes = _nodes;
random5 = _random;
initialize();
};
force.iterations = function(_8) {
return arguments.length ? (iterations = +_8, force) : iterations;
};
force.strength = function(_8) {
return arguments.length ? (strength = +_8, force) : strength;
};
force.radius = function(_8) {
return arguments.length ? (radius = typeof _8 === "function" ? _8 : constant_default3(+_8), initialize(), force) : radius;
};
return force;
}
// node_modules/d3-force/src/link.js
function index(d3) {
return d3.index;
}
function find3(nodeById, nodeId) {
var node = nodeById.get(nodeId);
if (!node)
throw new Error("node not found: " + nodeId);
return node;
}
function link_default(links) {
var id = index, strength = defaultStrength, strengths, distance15 = constant_default3(30), distances, nodes, count2, bias, random5, iterations = 1;
if (links == null)
links = [];
function defaultStrength(link) {
return 1 / Math.min(count2[link.source.index], count2[link.target.index]);
}
function force(alpha) {
for (var k4 = 0, n3 = links.length; k4 < iterations; ++k4) {
for (var i4 = 0, link, source, target, x6, y5, l4, b10; i4 < n3; ++i4) {
link = links[i4], source = link.source, target = link.target;
x6 = target.x + target.vx - source.x - source.vx || jiggle_default(random5);
y5 = target.y + target.vy - source.y - source.vy || jiggle_default(random5);
l4 = Math.sqrt(x6 * x6 + y5 * y5);
l4 = (l4 - distances[i4]) / l4 * alpha * strengths[i4];
x6 *= l4, y5 *= l4;
target.vx -= x6 * (b10 = bias[i4]);
target.vy -= y5 * b10;
source.vx += x6 * (b10 = 1 - b10);
source.vy += y5 * b10;
}
}
}
function initialize() {
if (!nodes)
return;
var i4, n3 = nodes.length, m4 = links.length, nodeById = new Map(nodes.map((d3, i5) => [id(d3, i5, nodes), d3])), link;
for (i4 = 0, count2 = new Array(n3); i4 < m4; ++i4) {
link = links[i4], link.index = i4;
if (typeof link.source !== "object")
link.source = find3(nodeById, link.source);
if (typeof link.target !== "object")
link.target = find3(nodeById, link.target);
count2[link.source.index] = (count2[link.source.index] || 0) + 1;
count2[link.target.index] = (count2[link.target.index] || 0) + 1;
}
for (i4 = 0, bias = new Array(m4); i4 < m4; ++i4) {
link = links[i4], bias[i4] = count2[link.source.index] / (count2[link.source.index] + count2[link.target.index]);
}
strengths = new Array(m4), initializeStrength();
distances = new Array(m4), initializeDistance();
}
function initializeStrength() {
if (!nodes)
return;
for (var i4 = 0, n3 = links.length; i4 < n3; ++i4) {
strengths[i4] = +strength(links[i4], i4, links);
}
}
function initializeDistance() {
if (!nodes)
return;
for (var i4 = 0, n3 = links.length; i4 < n3; ++i4) {
distances[i4] = +distance15(links[i4], i4, links);
}
}
force.initialize = function(_nodes, _random) {
nodes = _nodes;
random5 = _random;
initialize();
};
force.links = function(_8) {
return arguments.length ? (links = _8, initialize(), force) : links;
};
force.id = function(_8) {
return arguments.length ? (id = _8, force) : id;
};
force.iterations = function(_8) {
return arguments.length ? (iterations = +_8, force) : iterations;
};
force.strength = function(_8) {
return arguments.length ? (strength = typeof _8 === "function" ? _8 : constant_default3(+_8), initializeStrength(), force) : strength;
};
force.distance = function(_8) {
return arguments.length ? (distance15 = typeof _8 === "function" ? _8 : constant_default3(+_8), initializeDistance(), force) : distance15;
};
return force;
}
// node_modules/d3-dispatch/src/dispatch.js
var noop = { value: () => {
} };
function dispatch() {
for (var i4 = 0, n3 = arguments.length, _8 = {}, t4; i4 < n3; ++i4) {
if (!(t4 = arguments[i4] + "") || t4 in _8 || /[\s.]/.test(t4))
throw new Error("illegal type: " + t4);
_8[t4] = [];
}
return new Dispatch(_8);
}
function Dispatch(_8) {
this._ = _8;
}
function parseTypenames(typenames, types2) {
return typenames.trim().split(/^|\s+/).map(function(t4) {
var name = "", i4 = t4.indexOf(".");
if (i4 >= 0)
name = t4.slice(i4 + 1), t4 = t4.slice(0, i4);
if (t4 && !types2.hasOwnProperty(t4))
throw new Error("unknown type: " + t4);
return { type: t4, name };
});
}
Dispatch.prototype = dispatch.prototype = {
constructor: Dispatch,
on: function(typename, callback) {
var _8 = this._, T5 = parseTypenames(typename + "", _8), t4, i4 = -1, n3 = T5.length;
if (arguments.length < 2) {
while (++i4 < n3)
if ((t4 = (typename = T5[i4]).type) && (t4 = get2(_8[t4], typename.name)))
return t4;
return;
}
if (callback != null && typeof callback !== "function")
throw new Error("invalid callback: " + callback);
while (++i4 < n3) {
if (t4 = (typename = T5[i4]).type)
_8[t4] = set9(_8[t4], typename.name, callback);
else if (callback == null)
for (t4 in _8)
_8[t4] = set9(_8[t4], typename.name, null);
}
return this;
},
copy: function() {
var copy8 = {}, _8 = this._;
for (var t4 in _8)
copy8[t4] = _8[t4].slice();
return new Dispatch(copy8);
},
call: function(type2, that) {
if ((n3 = arguments.length - 2) > 0)
for (var args = new Array(n3), i4 = 0, n3, t4; i4 < n3; ++i4)
args[i4] = arguments[i4 + 2];
if (!this._.hasOwnProperty(type2))
throw new Error("unknown type: " + type2);
for (t4 = this._[type2], i4 = 0, n3 = t4.length; i4 < n3; ++i4)
t4[i4].value.apply(that, args);
},
apply: function(type2, that, args) {
if (!this._.hasOwnProperty(type2))
throw new Error("unknown type: " + type2);
for (var t4 = this._[type2], i4 = 0, n3 = t4.length; i4 < n3; ++i4)
t4[i4].value.apply(that, args);
}
};
function get2(type2, name) {
for (var i4 = 0, n3 = type2.length, c5; i4 < n3; ++i4) {
if ((c5 = type2[i4]).name === name) {
return c5.value;
}
}
}
function set9(type2, name, callback) {
for (var i4 = 0, n3 = type2.length; i4 < n3; ++i4) {
if (type2[i4].name === name) {
type2[i4] = noop, type2 = type2.slice(0, i4).concat(type2.slice(i4 + 1));
break;
}
}
if (callback != null)
type2.push({ name, value: callback });
return type2;
}
var dispatch_default = dispatch;
// node_modules/d3-force/src/lcg.js
var a3 = 1664525;
var c4 = 1013904223;
var m3 = 4294967296;
function lcg_default() {
let s4 = 1;
return () => (s4 = (a3 * s4 + c4) % m3) / m3;
}
// node_modules/d3-force/src/simulation.js
function x5(d3) {
return d3.x;
}
function y4(d3) {
return d3.y;
}
var initialRadius = 10;
var initialAngle = Math.PI * (3 - Math.sqrt(5));
function simulation_default(nodes) {
var simulation, alpha = 1, alphaMin = 1e-3, alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), alphaTarget = 0, velocityDecay = 0.6, forces = new Map(), stepper = timer(step), event = dispatch_default("tick", "end"), random5 = lcg_default();
if (nodes == null)
nodes = [];
function step() {
tick();
event.call("tick", simulation);
if (alpha < alphaMin) {
stepper.stop();
event.call("end", simulation);
}
}
function tick(iterations) {
var i4, n3 = nodes.length, node;
if (iterations === void 0)
iterations = 1;
for (var k4 = 0; k4 < iterations; ++k4) {
alpha += (alphaTarget - alpha) * alphaDecay;
forces.forEach(function(force) {
force(alpha);
});
for (i4 = 0; i4 < n3; ++i4) {
node = nodes[i4];
if (node.fx == null)
node.x += node.vx *= velocityDecay;
else
node.x = node.fx, node.vx = 0;
if (node.fy == null)
node.y += node.vy *= velocityDecay;
else
node.y = node.fy, node.vy = 0;
}
}
return simulation;
}
function initializeNodes() {
for (var i4 = 0, n3 = nodes.length, node; i4 < n3; ++i4) {
node = nodes[i4], node.index = i4;
if (node.fx != null)
node.x = node.fx;
if (node.fy != null)
node.y = node.fy;
if (isNaN(node.x) || isNaN(node.y)) {
var radius = initialRadius * Math.sqrt(0.5 + i4), angle3 = i4 * initialAngle;
node.x = radius * Math.cos(angle3);
node.y = radius * Math.sin(angle3);
}
if (isNaN(node.vx) || isNaN(node.vy)) {
node.vx = node.vy = 0;
}
}
}
function initializeForce(force) {
if (force.initialize)
force.initialize(nodes, random5);
return force;
}
initializeNodes();
return simulation = {
tick,
restart: function() {
return stepper.restart(step), simulation;
},
stop: function() {
return stepper.stop(), simulation;
},
nodes: function(_8) {
return arguments.length ? (nodes = _8, initializeNodes(), forces.forEach(initializeForce), simulation) : nodes;
},
alpha: function(_8) {
return arguments.length ? (alpha = +_8, simulation) : alpha;
},
alphaMin: function(_8) {
return arguments.length ? (alphaMin = +_8, simulation) : alphaMin;
},
alphaDecay: function(_8) {
return arguments.length ? (alphaDecay = +_8, simulation) : +alphaDecay;
},
alphaTarget: function(_8) {
return arguments.length ? (alphaTarget = +_8, simulation) : alphaTarget;
},
velocityDecay: function(_8) {
return arguments.length ? (velocityDecay = 1 - _8, simulation) : 1 - velocityDecay;
},
randomSource: function(_8) {
return arguments.length ? (random5 = _8, forces.forEach(initializeForce), simulation) : random5;
},
force: function(name, _8) {
return arguments.length > 1 ? (_8 == null ? forces.delete(name) : forces.set(name, initializeForce(_8)), simulation) : forces.get(name);
},
find: function(x6, y5, radius) {
var i4 = 0, n3 = nodes.length, dx, dy, d22, node, closest;
if (radius == null)
radius = Infinity;
else
radius *= radius;
for (i4 = 0; i4 < n3; ++i4) {
node = nodes[i4];
dx = x6 - node.x;
dy = y5 - node.y;
d22 = dx * dx + dy * dy;
if (d22 < radius)
closest = node, radius = d22;
}
return closest;
},
on: function(name, _8) {
return arguments.length > 1 ? (event.on(name, _8), simulation) : event.on(name);
}
};
}
// node_modules/d3-force/src/manyBody.js
function manyBody_default() {
var nodes, node, random5, alpha, strength = constant_default3(-30), strengths, distanceMin2 = 1, distanceMax2 = Infinity, theta2 = 0.81;
function force(_8) {
var i4, n3 = nodes.length, tree = quadtree(nodes, x5, y4).visitAfter(accumulate);
for (alpha = _8, i4 = 0; i4 < n3; ++i4)
node = nodes[i4], tree.visit(apply);
}
function initialize() {
if (!nodes)
return;
var i4, n3 = nodes.length, node2;
strengths = new Array(n3);
for (i4 = 0; i4 < n3; ++i4)
node2 = nodes[i4], strengths[node2.index] = +strength(node2, i4, nodes);
}
function accumulate(quad) {
var strength2 = 0, q4, c5, weight = 0, x6, y5, i4;
if (quad.length) {
for (x6 = y5 = i4 = 0; i4 < 4; ++i4) {
if ((q4 = quad[i4]) && (c5 = Math.abs(q4.value))) {
strength2 += q4.value, weight += c5, x6 += c5 * q4.x, y5 += c5 * q4.y;
}
}
quad.x = x6 / weight;
quad.y = y5 / weight;
} else {
q4 = quad;
q4.x = q4.data.x;
q4.y = q4.data.y;
do
strength2 += strengths[q4.data.index];
while (q4 = q4.next);
}
quad.value = strength2;
}
function apply(quad, x1, _8, x22) {
if (!quad.value)
return true;
var x6 = quad.x - node.x, y5 = quad.y - node.y, w4 = x22 - x1, l4 = x6 * x6 + y5 * y5;
if (w4 * w4 / theta2 < l4) {
if (l4 < distanceMax2) {
if (x6 === 0)
x6 = jiggle_default(random5), l4 += x6 * x6;
if (y5 === 0)
y5 = jiggle_default(random5), l4 += y5 * y5;
if (l4 < distanceMin2)
l4 = Math.sqrt(distanceMin2 * l4);
node.vx += x6 * quad.value * alpha / l4;
node.vy += y5 * quad.value * alpha / l4;
}
return true;
} else if (quad.length || l4 >= distanceMax2)
return;
if (quad.data !== node || quad.next) {
if (x6 === 0)
x6 = jiggle_default(random5), l4 += x6 * x6;
if (y5 === 0)
y5 = jiggle_default(random5), l4 += y5 * y5;
if (l4 < distanceMin2)
l4 = Math.sqrt(distanceMin2 * l4);
}
do
if (quad.data !== node) {
w4 = strengths[quad.data.index] * alpha / l4;
node.vx += x6 * w4;
node.vy += y5 * w4;
}
while (quad = quad.next);
}
force.initialize = function(_nodes, _random) {
nodes = _nodes;
random5 = _random;
initialize();
};
force.strength = function(_8) {
return arguments.length ? (strength = typeof _8 === "function" ? _8 : constant_default3(+_8), initialize(), force) : strength;
};
force.distanceMin = function(_8) {
return arguments.length ? (distanceMin2 = _8 * _8, force) : Math.sqrt(distanceMin2);
};
force.distanceMax = function(_8) {
return arguments.length ? (distanceMax2 = _8 * _8, force) : Math.sqrt(distanceMax2);
};
force.theta = function(_8) {
return arguments.length ? (theta2 = _8 * _8, force) : Math.sqrt(theta2);
};
return force;
}
// node_modules/d3-force/src/x.js
function x_default2(x6) {
var strength = constant_default3(0.1), nodes, strengths, xz;
if (typeof x6 !== "function")
x6 = constant_default3(x6 == null ? 0 : +x6);
function force(alpha) {
for (var i4 = 0, n3 = nodes.length, node; i4 < n3; ++i4) {
node = nodes[i4], node.vx += (xz[i4] - node.x) * strengths[i4] * alpha;
}
}
function initialize() {
if (!nodes)
return;
var i4, n3 = nodes.length;
strengths = new Array(n3);
xz = new Array(n3);
for (i4 = 0; i4 < n3; ++i4) {
strengths[i4] = isNaN(xz[i4] = +x6(nodes[i4], i4, nodes)) ? 0 : +strength(nodes[i4], i4, nodes);
}
}
force.initialize = function(_8) {
nodes = _8;
initialize();
};
force.strength = function(_8) {
return arguments.length ? (strength = typeof _8 === "function" ? _8 : constant_default3(+_8), initialize(), force) : strength;
};
force.x = function(_8) {
return arguments.length ? (x6 = typeof _8 === "function" ? _8 : constant_default3(+_8), initialize(), force) : x6;
};
return force;
}
// node_modules/d3-force/src/y.js
function y_default2(y5) {
var strength = constant_default3(0.1), nodes, strengths, yz;
if (typeof y5 !== "function")
y5 = constant_default3(y5 == null ? 0 : +y5);
function force(alpha) {
for (var i4 = 0, n3 = nodes.length, node; i4 < n3; ++i4) {
node = nodes[i4], node.vy += (yz[i4] - node.y) * strengths[i4] * alpha;
}
}
function initialize() {
if (!nodes)
return;
var i4, n3 = nodes.length;
strengths = new Array(n3);
yz = new Array(n3);
for (i4 = 0; i4 < n3; ++i4) {
strengths[i4] = isNaN(yz[i4] = +y5(nodes[i4], i4, nodes)) ? 0 : +strength(nodes[i4], i4, nodes);
}
}
force.initialize = function(_8) {
nodes = _8;
initialize();
};
force.strength = function(_8) {
return arguments.length ? (strength = typeof _8 === "function" ? _8 : constant_default3(+_8), initialize(), force) : strength;
};
force.y = function(_8) {
return arguments.length ? (y5 = typeof _8 === "function" ? _8 : constant_default3(+_8), initialize(), force) : y5;
};
return force;
}
// node_modules/@antv/layout/es/layout/force/force-in-a-box.js
function forceInABox() {
function constant2(_8) {
return () => _8;
}
let groupBy2 = (d3) => {
return d3.cluster;
};
let forceNodeSize = constant2(1);
let forceCharge = constant2(-1);
let forceLinkDistance = constant2(100);
let forceLinkStrength = constant2(0.1);
let offset = [0, 0];
let nodes = [];
let nodesMap = {};
let links = [];
let centerX = 100;
let centerY = 100;
let foci = {
none: {
x: 0,
y: 0
}
};
let templateNodes = [];
let templateForce;
let template2 = "force";
let enableGrouping = true;
let strength = 0.1;
function force(alpha) {
if (!enableGrouping) {
return force;
}
templateForce.tick();
getFocisFromTemplate();
for (let i4 = 0, n3 = nodes.length, node, k4 = alpha * strength; i4 < n3; ++i4) {
node = nodes[i4];
node.vx += (foci[groupBy2(node)].x - node.x) * k4;
node.vy += (foci[groupBy2(node)].y - node.y) * k4;
}
}
function initialize() {
if (!nodes)
return;
initializeWithForce();
}
function initializeWithForce() {
if (!nodes || !nodes.length) {
return;
}
if (groupBy2(nodes[0]) === void 0) {
throw Error("Couldnt find the grouping attribute for the nodes. Make sure to set it up with forceInABox.groupBy('clusterAttr') before calling .links()");
}
const net = getGroupsGraph();
templateForce = simulation_default(net.nodes).force("x", x_default2(centerX).strength(0.1)).force("y", y_default2(centerY).strength(0.1)).force("collide", collide_default((d3) => d3.r).iterations(4)).force("charge", manyBody_default().strength(forceCharge)).force("links", link_default(net.nodes.length ? net.links : []).distance(forceLinkDistance).strength(forceLinkStrength));
templateNodes = templateForce.nodes();
getFocisFromTemplate();
}
function getGroupsGraph() {
const gnodes = [];
const glinks = [];
const dNodes = {};
let clustersList = [];
let clustersCounts = {};
let clustersLinks = [];
clustersCounts = computeClustersNodeCounts(nodes);
clustersLinks = computeClustersLinkCounts(links);
clustersList = Object.keys(clustersCounts);
clustersList.forEach((key, index2) => {
const val = clustersCounts[key];
gnodes.push({
id: key,
size: val.count,
r: Math.sqrt(val.sumforceNodeSize / Math.PI)
});
dNodes[key] = index2;
});
clustersLinks.forEach((l4) => {
const sourceTerminal = getEdgeTerminal(l4, "source");
const targetTerminal = getEdgeTerminal(l4, "target");
const source = dNodes[sourceTerminal];
const target = dNodes[targetTerminal];
if (source !== void 0 && target !== void 0) {
glinks.push({
source,
target,
count: l4.count
});
}
});
return {
nodes: gnodes,
links: glinks
};
}
function computeClustersNodeCounts(nodes2) {
const clustersCounts = {};
nodes2.forEach((d3) => {
const key = groupBy2(d3);
if (!clustersCounts[key]) {
clustersCounts[key] = {
count: 0,
sumforceNodeSize: 0
};
}
});
nodes2.forEach((d3) => {
const key = groupBy2(d3);
const nodeSize = forceNodeSize(d3);
const tmpCount = clustersCounts[key];
tmpCount.count = tmpCount.count + 1;
tmpCount.sumforceNodeSize = tmpCount.sumforceNodeSize + Math.PI * (nodeSize * nodeSize) * 1.3;
clustersCounts[key] = tmpCount;
});
return clustersCounts;
}
function computeClustersLinkCounts(links2) {
const dClusterLinks = {};
const clusterLinks = [];
links2.forEach((l4) => {
const key = getLinkKey(l4);
let count2 = 0;
if (dClusterLinks[key] !== void 0) {
count2 = dClusterLinks[key];
}
count2 += 1;
dClusterLinks[key] = count2;
});
const entries = Object.entries(dClusterLinks);
entries.forEach(([key, count2]) => {
const source = key.split("~")[0];
const target = key.split("~")[1];
if (source !== void 0 && target !== void 0) {
clusterLinks.push({
source,
target,
count: count2
});
}
});
return clusterLinks;
}
function getFocisFromTemplate() {
foci = {
none: {
x: 0,
y: 0
}
};
templateNodes.forEach((d3) => {
foci[d3.id] = {
x: d3.x - offset[0],
y: d3.y - offset[1]
};
});
return foci;
}
function getLinkKey(l4) {
const source = getEdgeTerminal(l4, "source");
const target = getEdgeTerminal(l4, "target");
const sourceID = groupBy2(nodesMap[source]);
const targetID = groupBy2(nodesMap[target]);
return sourceID <= targetID ? `${sourceID}~${targetID}` : `${targetID}~${sourceID}`;
}
function genNodesMap(nodes2) {
nodesMap = {};
nodes2.forEach((node) => {
nodesMap[node.id] = node;
});
}
function setTemplate(x6) {
if (!arguments.length)
return template2;
template2 = x6;
initialize();
return force;
}
function setGroupBy(x6) {
if (!arguments.length)
return groupBy2;
if (typeof x6 === "string") {
groupBy2 = (d3) => {
return d3[x6];
};
return force;
}
groupBy2 = x6;
return force;
}
function setEnableGrouping(x6) {
if (!arguments.length)
return enableGrouping;
enableGrouping = x6;
return force;
}
function setStrength(x6) {
if (!arguments.length)
return strength;
strength = x6;
return force;
}
function setCenterX(_8) {
if (arguments.length) {
centerX = _8;
return force;
}
return centerX;
}
function setCenterY(_8) {
if (arguments.length) {
centerY = _8;
return force;
}
return centerY;
}
function setNodes(_8) {
if (arguments.length) {
genNodesMap(_8 || []);
nodes = _8 || [];
return force;
}
return nodes;
}
function setLinks(_8) {
if (arguments.length) {
links = _8 || [];
initialize();
return force;
}
return links;
}
function setForceNodeSize(_8) {
if (arguments.length) {
if (typeof _8 === "function") {
forceNodeSize = _8;
} else {
forceNodeSize = constant2(+_8);
}
initialize();
return force;
}
return forceNodeSize;
}
function setForceCharge(_8) {
if (arguments.length) {
if (typeof _8 === "function") {
forceCharge = _8;
} else {
forceCharge = constant2(+_8);
}
initialize();
return force;
}
return forceCharge;
}
function setForceLinkDistance(_8) {
if (arguments.length) {
if (typeof _8 === "function") {
forceLinkDistance = _8;
} else {
forceLinkDistance = constant2(+_8);
}
initialize();
return force;
}
return forceLinkDistance;
}
function setForceLinkStrength(_8) {
if (arguments.length) {
if (typeof _8 === "function") {
forceLinkStrength = _8;
} else {
forceLinkStrength = constant2(+_8);
}
initialize();
return force;
}
return forceLinkStrength;
}
function setOffset(_8) {
if (arguments.length) {
offset = _8;
return force;
}
return offset;
}
force.initialize = (_8) => {
nodes = _8;
initialize();
};
force.template = setTemplate;
force.groupBy = setGroupBy;
force.enableGrouping = setEnableGrouping;
force.strength = setStrength;
force.centerX = setCenterX;
force.centerY = setCenterY;
force.nodes = setNodes;
force.links = setLinks;
force.forceNodeSize = setForceNodeSize;
force.nodeSize = force.forceNodeSize;
force.forceCharge = setForceCharge;
force.forceLinkDistance = setForceLinkDistance;
force.forceLinkStrength = setForceLinkStrength;
force.offset = setOffset;
force.getFocis = getFocisFromTemplate;
return force;
}
// node_modules/@antv/layout/es/layout/constants.js
var LAYOUT_MESSAGE = {
RUN: "LAYOUT_RUN",
END: "LAYOUT_END",
ERROR: "LAYOUT_ERROR",
TICK: "LAYOUT_TICK",
GPURUN: "GPU_LAYOUT_RUN",
GPUEND: "GPU_LAYOUT_END"
};
// node_modules/@antv/layout/es/layout/force/force.js
var ForceLayout = class extends Base3 {
constructor(options) {
super();
this.center = [0, 0];
this.nodeStrength = null;
this.edgeStrength = null;
this.preventOverlap = false;
this.clusterNodeStrength = null;
this.clusterEdgeStrength = null;
this.clusterEdgeDistance = null;
this.clusterNodeSize = null;
this.clusterFociStrength = null;
this.linkDistance = 50;
this.alphaDecay = 0.028;
this.alphaMin = 1e-3;
this.alpha = 0.3;
this.collideStrength = 1;
this.workerEnabled = false;
this.tick = () => {
};
this.onLayoutEnd = () => {
};
this.ticking = void 0;
if (options) {
this.updateCfg(options);
}
}
getDefaultCfg() {
return {
center: [0, 0],
nodeStrength: null,
edgeStrength: null,
preventOverlap: false,
nodeSize: void 0,
nodeSpacing: void 0,
linkDistance: 50,
forceSimulation: null,
alphaDecay: 0.028,
alphaMin: 1e-3,
alpha: 0.3,
collideStrength: 1,
clustering: false,
clusterNodeStrength: -1,
clusterEdgeStrength: 0.1,
clusterEdgeDistance: 100,
clusterFociStrength: 0.8,
clusterNodeSize: 10,
tick() {
},
onLayoutEnd() {
},
workerEnabled: false
};
}
init(data3) {
const self2 = this;
self2.nodes = data3.nodes || [];
const edges = data3.edges || [];
self2.edges = edges.map((edge2) => {
const res = {};
const expectKeys = ["targetNode", "sourceNode", "startPoint", "endPoint"];
Object.keys(edge2).forEach((key) => {
if (!(expectKeys.indexOf(key) > -1)) {
res[key] = edge2[key];
}
});
return res;
});
self2.ticking = false;
}
execute(reloadData) {
const self2 = this;
const nodes = self2.nodes;
const edges = self2.edges;
if (self2.ticking) {
return;
}
let simulation = self2.forceSimulation;
const alphaMin = self2.alphaMin;
const alphaDecay = self2.alphaDecay;
const alpha = self2.alpha;
if (!simulation) {
try {
const nodeForce = manyBody_default();
if (self2.nodeStrength) {
nodeForce.strength(self2.nodeStrength);
}
simulation = simulation_default().nodes(nodes);
if (self2.clustering) {
const clusterForce = forceInABox();
clusterForce.centerX(self2.center[0]).centerY(self2.center[1]).template("force").strength(self2.clusterFociStrength);
if (edges) {
clusterForce.links(edges);
}
if (nodes) {
clusterForce.nodes(nodes);
}
clusterForce.forceLinkDistance(self2.clusterEdgeDistance).forceLinkStrength(self2.clusterEdgeStrength).forceCharge(self2.clusterNodeStrength).forceNodeSize(self2.clusterNodeSize);
self2.clusterForce = clusterForce;
simulation.force("group", clusterForce);
}
simulation.force("center", center_default(self2.center[0], self2.center[1])).force("charge", nodeForce).alpha(alpha).alphaDecay(alphaDecay).alphaMin(alphaMin);
if (self2.preventOverlap) {
self2.overlapProcess(simulation);
}
if (edges) {
const edgeForce = link_default().id((d3) => d3.id).links(edges);
if (self2.edgeStrength) {
edgeForce.strength(self2.edgeStrength);
}
if (self2.linkDistance) {
edgeForce.distance(self2.linkDistance);
}
self2.edgeForce = edgeForce;
simulation.force("link", edgeForce);
}
if (self2.workerEnabled && !isInWorker()) {
self2.workerEnabled = false;
console.warn("workerEnabled option is only supported when running in web worker.");
}
if (!self2.workerEnabled) {
simulation.on("tick", () => {
self2.tick();
}).on("end", () => {
self2.ticking = false;
if (self2.onLayoutEnd)
self2.onLayoutEnd();
});
self2.ticking = true;
} else {
simulation.stop();
const totalTicks = getSimulationTicks(simulation);
for (let currentTick = 1; currentTick <= totalTicks; currentTick++) {
simulation.tick();
postMessage({
nodes,
currentTick,
totalTicks,
type: LAYOUT_MESSAGE.TICK
}, void 0);
}
self2.ticking = false;
}
self2.forceSimulation = simulation;
self2.ticking = true;
} catch (e4) {
self2.ticking = false;
console.warn(e4);
}
} else {
if (reloadData) {
if (self2.clustering && self2.clusterForce) {
self2.clusterForce.nodes(nodes);
self2.clusterForce.links(edges);
}
simulation.nodes(nodes);
if (edges && self2.edgeForce)
self2.edgeForce.links(edges);
else if (edges && !self2.edgeForce) {
const edgeForce = link_default().id((d3) => d3.id).links(edges);
if (self2.edgeStrength) {
edgeForce.strength(self2.edgeStrength);
}
if (self2.linkDistance) {
edgeForce.distance(self2.linkDistance);
}
self2.edgeForce = edgeForce;
simulation.force("link", edgeForce);
}
}
if (self2.preventOverlap) {
self2.overlapProcess(simulation);
}
simulation.alpha(alpha).restart();
this.ticking = true;
}
}
overlapProcess(simulation) {
const self2 = this;
const nodeSize = self2.nodeSize;
const nodeSpacing = self2.nodeSpacing;
let nodeSizeFunc;
let nodeSpacingFunc;
const collideStrength = self2.collideStrength;
if (isNumber3(nodeSpacing)) {
nodeSpacingFunc = () => nodeSpacing;
} else if (isFunction(nodeSpacing)) {
nodeSpacingFunc = nodeSpacing;
} else {
nodeSpacingFunc = () => 0;
}
if (!nodeSize) {
nodeSizeFunc = (d3) => {
if (d3.size) {
if (isArray2(d3.size)) {
const res = d3.size[0] > d3.size[1] ? d3.size[0] : d3.size[1];
return res / 2 + nodeSpacingFunc(d3);
}
if (isObject2(d3.size)) {
const res = d3.size.width > d3.size.height ? d3.size.width : d3.size.height;
return res / 2 + nodeSpacingFunc(d3);
}
return d3.size / 2 + nodeSpacingFunc(d3);
}
return 10 + nodeSpacingFunc(d3);
};
} else if (isFunction(nodeSize)) {
nodeSizeFunc = (d3) => {
const size2 = nodeSize(d3);
return size2 + nodeSpacingFunc(d3);
};
} else if (isArray2(nodeSize)) {
const larger = nodeSize[0] > nodeSize[1] ? nodeSize[0] : nodeSize[1];
const radius = larger / 2;
nodeSizeFunc = (d3) => radius + nodeSpacingFunc(d3);
} else if (isNumber3(nodeSize)) {
const radius = nodeSize / 2;
nodeSizeFunc = (d3) => radius + nodeSpacingFunc(d3);
} else {
nodeSizeFunc = () => 10;
}
simulation.force("collisionForce", collide_default(nodeSizeFunc).strength(collideStrength));
}
updateCfg(cfg) {
const self2 = this;
if (self2.ticking) {
self2.forceSimulation.stop();
self2.ticking = false;
}
self2.forceSimulation = null;
Object.assign(self2, cfg);
}
destroy() {
const self2 = this;
if (self2.ticking) {
self2.forceSimulation.stop();
self2.ticking = false;
}
self2.nodes = null;
self2.edges = null;
self2.destroyed = true;
}
};
function getSimulationTicks(simulation) {
const alphaMin = simulation.alphaMin();
const alphaTarget = simulation.alphaTarget();
const alpha = simulation.alpha();
const totalTicksFloat = Math.log((alphaMin - alphaTarget) / (alpha - alphaTarget)) / Math.log(1 - simulation.alphaDecay());
const totalTicks = Math.ceil(totalTicksFloat);
return totalTicks;
}
function isInWorker() {
return typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope;
}
// node_modules/@antv/layout/es/layout/circular.js
function initHierarchy(nodes, edges, nodeMap, directed) {
nodes.forEach((_8, i4) => {
nodes[i4].children = [];
nodes[i4].parent = [];
});
if (directed) {
edges.forEach((e4) => {
const source = getEdgeTerminal(e4, "source");
const target = getEdgeTerminal(e4, "target");
let sourceIdx = 0;
if (source) {
sourceIdx = nodeMap[source];
}
let targetIdx = 0;
if (target) {
targetIdx = nodeMap[target];
}
const child = nodes[sourceIdx].children;
const parent = nodes[targetIdx].parent;
child.push(nodes[targetIdx].id);
parent.push(nodes[sourceIdx].id);
});
} else {
edges.forEach((e4) => {
const source = getEdgeTerminal(e4, "source");
const target = getEdgeTerminal(e4, "target");
let sourceIdx = 0;
if (source) {
sourceIdx = nodeMap[source];
}
let targetIdx = 0;
if (target) {
targetIdx = nodeMap[target];
}
const sourceChildren = nodes[sourceIdx].children;
const targetChildren = nodes[targetIdx].children;
sourceChildren.push(nodes[targetIdx].id);
targetChildren.push(nodes[sourceIdx].id);
});
}
}
function connect(a4, b10, edges) {
const m4 = edges.length;
for (let i4 = 0; i4 < m4; i4++) {
const source = getEdgeTerminal(edges[i4], "source");
const target = getEdgeTerminal(edges[i4], "target");
if (a4.id === source && b10.id === target || b10.id === source && a4.id === target) {
return true;
}
}
return false;
}
function compareDegree(a4, b10) {
const aDegree = a4.degree;
const bDegree = b10.degree;
if (aDegree < bDegree) {
return -1;
}
if (aDegree > bDegree) {
return 1;
}
return 0;
}
var CircularLayout = class extends Base3 {
constructor(options) {
super();
this.radius = null;
this.startRadius = null;
this.endRadius = null;
this.startAngle = 0;
this.endAngle = 2 * Math.PI;
this.clockwise = true;
this.divisions = 1;
this.ordering = null;
this.angleRatio = 1;
this.nodes = [];
this.edges = [];
this.nodeMap = {};
this.degrees = [];
this.width = 300;
this.height = 300;
this.updateCfg(options);
}
getDefaultCfg() {
return {
radius: null,
startRadius: null,
endRadius: null,
startAngle: 0,
endAngle: 2 * Math.PI,
clockwise: true,
divisions: 1,
ordering: null,
angleRatio: 1
};
}
execute() {
const self2 = this;
const nodes = self2.nodes;
const edges = self2.edges;
const n3 = nodes.length;
if (n3 === 0) {
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return;
}
if (!self2.width && typeof window !== "undefined") {
self2.width = window.innerWidth;
}
if (!self2.height && typeof window !== "undefined") {
self2.height = window.innerHeight;
}
if (!self2.center) {
self2.center = [self2.width / 2, self2.height / 2];
}
const center2 = self2.center;
if (n3 === 1) {
nodes[0].x = center2[0];
nodes[0].y = center2[1];
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return;
}
let radius = self2.radius;
let startRadius = self2.startRadius;
let endRadius = self2.endRadius;
const divisions = self2.divisions;
const startAngle = self2.startAngle;
const endAngle = self2.endAngle;
const angleStep = (endAngle - startAngle) / n3;
const nodeMap = {};
nodes.forEach((node, i4) => {
nodeMap[node.id] = i4;
});
self2.nodeMap = nodeMap;
const degrees = getDegree3(nodes.length, nodeMap, edges);
self2.degrees = degrees;
if (!radius && !startRadius && !endRadius) {
radius = self2.height > self2.width ? self2.width / 2 : self2.height / 2;
} else if (!startRadius && endRadius) {
startRadius = endRadius;
} else if (startRadius && !endRadius) {
endRadius = startRadius;
}
const angleRatio = self2.angleRatio;
const astep = angleStep * angleRatio;
const ordering = self2.ordering;
let layoutNodes2 = [];
if (ordering === "topology") {
layoutNodes2 = self2.topologyOrdering();
} else if (ordering === "topology-directed") {
layoutNodes2 = self2.topologyOrdering(true);
} else if (ordering === "degree") {
layoutNodes2 = self2.degreeOrdering();
} else {
layoutNodes2 = nodes;
}
const clockwise = self2.clockwise;
const divN = Math.ceil(n3 / divisions);
for (let i4 = 0; i4 < n3; ++i4) {
let r4 = radius;
if (!r4 && startRadius !== null && endRadius !== null) {
r4 = startRadius + i4 * (endRadius - startRadius) / (n3 - 1);
}
if (!r4) {
r4 = 10 + i4 * 100 / (n3 - 1);
}
let angle3 = startAngle + i4 % divN * astep + 2 * Math.PI / divisions * Math.floor(i4 / divN);
if (!clockwise) {
angle3 = endAngle - i4 % divN * astep - 2 * Math.PI / divisions * Math.floor(i4 / divN);
}
layoutNodes2[i4].x = center2[0] + Math.cos(angle3) * r4;
layoutNodes2[i4].y = center2[1] + Math.sin(angle3) * r4;
layoutNodes2[i4].weight = degrees[i4];
}
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return {
nodes: layoutNodes2,
edges: this.edges
};
}
topologyOrdering(directed = false) {
const self2 = this;
const degrees = self2.degrees;
const edges = self2.edges;
const nodes = self2.nodes;
const cnodes = clone9(nodes);
const nodeMap = self2.nodeMap;
const orderedCNodes = [cnodes[0]];
const resNodes = [nodes[0]];
const pickFlags = [];
const n3 = nodes.length;
pickFlags[0] = true;
initHierarchy(cnodes, edges, nodeMap, directed);
let k4 = 0;
cnodes.forEach((cnode, i4) => {
if (i4 !== 0) {
if ((i4 === n3 - 1 || degrees[i4] !== degrees[i4 + 1] || connect(orderedCNodes[k4], cnode, edges)) && !pickFlags[i4]) {
orderedCNodes.push(cnode);
resNodes.push(nodes[nodeMap[cnode.id]]);
pickFlags[i4] = true;
k4++;
} else {
const children = orderedCNodes[k4].children;
let foundChild = false;
for (let j4 = 0; j4 < children.length; j4++) {
const childIdx = nodeMap[children[j4]];
if (degrees[childIdx] === degrees[i4] && !pickFlags[childIdx]) {
orderedCNodes.push(cnodes[childIdx]);
resNodes.push(nodes[nodeMap[cnodes[childIdx].id]]);
pickFlags[childIdx] = true;
foundChild = true;
break;
}
}
let ii = 0;
while (!foundChild) {
if (!pickFlags[ii]) {
orderedCNodes.push(cnodes[ii]);
resNodes.push(nodes[nodeMap[cnodes[ii].id]]);
pickFlags[ii] = true;
foundChild = true;
}
ii++;
if (ii === n3) {
break;
}
}
}
}
});
return resNodes;
}
degreeOrdering() {
const self2 = this;
const nodes = self2.nodes;
const orderedNodes = [];
const degrees = self2.degrees;
nodes.forEach((node, i4) => {
node.degree = degrees[i4];
orderedNodes.push(node);
});
orderedNodes.sort(compareDegree);
return orderedNodes;
}
getType() {
return "circular";
}
};
// node_modules/@antv/layout/es/layout/dagre/src/graphlib.js
var import_graphlib = __toModule(require_graphlib());
var graphlib = import_graphlib.default;
if (!graphlib && typeof window !== "undefined") {
graphlib = window.graphlib;
}
if (!Array.prototype.flat) {
Array.prototype.flat = function(count2) {
let c5 = count2 || 1;
if (!isFinite(c5))
return;
const len5 = this.length;
let ret = [];
if (this.length === 0)
return this;
while (c5--) {
const arr = [];
let flag = false;
if (ret.length === 0) {
flag = true;
for (let i4 = 0; i4 < len5; i4++) {
if (this[i4] instanceof Array) {
ret.push(...this[i4]);
} else {
ret.push(this[i4]);
}
}
} else {
for (let i4 = 0; i4 < ret.length; i4++) {
if (ret[i4] instanceof Array) {
flag = true;
arr.push(...ret[i4]);
} else {
arr.push(ret[i4]);
}
}
ret = arr;
}
if (!flag && c5 === Infinity) {
break;
}
}
return ret;
};
}
var graphlib_default = graphlib;
// node_modules/@antv/layout/es/layout/dagre/src/data/list.js
var unlink = (entry) => {
entry._prev._next = entry._next;
entry._next._prev = entry._prev;
delete entry._next;
delete entry._prev;
};
var filterOutLinks = (k4, v3) => {
if (k4 !== "_next" && k4 !== "_prev") {
return v3;
}
};
var List2 = class {
constructor() {
const sentinel = {};
sentinel._next = sentinel._prev = sentinel;
this.isentinel = sentinel;
}
dequeue() {
const sentinel = this.isentinel;
const entry = sentinel._prev;
if (entry !== sentinel) {
unlink(entry);
return entry;
}
}
enqueue() {
const sentinel = this.isentinel;
const entry = sentinel._prev;
if (entry !== sentinel) {
unlink(entry);
return entry;
}
}
toString() {
const strs = [];
const sentinel = this.isentinel;
let curr = sentinel._prev;
while (curr !== sentinel) {
strs.push(JSON.stringify(curr, filterOutLinks));
curr = curr._prev;
}
return `[${strs.join(", ")}]`;
}
};
var list_default2 = List2;
// node_modules/@antv/layout/es/layout/dagre/src/greedy-fas.js
var Graph2 = graphlib_default.Graph;
var DEFAULT_WEIGHT_FN = () => 1;
var greedyFAS = (g4, weightFn) => {
var _a6;
if (g4.nodeCount() <= 1)
return [];
const state2 = buildState(g4, weightFn || DEFAULT_WEIGHT_FN);
const results = doGreedyFAS(state2.graph, state2.buckets, state2.zeroIdx);
return (_a6 = results.map((e4) => g4.outEdges(e4.v, e4.w))) === null || _a6 === void 0 ? void 0 : _a6.flat();
};
var doGreedyFAS = (g4, buckets, zeroIdx) => {
let results = [];
const sources = buckets[buckets.length - 1];
const sinks = buckets[0];
let entry;
while (g4.nodeCount()) {
while (entry = sinks.dequeue()) {
removeNode(g4, buckets, zeroIdx, entry);
}
while (entry = sources.dequeue()) {
removeNode(g4, buckets, zeroIdx, entry);
}
if (g4.nodeCount()) {
for (let i4 = buckets.length - 2; i4 > 0; --i4) {
entry = buckets[i4].dequeue();
if (entry) {
results = results.concat(removeNode(g4, buckets, zeroIdx, entry, true));
break;
}
}
}
}
return results;
};
var removeNode = (g4, buckets, zeroIdx, entry, collectPredecessors) => {
var _a6, _b;
const results = collectPredecessors ? [] : void 0;
(_a6 = g4.inEdges(entry.v)) === null || _a6 === void 0 ? void 0 : _a6.forEach((edge2) => {
const weight = g4.edge(edge2);
const uEntry = g4.node(edge2.v);
if (collectPredecessors) {
results.push({ v: edge2.v, w: edge2.w });
}
if (uEntry.out === void 0)
uEntry.out = 0;
uEntry.out -= weight;
assignBucket(buckets, zeroIdx, uEntry);
});
(_b = g4.outEdges(entry.v)) === null || _b === void 0 ? void 0 : _b.forEach((edge2) => {
const weight = g4.edge(edge2);
const w4 = edge2.w;
const wEntry = g4.node(w4);
if (wEntry.in === void 0)
wEntry.in = 0;
wEntry.in -= weight;
assignBucket(buckets, zeroIdx, wEntry);
});
g4.removeNode(entry.v);
return results;
};
var buildState = (g4, weightFn) => {
const fasGraph = new Graph2();
let maxIn = 0;
let maxOut = 0;
g4.nodes().forEach((v3) => {
fasGraph.setNode(v3, { v: v3, "in": 0, out: 0 });
});
g4.edges().forEach((e4) => {
const prevWeight = fasGraph.edge(e4.v, e4.w) || 0;
const weight = weightFn === null || weightFn === void 0 ? void 0 : weightFn(e4);
const edgeWeight = prevWeight + weight;
fasGraph.setEdge(e4.v, e4.w, edgeWeight);
maxOut = Math.max(maxOut, fasGraph.node(e4.v).out += weight);
maxIn = Math.max(maxIn, fasGraph.node(e4.w)["in"] += weight);
});
const buckets = [];
const rangeMax = maxOut + maxIn + 3;
for (let i4 = 0; i4 < rangeMax; i4++) {
buckets.push(new list_default2());
}
const zeroIdx = maxIn + 1;
fasGraph.nodes().forEach((v3) => {
assignBucket(buckets, zeroIdx, fasGraph.node(v3));
});
return { buckets, zeroIdx, graph: fasGraph };
};
var assignBucket = (buckets, zeroIdx, entry) => {
if (!entry.out) {
buckets[0].enqueue(entry);
} else if (!entry["in"]) {
buckets[buckets.length - 1].enqueue(entry);
} else {
buckets[entry.out - entry["in"] + zeroIdx].enqueue(entry);
}
};
var greedy_fas_default = greedyFAS;
// node_modules/@antv/layout/es/layout/dagre/src/acyclic.js
var run = (g4) => {
const weightFn = (g5) => {
return (e4) => g5.edge(e4).weight;
};
const fas = g4.graph().acyclicer === "greedy" ? greedy_fas_default(g4, weightFn(g4)) : dfsFAS(g4);
fas === null || fas === void 0 ? void 0 : fas.forEach((e4) => {
const label17 = g4.edge(e4);
g4.removeEdge(e4);
label17.forwardName = e4.name;
label17.reversed = true;
g4.setEdge(e4.w, e4.v, label17, `rev-${Math.random()}`);
});
};
var dfsFAS = (g4) => {
const fas = [];
const stack = {};
const visited = {};
const dfs2 = (v3) => {
var _a6;
if (visited.hasOwnProperty(v3)) {
return;
}
visited[v3] = true;
stack[v3] = true;
(_a6 = g4.outEdges(v3)) === null || _a6 === void 0 ? void 0 : _a6.forEach((e4) => {
if (stack.hasOwnProperty(e4.w)) {
fas.push(e4);
} else {
dfs2(e4.w);
}
});
delete stack[v3];
};
g4.nodes().forEach(dfs2);
return fas;
};
var undo = (g4) => {
g4.edges().forEach((e4) => {
const label17 = g4.edge(e4);
if (label17.reversed) {
g4.removeEdge(e4);
const forwardName = label17.forwardName;
delete label17.reversed;
delete label17.forwardName;
g4.setEdge(e4.w, e4.v, label17, forwardName);
}
});
};
var acyclic_default = { run, undo };
// node_modules/@antv/layout/es/layout/dagre/src/util.js
var Graph3 = graphlib_default.Graph;
var addDummyNode = (g4, type2, attrs, name) => {
let v3;
do {
v3 = `${name}${Math.random()}`;
} while (g4.hasNode(v3));
attrs.dummy = type2;
g4.setNode(v3, attrs);
return v3;
};
var simplify = (g4) => {
const simplified = new Graph3().setGraph(g4.graph());
g4.nodes().forEach((v3) => {
simplified.setNode(v3, g4.node(v3));
});
g4.edges().forEach((e4) => {
const simpleLabel = simplified.edge(e4.v, e4.w) || { weight: 0, minlen: 1 };
const label17 = g4.edge(e4);
simplified.setEdge(e4.v, e4.w, {
weight: simpleLabel.weight + label17.weight,
minlen: Math.max(simpleLabel.minlen, label17.minlen)
});
});
return simplified;
};
var asNonCompoundGraph = (g4) => {
const simplified = new Graph3({ multigraph: g4.isMultigraph() }).setGraph(g4.graph());
g4.nodes().forEach((v3) => {
var _a6;
if (!((_a6 = g4.children(v3)) === null || _a6 === void 0 ? void 0 : _a6.length)) {
simplified.setNode(v3, g4.node(v3));
}
});
g4.edges().forEach((e4) => simplified.setEdge(e4, g4.edge(e4)));
return simplified;
};
var zipObject = (keys2, values2) => {
const result = {};
keys2 === null || keys2 === void 0 ? void 0 : keys2.forEach((key, i4) => {
result[key] = values2[i4];
});
return result;
};
var successorWeights = (g4) => {
const weightMap = g4.nodes().map((v3) => {
var _a6;
const sucs = {};
(_a6 = g4.outEdges(v3)) === null || _a6 === void 0 ? void 0 : _a6.forEach((e4) => {
sucs[e4.w] = (sucs[e4.w] || 0) + g4.edge(e4).weight;
});
return sucs;
});
return zipObject(g4.nodes(), weightMap);
};
var predecessorWeights = (g4) => {
const weightMap = g4.nodes().map((v3) => {
var _a6;
const preds = {};
(_a6 = g4.inEdges(v3)) === null || _a6 === void 0 ? void 0 : _a6.forEach((e4) => {
preds[e4.v] = (preds[e4.v] || 0) + g4.edge(e4).weight;
});
return preds;
});
return zipObject(g4.nodes(), weightMap);
};
var intersectRect3 = (rect3, point2) => {
const x6 = rect3.x;
const y5 = rect3.y;
const dx = point2.x - x6;
const dy = point2.y - y5;
let w4 = rect3.width / 2;
let h3 = rect3.height / 2;
if (!dx && !dy) {
return { x: 0, y: 0 };
}
let sx;
let sy;
if (Math.abs(dy) * w4 > Math.abs(dx) * h3) {
if (dy < 0) {
h3 = -h3;
}
sx = h3 * dx / dy;
sy = h3;
} else {
if (dx < 0) {
w4 = -w4;
}
sx = w4;
sy = w4 * dy / dx;
}
return { x: x6 + sx, y: y5 + sy };
};
var buildLayerMatrix = (g4) => {
const layering = [];
const layeringNodes = [];
const rankMax = maxRank(g4) + 1;
for (let i4 = 0; i4 < rankMax; i4++) {
layering.push([]);
layeringNodes.push([]);
}
g4.nodes().forEach((v3) => {
const node = g4.node(v3);
const rank2 = node.rank;
if (rank2 !== void 0 && layering[rank2]) {
layeringNodes[rank2].push(v3);
}
});
layeringNodes === null || layeringNodes === void 0 ? void 0 : layeringNodes.forEach((layer, rank2) => {
layer === null || layer === void 0 ? void 0 : layer.sort((va, vb) => {
var _a6, _b;
return ((_a6 = g4.node(va)) === null || _a6 === void 0 ? void 0 : _a6.order) - ((_b = g4.node(vb)) === null || _b === void 0 ? void 0 : _b.order);
});
layer.forEach((v3) => {
layering[rank2].push(v3);
});
});
return layering;
};
var normalizeRanks = (g4) => {
const nodeRanks = g4.nodes().filter((v3) => g4.node(v3).rank !== void 0).map((v3) => g4.node(v3).rank);
const min7 = Math.min(...nodeRanks);
g4.nodes().forEach((v3) => {
const node = g4.node(v3);
if (node.hasOwnProperty("rank")) {
if (!node.rank)
node.rank = 0;
node.rank -= min7;
}
});
};
var removeEmptyRanks = (g4) => {
const nodeRanks = g4.nodes().filter((v3) => g4.node(v3).rank !== void 0).map((v3) => g4.node(v3).rank);
const offset = Math.min(...nodeRanks);
const layers = [];
g4.nodes().forEach((v3) => {
var _a6;
const rank2 = (((_a6 = g4.node(v3)) === null || _a6 === void 0 ? void 0 : _a6.rank) || 0) - offset;
if (!layers[rank2]) {
layers[rank2] = [];
}
layers[rank2].push(v3);
});
let delta = 0;
const nodeRankFactor = g4.graph().nodeRankFactor || 0;
for (let i4 = 0; i4 < layers.length; i4++) {
const vs = layers[i4];
if (vs === void 0 && i4 % nodeRankFactor !== 0) {
--delta;
} else if (delta) {
vs === null || vs === void 0 ? void 0 : vs.forEach((v3) => {
if (!g4.node(v3).rank)
g4.node(v3).rank = 0;
g4.node(v3).rank += delta;
});
}
}
};
var addBorderNode = (g4, prefix2, rank2, order2) => {
const node = {
width: 0,
height: 0
};
if (isNumber3(rank2) && isNumber3(order2)) {
node.rank = rank2;
node.order = order2;
}
return addDummyNode(g4, "border", node, prefix2);
};
var maxRank = (g4) => {
const nodeRanks = g4.nodes().map((v3) => {
const rank2 = g4.node(v3).rank;
if (rank2 !== void 0) {
return rank2;
}
return -Infinity;
});
return Math.max(...nodeRanks);
};
var partition2 = (collection, fn2) => {
const result = { lhs: [], rhs: [] };
collection === null || collection === void 0 ? void 0 : collection.forEach((value2) => {
if (fn2(value2)) {
result.lhs.push(value2);
} else {
result.rhs.push(value2);
}
});
return result;
};
var time = (name, fn2) => {
const start = Date.now();
try {
return fn2();
} finally {
console.log(`${name} time: ${Date.now() - start}ms`);
}
};
var notime = (name, fn2) => {
return fn2();
};
var minBy = (array, func) => {
let min7 = Infinity;
let minObject;
array === null || array === void 0 ? void 0 : array.forEach((item) => {
const value2 = func(item);
if (min7 > value2) {
min7 = value2;
minObject = item;
}
});
return minObject;
};
var util_default2 = {
addDummyNode,
simplify,
asNonCompoundGraph,
successorWeights,
predecessorWeights,
intersectRect: intersectRect3,
buildLayerMatrix,
normalizeRanks,
removeEmptyRanks,
addBorderNode,
maxRank,
partition: partition2,
time,
notime,
zipObject,
minBy
};
// node_modules/@antv/layout/es/layout/dagre/src/normalize.js
var run2 = (g4) => {
g4.graph().dummyChains = [];
g4.edges().forEach((edge2) => normalizeEdge(g4, edge2));
};
var normalizeEdge = (g4, e4) => {
var _a6, _b;
let v3 = e4.v;
let vRank = g4.node(v3).rank;
const w4 = e4.w;
const wRank = g4.node(w4).rank;
const name = e4.name;
const edgeLabel = g4.edge(e4);
const labelRank = edgeLabel.labelRank;
if (wRank === vRank + 1)
return;
g4.removeEdge(e4);
let dummy;
let attrs;
let i4;
for (i4 = 0, ++vRank; vRank < wRank; ++i4, ++vRank) {
edgeLabel.points = [];
attrs = {
edgeLabel,
width: 0,
height: 0,
edgeObj: e4,
rank: vRank
};
dummy = util_default2.addDummyNode(g4, "edge", attrs, "_d");
if (vRank === labelRank) {
attrs.width = edgeLabel.width;
attrs.height = edgeLabel.height;
attrs.dummy = "edge-label";
attrs.labelpos = edgeLabel.labelpos;
}
g4.setEdge(v3, dummy, { weight: edgeLabel.weight }, name);
if (i4 === 0) {
if (!g4.graph().dummyChains)
g4.graph().dummyChains = [];
(_b = (_a6 = g4.graph()) === null || _a6 === void 0 ? void 0 : _a6.dummyChains) === null || _b === void 0 ? void 0 : _b.push(dummy);
}
v3 = dummy;
}
g4.setEdge(v3, w4, { weight: edgeLabel.weight }, name);
};
var undo2 = (g4) => {
var _a6;
(_a6 = g4.graph().dummyChains) === null || _a6 === void 0 ? void 0 : _a6.forEach((v3) => {
var _a7;
let node = g4.node(v3);
const origLabel = node.edgeLabel;
let w4;
node.edgeObj && g4.setEdge(node.edgeObj, origLabel);
let currentV = v3;
while (node.dummy) {
w4 = (_a7 = g4.successors(currentV)) === null || _a7 === void 0 ? void 0 : _a7[0];
g4.removeNode(currentV);
origLabel.points.push({ x: node.x, y: node.y });
if (node.dummy === "edge-label") {
origLabel.x = node.x;
origLabel.y = node.y;
origLabel.width = node.width;
origLabel.height = node.height;
}
currentV = w4;
node = g4.node(currentV);
}
});
};
var normalize_default = { run: run2, undo: undo2 };
// node_modules/@antv/layout/es/layout/dagre/src/rank/util.js
var longestPath = (g4) => {
var _a6;
const visited = {};
const dfs2 = (v3) => {
var _a7;
const label17 = g4.node(v3);
if (visited.hasOwnProperty(v3)) {
return label17.rank;
}
visited[v3] = true;
const lengths = (_a7 = g4.outEdges(v3)) === null || _a7 === void 0 ? void 0 : _a7.map((e4) => {
return dfs2(e4.w) - g4.edge(e4).minlen || Infinity;
});
let rank2 = Math.min(...lengths);
if (rank2 === Number.POSITIVE_INFINITY || rank2 === void 0 || rank2 === null) {
rank2 = 0;
}
label17.rank = rank2;
return rank2;
};
(_a6 = g4.sources()) === null || _a6 === void 0 ? void 0 : _a6.forEach((source) => dfs2(source));
};
var longestPathWithLayer = (g4) => {
var _a6;
const visited = {};
let minRank = 0;
const dfs2 = (v3) => {
var _a7;
const label17 = g4.node(v3);
if (visited.hasOwnProperty(v3)) {
return label17.rank;
}
visited[v3] = true;
const lengths = (_a7 = g4.outEdges(v3)) === null || _a7 === void 0 ? void 0 : _a7.map((e4) => {
return dfs2(e4.w) - g4.edge(e4).minlen || Infinity;
});
let rank2 = Math.min(...lengths);
if (rank2 === Number.POSITIVE_INFINITY || rank2 === void 0 || rank2 === null) {
rank2 = 0;
}
label17.rank = rank2;
minRank = Math.min(label17.rank, minRank);
return label17.rank;
};
(_a6 = g4.sources()) === null || _a6 === void 0 ? void 0 : _a6.forEach((source) => dfs2(source));
minRank += 1;
const dfsForward = (v3, nextRank) => {
var _a7;
const label17 = g4.node(v3);
const currRank = !isNaN(label17.layer) ? label17.layer : nextRank;
if (label17.rank === void 0 || label17.rank < currRank) {
label17.rank = currRank;
}
(_a7 = g4.outEdges(v3)) === null || _a7 === void 0 ? void 0 : _a7.map((e4) => {
dfsForward(e4.w, currRank + g4.edge(e4).minlen);
});
};
g4.nodes().forEach((n3) => {
const label17 = g4.node(n3);
if (!isNaN(label17.layer)) {
dfsForward(n3, label17.layer);
} else {
label17.rank -= minRank;
}
});
};
var slack = (g4, e4) => {
return g4.node(e4.w).rank - g4.node(e4.v).rank - g4.edge(e4).minlen;
};
// node_modules/@antv/layout/es/layout/dagre/src/rank/feasible-tree.js
var Graph4 = graphlib_default.Graph;
var feasibleTree = (g4) => {
const t4 = new Graph4({ directed: false });
const start = g4.nodes()[0];
const size2 = g4.nodeCount();
t4.setNode(start, {});
let edge2;
let delta;
while (tightTree(t4, g4) < size2) {
edge2 = findMinSlackEdge(t4, g4);
delta = t4.hasNode(edge2.v) ? slack(g4, edge2) : -slack(g4, edge2);
shiftRanks(t4, g4, delta);
}
return t4;
};
var tightTree = (t4, g4) => {
const dfs2 = (v3) => {
g4.nodeEdges(v3).forEach((e4) => {
const edgeV = e4.v;
const w4 = v3 === edgeV ? e4.w : edgeV;
if (!t4.hasNode(w4) && !slack(g4, e4)) {
t4.setNode(w4, {});
t4.setEdge(v3, w4, {});
dfs2(w4);
}
});
};
t4.nodes().forEach(dfs2);
return t4.nodeCount();
};
var feasibleTreeWithLayer = (g4) => {
const t4 = new Graph4({ directed: false });
const start = g4.nodes()[0];
const size2 = g4.nodeCount();
t4.setNode(start, {});
let edge2;
let delta;
while (tightTreeWithLayer(t4, g4) < size2) {
edge2 = findMinSlackEdge(t4, g4);
delta = t4.hasNode(edge2.v) ? slack(g4, edge2) : -slack(g4, edge2);
shiftRanks(t4, g4, delta);
}
return t4;
};
var tightTreeWithLayer = (t4, g4) => {
const dfs2 = (v3) => {
var _a6;
(_a6 = g4.nodeEdges(v3)) === null || _a6 === void 0 ? void 0 : _a6.forEach((e4) => {
const edgeV = e4.v;
const w4 = v3 === edgeV ? e4.w : edgeV;
if (!t4.hasNode(w4) && (g4.node(w4).layer !== void 0 || !slack(g4, e4))) {
t4.setNode(w4, {});
t4.setEdge(v3, w4, {});
dfs2(w4);
}
});
};
t4.nodes().forEach(dfs2);
return t4.nodeCount();
};
var findMinSlackEdge = (t4, g4) => {
return minBy(g4.edges(), (e4) => {
if (t4.hasNode(e4.v) !== t4.hasNode(e4.w)) {
return slack(g4, e4);
}
return Infinity;
});
};
var shiftRanks = (t4, g4, delta) => {
t4.nodes().forEach((v3) => {
if (!g4.node(v3).rank)
g4.node(v3).rank = 0;
g4.node(v3).rank += delta;
});
};
// node_modules/@antv/layout/es/layout/dagre/src/rank/network-simplex.js
var alg = graphlib_default.alg;
var { preorder, postorder } = alg;
var networkSimplex = (g4) => {
g4 = simplify(g4);
longestPath(g4);
const t4 = feasibleTree(g4);
initLowLimValues(t4);
initCutValues(t4, g4);
let e4;
let f3;
while (e4 = leaveEdge(t4)) {
f3 = enterEdge(t4, g4, e4);
exchangeEdges(t4, g4, e4, f3);
}
};
var initCutValues = (t4, g4) => {
let vs = postorder(t4, t4.nodes());
vs = vs === null || vs === void 0 ? void 0 : vs.slice(0, (vs === null || vs === void 0 ? void 0 : vs.length) - 1);
vs === null || vs === void 0 ? void 0 : vs.forEach((v3) => {
assignCutValue(t4, g4, v3);
});
};
var assignCutValue = (t4, g4, child) => {
const childLab = t4.node(child);
const parent = childLab.parent;
t4.edge(child, parent).cutvalue = calcCutValue(t4, g4, child);
};
var calcCutValue = (t4, g4, child) => {
var _a6;
const childLab = t4.node(child);
const parent = childLab.parent;
let childIsTail = true;
let graphEdge = g4.edge(child, parent);
let cutValue = 0;
if (!graphEdge) {
childIsTail = false;
graphEdge = g4.edge(parent, child);
}
cutValue = graphEdge.weight;
(_a6 = g4.nodeEdges(child)) === null || _a6 === void 0 ? void 0 : _a6.forEach((e4) => {
const isOutEdge = e4.v === child;
const other2 = isOutEdge ? e4.w : e4.v;
if (other2 !== parent) {
const pointsToHead = isOutEdge === childIsTail;
const otherWeight = g4.edge(e4).weight;
cutValue += pointsToHead ? otherWeight : -otherWeight;
if (isTreeEdge(t4, child, other2)) {
const otherCutValue = t4.edge(child, other2).cutvalue;
cutValue += pointsToHead ? -otherCutValue : otherCutValue;
}
}
});
return cutValue;
};
var initLowLimValues = (tree, root) => {
if (root !== void 0) {
root = tree.nodes()[0];
}
dfsAssignLowLim(tree, {}, 1, root);
};
var dfsAssignLowLim = (tree, visited, nextLim, v3, parent) => {
var _a6;
const low = nextLim;
let useNextLim = nextLim;
const label17 = tree.node(v3);
visited[v3] = true;
(_a6 = tree.neighbors(v3)) === null || _a6 === void 0 ? void 0 : _a6.forEach((w4) => {
if (!visited.hasOwnProperty(w4)) {
useNextLim = dfsAssignLowLim(tree, visited, useNextLim, w4, v3);
}
});
label17.low = low;
label17.lim = useNextLim++;
if (parent) {
label17.parent = parent;
} else {
delete label17.parent;
}
return useNextLim;
};
var leaveEdge = (tree) => {
return tree.edges().find((e4) => {
return tree.edge(e4).cutvalue < 0;
});
};
var enterEdge = (t4, g4, edge2) => {
let v3 = edge2.v;
let w4 = edge2.w;
if (!g4.hasEdge(v3, w4)) {
v3 = edge2.w;
w4 = edge2.v;
}
const vLabel = t4.node(v3);
const wLabel = t4.node(w4);
let tailLabel = vLabel;
let flip = false;
if (vLabel.lim > wLabel.lim) {
tailLabel = wLabel;
flip = true;
}
const candidates = g4.edges().filter((edge3) => {
return flip === isDescendant(t4, t4.node(edge3.v), tailLabel) && flip !== isDescendant(t4, t4.node(edge3.w), tailLabel);
});
return minBy(candidates, (edge3) => {
return slack(g4, edge3);
});
};
var exchangeEdges = (t4, g4, e4, f3) => {
const v3 = e4.v;
const w4 = e4.w;
t4.removeEdge(v3, w4);
t4.setEdge(f3.v, f3.w, {});
initLowLimValues(t4);
initCutValues(t4, g4);
updateRanks(t4, g4);
};
var updateRanks = (t4, g4) => {
const root = t4.nodes().find((v3) => {
return !g4.node(v3).parent;
});
let vs = preorder(t4, root);
vs = vs === null || vs === void 0 ? void 0 : vs.slice(1);
vs === null || vs === void 0 ? void 0 : vs.forEach((v3) => {
const parent = t4.node(v3).parent;
let edge2 = g4.edge(v3, parent);
let flipped = false;
if (!edge2) {
edge2 = g4.edge(parent, v3);
flipped = true;
}
g4.node(v3).rank = g4.node(parent).rank + (flipped ? edge2.minlen : -edge2.minlen);
});
};
var isTreeEdge = (tree, u3, v3) => {
return tree.hasEdge(u3, v3);
};
var isDescendant = (tree, vLabel, rootLabel) => {
return rootLabel.low <= vLabel.lim && vLabel.lim <= rootLabel.lim;
};
networkSimplex.initLowLimValues = initLowLimValues;
networkSimplex.initCutValues = initCutValues;
networkSimplex.calcCutValue = calcCutValue;
networkSimplex.leaveEdge = leaveEdge;
networkSimplex.enterEdge = enterEdge;
networkSimplex.exchangeEdges = exchangeEdges;
var network_simplex_default = networkSimplex;
// node_modules/@antv/layout/es/layout/dagre/src/rank/index.js
var rank = (g4) => {
switch (g4.graph().ranker) {
case "network-simplex":
networkSimplexRanker(g4);
break;
case "tight-tree":
tightTreeRanker(g4);
break;
case "longest-path":
longestPathRanker(g4);
break;
default:
tightTreeRanker(g4);
}
};
var longestPathRanker = longestPath;
var tightTreeRanker = (g4) => {
longestPathWithLayer(g4);
feasibleTreeWithLayer(g4);
};
var networkSimplexRanker = (g4) => {
network_simplex_default(g4);
};
var rank_default = rank;
// node_modules/@antv/layout/es/layout/dagre/src/parent-dummy-chains.js
var parentDummyChains = (g4) => {
var _a6;
const postorderNums = postorder2(g4);
(_a6 = g4.graph().dummyChains) === null || _a6 === void 0 ? void 0 : _a6.forEach((v3) => {
var _a7, _b;
let node = g4.node(v3);
const edgeObj = node.edgeObj;
if (!edgeObj)
return;
const pathData = findPath(g4, postorderNums, edgeObj.v, edgeObj.w);
const path = pathData.path;
const lca = pathData.lca;
let pathIdx = 0;
let pathV = path[pathIdx];
let ascending = true;
while (v3 !== edgeObj.w) {
node = g4.node(v3);
if (ascending) {
while ((pathV = path[pathIdx]) !== lca && g4.node(pathV).maxRank < node.rank) {
pathIdx++;
}
if (pathV === lca) {
ascending = false;
}
}
if (!ascending) {
while (pathIdx < path.length - 1 && ((_a7 = g4.node(pathV = path[pathIdx + 1])) === null || _a7 === void 0 ? void 0 : _a7.minRank) <= node.rank) {
pathIdx++;
}
pathV = path[pathIdx];
}
g4.setParent(v3, pathV);
v3 = (_b = g4.successors(v3)) === null || _b === void 0 ? void 0 : _b[0];
}
});
};
var findPath = (g4, postorderNums, v3, w4) => {
const vPath = [];
const wPath = [];
const low = Math.min(postorderNums[v3].low, postorderNums[w4].low);
const lim = Math.max(postorderNums[v3].lim, postorderNums[w4].lim);
let parent;
let lca;
parent = v3;
do {
parent = g4.parent(parent);
vPath.push(parent);
} while (parent && (postorderNums[parent].low > low || lim > postorderNums[parent].lim));
lca = parent;
parent = w4;
while ((parent = g4.parent(parent)) !== lca) {
wPath.push(parent);
}
return { lca, path: vPath.concat(wPath.reverse()) };
};
var postorder2 = (g4) => {
var _a6;
const result = {};
let lim = 0;
const dfs2 = (v3) => {
var _a7;
const low = lim;
(_a7 = g4.children(v3)) === null || _a7 === void 0 ? void 0 : _a7.forEach(dfs2);
result[v3] = { low, lim: lim++ };
};
(_a6 = g4.children()) === null || _a6 === void 0 ? void 0 : _a6.forEach(dfs2);
return result;
};
var parent_dummy_chains_default = parentDummyChains;
// node_modules/@antv/layout/es/layout/dagre/src/nesting-graph.js
var run3 = (g4) => {
var _a6;
const root = util_default2.addDummyNode(g4, "root", {}, "_root");
const depths = treeDepths(g4);
const height = Math.max(...Object.values(depths)) - 1;
const nodeSep = 2 * height + 1;
g4.graph().nestingRoot = root;
g4.edges().forEach((e4) => {
g4.edge(e4).minlen *= nodeSep;
});
const weight = sumWeights(g4) + 1;
(_a6 = g4.children()) === null || _a6 === void 0 ? void 0 : _a6.forEach((child) => {
dfs(g4, root, nodeSep, weight, height, depths, child);
});
g4.graph().nodeRankFactor = nodeSep;
};
var dfs = (g4, root, nodeSep, weight, height, depths, v3) => {
const children = g4.children(v3);
if (!(children === null || children === void 0 ? void 0 : children.length)) {
if (v3 !== root) {
g4.setEdge(root, v3, { weight: 0, minlen: nodeSep });
}
return;
}
const top = util_default2.addBorderNode(g4, "_bt");
const bottom = util_default2.addBorderNode(g4, "_bb");
const label17 = g4.node(v3);
g4.setParent(top, v3);
label17.borderTop = top;
g4.setParent(bottom, v3);
label17.borderBottom = bottom;
children === null || children === void 0 ? void 0 : children.forEach((child) => {
dfs(g4, root, nodeSep, weight, height, depths, child);
const childNode = g4.node(child);
const childTop = childNode.borderTop ? childNode.borderTop : child;
const childBottom = childNode.borderBottom ? childNode.borderBottom : child;
const thisWeight = childNode.borderTop ? weight : 2 * weight;
const minlen = childTop !== childBottom ? 1 : height - depths[v3] + 1;
g4.setEdge(top, childTop, {
minlen,
weight: thisWeight,
nestingEdge: true
});
g4.setEdge(childBottom, bottom, {
minlen,
weight: thisWeight,
nestingEdge: true
});
});
if (!g4.parent(v3)) {
g4.setEdge(root, top, { weight: 0, minlen: height + depths[v3] });
}
};
var treeDepths = (g4) => {
var _a6;
const depths = {};
const dfs2 = (v3, depth) => {
const children = g4.children(v3);
children === null || children === void 0 ? void 0 : children.forEach((child) => dfs2(child, depth + 1));
depths[v3] = depth;
};
(_a6 = g4.children()) === null || _a6 === void 0 ? void 0 : _a6.forEach((v3) => dfs2(v3, 1));
return depths;
};
var sumWeights = (g4) => {
let result = 0;
g4.edges().forEach((e4) => {
result += g4.edge(e4).weight;
});
return result;
};
var cleanup = (g4) => {
const graphLabel = g4.graph();
graphLabel.nestingRoot && g4.removeNode(graphLabel.nestingRoot);
delete graphLabel.nestingRoot;
g4.edges().forEach((e4) => {
const edge2 = g4.edge(e4);
if (edge2.nestingEdge) {
g4.removeEdge(e4);
}
});
};
var nesting_graph_default = { run: run3, cleanup };
// node_modules/@antv/layout/es/layout/dagre/src/add-border-segments.js
var addBorderSegments = (g4) => {
var _a6;
const dfs2 = (v3) => {
const children = g4.children(v3);
const node = g4.node(v3);
if (children === null || children === void 0 ? void 0 : children.length) {
children.forEach((child) => dfs2(child));
}
if (node.hasOwnProperty("minRank")) {
node.borderLeft = [];
node.borderRight = [];
for (let rank2 = node.minRank, maxRank2 = node.maxRank + 1; rank2 < maxRank2; ++rank2) {
addBorderNode2(g4, "borderLeft", "_bl", v3, node, rank2);
addBorderNode2(g4, "borderRight", "_br", v3, node, rank2);
}
}
};
(_a6 = g4.children()) === null || _a6 === void 0 ? void 0 : _a6.forEach((child) => dfs2(child));
};
var addBorderNode2 = (g4, prop, prefix2, sg, sgNode, rank2) => {
const label17 = { rank: rank2, width: 0, height: 0, borderType: prop };
const prev = sgNode[prop][rank2 - 1];
const curr = util_default2.addDummyNode(g4, "border", label17, prefix2);
sgNode[prop][rank2] = curr;
g4.setParent(curr, sg);
if (prev) {
g4.setEdge(prev, curr, { weight: 1 });
}
};
var add_border_segments_default = addBorderSegments;
// node_modules/@antv/layout/es/layout/dagre/src/coordinate-system.js
var adjust3 = (g4) => {
var _a6;
const rankDir = (_a6 = g4.graph().rankdir) === null || _a6 === void 0 ? void 0 : _a6.toLowerCase();
if (rankDir === "lr" || rankDir === "rl") {
swapWidthHeight(g4);
}
};
var undo3 = (g4) => {
var _a6;
const rankDir = (_a6 = g4.graph().rankdir) === null || _a6 === void 0 ? void 0 : _a6.toLowerCase();
if (rankDir === "bt" || rankDir === "rl") {
reverseY(g4);
}
if (rankDir === "lr" || rankDir === "rl") {
swapXY(g4);
swapWidthHeight(g4);
}
};
var swapWidthHeight = (g4) => {
g4.nodes().forEach((v3) => {
swapWidthHeightOne(g4.node(v3));
});
g4.edges().forEach((e4) => {
swapWidthHeightOne(g4.edge(e4));
});
};
var swapWidthHeightOne = (attrs) => {
const w4 = attrs.width;
attrs.width = attrs.height;
attrs.height = w4;
};
var reverseY = (g4) => {
g4.nodes().forEach((v3) => {
reverseYOne(g4.node(v3));
});
g4.edges().forEach((e4) => {
var _a6;
const edge2 = g4.edge(e4);
(_a6 = edge2.points) === null || _a6 === void 0 ? void 0 : _a6.forEach((point2) => reverseYOne(point2));
if (edge2.hasOwnProperty("y")) {
reverseYOne(edge2);
}
});
};
var reverseYOne = (attrs) => {
attrs.y = -attrs.y;
};
var swapXY = (g4) => {
g4.nodes().forEach((v3) => {
swapXYOne(g4.node(v3));
});
g4.edges().forEach((e4) => {
var _a6;
const edge2 = g4.edge(e4);
(_a6 = edge2.points) === null || _a6 === void 0 ? void 0 : _a6.forEach((point2) => swapXYOne(point2));
if (edge2.hasOwnProperty("x")) {
swapXYOne(edge2);
}
});
};
var swapXYOne = (attrs) => {
const x6 = attrs.x;
attrs.x = attrs.y;
attrs.y = x6;
};
var coordinate_system_default = { adjust: adjust3, undo: undo3 };
// node_modules/@antv/layout/es/layout/dagre/src/order/init-order.js
var initOrder = (g4) => {
const visited = {};
const simpleNodes = g4.nodes().filter((v3) => {
var _a6;
return !((_a6 = g4.children(v3)) === null || _a6 === void 0 ? void 0 : _a6.length);
});
const nodeRanks = simpleNodes.map((v3) => g4.node(v3).rank);
const maxRank2 = Math.max(...nodeRanks);
const layers = [];
for (let i4 = 0; i4 < maxRank2 + 1; i4++) {
layers.push([]);
}
const dfs2 = (v3) => {
var _a6;
if (visited.hasOwnProperty(v3))
return;
visited[v3] = true;
const node = g4.node(v3);
if (!isNaN(node.rank)) {
layers[node.rank].push(v3);
}
(_a6 = g4.successors(v3)) === null || _a6 === void 0 ? void 0 : _a6.forEach((child) => dfs2(child));
};
const orderedVs = simpleNodes.sort((a4, b10) => g4.node(a4).rank - g4.node(b10).rank);
const beforeSort = orderedVs.filter((n3) => {
return g4.node(n3).fixorder !== void 0;
});
const fixOrderNodes = beforeSort.sort((a4, b10) => g4.node(a4).fixorder - g4.node(b10).fixorder);
fixOrderNodes === null || fixOrderNodes === void 0 ? void 0 : fixOrderNodes.forEach((n3) => {
if (!isNaN(g4.node(n3).rank)) {
layers[g4.node(n3).rank].push(n3);
}
visited[n3] = true;
});
orderedVs === null || orderedVs === void 0 ? void 0 : orderedVs.forEach(dfs2);
return layers;
};
var init_order_default = initOrder;
// node_modules/@antv/layout/es/layout/dagre/src/order/cross-count.js
var twoLayerCrossCount = (g4, northLayer, southLayer) => {
const southPos = zipObject(southLayer, southLayer.map((v3, i4) => i4));
const unflat = northLayer.map((v3) => {
var _a6;
const unsort = (_a6 = g4.outEdges(v3)) === null || _a6 === void 0 ? void 0 : _a6.map((e4) => {
return { pos: southPos[e4.w] || 0, weight: g4.edge(e4).weight };
});
return unsort === null || unsort === void 0 ? void 0 : unsort.sort((a4, b10) => a4.pos - b10.pos);
});
const southEntries = unflat.flat().filter((entry) => entry !== void 0);
let firstIndex = 1;
while (firstIndex < southLayer.length)
firstIndex <<= 1;
const treeSize = 2 * firstIndex - 1;
firstIndex -= 1;
const tree = Array(treeSize).fill(0, 0, treeSize);
let cc = 0;
southEntries === null || southEntries === void 0 ? void 0 : southEntries.forEach((entry) => {
let index2 = entry.pos + firstIndex;
tree[index2] += entry.weight;
let weightSum = 0;
while (index2 > 0) {
if (index2 % 2) {
weightSum += tree[index2 + 1];
}
index2 = index2 - 1 >> 1;
tree[index2] += entry.weight;
}
cc += entry.weight * weightSum;
});
return cc;
};
var crossCount = (g4, layering) => {
let cc = 0;
for (let i4 = 1; i4 < (layering === null || layering === void 0 ? void 0 : layering.length); ++i4) {
cc += twoLayerCrossCount(g4, layering[i4 - 1], layering[i4]);
}
return cc;
};
var cross_count_default = crossCount;
// node_modules/@antv/layout/es/layout/dagre/src/order/build-layer-graph.js
var Graph5 = graphlib_default.Graph;
var buildLayerGraph = (g4, rank2, relationship) => {
const root = createRootNode(g4);
const result = new Graph5({ compound: true }).setGraph({ root }).setDefaultNodeLabel((v3) => {
return g4.node(v3);
});
g4.nodes().forEach((v3) => {
const node = g4.node(v3);
const parent = g4.parent(v3);
if (node.rank === rank2 || node.minRank <= rank2 && rank2 <= node.maxRank) {
result.setNode(v3);
result.setParent(v3, parent || root);
g4[relationship](v3).forEach((e4) => {
const u3 = e4.v === v3 ? e4.w : e4.v;
const edge2 = result.edge(u3, v3);
const weight = edge2 !== void 0 ? edge2.weight : 0;
result.setEdge(u3, v3, { weight: g4.edge(e4).weight + weight });
});
if (node.hasOwnProperty("minRank")) {
result.setNode(v3, {
borderLeft: node.borderLeft[rank2],
borderRight: node.borderRight[rank2]
});
}
}
});
return result;
};
var createRootNode = (g4) => {
let v3;
while (g4.hasNode(v3 = `_root${Math.random()}`))
;
return v3;
};
var build_layer_graph_default = buildLayerGraph;
// node_modules/@antv/layout/es/layout/dagre/src/order/add-subgraph-constraints.js
var addSubgraphConstraints = (g4, cg, vs) => {
const prev = {};
let rootPrev;
vs === null || vs === void 0 ? void 0 : vs.forEach((v3) => {
let child = g4.parent(v3);
let parent;
let prevChild;
while (child) {
parent = g4.parent(child);
if (parent) {
prevChild = prev[parent];
prev[parent] = child;
} else {
prevChild = rootPrev;
rootPrev = child;
}
if (prevChild && prevChild !== child) {
cg.setEdge(prevChild, child);
return;
}
child = parent;
}
});
};
var add_subgraph_constraints_default = addSubgraphConstraints;
// node_modules/@antv/layout/es/layout/dagre/src/order/barycenter.js
var barycenter = (g4, movable) => {
return movable.map((v3) => {
const inV = g4.inEdges(v3);
if (!(inV === null || inV === void 0 ? void 0 : inV.length)) {
return { v: v3 };
}
{
const result = { sum: 0, weight: 0 };
inV === null || inV === void 0 ? void 0 : inV.forEach((e4) => {
const edge2 = g4.edge(e4);
const nodeU = g4.node(e4.v);
result.sum += edge2.weight * nodeU.order;
result.weight += edge2.weight;
});
return {
v: v3,
barycenter: result.sum / result.weight,
weight: result.weight
};
}
});
};
var barycenter_default = barycenter;
// node_modules/@antv/layout/es/layout/dagre/src/order/resolve-conflicts.js
var resolveConflicts = (entries, cg) => {
var _a6, _b, _c;
const mappedEntries = {};
entries === null || entries === void 0 ? void 0 : entries.forEach((entry, i4) => {
const tmp = mappedEntries[entry.v] = {
i: i4,
indegree: 0,
"in": [],
out: [],
vs: [entry.v]
};
if (entry.barycenter !== void 0) {
tmp.barycenter = entry.barycenter;
tmp.weight = entry.weight;
}
});
(_a6 = cg.edges()) === null || _a6 === void 0 ? void 0 : _a6.forEach((e4) => {
const entryV = mappedEntries[e4.v];
const entryW = mappedEntries[e4.w];
if (entryV !== void 0 && entryW !== void 0) {
entryW.indegree++;
entryV.out.push(mappedEntries[e4.w]);
}
});
const sourceSet = (_c = (_b = Object.values(mappedEntries)).filter) === null || _c === void 0 ? void 0 : _c.call(_b, (entry) => !entry.indegree);
return doResolveConflicts(sourceSet);
};
var doResolveConflicts = (sourceSet) => {
var _a6, _b;
const entries = [];
const handleIn = (vEntry) => {
return (uEntry) => {
if (uEntry.merged)
return;
if (uEntry.barycenter === void 0 || vEntry.barycenter === void 0 || uEntry.barycenter >= vEntry.barycenter) {
mergeEntries(vEntry, uEntry);
}
};
};
const handleOut = (vEntry) => {
return (wEntry) => {
wEntry["in"].push(vEntry);
if (--wEntry.indegree === 0) {
sourceSet.push(wEntry);
}
};
};
while (sourceSet === null || sourceSet === void 0 ? void 0 : sourceSet.length) {
const entry = sourceSet.pop();
entries.push(entry);
(_a6 = entry["in"].reverse()) === null || _a6 === void 0 ? void 0 : _a6.forEach((e4) => handleIn(entry)(e4));
(_b = entry.out) === null || _b === void 0 ? void 0 : _b.forEach((e4) => handleOut(entry)(e4));
}
const filtered = entries.filter((entry) => !entry.merged);
const keys2 = ["vs", "i", "barycenter", "weight"];
return filtered.map((entry) => {
const picked = {};
keys2 === null || keys2 === void 0 ? void 0 : keys2.forEach((key) => {
if (entry[key] === void 0)
return;
picked[key] = entry[key];
});
return picked;
});
};
var mergeEntries = (target, source) => {
var _a6;
let sum = 0;
let weight = 0;
if (target.weight) {
sum += target.barycenter * target.weight;
weight += target.weight;
}
if (source.weight) {
sum += source.barycenter * source.weight;
weight += source.weight;
}
target.vs = (_a6 = source.vs) === null || _a6 === void 0 ? void 0 : _a6.concat(target.vs);
target.barycenter = sum / weight;
target.weight = weight;
target.i = Math.min(source.i, target.i);
source.merged = true;
};
var resolve_conflicts_default = resolveConflicts;
// node_modules/@antv/layout/es/layout/dagre/src/order/sort.js
var sort = (entries, biasRight, usePrev) => {
const parts = util_default2.partition(entries, (entry) => {
return entry.hasOwnProperty("fixorder") && !isNaN(entry.fixorder) || entry.hasOwnProperty("barycenter");
});
const sortable = parts.lhs;
const unsortable = parts.rhs.sort((a4, b10) => -a4.i - -b10.i);
const vs = [];
let sum = 0;
let weight = 0;
let vsIndex = 0;
sortable === null || sortable === void 0 ? void 0 : sortable.sort(compareWithBias(!!biasRight, !!usePrev));
vsIndex = consumeUnsortable(vs, unsortable, vsIndex);
sortable === null || sortable === void 0 ? void 0 : sortable.forEach((entry) => {
var _a6;
vsIndex += (_a6 = entry.vs) === null || _a6 === void 0 ? void 0 : _a6.length;
vs.push(entry.vs);
sum += entry.barycenter * entry.weight;
weight += entry.weight;
vsIndex = consumeUnsortable(vs, unsortable, vsIndex);
});
const result = { vs: vs.flat() };
if (weight) {
result.barycenter = sum / weight;
result.weight = weight;
}
return result;
};
var consumeUnsortable = (vs, unsortable, index2) => {
let iindex = index2;
let last2;
while (unsortable.length && (last2 = unsortable[unsortable.length - 1]).i <= iindex) {
unsortable.pop();
vs === null || vs === void 0 ? void 0 : vs.push(last2.vs);
iindex++;
}
return iindex;
};
var compareWithBias = (bias, usePrev) => {
return (entryV, entryW) => {
if (entryV.fixorder !== void 0 && entryW.fixorder !== void 0) {
return entryV.fixorder - entryW.fixorder;
}
if (entryV.barycenter < entryW.barycenter) {
return -1;
}
if (entryV.barycenter > entryW.barycenter) {
return 1;
}
if (usePrev && entryV.order !== void 0 && entryW.order !== void 0) {
if (entryV.order < entryW.order) {
return -1;
}
if (entryV.order > entryW.order) {
return 1;
}
}
return !bias ? entryV.i - entryW.i : entryW.i - entryV.i;
};
};
var sort_default2 = sort;
// node_modules/@antv/layout/es/layout/dagre/src/order/sort-subgraph.js
var sortSubgraph = (g4, v3, cg, biasRight, usePrev) => {
var _a6, _b, _c, _d;
let movable = g4.children(v3);
const node = g4.node(v3);
const bl = node ? node.borderLeft : void 0;
const br = node ? node.borderRight : void 0;
const subgraphs = {};
if (bl) {
movable = movable === null || movable === void 0 ? void 0 : movable.filter((w4) => {
return w4 !== bl && w4 !== br;
});
}
const barycenters = barycenter_default(g4, movable || []);
barycenters === null || barycenters === void 0 ? void 0 : barycenters.forEach((entry) => {
var _a7;
if ((_a7 = g4.children(entry.v)) === null || _a7 === void 0 ? void 0 : _a7.length) {
const subgraphResult = sortSubgraph(g4, entry.v, cg, biasRight);
subgraphs[entry.v] = subgraphResult;
if (subgraphResult.hasOwnProperty("barycenter")) {
mergeBarycenters(entry, subgraphResult);
}
}
});
const entries = resolve_conflicts_default(barycenters, cg);
expandSubgraphs(entries, subgraphs);
(_a6 = entries.filter((e4) => {
var _a7;
return !!e4.vs || ((_a7 = e4.vs) === null || _a7 === void 0 ? void 0 : _a7.length) > 0;
})) === null || _a6 === void 0 ? void 0 : _a6.forEach((e4) => {
const node2 = g4.node(e4.vs[0]);
e4.fixorder = node2.fixorder;
e4.order = node2.order;
});
const result = sort_default2(entries, biasRight, usePrev);
if (bl) {
result.vs = [bl, result.vs, br].flat();
if ((_b = g4.predecessors(bl)) === null || _b === void 0 ? void 0 : _b.length) {
const blPred = g4.node(((_c = g4.predecessors(bl)) === null || _c === void 0 ? void 0 : _c[0]) || {});
const brPred = g4.node(((_d = g4.predecessors(br)) === null || _d === void 0 ? void 0 : _d[0]) || {});
if (!result.hasOwnProperty("barycenter")) {
result.barycenter = 0;
result.weight = 0;
}
result.barycenter = (result.barycenter * result.weight + blPred.order + brPred.order) / (result.weight + 2);
result.weight += 2;
}
}
return result;
};
var expandSubgraphs = (entries, subgraphs) => {
entries === null || entries === void 0 ? void 0 : entries.forEach((entry) => {
var _a6;
const vss = (_a6 = entry.vs) === null || _a6 === void 0 ? void 0 : _a6.map((v3) => {
if (subgraphs[v3]) {
return subgraphs[v3].vs;
}
return v3;
});
entry.vs = vss.flat();
});
};
var mergeBarycenters = (target, other2) => {
if (target.barycenter !== void 0) {
target.barycenter = (target.barycenter * target.weight + other2.barycenter * other2.weight) / (target.weight + other2.weight);
target.weight += other2.weight;
} else {
target.barycenter = other2.barycenter;
target.weight = other2.weight;
}
};
var sort_subgraph_default = sortSubgraph;
// node_modules/@antv/layout/es/layout/dagre/src/order/index.js
var Graph6 = graphlib_default.Graph;
var order = (g4) => {
const maxRank2 = util_default2.maxRank(g4);
const range1 = [];
const range2 = [];
for (let i4 = 1; i4 < maxRank2 + 1; i4++)
range1.push(i4);
for (let i4 = maxRank2 - 1; i4 > -1; i4--)
range2.push(i4);
const downLayerGraphs = buildLayerGraphs(g4, range1, "inEdges");
const upLayerGraphs = buildLayerGraphs(g4, range2, "outEdges");
let layering = init_order_default(g4);
assignOrder(g4, layering);
let bestCC = Number.POSITIVE_INFINITY;
let best;
for (let i4 = 0, lastBest = 0; lastBest < 4; ++i4, ++lastBest) {
sweepLayerGraphs(i4 % 2 ? downLayerGraphs : upLayerGraphs, i4 % 4 >= 2);
layering = util_default2.buildLayerMatrix(g4);
const cc = cross_count_default(g4, layering);
if (cc < bestCC) {
lastBest = 0;
best = clone9(layering);
bestCC = cc;
}
}
layering = init_order_default(g4);
assignOrder(g4, layering);
for (let i4 = 0, lastBest = 0; lastBest < 4; ++i4, ++lastBest) {
sweepLayerGraphs(i4 % 2 ? downLayerGraphs : upLayerGraphs, i4 % 4 >= 2, true);
layering = util_default2.buildLayerMatrix(g4);
const cc = cross_count_default(g4, layering);
if (cc < bestCC) {
lastBest = 0;
best = clone9(layering);
bestCC = cc;
}
}
assignOrder(g4, best);
};
var buildLayerGraphs = (g4, ranks, relationship) => {
return ranks.map((rank2) => {
return build_layer_graph_default(g4, rank2, relationship);
});
};
var sweepLayerGraphs = (layerGraphs, biasRight, usePrev) => {
const cg = new Graph6();
layerGraphs === null || layerGraphs === void 0 ? void 0 : layerGraphs.forEach((lg) => {
var _a6;
const root = lg.graph().root;
const sorted = sort_subgraph_default(lg, root, cg, biasRight, usePrev);
for (let i4 = 0; i4 < ((_a6 = sorted.vs) === null || _a6 === void 0 ? void 0 : _a6.length) || 0; i4++) {
lg.node(sorted.vs[i4]).order = i4;
}
add_subgraph_constraints_default(lg, cg, sorted.vs);
});
};
var assignOrder = (g4, layering) => {
layering === null || layering === void 0 ? void 0 : layering.forEach((layer) => {
layer === null || layer === void 0 ? void 0 : layer.forEach((v3, i4) => {
g4.node(v3).order = i4;
});
});
};
var order_default = order;
// node_modules/@antv/layout/es/layout/dagre/src/position/bk.js
var Graph7 = graphlib_default.Graph;
var findType1Conflicts = (g4, layering) => {
const conflicts = {};
const visitLayer = (prevLayer, layer) => {
let k0 = 0;
let scanPos = 0;
const prevLayerLength = prevLayer.length;
const lastNode = layer === null || layer === void 0 ? void 0 : layer[(layer === null || layer === void 0 ? void 0 : layer.length) - 1];
layer === null || layer === void 0 ? void 0 : layer.forEach((v3, i4) => {
var _a6;
const w4 = findOtherInnerSegmentNode(g4, v3);
const k1 = w4 ? g4.node(w4).order : prevLayerLength;
if (w4 || v3 === lastNode) {
(_a6 = layer.slice(scanPos, i4 + 1)) === null || _a6 === void 0 ? void 0 : _a6.forEach((scanNode) => {
var _a7;
(_a7 = g4.predecessors(scanNode)) === null || _a7 === void 0 ? void 0 : _a7.forEach((u3) => {
const uLabel = g4.node(u3);
const uPos = uLabel.order;
if ((uPos < k0 || k1 < uPos) && !(uLabel.dummy && g4.node(scanNode).dummy)) {
addConflict(conflicts, u3, scanNode);
}
});
});
scanPos = i4 + 1;
k0 = k1;
}
});
return layer;
};
if (layering === null || layering === void 0 ? void 0 : layering.length) {
layering.reduce(visitLayer);
}
return conflicts;
};
var findType2Conflicts = (g4, layering) => {
const conflicts = {};
const scan = (south, southPos, southEnd, prevNorthBorder, nextNorthBorder) => {
let v3;
const range = [];
for (let i4 = southPos; i4 < southEnd; i4++) {
range.push(i4);
}
range.forEach((i4) => {
var _a6;
v3 = south[i4];
if (g4.node(v3).dummy) {
(_a6 = g4.predecessors(v3)) === null || _a6 === void 0 ? void 0 : _a6.forEach((u3) => {
const uNode = g4.node(u3);
if (uNode.dummy && (uNode.order < prevNorthBorder || uNode.order > nextNorthBorder)) {
addConflict(conflicts, u3, v3);
}
});
}
});
};
const visitLayer = (north, south) => {
let prevNorthPos = -1;
let nextNorthPos;
let southPos = 0;
south === null || south === void 0 ? void 0 : south.forEach((v3, southLookahead) => {
if (g4.node(v3).dummy === "border") {
const predecessors = g4.predecessors(v3) || [];
if (predecessors.length) {
nextNorthPos = g4.node(predecessors[0]).order;
scan(south, southPos, southLookahead, prevNorthPos, nextNorthPos);
southPos = southLookahead;
prevNorthPos = nextNorthPos;
}
}
scan(south, southPos, south.length, nextNorthPos, north.length);
});
return south;
};
if (layering === null || layering === void 0 ? void 0 : layering.length) {
layering.reduce(visitLayer);
}
return conflicts;
};
var findOtherInnerSegmentNode = (g4, v3) => {
var _a6;
if (g4.node(v3).dummy) {
return (_a6 = g4.predecessors(v3)) === null || _a6 === void 0 ? void 0 : _a6.find((u3) => g4.node(u3).dummy);
}
};
var addConflict = (conflicts, v3, w4) => {
let vv = v3;
let ww = w4;
if (vv > ww) {
const tmp = vv;
vv = ww;
ww = tmp;
}
let conflictsV = conflicts[vv];
if (!conflictsV) {
conflicts[vv] = conflictsV = {};
}
conflictsV[ww] = true;
};
var hasConflict = (conflicts, v3, w4) => {
let vv = v3;
let ww = w4;
if (vv > ww) {
const tmp = v3;
vv = ww;
ww = tmp;
}
return conflicts[vv] && conflicts[vv].hasOwnProperty(ww);
};
var verticalAlignment = (g4, layering, conflicts, neighborFn) => {
const root = {};
const align = {};
const pos = {};
layering === null || layering === void 0 ? void 0 : layering.forEach((layer) => {
layer === null || layer === void 0 ? void 0 : layer.forEach((v3, order2) => {
root[v3] = v3;
align[v3] = v3;
pos[v3] = order2;
});
});
layering === null || layering === void 0 ? void 0 : layering.forEach((layer) => {
let prevIdx = -1;
layer === null || layer === void 0 ? void 0 : layer.forEach((v3) => {
let ws = neighborFn(v3);
if (ws.length) {
ws = ws.sort((a4, b10) => pos[a4] - pos[b10]);
const mp = (ws.length - 1) / 2;
for (let i4 = Math.floor(mp), il = Math.ceil(mp); i4 <= il; ++i4) {
const w4 = ws[i4];
if (align[v3] === v3 && prevIdx < pos[w4] && !hasConflict(conflicts, v3, w4)) {
align[w4] = v3;
align[v3] = root[v3] = root[w4];
prevIdx = pos[w4];
}
}
}
});
});
return { root, align };
};
var horizontalCompaction = (g4, layering, root, align, reverseSep) => {
var _a6;
const xs = {};
const blockG = buildBlockGraph(g4, layering, root, reverseSep);
const borderType = reverseSep ? "borderLeft" : "borderRight";
const iterate = (setXsFunc, nextNodesFunc) => {
let stack = blockG.nodes();
let elem = stack.pop();
const visited = {};
while (elem) {
if (visited[elem]) {
setXsFunc(elem);
} else {
visited[elem] = true;
stack.push(elem);
stack = stack.concat(nextNodesFunc(elem));
}
elem = stack.pop();
}
};
const pass1 = (elem) => {
xs[elem] = (blockG.inEdges(elem) || []).reduce((acc, e4) => {
return Math.max(acc, (xs[e4.v] || 0) + blockG.edge(e4));
}, 0);
};
const pass2 = (elem) => {
const min7 = (blockG.outEdges(elem) || []).reduce((acc, e4) => {
return Math.min(acc, (xs[e4.w] || 0) - blockG.edge(e4));
}, Number.POSITIVE_INFINITY);
const node = g4.node(elem);
if (min7 !== Number.POSITIVE_INFINITY && node.borderType !== borderType) {
xs[elem] = Math.max(xs[elem], min7);
}
};
iterate(pass1, blockG.predecessors.bind(blockG));
iterate(pass2, blockG.successors.bind(blockG));
(_a6 = Object.values(align)) === null || _a6 === void 0 ? void 0 : _a6.forEach((v3) => {
xs[v3] = xs[root[v3]];
});
return xs;
};
var buildBlockGraph = (g4, layering, root, reverseSep) => {
const blockGraph = new Graph7();
const graphLabel = g4.graph();
const sepFn = sep(graphLabel.nodesep, graphLabel.edgesep, reverseSep);
layering === null || layering === void 0 ? void 0 : layering.forEach((layer) => {
let u3;
layer === null || layer === void 0 ? void 0 : layer.forEach((v3) => {
const vRoot = root[v3];
blockGraph.setNode(vRoot);
if (u3) {
const uRoot = root[u3];
const prevMax = blockGraph.edge(uRoot, vRoot);
blockGraph.setEdge(uRoot, vRoot, Math.max(sepFn(g4, v3, u3), prevMax || 0));
}
u3 = v3;
});
});
return blockGraph;
};
var findSmallestWidthAlignment = (g4, xss) => {
return util_default2.minBy(Object.values(xss), (xs) => {
var _a6;
let max8 = Number.NEGATIVE_INFINITY;
let min7 = Number.POSITIVE_INFINITY;
(_a6 = Object.keys(xs)) === null || _a6 === void 0 ? void 0 : _a6.forEach((v3) => {
const x6 = xs[v3];
const halfWidth = width(g4, v3) / 2;
max8 = Math.max(x6 + halfWidth, max8);
min7 = Math.min(x6 - halfWidth, min7);
});
return max8 - min7;
});
};
function alignCoordinates(xss, alignTo) {
const alignToVals = Object.values(alignTo);
const alignToMin = Math.min(...alignToVals);
const alignToMax = Math.max(...alignToVals);
["u", "d"].forEach((vert) => {
["l", "r"].forEach((horiz) => {
const alignment = vert + horiz;
const xs = xss[alignment];
let delta;
if (xs === alignTo)
return;
const xsVals = Object.values(xs);
delta = horiz === "l" ? alignToMin - Math.min(...xsVals) : alignToMax - Math.max(...xsVals);
if (delta) {
xss[alignment] = {};
Object.keys(xs).forEach((key) => {
xss[alignment][key] = xs[key] + delta;
});
}
});
});
}
var balance = (xss, align) => {
const result = {};
Object.keys(xss.ul).forEach((key) => {
if (align) {
result[key] = xss[align.toLowerCase()][key];
} else {
const values2 = Object.values(xss).map((x6) => x6[key]);
const xs = values2.sort((a4, b10) => a4 - b10);
result[key] = (xs[1] + xs[2]) / 2;
}
});
return result;
};
var sep = (nodeSep, edgeSep, reverseSep) => {
return (g4, v3, w4) => {
const vLabel = g4.node(v3);
const wLabel = g4.node(w4);
let sum = 0;
let delta;
sum += vLabel.width / 2;
if (vLabel.hasOwnProperty("labelpos")) {
switch ((vLabel.labelpos || "").toLowerCase()) {
case "l":
delta = -vLabel.width / 2;
break;
case "r":
delta = vLabel.width / 2;
break;
}
}
if (delta) {
sum += reverseSep ? delta : -delta;
}
delta = 0;
sum += (vLabel.dummy ? edgeSep : nodeSep) / 2;
sum += (wLabel.dummy ? edgeSep : nodeSep) / 2;
sum += wLabel.width / 2;
if (wLabel.hasOwnProperty("labelpos")) {
switch ((wLabel.labelpos || "").toLowerCase()) {
case "l":
delta = wLabel.width / 2;
break;
case "r":
delta = -wLabel.width / 2;
break;
}
}
if (delta) {
sum += reverseSep ? delta : -delta;
}
delta = 0;
return sum;
};
};
var width = (g4, v3) => {
var _a6;
return ((_a6 = g4.node(v3)) === null || _a6 === void 0 ? void 0 : _a6.width) || 0;
};
// node_modules/@antv/layout/es/layout/dagre/src/position/index.js
var positionY = (g4) => {
const layering = util_default2.buildLayerMatrix(g4);
const rankSep = g4.graph().ranksep;
let prevY = 0;
layering === null || layering === void 0 ? void 0 : layering.forEach((layer) => {
const heights = layer.map((v3) => g4.node(v3).height);
const maxHeight = Math.max(...heights);
layer === null || layer === void 0 ? void 0 : layer.forEach((v3) => {
g4.node(v3).y = prevY + maxHeight / 2;
});
prevY += maxHeight + rankSep;
});
};
var positionX = (g4) => {
const layering = util_default2.buildLayerMatrix(g4);
const conflicts = Object.assign(findType1Conflicts(g4, layering), findType2Conflicts(g4, layering));
const xss = {};
let adjustedLayering;
["u", "d"].forEach((vert) => {
adjustedLayering = vert === "u" ? layering : Object.values(layering).reverse();
["l", "r"].forEach((horiz) => {
if (horiz === "r") {
adjustedLayering = adjustedLayering.map((inner) => Object.values(inner).reverse());
}
const neighborFn = (vert === "u" ? g4.predecessors : g4.successors).bind(g4);
const align = verticalAlignment(g4, adjustedLayering, conflicts, neighborFn);
const xs = horizontalCompaction(g4, adjustedLayering, align.root, align.align, horiz === "r");
if (horiz === "r") {
Object.keys(xs).forEach((xsKey) => xs[xsKey] = -xs[xsKey]);
}
xss[vert + horiz] = xs;
});
});
const smallestWidth = findSmallestWidthAlignment(g4, xss);
smallestWidth && alignCoordinates(xss, smallestWidth);
return balance(xss, g4.graph().align);
};
var position = (g4) => {
var _a6;
g4 = util_default2.asNonCompoundGraph(g4);
positionY(g4);
const xs = positionX(g4);
(_a6 = Object.keys(xs)) === null || _a6 === void 0 ? void 0 : _a6.forEach((key) => {
g4.node(key).x = xs[key];
});
};
var position_default2 = position;
// node_modules/@antv/layout/es/layout/dagre/src/order/init-data-order.js
var initDataOrder = (g4, nodeOrder) => {
const simpleNodes = g4.nodes().filter((v3) => {
var _a6;
return !((_a6 = g4.children(v3)) === null || _a6 === void 0 ? void 0 : _a6.length);
});
const ranks = simpleNodes.map((v3) => g4.node(v3).rank);
const maxRank2 = Math.max(...ranks);
const layers = [];
for (let i4 = 0; i4 < maxRank2 + 1; i4++) {
layers.push([]);
}
nodeOrder === null || nodeOrder === void 0 ? void 0 : nodeOrder.forEach((n3) => {
const node = g4.node(n3);
if (!node || node.dummy)
return;
if (!isNaN(node.rank)) {
node.fixorder = layers[node.rank].length;
layers[node.rank].push(n3);
}
});
};
var init_data_order_default = initDataOrder;
// node_modules/@antv/layout/es/layout/dagre/src/layout.js
var Graph8 = graphlib_default.Graph;
var layout2 = (g4, opts) => {
const time2 = opts && opts.debugTiming ? util_default2.time : util_default2.notime;
time2("layout", () => {
if (opts && !opts.keepNodeOrder && opts.prevGraph) {
time2(" inheritOrder", () => {
inheritOrder(g4, opts.prevGraph);
});
}
const layoutGraph = time2(" buildLayoutGraph", () => {
return buildLayoutGraph(g4);
});
if (!(opts && opts.edgeLabelSpace === false)) {
time2(" makeSpaceForEdgeLabels", () => {
makeSpaceForEdgeLabels(layoutGraph);
});
}
try {
time2(" runLayout", () => {
runLayout(layoutGraph, time2, opts);
});
} catch (e4) {
if (e4.message === "Not possible to find intersection inside of the rectangle") {
console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:\n", e4);
return;
}
throw e4;
}
time2(" updateInputGraph", () => {
updateInputGraph(g4, layoutGraph);
});
});
};
var runLayout = (g4, time2, opts) => {
time2(" removeSelfEdges", () => {
removeSelfEdges(g4);
});
time2(" acyclic", () => {
acyclic_default.run(g4);
});
time2(" nestingGraph.run", () => {
nesting_graph_default.run(g4);
});
time2(" rank", () => {
rank_default(util_default2.asNonCompoundGraph(g4));
});
time2(" injectEdgeLabelProxies", () => {
injectEdgeLabelProxies(g4);
});
time2(" removeEmptyRanks", () => {
removeEmptyRanks(g4);
});
time2(" nestingGraph.cleanup", () => {
nesting_graph_default.cleanup(g4);
});
time2(" normalizeRanks", () => {
normalizeRanks(g4);
});
time2(" assignRankMinMax", () => {
assignRankMinMax(g4);
});
time2(" removeEdgeLabelProxies", () => {
removeEdgeLabelProxies(g4);
});
time2(" normalize.run", () => {
normalize_default.run(g4);
});
time2(" parentDummyChains", () => {
parent_dummy_chains_default(g4);
});
time2(" addBorderSegments", () => {
add_border_segments_default(g4);
});
if (opts && opts.keepNodeOrder) {
time2(" initDataOrder", () => {
init_data_order_default(g4, opts.nodeOrder);
});
}
time2(" order", () => {
order_default(g4);
});
time2(" insertSelfEdges", () => {
insertSelfEdges(g4);
});
time2(" adjustCoordinateSystem", () => {
coordinate_system_default.adjust(g4);
});
time2(" position", () => {
position_default2(g4);
});
time2(" positionSelfEdges", () => {
positionSelfEdges(g4);
});
time2(" removeBorderNodes", () => {
removeBorderNodes(g4);
});
time2(" normalize.undo", () => {
normalize_default.undo(g4);
});
time2(" fixupEdgeLabelCoords", () => {
fixupEdgeLabelCoords(g4);
});
time2(" undoCoordinateSystem", () => {
coordinate_system_default.undo(g4);
});
time2(" translateGraph", () => {
translateGraph(g4);
});
time2(" assignNodeIntersects", () => {
assignNodeIntersects(g4);
});
time2(" reversePoints", () => {
reversePointsForReversedEdges(g4);
});
time2(" acyclic.undo", () => {
acyclic_default.undo(g4);
});
};
var inheritOrder = (currG, prevG) => {
const prevNodeMap = prevG._nodes || {};
currG.nodes().forEach((n3) => {
const node = currG.node(n3);
if (prevNodeMap[n3] !== void 0) {
node.fixorder = prevNodeMap[n3]._order;
delete prevNodeMap[n3]._order;
} else {
delete node.fixorder;
}
});
};
var updateInputGraph = (inputGraph, layoutGraph) => {
inputGraph.nodes().forEach((v3) => {
var _a6;
const inputLabel = inputGraph.node(v3);
const layoutLabel = layoutGraph.node(v3);
if (inputLabel) {
inputLabel.x = layoutLabel.x;
inputLabel.y = layoutLabel.y;
inputLabel._order = layoutLabel.order;
inputLabel._rank = layoutLabel.rank;
if ((_a6 = layoutGraph.children(v3)) === null || _a6 === void 0 ? void 0 : _a6.length) {
inputLabel.width = layoutLabel.width;
inputLabel.height = layoutLabel.height;
}
}
});
inputGraph.edges().forEach((e4) => {
const inputLabel = inputGraph.edge(e4);
const layoutLabel = layoutGraph.edge(e4);
inputLabel.points = layoutLabel.points;
if (layoutLabel.hasOwnProperty("x")) {
inputLabel.x = layoutLabel.x;
inputLabel.y = layoutLabel.y;
}
});
inputGraph.graph().width = layoutGraph.graph().width;
inputGraph.graph().height = layoutGraph.graph().height;
};
var graphNumAttrs = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"];
var graphDefaults = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" };
var graphAttrs = ["acyclicer", "ranker", "rankdir", "align"];
var nodeNumAttrs = ["width", "height", "layer", "fixorder"];
var nodeDefaults = { width: 0, height: 0 };
var edgeNumAttrs = ["minlen", "weight", "width", "height", "labeloffset"];
var edgeDefaults = {
minlen: 1,
weight: 1,
width: 0,
height: 0,
labeloffset: 10,
labelpos: "r"
};
var edgeAttrs = ["labelpos"];
var buildLayoutGraph = (inputGraph) => {
const g4 = new Graph8({ multigraph: true, compound: true });
const graph = canonicalize(inputGraph.graph());
const pickedProperties = {};
graphAttrs === null || graphAttrs === void 0 ? void 0 : graphAttrs.forEach((key) => {
if (graph[key] !== void 0)
pickedProperties[key] = graph[key];
});
g4.setGraph(Object.assign({}, graphDefaults, selectNumberAttrs(graph, graphNumAttrs), pickedProperties));
inputGraph.nodes().forEach((v3) => {
const node = canonicalize(inputGraph.node(v3));
const defaultAttrs = selectNumberAttrs(node, nodeNumAttrs);
Object.keys(nodeDefaults).forEach((key) => {
if (defaultAttrs[key] === void 0) {
defaultAttrs[key] = nodeDefaults[key];
}
});
g4.setNode(v3, defaultAttrs);
g4.setParent(v3, inputGraph.parent(v3));
});
inputGraph.edges().forEach((e4) => {
const edge2 = canonicalize(inputGraph.edge(e4));
const pickedProperties2 = {};
edgeAttrs === null || edgeAttrs === void 0 ? void 0 : edgeAttrs.forEach((key) => {
if (edge2[key] !== void 0)
pickedProperties2[key] = edge2[key];
});
g4.setEdge(e4, Object.assign({}, edgeDefaults, selectNumberAttrs(edge2, edgeNumAttrs), pickedProperties2));
});
return g4;
};
var makeSpaceForEdgeLabels = (g4) => {
const graph = g4.graph();
if (!graph.ranksep)
graph.ranksep = 0;
graph.ranksep /= 2;
g4.nodes().forEach((n3) => {
const node = g4.node(n3);
if (!isNaN(node.layer)) {
if (!node.layer)
node.layer = 0;
else
node.layer *= 2;
}
});
g4.edges().forEach((e4) => {
var _a6;
const edge2 = g4.edge(e4);
edge2.minlen *= 2;
if (((_a6 = edge2.labelpos) === null || _a6 === void 0 ? void 0 : _a6.toLowerCase()) !== "c") {
if (graph.rankdir === "TB" || graph.rankdir === "BT") {
edge2.width += edge2.labeloffset;
} else {
edge2.height += edge2.labeloffset;
}
}
});
};
var injectEdgeLabelProxies = (g4) => {
g4.edges().forEach((e4) => {
const edge2 = g4.edge(e4);
if (edge2.width && edge2.height) {
const v3 = g4.node(e4.v);
const w4 = g4.node(e4.w);
const label17 = { e: e4, rank: (w4.rank - v3.rank) / 2 + v3.rank };
util_default2.addDummyNode(g4, "edge-proxy", label17, "_ep");
}
});
};
var assignRankMinMax = (g4) => {
let maxRank2 = 0;
g4.nodes().forEach((v3) => {
const node = g4.node(v3);
if (node.borderTop) {
node.minRank = g4.node(node.borderTop).rank;
node.maxRank = g4.node(node.borderBottom).rank;
maxRank2 = Math.max(maxRank2, node.maxRank || -Infinity);
}
});
g4.graph().maxRank = maxRank2;
};
var removeEdgeLabelProxies = (g4) => {
g4.nodes().forEach((v3) => {
const node = g4.node(v3);
if (node.dummy === "edge-proxy") {
g4.edge(node.e).labelRank = node.rank;
g4.removeNode(v3);
}
});
};
var translateGraph = (g4) => {
let minX = Number.POSITIVE_INFINITY;
let maxX = 0;
let minY = Number.POSITIVE_INFINITY;
let maxY2 = 0;
const graphLabel = g4.graph();
const marginX = graphLabel.marginx || 0;
const marginY = graphLabel.marginy || 0;
const getExtremes = (attrs) => {
if (!attrs)
return;
const x6 = attrs.x;
const y5 = attrs.y;
const w4 = attrs.width;
const h3 = attrs.height;
if (!isNaN(x6) && !isNaN(w4)) {
minX = Math.min(minX, x6 - w4 / 2);
maxX = Math.max(maxX, x6 + w4 / 2);
}
if (!isNaN(y5) && !isNaN(h3)) {
minY = Math.min(minY, y5 - h3 / 2);
maxY2 = Math.max(maxY2, y5 + h3 / 2);
}
};
g4.nodes().forEach((v3) => {
getExtremes(g4.node(v3));
});
g4.edges().forEach((e4) => {
const edge2 = g4.edge(e4);
if (edge2.hasOwnProperty("x")) {
getExtremes(edge2);
}
});
minX -= marginX;
minY -= marginY;
g4.nodes().forEach((v3) => {
const node = g4.node(v3);
node.x -= minX;
node.y -= minY;
});
g4.edges().forEach((e4) => {
var _a6;
const edge2 = g4.edge(e4);
(_a6 = edge2.points) === null || _a6 === void 0 ? void 0 : _a6.forEach((p4) => {
p4.x -= minX;
p4.y -= minY;
});
if (edge2.hasOwnProperty("x")) {
edge2.x -= minX;
}
if (edge2.hasOwnProperty("y")) {
edge2.y -= minY;
}
});
graphLabel.width = maxX - minX + marginX;
graphLabel.height = maxY2 - minY + marginY;
};
var assignNodeIntersects = (g4) => {
g4.edges().forEach((e4) => {
const edge2 = g4.edge(e4);
const nodeV = g4.node(e4.v);
const nodeW = g4.node(e4.w);
let p1;
let p22;
if (!edge2.points) {
edge2.points = [];
p1 = nodeW;
p22 = nodeV;
} else {
p1 = edge2.points[0];
p22 = edge2.points[edge2.points.length - 1];
}
edge2.points.unshift(util_default2.intersectRect(nodeV, p1));
edge2.points.push(util_default2.intersectRect(nodeW, p22));
});
};
var fixupEdgeLabelCoords = (g4) => {
g4.edges().forEach((e4) => {
const edge2 = g4.edge(e4);
if (edge2.hasOwnProperty("x")) {
if (edge2.labelpos === "l" || edge2.labelpos === "r") {
edge2.width -= edge2.labeloffset;
}
switch (edge2.labelpos) {
case "l":
edge2.x -= edge2.width / 2 + edge2.labeloffset;
break;
case "r":
edge2.x += edge2.width / 2 + edge2.labeloffset;
break;
}
}
});
};
var reversePointsForReversedEdges = (g4) => {
g4.edges().forEach((e4) => {
const edge2 = g4.edge(e4);
if (edge2.reversed) {
edge2.points.reverse();
}
});
};
var removeBorderNodes = (g4) => {
g4.nodes().forEach((v3) => {
var _a6, _b, _c;
if ((_a6 = g4.children(v3)) === null || _a6 === void 0 ? void 0 : _a6.length) {
const node = g4.node(v3);
const t4 = g4.node(node.borderTop);
const b10 = g4.node(node.borderBottom);
const l4 = g4.node(node.borderLeft[((_b = node.borderLeft) === null || _b === void 0 ? void 0 : _b.length) - 1]);
const r4 = g4.node(node.borderRight[((_c = node.borderRight) === null || _c === void 0 ? void 0 : _c.length) - 1]);
node.width = Math.abs((r4 === null || r4 === void 0 ? void 0 : r4.x) - (l4 === null || l4 === void 0 ? void 0 : l4.x)) || 10;
node.height = Math.abs((b10 === null || b10 === void 0 ? void 0 : b10.y) - (t4 === null || t4 === void 0 ? void 0 : t4.y)) || 10;
node.x = ((l4 === null || l4 === void 0 ? void 0 : l4.x) || 0) + node.width / 2;
node.y = ((t4 === null || t4 === void 0 ? void 0 : t4.y) || 0) + node.height / 2;
}
});
g4.nodes().forEach((v3) => {
if (g4.node(v3).dummy === "border") {
g4.removeNode(v3);
}
});
};
var removeSelfEdges = (g4) => {
g4.edges().forEach((e4) => {
if (e4.v === e4.w) {
const node = g4.node(e4.v);
if (!node.selfEdges) {
node.selfEdges = [];
}
node.selfEdges.push({ e: e4, label: g4.edge(e4) });
g4.removeEdge(e4);
}
});
};
var insertSelfEdges = (g4) => {
const layers = util_default2.buildLayerMatrix(g4);
layers === null || layers === void 0 ? void 0 : layers.forEach((layer) => {
let orderShift = 0;
layer === null || layer === void 0 ? void 0 : layer.forEach((v3, i4) => {
var _a6;
const node = g4.node(v3);
node.order = i4 + orderShift;
(_a6 = node.selfEdges) === null || _a6 === void 0 ? void 0 : _a6.forEach((selfEdge) => {
util_default2.addDummyNode(g4, "selfedge", {
width: selfEdge.label.width,
height: selfEdge.label.height,
rank: node.rank,
order: i4 + ++orderShift,
e: selfEdge.e,
label: selfEdge.label
}, "_se");
});
delete node.selfEdges;
});
});
};
var positionSelfEdges = (g4) => {
g4.nodes().forEach((v3) => {
const node = g4.node(v3);
if (node.dummy === "selfedge") {
const selfNode = g4.node(node.e.v);
const x6 = selfNode.x + selfNode.width / 2;
const y5 = selfNode.y;
const dx = node.x - x6;
const dy = selfNode.height / 2;
g4.setEdge(node.e, node.label);
g4.removeNode(v3);
node.label.points = [
{ x: x6 + 2 * dx / 3, y: y5 - dy },
{ x: x6 + 5 * dx / 6, y: y5 - dy },
{ y: y5, x: x6 + dx },
{ x: x6 + 5 * dx / 6, y: y5 + dy },
{ x: x6 + 2 * dx / 3, y: y5 + dy }
];
node.label.x = node.x;
node.label.y = node.y;
}
});
};
var selectNumberAttrs = (obj, attrs) => {
const pickedProperties = {};
attrs === null || attrs === void 0 ? void 0 : attrs.forEach((key) => {
if (obj[key] === void 0)
return;
pickedProperties[key] = +obj[key];
});
return pickedProperties;
};
var canonicalize = (attrs) => {
const newAttrs = {};
Object.keys(attrs).forEach((k4) => {
const v3 = attrs[k4];
newAttrs[k4.toLowerCase()] = v3;
});
return newAttrs;
};
var layout_default2 = layout2;
// node_modules/@antv/layout/es/layout/dagre/index.js
var dagre_default = {
graphlib: graphlib_default,
layout: layout_default2,
util: {
time,
notime
}
};
// node_modules/@antv/layout/es/layout/dagre.js
var DagreLayout = class extends Base3 {
constructor(options) {
super();
this.rankdir = "TB";
this.nodesep = 50;
this.ranksep = 50;
this.controlPoints = false;
this.sortByCombo = false;
this.edgeLabelSpace = true;
this.nodes = [];
this.edges = [];
this.onLayoutEnd = () => {
};
this.layoutNode = (nodeId) => {
const self2 = this;
const { nodes } = self2;
const node = nodes.find((node2) => node2.id === nodeId);
if (node) {
const layout6 = node.layout !== false;
return layout6;
}
return true;
};
this.updateCfg(options);
}
getDefaultCfg() {
return {
rankdir: "TB",
align: void 0,
nodeSize: void 0,
nodesepFunc: void 0,
ranksepFunc: void 0,
nodesep: 50,
ranksep: 50,
controlPoints: false
};
}
execute() {
const self2 = this;
const { nodes, nodeSize, rankdir, combos, begin } = self2;
if (!nodes)
return;
const edges = self2.edges || [];
const g4 = new dagre_default.graphlib.Graph({
multigraph: true,
compound: true
});
let nodeSizeFunc;
if (!nodeSize) {
nodeSizeFunc = (d3) => {
if (d3.size) {
if (isArray2(d3.size)) {
return d3.size;
}
if (isObject2(d3.size)) {
return [d3.size.width || 40, d3.size.height || 40];
}
return [d3.size, d3.size];
}
return [40, 40];
};
} else if (isArray2(nodeSize)) {
nodeSizeFunc = () => nodeSize;
} else {
nodeSizeFunc = () => [nodeSize, nodeSize];
}
let horisep = getFunc(self2.nodesepFunc, self2.nodesep, 50);
let vertisep = getFunc(self2.ranksepFunc, self2.ranksep, 50);
if (rankdir === "LR" || rankdir === "RL") {
horisep = getFunc(self2.ranksepFunc, self2.ranksep, 50);
vertisep = getFunc(self2.nodesepFunc, self2.nodesep, 50);
}
g4.setDefaultEdgeLabel(() => ({}));
g4.setGraph(self2);
const comboMap = {};
nodes.filter((node) => node.layout !== false).forEach((node) => {
const size2 = nodeSizeFunc(node);
const verti = vertisep(node);
const hori = horisep(node);
const width2 = size2[0] + 2 * hori;
const height = size2[1] + 2 * verti;
const layer = node.layer;
if (isNumber3(layer)) {
g4.setNode(node.id, { width: width2, height, layer });
} else {
g4.setNode(node.id, { width: width2, height });
}
if (this.sortByCombo && node.comboId) {
if (!comboMap[node.comboId]) {
comboMap[node.comboId] = true;
g4.setNode(node.comboId, {});
}
g4.setParent(node.id, node.comboId);
}
});
if (this.sortByCombo && combos) {
combos.forEach((combo) => {
if (!combo.parentId)
return;
if (!comboMap[combo.parentId]) {
comboMap[combo.parentId] = true;
g4.setNode(combo.parentId, {});
}
g4.setParent(combo.id, combo.parentId);
});
}
edges.forEach((edge2) => {
const source = getEdgeTerminal(edge2, "source");
const target = getEdgeTerminal(edge2, "target");
if (this.layoutNode(source) && this.layoutNode(target)) {
g4.setEdge(source, target, {
weight: edge2.weight || 1
});
}
});
let prevGraph = void 0;
if (self2.preset) {
prevGraph = new dagre_default.graphlib.Graph({
multigraph: true,
compound: true
});
self2.preset.nodes.forEach((node) => {
prevGraph === null || prevGraph === void 0 ? void 0 : prevGraph.setNode(node.id, node);
});
}
dagre_default.layout(g4, {
prevGraph,
edgeLabelSpace: self2.edgeLabelSpace,
keepNodeOrder: Boolean(!!self2.nodeOrder),
nodeOrder: self2.nodeOrder
});
const dBegin = [0, 0];
if (begin) {
let minX = Infinity;
let minY = Infinity;
g4.nodes().forEach((node) => {
const coord2 = g4.node(node);
if (minX > coord2.x)
minX = coord2.x;
if (minY > coord2.y)
minY = coord2.y;
});
g4.edges().forEach((edge2) => {
const coord2 = g4.edge(edge2);
coord2.points.forEach((point2) => {
if (minX > point2.x)
minX = point2.x;
if (minY > point2.y)
minY = point2.y;
});
});
dBegin[0] = begin[0] - minX;
dBegin[1] = begin[1] - minY;
}
g4.nodes().forEach((node) => {
const coord2 = g4.node(node);
const i4 = nodes.findIndex((it) => it.id === node);
if (!nodes[i4])
return;
nodes[i4].x = coord2.x + dBegin[0];
nodes[i4].y = coord2.y + dBegin[1];
nodes[i4]._order = coord2._order;
});
g4.edges().forEach((edge2) => {
const coord2 = g4.edge(edge2);
const i4 = edges.findIndex((it) => {
const source = getEdgeTerminal(it, "source");
const target = getEdgeTerminal(it, "target");
return source === edge2.v && target === edge2.w;
});
if (self2.edgeLabelSpace && self2.controlPoints && edges[i4].type !== "loop") {
edges[i4].controlPoints = coord2.points.slice(1, coord2.points.length - 1);
edges[i4].controlPoints.forEach((point2) => {
point2.x += dBegin[0];
point2.y += dBegin[1];
});
}
});
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return {
nodes,
edges
};
}
getType() {
return "dagre";
}
};
function getFunc(func, value2, defaultValue) {
let resultFunc;
if (func) {
resultFunc = func;
} else if (isNumber3(value2)) {
resultFunc = () => value2;
} else {
resultFunc = () => defaultValue;
}
return resultFunc;
}
// node_modules/is-any-array/src/index.js
var toString5 = Object.prototype.toString;
function isAnyArray(object) {
return toString5.call(object).endsWith("Array]");
}
// node_modules/ml-array-max/lib-es6/index.js
function max5(input) {
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
if (!isAnyArray(input)) {
throw new TypeError("input must be an array");
}
if (input.length === 0) {
throw new TypeError("input must not be empty");
}
var _options$fromIndex = options.fromIndex, fromIndex = _options$fromIndex === void 0 ? 0 : _options$fromIndex, _options$toIndex = options.toIndex, toIndex = _options$toIndex === void 0 ? input.length : _options$toIndex;
if (fromIndex < 0 || fromIndex >= input.length || !Number.isInteger(fromIndex)) {
throw new Error("fromIndex must be a positive integer smaller than length");
}
if (toIndex <= fromIndex || toIndex > input.length || !Number.isInteger(toIndex)) {
throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");
}
var maxValue = input[fromIndex];
for (var i4 = fromIndex + 1; i4 < toIndex; i4++) {
if (input[i4] > maxValue)
maxValue = input[i4];
}
return maxValue;
}
var lib_es6_default = max5;
// node_modules/ml-array-min/lib-es6/index.js
function min5(input) {
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
if (!isAnyArray(input)) {
throw new TypeError("input must be an array");
}
if (input.length === 0) {
throw new TypeError("input must not be empty");
}
var _options$fromIndex = options.fromIndex, fromIndex = _options$fromIndex === void 0 ? 0 : _options$fromIndex, _options$toIndex = options.toIndex, toIndex = _options$toIndex === void 0 ? input.length : _options$toIndex;
if (fromIndex < 0 || fromIndex >= input.length || !Number.isInteger(fromIndex)) {
throw new Error("fromIndex must be a positive integer smaller than length");
}
if (toIndex <= fromIndex || toIndex > input.length || !Number.isInteger(toIndex)) {
throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");
}
var minValue = input[fromIndex];
for (var i4 = fromIndex + 1; i4 < toIndex; i4++) {
if (input[i4] < minValue)
minValue = input[i4];
}
return minValue;
}
var lib_es6_default2 = min5;
// node_modules/ml-array-rescale/lib-es6/index.js
function rescale(input) {
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
if (!isAnyArray(input)) {
throw new TypeError("input must be an array");
} else if (input.length === 0) {
throw new TypeError("input must not be empty");
}
var output;
if (options.output !== void 0) {
if (!isAnyArray(options.output)) {
throw new TypeError("output option must be an array if specified");
}
output = options.output;
} else {
output = new Array(input.length);
}
var currentMin = lib_es6_default2(input);
var currentMax = lib_es6_default(input);
if (currentMin === currentMax) {
throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");
}
var _options$min = options.min, minValue = _options$min === void 0 ? options.autoMinMax ? currentMin : 0 : _options$min, _options$max = options.max, maxValue = _options$max === void 0 ? options.autoMinMax ? currentMax : 1 : _options$max;
if (minValue >= maxValue) {
throw new RangeError("min option must be smaller than max option");
}
var factor = (maxValue - minValue) / (currentMax - currentMin);
for (var i4 = 0; i4 < input.length; i4++) {
output[i4] = (input[i4] - currentMin) * factor + minValue;
}
return output;
}
// node_modules/ml-matrix/src/inspect.js
var indent = " ".repeat(2);
var indentData = " ".repeat(4);
function inspectMatrix() {
return inspectMatrixWithOptions(this);
}
function inspectMatrixWithOptions(matrix, options = {}) {
const { maxRows = 15, maxColumns = 10, maxNumSize = 8 } = options;
return `${matrix.constructor.name} {
${indent}[
${indentData}${inspectData(matrix, maxRows, maxColumns, maxNumSize)}
${indent}]
${indent}rows: ${matrix.rows}
${indent}columns: ${matrix.columns}
}`;
}
function inspectData(matrix, maxRows, maxColumns, maxNumSize) {
const { rows, columns } = matrix;
const maxI = Math.min(rows, maxRows);
const maxJ = Math.min(columns, maxColumns);
const result = [];
for (let i4 = 0; i4 < maxI; i4++) {
let line2 = [];
for (let j4 = 0; j4 < maxJ; j4++) {
line2.push(formatNumber(matrix.get(i4, j4), maxNumSize));
}
result.push(`${line2.join(" ")}`);
}
if (maxJ !== columns) {
result[result.length - 1] += ` ... ${columns - maxColumns} more columns`;
}
if (maxI !== rows) {
result.push(`... ${rows - maxRows} more rows`);
}
return result.join(`
${indentData}`);
}
function formatNumber(num, maxNumSize) {
const numStr = String(num);
if (numStr.length <= maxNumSize) {
return numStr.padEnd(maxNumSize, " ");
}
const precise = num.toPrecision(maxNumSize - 2);
if (precise.length <= maxNumSize) {
return precise;
}
const exponential2 = num.toExponential(maxNumSize - 2);
const eIndex = exponential2.indexOf("e");
const e4 = exponential2.slice(eIndex);
return exponential2.slice(0, maxNumSize - e4.length) + e4;
}
// node_modules/ml-matrix/src/mathOperations.js
function installMathOperations(AbstractMatrix2, Matrix3) {
AbstractMatrix2.prototype.add = function add8(value2) {
if (typeof value2 === "number")
return this.addS(value2);
return this.addM(value2);
};
AbstractMatrix2.prototype.addS = function addS(value2) {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) + value2);
}
}
return this;
};
AbstractMatrix2.prototype.addM = function addM(matrix) {
matrix = Matrix3.checkMatrix(matrix);
if (this.rows !== matrix.rows || this.columns !== matrix.columns) {
throw new RangeError("Matrices dimensions must be equal");
}
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) + matrix.get(i4, j4));
}
}
return this;
};
AbstractMatrix2.add = function add8(matrix, value2) {
const newMatrix = new Matrix3(matrix);
return newMatrix.add(value2);
};
AbstractMatrix2.prototype.sub = function sub6(value2) {
if (typeof value2 === "number")
return this.subS(value2);
return this.subM(value2);
};
AbstractMatrix2.prototype.subS = function subS(value2) {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) - value2);
}
}
return this;
};
AbstractMatrix2.prototype.subM = function subM(matrix) {
matrix = Matrix3.checkMatrix(matrix);
if (this.rows !== matrix.rows || this.columns !== matrix.columns) {
throw new RangeError("Matrices dimensions must be equal");
}
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) - matrix.get(i4, j4));
}
}
return this;
};
AbstractMatrix2.sub = function sub6(matrix, value2) {
const newMatrix = new Matrix3(matrix);
return newMatrix.sub(value2);
};
AbstractMatrix2.prototype.subtract = AbstractMatrix2.prototype.sub;
AbstractMatrix2.prototype.subtractS = AbstractMatrix2.prototype.subS;
AbstractMatrix2.prototype.subtractM = AbstractMatrix2.prototype.subM;
AbstractMatrix2.subtract = AbstractMatrix2.sub;
AbstractMatrix2.prototype.mul = function mul7(value2) {
if (typeof value2 === "number")
return this.mulS(value2);
return this.mulM(value2);
};
AbstractMatrix2.prototype.mulS = function mulS(value2) {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) * value2);
}
}
return this;
};
AbstractMatrix2.prototype.mulM = function mulM(matrix) {
matrix = Matrix3.checkMatrix(matrix);
if (this.rows !== matrix.rows || this.columns !== matrix.columns) {
throw new RangeError("Matrices dimensions must be equal");
}
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) * matrix.get(i4, j4));
}
}
return this;
};
AbstractMatrix2.mul = function mul7(matrix, value2) {
const newMatrix = new Matrix3(matrix);
return newMatrix.mul(value2);
};
AbstractMatrix2.prototype.multiply = AbstractMatrix2.prototype.mul;
AbstractMatrix2.prototype.multiplyS = AbstractMatrix2.prototype.mulS;
AbstractMatrix2.prototype.multiplyM = AbstractMatrix2.prototype.mulM;
AbstractMatrix2.multiply = AbstractMatrix2.mul;
AbstractMatrix2.prototype.div = function div4(value2) {
if (typeof value2 === "number")
return this.divS(value2);
return this.divM(value2);
};
AbstractMatrix2.prototype.divS = function divS(value2) {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) / value2);
}
}
return this;
};
AbstractMatrix2.prototype.divM = function divM(matrix) {
matrix = Matrix3.checkMatrix(matrix);
if (this.rows !== matrix.rows || this.columns !== matrix.columns) {
throw new RangeError("Matrices dimensions must be equal");
}
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) / matrix.get(i4, j4));
}
}
return this;
};
AbstractMatrix2.div = function div4(matrix, value2) {
const newMatrix = new Matrix3(matrix);
return newMatrix.div(value2);
};
AbstractMatrix2.prototype.divide = AbstractMatrix2.prototype.div;
AbstractMatrix2.prototype.divideS = AbstractMatrix2.prototype.divS;
AbstractMatrix2.prototype.divideM = AbstractMatrix2.prototype.divM;
AbstractMatrix2.divide = AbstractMatrix2.div;
AbstractMatrix2.prototype.mod = function mod3(value2) {
if (typeof value2 === "number")
return this.modS(value2);
return this.modM(value2);
};
AbstractMatrix2.prototype.modS = function modS(value2) {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) % value2);
}
}
return this;
};
AbstractMatrix2.prototype.modM = function modM(matrix) {
matrix = Matrix3.checkMatrix(matrix);
if (this.rows !== matrix.rows || this.columns !== matrix.columns) {
throw new RangeError("Matrices dimensions must be equal");
}
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) % matrix.get(i4, j4));
}
}
return this;
};
AbstractMatrix2.mod = function mod3(matrix, value2) {
const newMatrix = new Matrix3(matrix);
return newMatrix.mod(value2);
};
AbstractMatrix2.prototype.modulus = AbstractMatrix2.prototype.mod;
AbstractMatrix2.prototype.modulusS = AbstractMatrix2.prototype.modS;
AbstractMatrix2.prototype.modulusM = AbstractMatrix2.prototype.modM;
AbstractMatrix2.modulus = AbstractMatrix2.mod;
AbstractMatrix2.prototype.and = function and(value2) {
if (typeof value2 === "number")
return this.andS(value2);
return this.andM(value2);
};
AbstractMatrix2.prototype.andS = function andS(value2) {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) & value2);
}
}
return this;
};
AbstractMatrix2.prototype.andM = function andM(matrix) {
matrix = Matrix3.checkMatrix(matrix);
if (this.rows !== matrix.rows || this.columns !== matrix.columns) {
throw new RangeError("Matrices dimensions must be equal");
}
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) & matrix.get(i4, j4));
}
}
return this;
};
AbstractMatrix2.and = function and(matrix, value2) {
const newMatrix = new Matrix3(matrix);
return newMatrix.and(value2);
};
AbstractMatrix2.prototype.or = function or(value2) {
if (typeof value2 === "number")
return this.orS(value2);
return this.orM(value2);
};
AbstractMatrix2.prototype.orS = function orS(value2) {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) | value2);
}
}
return this;
};
AbstractMatrix2.prototype.orM = function orM(matrix) {
matrix = Matrix3.checkMatrix(matrix);
if (this.rows !== matrix.rows || this.columns !== matrix.columns) {
throw new RangeError("Matrices dimensions must be equal");
}
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) | matrix.get(i4, j4));
}
}
return this;
};
AbstractMatrix2.or = function or(matrix, value2) {
const newMatrix = new Matrix3(matrix);
return newMatrix.or(value2);
};
AbstractMatrix2.prototype.xor = function xor(value2) {
if (typeof value2 === "number")
return this.xorS(value2);
return this.xorM(value2);
};
AbstractMatrix2.prototype.xorS = function xorS(value2) {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) ^ value2);
}
}
return this;
};
AbstractMatrix2.prototype.xorM = function xorM(matrix) {
matrix = Matrix3.checkMatrix(matrix);
if (this.rows !== matrix.rows || this.columns !== matrix.columns) {
throw new RangeError("Matrices dimensions must be equal");
}
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) ^ matrix.get(i4, j4));
}
}
return this;
};
AbstractMatrix2.xor = function xor(matrix, value2) {
const newMatrix = new Matrix3(matrix);
return newMatrix.xor(value2);
};
AbstractMatrix2.prototype.leftShift = function leftShift(value2) {
if (typeof value2 === "number")
return this.leftShiftS(value2);
return this.leftShiftM(value2);
};
AbstractMatrix2.prototype.leftShiftS = function leftShiftS(value2) {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) << value2);
}
}
return this;
};
AbstractMatrix2.prototype.leftShiftM = function leftShiftM(matrix) {
matrix = Matrix3.checkMatrix(matrix);
if (this.rows !== matrix.rows || this.columns !== matrix.columns) {
throw new RangeError("Matrices dimensions must be equal");
}
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) << matrix.get(i4, j4));
}
}
return this;
};
AbstractMatrix2.leftShift = function leftShift(matrix, value2) {
const newMatrix = new Matrix3(matrix);
return newMatrix.leftShift(value2);
};
AbstractMatrix2.prototype.signPropagatingRightShift = function signPropagatingRightShift(value2) {
if (typeof value2 === "number")
return this.signPropagatingRightShiftS(value2);
return this.signPropagatingRightShiftM(value2);
};
AbstractMatrix2.prototype.signPropagatingRightShiftS = function signPropagatingRightShiftS(value2) {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) >> value2);
}
}
return this;
};
AbstractMatrix2.prototype.signPropagatingRightShiftM = function signPropagatingRightShiftM(matrix) {
matrix = Matrix3.checkMatrix(matrix);
if (this.rows !== matrix.rows || this.columns !== matrix.columns) {
throw new RangeError("Matrices dimensions must be equal");
}
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) >> matrix.get(i4, j4));
}
}
return this;
};
AbstractMatrix2.signPropagatingRightShift = function signPropagatingRightShift(matrix, value2) {
const newMatrix = new Matrix3(matrix);
return newMatrix.signPropagatingRightShift(value2);
};
AbstractMatrix2.prototype.rightShift = function rightShift(value2) {
if (typeof value2 === "number")
return this.rightShiftS(value2);
return this.rightShiftM(value2);
};
AbstractMatrix2.prototype.rightShiftS = function rightShiftS(value2) {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) >>> value2);
}
}
return this;
};
AbstractMatrix2.prototype.rightShiftM = function rightShiftM(matrix) {
matrix = Matrix3.checkMatrix(matrix);
if (this.rows !== matrix.rows || this.columns !== matrix.columns) {
throw new RangeError("Matrices dimensions must be equal");
}
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) >>> matrix.get(i4, j4));
}
}
return this;
};
AbstractMatrix2.rightShift = function rightShift(matrix, value2) {
const newMatrix = new Matrix3(matrix);
return newMatrix.rightShift(value2);
};
AbstractMatrix2.prototype.zeroFillRightShift = AbstractMatrix2.prototype.rightShift;
AbstractMatrix2.prototype.zeroFillRightShiftS = AbstractMatrix2.prototype.rightShiftS;
AbstractMatrix2.prototype.zeroFillRightShiftM = AbstractMatrix2.prototype.rightShiftM;
AbstractMatrix2.zeroFillRightShift = AbstractMatrix2.rightShift;
AbstractMatrix2.prototype.not = function not() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, ~this.get(i4, j4));
}
}
return this;
};
AbstractMatrix2.not = function not(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.not();
};
AbstractMatrix2.prototype.abs = function abs3() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.abs(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.abs = function abs3(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.abs();
};
AbstractMatrix2.prototype.acos = function acos() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.acos(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.acos = function acos(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.acos();
};
AbstractMatrix2.prototype.acosh = function acosh() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.acosh(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.acosh = function acosh(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.acosh();
};
AbstractMatrix2.prototype.asin = function asin() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.asin(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.asin = function asin(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.asin();
};
AbstractMatrix2.prototype.asinh = function asinh() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.asinh(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.asinh = function asinh(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.asinh();
};
AbstractMatrix2.prototype.atan = function atan() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.atan(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.atan = function atan(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.atan();
};
AbstractMatrix2.prototype.atanh = function atanh() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.atanh(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.atanh = function atanh(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.atanh();
};
AbstractMatrix2.prototype.cbrt = function cbrt() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.cbrt(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.cbrt = function cbrt(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.cbrt();
};
AbstractMatrix2.prototype.ceil = function ceil4() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.ceil(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.ceil = function ceil4(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.ceil();
};
AbstractMatrix2.prototype.clz32 = function clz32() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.clz32(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.clz32 = function clz32(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.clz32();
};
AbstractMatrix2.prototype.cos = function cos3() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.cos(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.cos = function cos3(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.cos();
};
AbstractMatrix2.prototype.cosh = function cosh() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.cosh(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.cosh = function cosh(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.cosh();
};
AbstractMatrix2.prototype.exp = function exp2() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.exp(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.exp = function exp2(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.exp();
};
AbstractMatrix2.prototype.expm1 = function expm1() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.expm1(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.expm1 = function expm1(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.expm1();
};
AbstractMatrix2.prototype.floor = function floor4() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.floor(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.floor = function floor4(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.floor();
};
AbstractMatrix2.prototype.fround = function fround() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.fround(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.fround = function fround(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.fround();
};
AbstractMatrix2.prototype.log = function log3() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.log(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.log = function log3(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.log();
};
AbstractMatrix2.prototype.log1p = function log1p() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.log1p(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.log1p = function log1p(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.log1p();
};
AbstractMatrix2.prototype.log10 = function log10() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.log10(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.log10 = function log10(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.log10();
};
AbstractMatrix2.prototype.log2 = function log22() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.log2(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.log2 = function log22(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.log2();
};
AbstractMatrix2.prototype.round = function round5() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.round(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.round = function round5(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.round();
};
AbstractMatrix2.prototype.sign = function sign() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.sign(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.sign = function sign(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.sign();
};
AbstractMatrix2.prototype.sin = function sin3() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.sin(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.sin = function sin3(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.sin();
};
AbstractMatrix2.prototype.sinh = function sinh() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.sinh(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.sinh = function sinh(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.sinh();
};
AbstractMatrix2.prototype.sqrt = function sqrt() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.sqrt(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.sqrt = function sqrt(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.sqrt();
};
AbstractMatrix2.prototype.tan = function tan() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.tan(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.tan = function tan(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.tan();
};
AbstractMatrix2.prototype.tanh = function tanh() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.tanh(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.tanh = function tanh(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.tanh();
};
AbstractMatrix2.prototype.trunc = function trunc() {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.trunc(this.get(i4, j4)));
}
}
return this;
};
AbstractMatrix2.trunc = function trunc(matrix) {
const newMatrix = new Matrix3(matrix);
return newMatrix.trunc();
};
AbstractMatrix2.pow = function pow2(matrix, arg0) {
const newMatrix = new Matrix3(matrix);
return newMatrix.pow(arg0);
};
AbstractMatrix2.prototype.pow = function pow2(value2) {
if (typeof value2 === "number")
return this.powS(value2);
return this.powM(value2);
};
AbstractMatrix2.prototype.powS = function powS(value2) {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.pow(this.get(i4, j4), value2));
}
}
return this;
};
AbstractMatrix2.prototype.powM = function powM(matrix) {
matrix = Matrix3.checkMatrix(matrix);
if (this.rows !== matrix.rows || this.columns !== matrix.columns) {
throw new RangeError("Matrices dimensions must be equal");
}
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, Math.pow(this.get(i4, j4), matrix.get(i4, j4)));
}
}
return this;
};
}
// node_modules/ml-matrix/src/util.js
function checkRowIndex(matrix, index2, outer) {
let max8 = outer ? matrix.rows : matrix.rows - 1;
if (index2 < 0 || index2 > max8) {
throw new RangeError("Row index out of range");
}
}
function checkColumnIndex(matrix, index2, outer) {
let max8 = outer ? matrix.columns : matrix.columns - 1;
if (index2 < 0 || index2 > max8) {
throw new RangeError("Column index out of range");
}
}
function checkRowVector(matrix, vector) {
if (vector.to1DArray) {
vector = vector.to1DArray();
}
if (vector.length !== matrix.columns) {
throw new RangeError("vector size must be the same as the number of columns");
}
return vector;
}
function checkColumnVector(matrix, vector) {
if (vector.to1DArray) {
vector = vector.to1DArray();
}
if (vector.length !== matrix.rows) {
throw new RangeError("vector size must be the same as the number of rows");
}
return vector;
}
function checkIndices(matrix, rowIndices, columnIndices) {
return {
row: checkRowIndices(matrix, rowIndices),
column: checkColumnIndices(matrix, columnIndices)
};
}
function checkRowIndices(matrix, rowIndices) {
if (typeof rowIndices !== "object") {
throw new TypeError("unexpected type for row indices");
}
let rowOut = rowIndices.some((r4) => {
return r4 < 0 || r4 >= matrix.rows;
});
if (rowOut) {
throw new RangeError("row indices are out of range");
}
if (!Array.isArray(rowIndices))
rowIndices = Array.from(rowIndices);
return rowIndices;
}
function checkColumnIndices(matrix, columnIndices) {
if (typeof columnIndices !== "object") {
throw new TypeError("unexpected type for column indices");
}
let columnOut = columnIndices.some((c5) => {
return c5 < 0 || c5 >= matrix.columns;
});
if (columnOut) {
throw new RangeError("column indices are out of range");
}
if (!Array.isArray(columnIndices))
columnIndices = Array.from(columnIndices);
return columnIndices;
}
function checkRange(matrix, startRow, endRow, startColumn, endColumn) {
if (arguments.length !== 5) {
throw new RangeError("expected 4 arguments");
}
checkNumber("startRow", startRow);
checkNumber("endRow", endRow);
checkNumber("startColumn", startColumn);
checkNumber("endColumn", endColumn);
if (startRow > endRow || startColumn > endColumn || startRow < 0 || startRow >= matrix.rows || endRow < 0 || endRow >= matrix.rows || startColumn < 0 || startColumn >= matrix.columns || endColumn < 0 || endColumn >= matrix.columns) {
throw new RangeError("Submatrix indices are out of range");
}
}
function newArray(length5, value2 = 0) {
let array = [];
for (let i4 = 0; i4 < length5; i4++) {
array.push(value2);
}
return array;
}
function checkNumber(name, value2) {
if (typeof value2 !== "number") {
throw new TypeError(`${name} must be a number`);
}
}
function checkNonEmpty(matrix) {
if (matrix.isEmpty()) {
throw new Error("Empty matrix has no elements to index");
}
}
// node_modules/ml-matrix/src/stat.js
function sumByRow(matrix) {
let sum = newArray(matrix.rows);
for (let i4 = 0; i4 < matrix.rows; ++i4) {
for (let j4 = 0; j4 < matrix.columns; ++j4) {
sum[i4] += matrix.get(i4, j4);
}
}
return sum;
}
function sumByColumn(matrix) {
let sum = newArray(matrix.columns);
for (let i4 = 0; i4 < matrix.rows; ++i4) {
for (let j4 = 0; j4 < matrix.columns; ++j4) {
sum[j4] += matrix.get(i4, j4);
}
}
return sum;
}
function sumAll(matrix) {
let v3 = 0;
for (let i4 = 0; i4 < matrix.rows; i4++) {
for (let j4 = 0; j4 < matrix.columns; j4++) {
v3 += matrix.get(i4, j4);
}
}
return v3;
}
function productByRow(matrix) {
let sum = newArray(matrix.rows, 1);
for (let i4 = 0; i4 < matrix.rows; ++i4) {
for (let j4 = 0; j4 < matrix.columns; ++j4) {
sum[i4] *= matrix.get(i4, j4);
}
}
return sum;
}
function productByColumn(matrix) {
let sum = newArray(matrix.columns, 1);
for (let i4 = 0; i4 < matrix.rows; ++i4) {
for (let j4 = 0; j4 < matrix.columns; ++j4) {
sum[j4] *= matrix.get(i4, j4);
}
}
return sum;
}
function productAll(matrix) {
let v3 = 1;
for (let i4 = 0; i4 < matrix.rows; i4++) {
for (let j4 = 0; j4 < matrix.columns; j4++) {
v3 *= matrix.get(i4, j4);
}
}
return v3;
}
function varianceByRow(matrix, unbiased, mean) {
const rows = matrix.rows;
const cols = matrix.columns;
const variance = [];
for (let i4 = 0; i4 < rows; i4++) {
let sum1 = 0;
let sum2 = 0;
let x6 = 0;
for (let j4 = 0; j4 < cols; j4++) {
x6 = matrix.get(i4, j4) - mean[i4];
sum1 += x6;
sum2 += x6 * x6;
}
if (unbiased) {
variance.push((sum2 - sum1 * sum1 / cols) / (cols - 1));
} else {
variance.push((sum2 - sum1 * sum1 / cols) / cols);
}
}
return variance;
}
function varianceByColumn(matrix, unbiased, mean) {
const rows = matrix.rows;
const cols = matrix.columns;
const variance = [];
for (let j4 = 0; j4 < cols; j4++) {
let sum1 = 0;
let sum2 = 0;
let x6 = 0;
for (let i4 = 0; i4 < rows; i4++) {
x6 = matrix.get(i4, j4) - mean[j4];
sum1 += x6;
sum2 += x6 * x6;
}
if (unbiased) {
variance.push((sum2 - sum1 * sum1 / rows) / (rows - 1));
} else {
variance.push((sum2 - sum1 * sum1 / rows) / rows);
}
}
return variance;
}
function varianceAll(matrix, unbiased, mean) {
const rows = matrix.rows;
const cols = matrix.columns;
const size2 = rows * cols;
let sum1 = 0;
let sum2 = 0;
let x6 = 0;
for (let i4 = 0; i4 < rows; i4++) {
for (let j4 = 0; j4 < cols; j4++) {
x6 = matrix.get(i4, j4) - mean;
sum1 += x6;
sum2 += x6 * x6;
}
}
if (unbiased) {
return (sum2 - sum1 * sum1 / size2) / (size2 - 1);
} else {
return (sum2 - sum1 * sum1 / size2) / size2;
}
}
function centerByRow(matrix, mean) {
for (let i4 = 0; i4 < matrix.rows; i4++) {
for (let j4 = 0; j4 < matrix.columns; j4++) {
matrix.set(i4, j4, matrix.get(i4, j4) - mean[i4]);
}
}
}
function centerByColumn(matrix, mean) {
for (let i4 = 0; i4 < matrix.rows; i4++) {
for (let j4 = 0; j4 < matrix.columns; j4++) {
matrix.set(i4, j4, matrix.get(i4, j4) - mean[j4]);
}
}
}
function centerAll(matrix, mean) {
for (let i4 = 0; i4 < matrix.rows; i4++) {
for (let j4 = 0; j4 < matrix.columns; j4++) {
matrix.set(i4, j4, matrix.get(i4, j4) - mean);
}
}
}
function getScaleByRow(matrix) {
const scale12 = [];
for (let i4 = 0; i4 < matrix.rows; i4++) {
let sum = 0;
for (let j4 = 0; j4 < matrix.columns; j4++) {
sum += Math.pow(matrix.get(i4, j4), 2) / (matrix.columns - 1);
}
scale12.push(Math.sqrt(sum));
}
return scale12;
}
function scaleByRow(matrix, scale12) {
for (let i4 = 0; i4 < matrix.rows; i4++) {
for (let j4 = 0; j4 < matrix.columns; j4++) {
matrix.set(i4, j4, matrix.get(i4, j4) / scale12[i4]);
}
}
}
function getScaleByColumn(matrix) {
const scale12 = [];
for (let j4 = 0; j4 < matrix.columns; j4++) {
let sum = 0;
for (let i4 = 0; i4 < matrix.rows; i4++) {
sum += Math.pow(matrix.get(i4, j4), 2) / (matrix.rows - 1);
}
scale12.push(Math.sqrt(sum));
}
return scale12;
}
function scaleByColumn(matrix, scale12) {
for (let i4 = 0; i4 < matrix.rows; i4++) {
for (let j4 = 0; j4 < matrix.columns; j4++) {
matrix.set(i4, j4, matrix.get(i4, j4) / scale12[j4]);
}
}
}
function getScaleAll(matrix) {
const divider = matrix.size - 1;
let sum = 0;
for (let j4 = 0; j4 < matrix.columns; j4++) {
for (let i4 = 0; i4 < matrix.rows; i4++) {
sum += Math.pow(matrix.get(i4, j4), 2) / divider;
}
}
return Math.sqrt(sum);
}
function scaleAll(matrix, scale12) {
for (let i4 = 0; i4 < matrix.rows; i4++) {
for (let j4 = 0; j4 < matrix.columns; j4++) {
matrix.set(i4, j4, matrix.get(i4, j4) / scale12);
}
}
}
// node_modules/ml-matrix/src/matrix.js
var AbstractMatrix = class {
static from1DArray(newRows, newColumns, newData) {
let length5 = newRows * newColumns;
if (length5 !== newData.length) {
throw new RangeError("data length does not match given dimensions");
}
let newMatrix = new Matrix2(newRows, newColumns);
for (let row = 0; row < newRows; row++) {
for (let column = 0; column < newColumns; column++) {
newMatrix.set(row, column, newData[row * newColumns + column]);
}
}
return newMatrix;
}
static rowVector(newData) {
let vector = new Matrix2(1, newData.length);
for (let i4 = 0; i4 < newData.length; i4++) {
vector.set(0, i4, newData[i4]);
}
return vector;
}
static columnVector(newData) {
let vector = new Matrix2(newData.length, 1);
for (let i4 = 0; i4 < newData.length; i4++) {
vector.set(i4, 0, newData[i4]);
}
return vector;
}
static zeros(rows, columns) {
return new Matrix2(rows, columns);
}
static ones(rows, columns) {
return new Matrix2(rows, columns).fill(1);
}
static rand(rows, columns, options = {}) {
if (typeof options !== "object") {
throw new TypeError("options must be an object");
}
const { random: random5 = Math.random } = options;
let matrix = new Matrix2(rows, columns);
for (let i4 = 0; i4 < rows; i4++) {
for (let j4 = 0; j4 < columns; j4++) {
matrix.set(i4, j4, random5());
}
}
return matrix;
}
static randInt(rows, columns, options = {}) {
if (typeof options !== "object") {
throw new TypeError("options must be an object");
}
const { min: min7 = 0, max: max8 = 1e3, random: random5 = Math.random } = options;
if (!Number.isInteger(min7))
throw new TypeError("min must be an integer");
if (!Number.isInteger(max8))
throw new TypeError("max must be an integer");
if (min7 >= max8)
throw new RangeError("min must be smaller than max");
let interval3 = max8 - min7;
let matrix = new Matrix2(rows, columns);
for (let i4 = 0; i4 < rows; i4++) {
for (let j4 = 0; j4 < columns; j4++) {
let value2 = min7 + Math.round(random5() * interval3);
matrix.set(i4, j4, value2);
}
}
return matrix;
}
static eye(rows, columns, value2) {
if (columns === void 0)
columns = rows;
if (value2 === void 0)
value2 = 1;
let min7 = Math.min(rows, columns);
let matrix = this.zeros(rows, columns);
for (let i4 = 0; i4 < min7; i4++) {
matrix.set(i4, i4, value2);
}
return matrix;
}
static diag(data3, rows, columns) {
let l4 = data3.length;
if (rows === void 0)
rows = l4;
if (columns === void 0)
columns = rows;
let min7 = Math.min(l4, rows, columns);
let matrix = this.zeros(rows, columns);
for (let i4 = 0; i4 < min7; i4++) {
matrix.set(i4, i4, data3[i4]);
}
return matrix;
}
static min(matrix1, matrix2) {
matrix1 = this.checkMatrix(matrix1);
matrix2 = this.checkMatrix(matrix2);
let rows = matrix1.rows;
let columns = matrix1.columns;
let result = new Matrix2(rows, columns);
for (let i4 = 0; i4 < rows; i4++) {
for (let j4 = 0; j4 < columns; j4++) {
result.set(i4, j4, Math.min(matrix1.get(i4, j4), matrix2.get(i4, j4)));
}
}
return result;
}
static max(matrix1, matrix2) {
matrix1 = this.checkMatrix(matrix1);
matrix2 = this.checkMatrix(matrix2);
let rows = matrix1.rows;
let columns = matrix1.columns;
let result = new this(rows, columns);
for (let i4 = 0; i4 < rows; i4++) {
for (let j4 = 0; j4 < columns; j4++) {
result.set(i4, j4, Math.max(matrix1.get(i4, j4), matrix2.get(i4, j4)));
}
}
return result;
}
static checkMatrix(value2) {
return AbstractMatrix.isMatrix(value2) ? value2 : new Matrix2(value2);
}
static isMatrix(value2) {
return value2 != null && value2.klass === "Matrix";
}
get size() {
return this.rows * this.columns;
}
apply(callback) {
if (typeof callback !== "function") {
throw new TypeError("callback must be a function");
}
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
callback.call(this, i4, j4);
}
}
return this;
}
to1DArray() {
let array = [];
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
array.push(this.get(i4, j4));
}
}
return array;
}
to2DArray() {
let copy8 = [];
for (let i4 = 0; i4 < this.rows; i4++) {
copy8.push([]);
for (let j4 = 0; j4 < this.columns; j4++) {
copy8[i4].push(this.get(i4, j4));
}
}
return copy8;
}
toJSON() {
return this.to2DArray();
}
isRowVector() {
return this.rows === 1;
}
isColumnVector() {
return this.columns === 1;
}
isVector() {
return this.rows === 1 || this.columns === 1;
}
isSquare() {
return this.rows === this.columns;
}
isEmpty() {
return this.rows === 0 || this.columns === 0;
}
isSymmetric() {
if (this.isSquare()) {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 <= i4; j4++) {
if (this.get(i4, j4) !== this.get(j4, i4)) {
return false;
}
}
}
return true;
}
return false;
}
isEchelonForm() {
let i4 = 0;
let j4 = 0;
let previousColumn = -1;
let isEchelonForm = true;
let checked = false;
while (i4 < this.rows && isEchelonForm) {
j4 = 0;
checked = false;
while (j4 < this.columns && checked === false) {
if (this.get(i4, j4) === 0) {
j4++;
} else if (this.get(i4, j4) === 1 && j4 > previousColumn) {
checked = true;
previousColumn = j4;
} else {
isEchelonForm = false;
checked = true;
}
}
i4++;
}
return isEchelonForm;
}
isReducedEchelonForm() {
let i4 = 0;
let j4 = 0;
let previousColumn = -1;
let isReducedEchelonForm = true;
let checked = false;
while (i4 < this.rows && isReducedEchelonForm) {
j4 = 0;
checked = false;
while (j4 < this.columns && checked === false) {
if (this.get(i4, j4) === 0) {
j4++;
} else if (this.get(i4, j4) === 1 && j4 > previousColumn) {
checked = true;
previousColumn = j4;
} else {
isReducedEchelonForm = false;
checked = true;
}
}
for (let k4 = j4 + 1; k4 < this.rows; k4++) {
if (this.get(i4, k4) !== 0) {
isReducedEchelonForm = false;
}
}
i4++;
}
return isReducedEchelonForm;
}
echelonForm() {
let result = this.clone();
let h3 = 0;
let k4 = 0;
while (h3 < result.rows && k4 < result.columns) {
let iMax = h3;
for (let i4 = h3; i4 < result.rows; i4++) {
if (result.get(i4, k4) > result.get(iMax, k4)) {
iMax = i4;
}
}
if (result.get(iMax, k4) === 0) {
k4++;
} else {
result.swapRows(h3, iMax);
let tmp = result.get(h3, k4);
for (let j4 = k4; j4 < result.columns; j4++) {
result.set(h3, j4, result.get(h3, j4) / tmp);
}
for (let i4 = h3 + 1; i4 < result.rows; i4++) {
let factor = result.get(i4, k4) / result.get(h3, k4);
result.set(i4, k4, 0);
for (let j4 = k4 + 1; j4 < result.columns; j4++) {
result.set(i4, j4, result.get(i4, j4) - result.get(h3, j4) * factor);
}
}
h3++;
k4++;
}
}
return result;
}
reducedEchelonForm() {
let result = this.echelonForm();
let m4 = result.columns;
let n3 = result.rows;
let h3 = n3 - 1;
while (h3 >= 0) {
if (result.maxRow(h3) === 0) {
h3--;
} else {
let p4 = 0;
let pivot = false;
while (p4 < n3 && pivot === false) {
if (result.get(h3, p4) === 1) {
pivot = true;
} else {
p4++;
}
}
for (let i4 = 0; i4 < h3; i4++) {
let factor = result.get(i4, p4);
for (let j4 = p4; j4 < m4; j4++) {
let tmp = result.get(i4, j4) - factor * result.get(h3, j4);
result.set(i4, j4, tmp);
}
}
h3--;
}
}
return result;
}
set() {
throw new Error("set method is unimplemented");
}
get() {
throw new Error("get method is unimplemented");
}
repeat(options = {}) {
if (typeof options !== "object") {
throw new TypeError("options must be an object");
}
const { rows = 1, columns = 1 } = options;
if (!Number.isInteger(rows) || rows <= 0) {
throw new TypeError("rows must be a positive integer");
}
if (!Number.isInteger(columns) || columns <= 0) {
throw new TypeError("columns must be a positive integer");
}
let matrix = new Matrix2(this.rows * rows, this.columns * columns);
for (let i4 = 0; i4 < rows; i4++) {
for (let j4 = 0; j4 < columns; j4++) {
matrix.setSubMatrix(this, this.rows * i4, this.columns * j4);
}
}
return matrix;
}
fill(value2) {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, value2);
}
}
return this;
}
neg() {
return this.mulS(-1);
}
getRow(index2) {
checkRowIndex(this, index2);
let row = [];
for (let i4 = 0; i4 < this.columns; i4++) {
row.push(this.get(index2, i4));
}
return row;
}
getRowVector(index2) {
return Matrix2.rowVector(this.getRow(index2));
}
setRow(index2, array) {
checkRowIndex(this, index2);
array = checkRowVector(this, array);
for (let i4 = 0; i4 < this.columns; i4++) {
this.set(index2, i4, array[i4]);
}
return this;
}
swapRows(row1, row2) {
checkRowIndex(this, row1);
checkRowIndex(this, row2);
for (let i4 = 0; i4 < this.columns; i4++) {
let temp = this.get(row1, i4);
this.set(row1, i4, this.get(row2, i4));
this.set(row2, i4, temp);
}
return this;
}
getColumn(index2) {
checkColumnIndex(this, index2);
let column = [];
for (let i4 = 0; i4 < this.rows; i4++) {
column.push(this.get(i4, index2));
}
return column;
}
getColumnVector(index2) {
return Matrix2.columnVector(this.getColumn(index2));
}
setColumn(index2, array) {
checkColumnIndex(this, index2);
array = checkColumnVector(this, array);
for (let i4 = 0; i4 < this.rows; i4++) {
this.set(i4, index2, array[i4]);
}
return this;
}
swapColumns(column1, column2) {
checkColumnIndex(this, column1);
checkColumnIndex(this, column2);
for (let i4 = 0; i4 < this.rows; i4++) {
let temp = this.get(i4, column1);
this.set(i4, column1, this.get(i4, column2));
this.set(i4, column2, temp);
}
return this;
}
addRowVector(vector) {
vector = checkRowVector(this, vector);
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) + vector[j4]);
}
}
return this;
}
subRowVector(vector) {
vector = checkRowVector(this, vector);
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) - vector[j4]);
}
}
return this;
}
mulRowVector(vector) {
vector = checkRowVector(this, vector);
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) * vector[j4]);
}
}
return this;
}
divRowVector(vector) {
vector = checkRowVector(this, vector);
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) / vector[j4]);
}
}
return this;
}
addColumnVector(vector) {
vector = checkColumnVector(this, vector);
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) + vector[i4]);
}
}
return this;
}
subColumnVector(vector) {
vector = checkColumnVector(this, vector);
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) - vector[i4]);
}
}
return this;
}
mulColumnVector(vector) {
vector = checkColumnVector(this, vector);
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) * vector[i4]);
}
}
return this;
}
divColumnVector(vector) {
vector = checkColumnVector(this, vector);
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
this.set(i4, j4, this.get(i4, j4) / vector[i4]);
}
}
return this;
}
mulRow(index2, value2) {
checkRowIndex(this, index2);
for (let i4 = 0; i4 < this.columns; i4++) {
this.set(index2, i4, this.get(index2, i4) * value2);
}
return this;
}
mulColumn(index2, value2) {
checkColumnIndex(this, index2);
for (let i4 = 0; i4 < this.rows; i4++) {
this.set(i4, index2, this.get(i4, index2) * value2);
}
return this;
}
max() {
if (this.isEmpty()) {
return NaN;
}
let v3 = this.get(0, 0);
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
if (this.get(i4, j4) > v3) {
v3 = this.get(i4, j4);
}
}
}
return v3;
}
maxIndex() {
checkNonEmpty(this);
let v3 = this.get(0, 0);
let idx = [0, 0];
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
if (this.get(i4, j4) > v3) {
v3 = this.get(i4, j4);
idx[0] = i4;
idx[1] = j4;
}
}
}
return idx;
}
min() {
if (this.isEmpty()) {
return NaN;
}
let v3 = this.get(0, 0);
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
if (this.get(i4, j4) < v3) {
v3 = this.get(i4, j4);
}
}
}
return v3;
}
minIndex() {
checkNonEmpty(this);
let v3 = this.get(0, 0);
let idx = [0, 0];
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
if (this.get(i4, j4) < v3) {
v3 = this.get(i4, j4);
idx[0] = i4;
idx[1] = j4;
}
}
}
return idx;
}
maxRow(row) {
checkRowIndex(this, row);
if (this.isEmpty()) {
return NaN;
}
let v3 = this.get(row, 0);
for (let i4 = 1; i4 < this.columns; i4++) {
if (this.get(row, i4) > v3) {
v3 = this.get(row, i4);
}
}
return v3;
}
maxRowIndex(row) {
checkRowIndex(this, row);
checkNonEmpty(this);
let v3 = this.get(row, 0);
let idx = [row, 0];
for (let i4 = 1; i4 < this.columns; i4++) {
if (this.get(row, i4) > v3) {
v3 = this.get(row, i4);
idx[1] = i4;
}
}
return idx;
}
minRow(row) {
checkRowIndex(this, row);
if (this.isEmpty()) {
return NaN;
}
let v3 = this.get(row, 0);
for (let i4 = 1; i4 < this.columns; i4++) {
if (this.get(row, i4) < v3) {
v3 = this.get(row, i4);
}
}
return v3;
}
minRowIndex(row) {
checkRowIndex(this, row);
checkNonEmpty(this);
let v3 = this.get(row, 0);
let idx = [row, 0];
for (let i4 = 1; i4 < this.columns; i4++) {
if (this.get(row, i4) < v3) {
v3 = this.get(row, i4);
idx[1] = i4;
}
}
return idx;
}
maxColumn(column) {
checkColumnIndex(this, column);
if (this.isEmpty()) {
return NaN;
}
let v3 = this.get(0, column);
for (let i4 = 1; i4 < this.rows; i4++) {
if (this.get(i4, column) > v3) {
v3 = this.get(i4, column);
}
}
return v3;
}
maxColumnIndex(column) {
checkColumnIndex(this, column);
checkNonEmpty(this);
let v3 = this.get(0, column);
let idx = [0, column];
for (let i4 = 1; i4 < this.rows; i4++) {
if (this.get(i4, column) > v3) {
v3 = this.get(i4, column);
idx[0] = i4;
}
}
return idx;
}
minColumn(column) {
checkColumnIndex(this, column);
if (this.isEmpty()) {
return NaN;
}
let v3 = this.get(0, column);
for (let i4 = 1; i4 < this.rows; i4++) {
if (this.get(i4, column) < v3) {
v3 = this.get(i4, column);
}
}
return v3;
}
minColumnIndex(column) {
checkColumnIndex(this, column);
checkNonEmpty(this);
let v3 = this.get(0, column);
let idx = [0, column];
for (let i4 = 1; i4 < this.rows; i4++) {
if (this.get(i4, column) < v3) {
v3 = this.get(i4, column);
idx[0] = i4;
}
}
return idx;
}
diag() {
let min7 = Math.min(this.rows, this.columns);
let diag = [];
for (let i4 = 0; i4 < min7; i4++) {
diag.push(this.get(i4, i4));
}
return diag;
}
norm(type2 = "frobenius") {
let result = 0;
if (type2 === "max") {
return this.max();
} else if (type2 === "frobenius") {
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
result = result + this.get(i4, j4) * this.get(i4, j4);
}
}
return Math.sqrt(result);
} else {
throw new RangeError(`unknown norm type: ${type2}`);
}
}
cumulativeSum() {
let sum = 0;
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
sum += this.get(i4, j4);
this.set(i4, j4, sum);
}
}
return this;
}
dot(vector2) {
if (AbstractMatrix.isMatrix(vector2))
vector2 = vector2.to1DArray();
let vector1 = this.to1DArray();
if (vector1.length !== vector2.length) {
throw new RangeError("vectors do not have the same size");
}
let dot7 = 0;
for (let i4 = 0; i4 < vector1.length; i4++) {
dot7 += vector1[i4] * vector2[i4];
}
return dot7;
}
mmul(other2) {
other2 = Matrix2.checkMatrix(other2);
let m4 = this.rows;
let n3 = this.columns;
let p4 = other2.columns;
let result = new Matrix2(m4, p4);
let Bcolj = new Float64Array(n3);
for (let j4 = 0; j4 < p4; j4++) {
for (let k4 = 0; k4 < n3; k4++) {
Bcolj[k4] = other2.get(k4, j4);
}
for (let i4 = 0; i4 < m4; i4++) {
let s4 = 0;
for (let k4 = 0; k4 < n3; k4++) {
s4 += this.get(i4, k4) * Bcolj[k4];
}
result.set(i4, j4, s4);
}
}
return result;
}
strassen2x2(other2) {
other2 = Matrix2.checkMatrix(other2);
let result = new Matrix2(2, 2);
const a11 = this.get(0, 0);
const b11 = other2.get(0, 0);
const a12 = this.get(0, 1);
const b12 = other2.get(0, 1);
const a21 = this.get(1, 0);
const b21 = other2.get(1, 0);
const a22 = this.get(1, 1);
const b222 = other2.get(1, 1);
const m1 = (a11 + a22) * (b11 + b222);
const m22 = (a21 + a22) * b11;
const m32 = a11 * (b12 - b222);
const m4 = a22 * (b21 - b11);
const m5 = (a11 + a12) * b222;
const m6 = (a21 - a11) * (b11 + b12);
const m7 = (a12 - a22) * (b21 + b222);
const c00 = m1 + m4 - m5 + m7;
const c01 = m32 + m5;
const c10 = m22 + m4;
const c11 = m1 - m22 + m32 + m6;
result.set(0, 0, c00);
result.set(0, 1, c01);
result.set(1, 0, c10);
result.set(1, 1, c11);
return result;
}
strassen3x3(other2) {
other2 = Matrix2.checkMatrix(other2);
let result = new Matrix2(3, 3);
const a00 = this.get(0, 0);
const a01 = this.get(0, 1);
const a02 = this.get(0, 2);
const a10 = this.get(1, 0);
const a11 = this.get(1, 1);
const a12 = this.get(1, 2);
const a20 = this.get(2, 0);
const a21 = this.get(2, 1);
const a22 = this.get(2, 2);
const b00 = other2.get(0, 0);
const b01 = other2.get(0, 1);
const b02 = other2.get(0, 2);
const b10 = other2.get(1, 0);
const b11 = other2.get(1, 1);
const b12 = other2.get(1, 2);
const b20 = other2.get(2, 0);
const b21 = other2.get(2, 1);
const b222 = other2.get(2, 2);
const m1 = (a00 + a01 + a02 - a10 - a11 - a21 - a22) * b11;
const m22 = (a00 - a10) * (-b01 + b11);
const m32 = a11 * (-b00 + b01 + b10 - b11 - b12 - b20 + b222);
const m4 = (-a00 + a10 + a11) * (b00 - b01 + b11);
const m5 = (a10 + a11) * (-b00 + b01);
const m6 = a00 * b00;
const m7 = (-a00 + a20 + a21) * (b00 - b02 + b12);
const m8 = (-a00 + a20) * (b02 - b12);
const m9 = (a20 + a21) * (-b00 + b02);
const m10 = (a00 + a01 + a02 - a11 - a12 - a20 - a21) * b12;
const m11 = a21 * (-b00 + b02 + b10 - b11 - b12 - b20 + b21);
const m12 = (-a02 + a21 + a22) * (b11 + b20 - b21);
const m13 = (a02 - a22) * (b11 - b21);
const m14 = a02 * b20;
const m15 = (a21 + a22) * (-b20 + b21);
const m16 = (-a02 + a11 + a12) * (b12 + b20 - b222);
const m17 = (a02 - a12) * (b12 - b222);
const m18 = (a11 + a12) * (-b20 + b222);
const m19 = a01 * b10;
const m20 = a12 * b21;
const m21 = a10 * b02;
const m222 = a20 * b01;
const m23 = a22 * b222;
const c00 = m6 + m14 + m19;
const c01 = m1 + m4 + m5 + m6 + m12 + m14 + m15;
const c02 = m6 + m7 + m9 + m10 + m14 + m16 + m18;
const c10 = m22 + m32 + m4 + m6 + m14 + m16 + m17;
const c11 = m22 + m4 + m5 + m6 + m20;
const c12 = m14 + m16 + m17 + m18 + m21;
const c20 = m6 + m7 + m8 + m11 + m12 + m13 + m14;
const c21 = m12 + m13 + m14 + m15 + m222;
const c22 = m6 + m7 + m8 + m9 + m23;
result.set(0, 0, c00);
result.set(0, 1, c01);
result.set(0, 2, c02);
result.set(1, 0, c10);
result.set(1, 1, c11);
result.set(1, 2, c12);
result.set(2, 0, c20);
result.set(2, 1, c21);
result.set(2, 2, c22);
return result;
}
mmulStrassen(y5) {
y5 = Matrix2.checkMatrix(y5);
let x6 = this.clone();
let r1 = x6.rows;
let c1 = x6.columns;
let r22 = y5.rows;
let c22 = y5.columns;
if (c1 !== r22) {
console.warn(`Multiplying ${r1} x ${c1} and ${r22} x ${c22} matrix: dimensions do not match.`);
}
function embed(mat, rows, cols) {
let r5 = mat.rows;
let c6 = mat.columns;
if (r5 === rows && c6 === cols) {
return mat;
} else {
let resultat = AbstractMatrix.zeros(rows, cols);
resultat = resultat.setSubMatrix(mat, 0, 0);
return resultat;
}
}
let r4 = Math.max(r1, r22);
let c5 = Math.max(c1, c22);
x6 = embed(x6, r4, c5);
y5 = embed(y5, r4, c5);
function blockMult(a4, b10, rows, cols) {
if (rows <= 512 || cols <= 512) {
return a4.mmul(b10);
}
if (rows % 2 === 1 && cols % 2 === 1) {
a4 = embed(a4, rows + 1, cols + 1);
b10 = embed(b10, rows + 1, cols + 1);
} else if (rows % 2 === 1) {
a4 = embed(a4, rows + 1, cols);
b10 = embed(b10, rows + 1, cols);
} else if (cols % 2 === 1) {
a4 = embed(a4, rows, cols + 1);
b10 = embed(b10, rows, cols + 1);
}
let halfRows = parseInt(a4.rows / 2, 10);
let halfCols = parseInt(a4.columns / 2, 10);
let a11 = a4.subMatrix(0, halfRows - 1, 0, halfCols - 1);
let b11 = b10.subMatrix(0, halfRows - 1, 0, halfCols - 1);
let a12 = a4.subMatrix(0, halfRows - 1, halfCols, a4.columns - 1);
let b12 = b10.subMatrix(0, halfRows - 1, halfCols, b10.columns - 1);
let a21 = a4.subMatrix(halfRows, a4.rows - 1, 0, halfCols - 1);
let b21 = b10.subMatrix(halfRows, b10.rows - 1, 0, halfCols - 1);
let a22 = a4.subMatrix(halfRows, a4.rows - 1, halfCols, a4.columns - 1);
let b222 = b10.subMatrix(halfRows, b10.rows - 1, halfCols, b10.columns - 1);
let m1 = blockMult(AbstractMatrix.add(a11, a22), AbstractMatrix.add(b11, b222), halfRows, halfCols);
let m22 = blockMult(AbstractMatrix.add(a21, a22), b11, halfRows, halfCols);
let m32 = blockMult(a11, AbstractMatrix.sub(b12, b222), halfRows, halfCols);
let m4 = blockMult(a22, AbstractMatrix.sub(b21, b11), halfRows, halfCols);
let m5 = blockMult(AbstractMatrix.add(a11, a12), b222, halfRows, halfCols);
let m6 = blockMult(AbstractMatrix.sub(a21, a11), AbstractMatrix.add(b11, b12), halfRows, halfCols);
let m7 = blockMult(AbstractMatrix.sub(a12, a22), AbstractMatrix.add(b21, b222), halfRows, halfCols);
let c11 = AbstractMatrix.add(m1, m4);
c11.sub(m5);
c11.add(m7);
let c12 = AbstractMatrix.add(m32, m5);
let c21 = AbstractMatrix.add(m22, m4);
let c222 = AbstractMatrix.sub(m1, m22);
c222.add(m32);
c222.add(m6);
let resultat = AbstractMatrix.zeros(2 * c11.rows, 2 * c11.columns);
resultat = resultat.setSubMatrix(c11, 0, 0);
resultat = resultat.setSubMatrix(c12, c11.rows, 0);
resultat = resultat.setSubMatrix(c21, 0, c11.columns);
resultat = resultat.setSubMatrix(c222, c11.rows, c11.columns);
return resultat.subMatrix(0, rows - 1, 0, cols - 1);
}
return blockMult(x6, y5, r4, c5);
}
scaleRows(options = {}) {
if (typeof options !== "object") {
throw new TypeError("options must be an object");
}
const { min: min7 = 0, max: max8 = 1 } = options;
if (!Number.isFinite(min7))
throw new TypeError("min must be a number");
if (!Number.isFinite(max8))
throw new TypeError("max must be a number");
if (min7 >= max8)
throw new RangeError("min must be smaller than max");
let newMatrix = new Matrix2(this.rows, this.columns);
for (let i4 = 0; i4 < this.rows; i4++) {
const row = this.getRow(i4);
if (row.length > 0) {
rescale(row, { min: min7, max: max8, output: row });
}
newMatrix.setRow(i4, row);
}
return newMatrix;
}
scaleColumns(options = {}) {
if (typeof options !== "object") {
throw new TypeError("options must be an object");
}
const { min: min7 = 0, max: max8 = 1 } = options;
if (!Number.isFinite(min7))
throw new TypeError("min must be a number");
if (!Number.isFinite(max8))
throw new TypeError("max must be a number");
if (min7 >= max8)
throw new RangeError("min must be smaller than max");
let newMatrix = new Matrix2(this.rows, this.columns);
for (let i4 = 0; i4 < this.columns; i4++) {
const column = this.getColumn(i4);
if (column.length) {
rescale(column, {
min: min7,
max: max8,
output: column
});
}
newMatrix.setColumn(i4, column);
}
return newMatrix;
}
flipRows() {
const middle = Math.ceil(this.columns / 2);
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < middle; j4++) {
let first = this.get(i4, j4);
let last2 = this.get(i4, this.columns - 1 - j4);
this.set(i4, j4, last2);
this.set(i4, this.columns - 1 - j4, first);
}
}
return this;
}
flipColumns() {
const middle = Math.ceil(this.rows / 2);
for (let j4 = 0; j4 < this.columns; j4++) {
for (let i4 = 0; i4 < middle; i4++) {
let first = this.get(i4, j4);
let last2 = this.get(this.rows - 1 - i4, j4);
this.set(i4, j4, last2);
this.set(this.rows - 1 - i4, j4, first);
}
}
return this;
}
kroneckerProduct(other2) {
other2 = Matrix2.checkMatrix(other2);
let m4 = this.rows;
let n3 = this.columns;
let p4 = other2.rows;
let q4 = other2.columns;
let result = new Matrix2(m4 * p4, n3 * q4);
for (let i4 = 0; i4 < m4; i4++) {
for (let j4 = 0; j4 < n3; j4++) {
for (let k4 = 0; k4 < p4; k4++) {
for (let l4 = 0; l4 < q4; l4++) {
result.set(p4 * i4 + k4, q4 * j4 + l4, this.get(i4, j4) * other2.get(k4, l4));
}
}
}
}
return result;
}
kroneckerSum(other2) {
other2 = Matrix2.checkMatrix(other2);
if (!this.isSquare() || !other2.isSquare()) {
throw new Error("Kronecker Sum needs two Square Matrices");
}
let m4 = this.rows;
let n3 = other2.rows;
let AxI = this.kroneckerProduct(Matrix2.eye(n3, n3));
let IxB = Matrix2.eye(m4, m4).kroneckerProduct(other2);
return AxI.add(IxB);
}
transpose() {
let result = new Matrix2(this.columns, this.rows);
for (let i4 = 0; i4 < this.rows; i4++) {
for (let j4 = 0; j4 < this.columns; j4++) {
result.set(j4, i4, this.get(i4, j4));
}
}
return result;
}
sortRows(compareFunction = compareNumbers) {
for (let i4 = 0; i4 < this.rows; i4++) {
this.setRow(i4, this.getRow(i4).sort(compareFunction));
}
return this;
}
sortColumns(compareFunction = compareNumbers) {
for (let i4 = 0; i4 < this.columns; i4++) {
this.setColumn(i4, this.getColumn(i4).sort(compareFunction));
}
return this;
}
subMatrix(startRow, endRow, startColumn, endColumn) {
checkRange(this, startRow, endRow, startColumn, endColumn);
let newMatrix = new Matrix2(endRow - startRow + 1, endColumn - startColumn + 1);
for (let i4 = startRow; i4 <= endRow; i4++) {
for (let j4 = startColumn; j4 <= endColumn; j4++) {
newMatrix.set(i4 - startRow, j4 - startColumn, this.get(i4, j4));
}
}
return newMatrix;
}
subMatrixRow(indices, startColumn, endColumn) {
if (startColumn === void 0)
startColumn = 0;
if (endColumn === void 0)
endColumn = this.columns - 1;
if (startColumn > endColumn || startColumn < 0 || startColumn >= this.columns || endColumn < 0 || endColumn >= this.columns) {
throw new RangeError("Argument out of range");
}
let newMatrix = new Matrix2(indices.length, endColumn - startColumn + 1);
for (let i4 = 0; i4 < indices.length; i4++) {
for (let j4 = startColumn; j4 <= endColumn; j4++) {
if (indices[i4] < 0 || indices[i4] >= this.rows) {
throw new RangeError(`Row index out of range: ${indices[i4]}`);
}
newMatrix.set(i4, j4 - startColumn, this.get(indices[i4], j4));
}
}
return newMatrix;
}
subMatrixColumn(indices, startRow, endRow) {
if (startRow === void 0)
startRow = 0;
if (endRow === void 0)
endRow = this.rows - 1;
if (startRow > endRow || startRow < 0 || startRow >= this.rows || endRow < 0 || endRow >= this.rows) {
throw new RangeError("Argument out of range");
}
let newMatrix = new Matrix2(endRow - startRow + 1, indices.length);
for (let i4 = 0; i4 < indices.length; i4++) {
for (let j4 = startRow; j4 <= endRow; j4++) {
if (indices[i4] < 0 || indices[i4] >= this.columns) {
throw new RangeError(`Column index out of range: ${indices[i4]}`);
}
newMatrix.set(j4 - startRow, i4, this.get(j4, indices[i4]));
}
}
return newMatrix;
}
setSubMatrix(matrix, startRow, startColumn) {
matrix = Matrix2.checkMatrix(matrix);
if (matrix.isEmpty()) {
return this;
}
let endRow = startRow + matrix.rows - 1;
let endColumn = startColumn + matrix.columns - 1;
checkRange(this, startRow, endRow, startColumn, endColumn);
for (let i4 = 0; i4 < matrix.rows; i4++) {
for (let j4 = 0; j4 < matrix.columns; j4++) {
this.set(startRow + i4, startColumn + j4, matrix.get(i4, j4));
}
}
return this;
}
selection(rowIndices, columnIndices) {
let indices = checkIndices(this, rowIndices, columnIndices);
let newMatrix = new Matrix2(rowIndices.length, columnIndices.length);
for (let i4 = 0; i4 < indices.row.length; i4++) {
let rowIndex = indices.row[i4];
for (let j4 = 0; j4 < indices.column.length; j4++) {
let columnIndex = indices.column[j4];
newMatrix.set(i4, j4, this.get(rowIndex, columnIndex));
}
}
return newMatrix;
}
trace() {
let min7 = Math.min(this.rows, this.columns);
let trace = 0;
for (let i4 = 0; i4 < min7; i4++) {
trace += this.get(i4, i4);
}
return trace;
}
clone() {
let newMatrix = new Matrix2(this.rows, this.columns);
for (let row = 0; row < this.rows; row++) {
for (let column = 0; column < this.columns; column++) {
newMatrix.set(row, column, this.get(row, column));
}
}
return newMatrix;
}
sum(by) {
switch (by) {
case "row":
return sumByRow(this);
case "column":
return sumByColumn(this);
case void 0:
return sumAll(this);
default:
throw new Error(`invalid option: ${by}`);
}
}
product(by) {
switch (by) {
case "row":
return productByRow(this);
case "column":
return productByColumn(this);
case void 0:
return productAll(this);
default:
throw new Error(`invalid option: ${by}`);
}
}
mean(by) {
const sum = this.sum(by);
switch (by) {
case "row": {
for (let i4 = 0; i4 < this.rows; i4++) {
sum[i4] /= this.columns;
}
return sum;
}
case "column": {
for (let i4 = 0; i4 < this.columns; i4++) {
sum[i4] /= this.rows;
}
return sum;
}
case void 0:
return sum / this.size;
default:
throw new Error(`invalid option: ${by}`);
}
}
variance(by, options = {}) {
if (typeof by === "object") {
options = by;
by = void 0;
}
if (typeof options !== "object") {
throw new TypeError("options must be an object");
}
const { unbiased = true, mean = this.mean(by) } = options;
if (typeof unbiased !== "boolean") {
throw new TypeError("unbiased must be a boolean");
}
switch (by) {
case "row": {
if (!Array.isArray(mean)) {
throw new TypeError("mean must be an array");
}
return varianceByRow(this, unbiased, mean);
}
case "column": {
if (!Array.isArray(mean)) {
throw new TypeError("mean must be an array");
}
return varianceByColumn(this, unbiased, mean);
}
case void 0: {
if (typeof mean !== "number") {
throw new TypeError("mean must be a number");
}
return varianceAll(this, unbiased, mean);
}
default:
throw new Error(`invalid option: ${by}`);
}
}
standardDeviation(by, options) {
if (typeof by === "object") {
options = by;
by = void 0;
}
const variance = this.variance(by, options);
if (by === void 0) {
return Math.sqrt(variance);
} else {
for (let i4 = 0; i4 < variance.length; i4++) {
variance[i4] = Math.sqrt(variance[i4]);
}
return variance;
}
}
center(by, options = {}) {
if (typeof by === "object") {
options = by;
by = void 0;
}
if (typeof options !== "object") {
throw new TypeError("options must be an object");
}
const { center: center2 = this.mean(by) } = options;
switch (by) {
case "row": {
if (!Array.isArray(center2)) {
throw new TypeError("center must be an array");
}
centerByRow(this, center2);
return this;
}
case "column": {
if (!Array.isArray(center2)) {
throw new TypeError("center must be an array");
}
centerByColumn(this, center2);
return this;
}
case void 0: {
if (typeof center2 !== "number") {
throw new TypeError("center must be a number");
}
centerAll(this, center2);
return this;
}
default:
throw new Error(`invalid option: ${by}`);
}
}
scale(by, options = {}) {
if (typeof by === "object") {
options = by;
by = void 0;
}
if (typeof options !== "object") {
throw new TypeError("options must be an object");
}
let scale12 = options.scale;
switch (by) {
case "row": {
if (scale12 === void 0) {
scale12 = getScaleByRow(this);
} else if (!Array.isArray(scale12)) {
throw new TypeError("scale must be an array");
}
scaleByRow(this, scale12);
return this;
}
case "column": {
if (scale12 === void 0) {
scale12 = getScaleByColumn(this);
} else if (!Array.isArray(scale12)) {
throw new TypeError("scale must be an array");
}
scaleByColumn(this, scale12);
return this;
}
case void 0: {
if (scale12 === void 0) {
scale12 = getScaleAll(this);
} else if (typeof scale12 !== "number") {
throw new TypeError("scale must be a number");
}
scaleAll(this, scale12);
return this;
}
default:
throw new Error(`invalid option: ${by}`);
}
}
toString(options) {
return inspectMatrixWithOptions(this, options);
}
};
AbstractMatrix.prototype.klass = "Matrix";
if (typeof Symbol !== "undefined") {
AbstractMatrix.prototype[Symbol.for("nodejs.util.inspect.custom")] = inspectMatrix;
}
function compareNumbers(a4, b10) {
return a4 - b10;
}
AbstractMatrix.random = AbstractMatrix.rand;
AbstractMatrix.randomInt = AbstractMatrix.randInt;
AbstractMatrix.diagonal = AbstractMatrix.diag;
AbstractMatrix.prototype.diagonal = AbstractMatrix.prototype.diag;
AbstractMatrix.identity = AbstractMatrix.eye;
AbstractMatrix.prototype.negate = AbstractMatrix.prototype.neg;
AbstractMatrix.prototype.tensorProduct = AbstractMatrix.prototype.kroneckerProduct;
var Matrix2 = class extends AbstractMatrix {
constructor(nRows, nColumns) {
super();
if (Matrix2.isMatrix(nRows)) {
return nRows.clone();
} else if (Number.isInteger(nRows) && nRows >= 0) {
this.data = [];
if (Number.isInteger(nColumns) && nColumns >= 0) {
for (let i4 = 0; i4 < nRows; i4++) {
this.data.push(new Float64Array(nColumns));
}
} else {
throw new TypeError("nColumns must be a positive integer");
}
} else if (Array.isArray(nRows)) {
const arrayData = nRows;
nRows = arrayData.length;
nColumns = nRows ? arrayData[0].length : 0;
if (typeof nColumns !== "number") {
throw new TypeError("Data must be a 2D array with at least one element");
}
this.data = [];
for (let i4 = 0; i4 < nRows; i4++) {
if (arrayData[i4].length !== nColumns) {
throw new RangeError("Inconsistent array dimensions");
}
this.data.push(Float64Array.from(arrayData[i4]));
}
} else {
throw new TypeError("First argument must be a positive number or an array");
}
this.rows = nRows;
this.columns = nColumns;
}
set(rowIndex, columnIndex, value2) {
this.data[rowIndex][columnIndex] = value2;
return this;
}
get(rowIndex, columnIndex) {
return this.data[rowIndex][columnIndex];
}
removeRow(index2) {
checkRowIndex(this, index2);
this.data.splice(index2, 1);
this.rows -= 1;
return this;
}
addRow(index2, array) {
if (array === void 0) {
array = index2;
index2 = this.rows;
}
checkRowIndex(this, index2, true);
array = Float64Array.from(checkRowVector(this, array));
this.data.splice(index2, 0, array);
this.rows += 1;
return this;
}
removeColumn(index2) {
checkColumnIndex(this, index2);
for (let i4 = 0; i4 < this.rows; i4++) {
const newRow = new Float64Array(this.columns - 1);
for (let j4 = 0; j4 < index2; j4++) {
newRow[j4] = this.data[i4][j4];
}
for (let j4 = index2 + 1; j4 < this.columns; j4++) {
newRow[j4 - 1] = this.data[i4][j4];
}
this.data[i4] = newRow;
}
this.columns -= 1;
return this;
}
addColumn(index2, array) {
if (typeof array === "undefined") {
array = index2;
index2 = this.columns;
}
checkColumnIndex(this, index2, true);
array = checkColumnVector(this, array);
for (let i4 = 0; i4 < this.rows; i4++) {
const newRow = new Float64Array(this.columns + 1);
let j4 = 0;
for (; j4 < index2; j4++) {
newRow[j4] = this.data[i4][j4];
}
newRow[j4++] = array[i4];
for (; j4 < this.columns + 1; j4++) {
newRow[j4] = this.data[i4][j4 - 1];
}
this.data[i4] = newRow;
}
this.columns += 1;
return this;
}
};
installMathOperations(AbstractMatrix, Matrix2);
// node_modules/ml-matrix/src/wrap/WrapperMatrix2D.js
var WrapperMatrix2D = class extends AbstractMatrix {
constructor(data3) {
super();
this.data = data3;
this.rows = data3.length;
this.columns = data3[0].length;
}
set(rowIndex, columnIndex, value2) {
this.data[rowIndex][columnIndex] = value2;
return this;
}
get(rowIndex, columnIndex) {
return this.data[rowIndex][columnIndex];
}
};
// node_modules/ml-matrix/src/dc/util.js
function hypotenuse(a4, b10) {
let r4 = 0;
if (Math.abs(a4) > Math.abs(b10)) {
r4 = b10 / a4;
return Math.abs(a4) * Math.sqrt(1 + r4 * r4);
}
if (b10 !== 0) {
r4 = a4 / b10;
return Math.abs(b10) * Math.sqrt(1 + r4 * r4);
}
return 0;
}
// node_modules/ml-matrix/src/dc/svd.js
var SingularValueDecomposition = class {
constructor(value2, options = {}) {
value2 = WrapperMatrix2D.checkMatrix(value2);
if (value2.isEmpty()) {
throw new Error("Matrix must be non-empty");
}
let m4 = value2.rows;
let n3 = value2.columns;
const {
computeLeftSingularVectors = true,
computeRightSingularVectors = true,
autoTranspose = false
} = options;
let wantu = Boolean(computeLeftSingularVectors);
let wantv = Boolean(computeRightSingularVectors);
let swapped = false;
let a4;
if (m4 < n3) {
if (!autoTranspose) {
a4 = value2.clone();
console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");
} else {
a4 = value2.transpose();
m4 = a4.rows;
n3 = a4.columns;
swapped = true;
let aux = wantu;
wantu = wantv;
wantv = aux;
}
} else {
a4 = value2.clone();
}
let nu = Math.min(m4, n3);
let ni = Math.min(m4 + 1, n3);
let s4 = new Float64Array(ni);
let U2 = new Matrix2(m4, nu);
let V2 = new Matrix2(n3, n3);
let e4 = new Float64Array(n3);
let work = new Float64Array(m4);
let si = new Float64Array(ni);
for (let i4 = 0; i4 < ni; i4++)
si[i4] = i4;
let nct = Math.min(m4 - 1, n3);
let nrt = Math.max(0, Math.min(n3 - 2, m4));
let mrc = Math.max(nct, nrt);
for (let k4 = 0; k4 < mrc; k4++) {
if (k4 < nct) {
s4[k4] = 0;
for (let i4 = k4; i4 < m4; i4++) {
s4[k4] = hypotenuse(s4[k4], a4.get(i4, k4));
}
if (s4[k4] !== 0) {
if (a4.get(k4, k4) < 0) {
s4[k4] = -s4[k4];
}
for (let i4 = k4; i4 < m4; i4++) {
a4.set(i4, k4, a4.get(i4, k4) / s4[k4]);
}
a4.set(k4, k4, a4.get(k4, k4) + 1);
}
s4[k4] = -s4[k4];
}
for (let j4 = k4 + 1; j4 < n3; j4++) {
if (k4 < nct && s4[k4] !== 0) {
let t4 = 0;
for (let i4 = k4; i4 < m4; i4++) {
t4 += a4.get(i4, k4) * a4.get(i4, j4);
}
t4 = -t4 / a4.get(k4, k4);
for (let i4 = k4; i4 < m4; i4++) {
a4.set(i4, j4, a4.get(i4, j4) + t4 * a4.get(i4, k4));
}
}
e4[j4] = a4.get(k4, j4);
}
if (wantu && k4 < nct) {
for (let i4 = k4; i4 < m4; i4++) {
U2.set(i4, k4, a4.get(i4, k4));
}
}
if (k4 < nrt) {
e4[k4] = 0;
for (let i4 = k4 + 1; i4 < n3; i4++) {
e4[k4] = hypotenuse(e4[k4], e4[i4]);
}
if (e4[k4] !== 0) {
if (e4[k4 + 1] < 0) {
e4[k4] = 0 - e4[k4];
}
for (let i4 = k4 + 1; i4 < n3; i4++) {
e4[i4] /= e4[k4];
}
e4[k4 + 1] += 1;
}
e4[k4] = -e4[k4];
if (k4 + 1 < m4 && e4[k4] !== 0) {
for (let i4 = k4 + 1; i4 < m4; i4++) {
work[i4] = 0;
}
for (let i4 = k4 + 1; i4 < m4; i4++) {
for (let j4 = k4 + 1; j4 < n3; j4++) {
work[i4] += e4[j4] * a4.get(i4, j4);
}
}
for (let j4 = k4 + 1; j4 < n3; j4++) {
let t4 = -e4[j4] / e4[k4 + 1];
for (let i4 = k4 + 1; i4 < m4; i4++) {
a4.set(i4, j4, a4.get(i4, j4) + t4 * work[i4]);
}
}
}
if (wantv) {
for (let i4 = k4 + 1; i4 < n3; i4++) {
V2.set(i4, k4, e4[i4]);
}
}
}
}
let p4 = Math.min(n3, m4 + 1);
if (nct < n3) {
s4[nct] = a4.get(nct, nct);
}
if (m4 < p4) {
s4[p4 - 1] = 0;
}
if (nrt + 1 < p4) {
e4[nrt] = a4.get(nrt, p4 - 1);
}
e4[p4 - 1] = 0;
if (wantu) {
for (let j4 = nct; j4 < nu; j4++) {
for (let i4 = 0; i4 < m4; i4++) {
U2.set(i4, j4, 0);
}
U2.set(j4, j4, 1);
}
for (let k4 = nct - 1; k4 >= 0; k4--) {
if (s4[k4] !== 0) {
for (let j4 = k4 + 1; j4 < nu; j4++) {
let t4 = 0;
for (let i4 = k4; i4 < m4; i4++) {
t4 += U2.get(i4, k4) * U2.get(i4, j4);
}
t4 = -t4 / U2.get(k4, k4);
for (let i4 = k4; i4 < m4; i4++) {
U2.set(i4, j4, U2.get(i4, j4) + t4 * U2.get(i4, k4));
}
}
for (let i4 = k4; i4 < m4; i4++) {
U2.set(i4, k4, -U2.get(i4, k4));
}
U2.set(k4, k4, 1 + U2.get(k4, k4));
for (let i4 = 0; i4 < k4 - 1; i4++) {
U2.set(i4, k4, 0);
}
} else {
for (let i4 = 0; i4 < m4; i4++) {
U2.set(i4, k4, 0);
}
U2.set(k4, k4, 1);
}
}
}
if (wantv) {
for (let k4 = n3 - 1; k4 >= 0; k4--) {
if (k4 < nrt && e4[k4] !== 0) {
for (let j4 = k4 + 1; j4 < n3; j4++) {
let t4 = 0;
for (let i4 = k4 + 1; i4 < n3; i4++) {
t4 += V2.get(i4, k4) * V2.get(i4, j4);
}
t4 = -t4 / V2.get(k4 + 1, k4);
for (let i4 = k4 + 1; i4 < n3; i4++) {
V2.set(i4, j4, V2.get(i4, j4) + t4 * V2.get(i4, k4));
}
}
}
for (let i4 = 0; i4 < n3; i4++) {
V2.set(i4, k4, 0);
}
V2.set(k4, k4, 1);
}
}
let pp = p4 - 1;
let iter = 0;
let eps2 = Number.EPSILON;
while (p4 > 0) {
let k4, kase;
for (k4 = p4 - 2; k4 >= -1; k4--) {
if (k4 === -1) {
break;
}
const alpha = Number.MIN_VALUE + eps2 * Math.abs(s4[k4] + Math.abs(s4[k4 + 1]));
if (Math.abs(e4[k4]) <= alpha || Number.isNaN(e4[k4])) {
e4[k4] = 0;
break;
}
}
if (k4 === p4 - 2) {
kase = 4;
} else {
let ks;
for (ks = p4 - 1; ks >= k4; ks--) {
if (ks === k4) {
break;
}
let t4 = (ks !== p4 ? Math.abs(e4[ks]) : 0) + (ks !== k4 + 1 ? Math.abs(e4[ks - 1]) : 0);
if (Math.abs(s4[ks]) <= eps2 * t4) {
s4[ks] = 0;
break;
}
}
if (ks === k4) {
kase = 3;
} else if (ks === p4 - 1) {
kase = 1;
} else {
kase = 2;
k4 = ks;
}
}
k4++;
switch (kase) {
case 1: {
let f3 = e4[p4 - 2];
e4[p4 - 2] = 0;
for (let j4 = p4 - 2; j4 >= k4; j4--) {
let t4 = hypotenuse(s4[j4], f3);
let cs = s4[j4] / t4;
let sn = f3 / t4;
s4[j4] = t4;
if (j4 !== k4) {
f3 = -sn * e4[j4 - 1];
e4[j4 - 1] = cs * e4[j4 - 1];
}
if (wantv) {
for (let i4 = 0; i4 < n3; i4++) {
t4 = cs * V2.get(i4, j4) + sn * V2.get(i4, p4 - 1);
V2.set(i4, p4 - 1, -sn * V2.get(i4, j4) + cs * V2.get(i4, p4 - 1));
V2.set(i4, j4, t4);
}
}
}
break;
}
case 2: {
let f3 = e4[k4 - 1];
e4[k4 - 1] = 0;
for (let j4 = k4; j4 < p4; j4++) {
let t4 = hypotenuse(s4[j4], f3);
let cs = s4[j4] / t4;
let sn = f3 / t4;
s4[j4] = t4;
f3 = -sn * e4[j4];
e4[j4] = cs * e4[j4];
if (wantu) {
for (let i4 = 0; i4 < m4; i4++) {
t4 = cs * U2.get(i4, j4) + sn * U2.get(i4, k4 - 1);
U2.set(i4, k4 - 1, -sn * U2.get(i4, j4) + cs * U2.get(i4, k4 - 1));
U2.set(i4, j4, t4);
}
}
}
break;
}
case 3: {
const scale12 = Math.max(Math.abs(s4[p4 - 1]), Math.abs(s4[p4 - 2]), Math.abs(e4[p4 - 2]), Math.abs(s4[k4]), Math.abs(e4[k4]));
const sp = s4[p4 - 1] / scale12;
const spm1 = s4[p4 - 2] / scale12;
const epm1 = e4[p4 - 2] / scale12;
const sk = s4[k4] / scale12;
const ek = e4[k4] / scale12;
const b10 = ((spm1 + sp) * (spm1 - sp) + epm1 * epm1) / 2;
const c5 = sp * epm1 * (sp * epm1);
let shift = 0;
if (b10 !== 0 || c5 !== 0) {
if (b10 < 0) {
shift = 0 - Math.sqrt(b10 * b10 + c5);
} else {
shift = Math.sqrt(b10 * b10 + c5);
}
shift = c5 / (b10 + shift);
}
let f3 = (sk + sp) * (sk - sp) + shift;
let g4 = sk * ek;
for (let j4 = k4; j4 < p4 - 1; j4++) {
let t4 = hypotenuse(f3, g4);
if (t4 === 0)
t4 = Number.MIN_VALUE;
let cs = f3 / t4;
let sn = g4 / t4;
if (j4 !== k4) {
e4[j4 - 1] = t4;
}
f3 = cs * s4[j4] + sn * e4[j4];
e4[j4] = cs * e4[j4] - sn * s4[j4];
g4 = sn * s4[j4 + 1];
s4[j4 + 1] = cs * s4[j4 + 1];
if (wantv) {
for (let i4 = 0; i4 < n3; i4++) {
t4 = cs * V2.get(i4, j4) + sn * V2.get(i4, j4 + 1);
V2.set(i4, j4 + 1, -sn * V2.get(i4, j4) + cs * V2.get(i4, j4 + 1));
V2.set(i4, j4, t4);
}
}
t4 = hypotenuse(f3, g4);
if (t4 === 0)
t4 = Number.MIN_VALUE;
cs = f3 / t4;
sn = g4 / t4;
s4[j4] = t4;
f3 = cs * e4[j4] + sn * s4[j4 + 1];
s4[j4 + 1] = -sn * e4[j4] + cs * s4[j4 + 1];
g4 = sn * e4[j4 + 1];
e4[j4 + 1] = cs * e4[j4 + 1];
if (wantu && j4 < m4 - 1) {
for (let i4 = 0; i4 < m4; i4++) {
t4 = cs * U2.get(i4, j4) + sn * U2.get(i4, j4 + 1);
U2.set(i4, j4 + 1, -sn * U2.get(i4, j4) + cs * U2.get(i4, j4 + 1));
U2.set(i4, j4, t4);
}
}
}
e4[p4 - 2] = f3;
iter = iter + 1;
break;
}
case 4: {
if (s4[k4] <= 0) {
s4[k4] = s4[k4] < 0 ? -s4[k4] : 0;
if (wantv) {
for (let i4 = 0; i4 <= pp; i4++) {
V2.set(i4, k4, -V2.get(i4, k4));
}
}
}
while (k4 < pp) {
if (s4[k4] >= s4[k4 + 1]) {
break;
}
let t4 = s4[k4];
s4[k4] = s4[k4 + 1];
s4[k4 + 1] = t4;
if (wantv && k4 < n3 - 1) {
for (let i4 = 0; i4 < n3; i4++) {
t4 = V2.get(i4, k4 + 1);
V2.set(i4, k4 + 1, V2.get(i4, k4));
V2.set(i4, k4, t4);
}
}
if (wantu && k4 < m4 - 1) {
for (let i4 = 0; i4 < m4; i4++) {
t4 = U2.get(i4, k4 + 1);
U2.set(i4, k4 + 1, U2.get(i4, k4));
U2.set(i4, k4, t4);
}
}
k4++;
}
iter = 0;
p4--;
break;
}
}
}
if (swapped) {
let tmp = V2;
V2 = U2;
U2 = tmp;
}
this.m = m4;
this.n = n3;
this.s = s4;
this.U = U2;
this.V = V2;
}
solve(value2) {
let Y2 = value2;
let e4 = this.threshold;
let scols = this.s.length;
let Ls = Matrix2.zeros(scols, scols);
for (let i4 = 0; i4 < scols; i4++) {
if (Math.abs(this.s[i4]) <= e4) {
Ls.set(i4, i4, 0);
} else {
Ls.set(i4, i4, 1 / this.s[i4]);
}
}
let U2 = this.U;
let V2 = this.rightSingularVectors;
let VL = V2.mmul(Ls);
let vrows = V2.rows;
let urows = U2.rows;
let VLU = Matrix2.zeros(vrows, urows);
for (let i4 = 0; i4 < vrows; i4++) {
for (let j4 = 0; j4 < urows; j4++) {
let sum = 0;
for (let k4 = 0; k4 < scols; k4++) {
sum += VL.get(i4, k4) * U2.get(j4, k4);
}
VLU.set(i4, j4, sum);
}
}
return VLU.mmul(Y2);
}
solveForDiagonal(value2) {
return this.solve(Matrix2.diag(value2));
}
inverse() {
let V2 = this.V;
let e4 = this.threshold;
let vrows = V2.rows;
let vcols = V2.columns;
let X2 = new Matrix2(vrows, this.s.length);
for (let i4 = 0; i4 < vrows; i4++) {
for (let j4 = 0; j4 < vcols; j4++) {
if (Math.abs(this.s[j4]) > e4) {
X2.set(i4, j4, V2.get(i4, j4) / this.s[j4]);
}
}
}
let U2 = this.U;
let urows = U2.rows;
let ucols = U2.columns;
let Y2 = new Matrix2(vrows, urows);
for (let i4 = 0; i4 < vrows; i4++) {
for (let j4 = 0; j4 < urows; j4++) {
let sum = 0;
for (let k4 = 0; k4 < ucols; k4++) {
sum += X2.get(i4, k4) * U2.get(j4, k4);
}
Y2.set(i4, j4, sum);
}
}
return Y2;
}
get condition() {
return this.s[0] / this.s[Math.min(this.m, this.n) - 1];
}
get norm2() {
return this.s[0];
}
get rank() {
let tol = Math.max(this.m, this.n) * this.s[0] * Number.EPSILON;
let r4 = 0;
let s4 = this.s;
for (let i4 = 0, ii = s4.length; i4 < ii; i4++) {
if (s4[i4] > tol) {
r4++;
}
}
return r4;
}
get diagonal() {
return Array.from(this.s);
}
get threshold() {
return Number.EPSILON / 2 * Math.max(this.m, this.n) * this.s[0];
}
get leftSingularVectors() {
return this.U;
}
get rightSingularVectors() {
return this.V;
}
get diagonalMatrix() {
return Matrix2.diag(this.s);
}
};
// node_modules/@antv/layout/es/layout/radial/mds.js
var MDS = class {
constructor(params) {
this.distances = params.distances;
this.dimension = params.dimension || 2;
this.linkDistance = params.linkDistance;
}
layout() {
const self2 = this;
const { dimension, distances, linkDistance } = self2;
try {
const M3 = Matrix2.mul(Matrix2.pow(distances, 2), -0.5);
const rowMeans = M3.mean("row");
const colMeans = M3.mean("column");
const totalMean = M3.mean();
M3.add(totalMean).subRowVector(rowMeans).subColumnVector(colMeans);
const ret = new SingularValueDecomposition(M3);
const eigenValues = Matrix2.sqrt(ret.diagonalMatrix).diagonal();
return ret.leftSingularVectors.toJSON().map((row) => {
return Matrix2.mul([row], [eigenValues]).toJSON()[0].splice(0, dimension);
});
} catch (_a6) {
const res = [];
for (let i4 = 0; i4 < distances.length; i4++) {
const x6 = Math.random() * linkDistance;
const y5 = Math.random() * linkDistance;
res.push([x6, y5]);
}
return res;
}
}
};
// node_modules/@antv/layout/es/layout/radial/radialNonoverlapForce.js
var SPEED_DIVISOR = 800;
var RadialNonoverlapForce = class {
constructor(params) {
this.disp = [];
this.positions = params.positions;
this.adjMatrix = params.adjMatrix;
this.focusID = params.focusID;
this.radii = params.radii;
this.iterations = params.iterations || 10;
this.height = params.height || 10;
this.width = params.width || 10;
this.speed = params.speed || 100;
this.gravity = params.gravity || 10;
this.nodeSizeFunc = params.nodeSizeFunc;
this.k = params.k || 5;
this.strictRadial = params.strictRadial;
this.nodes = params.nodes;
}
layout() {
const self2 = this;
const positions = self2.positions;
const disp = [];
const iterations = self2.iterations;
const maxDisplace = self2.width / 10;
self2.maxDisplace = maxDisplace;
self2.disp = disp;
for (let i4 = 0; i4 < iterations; i4++) {
positions.forEach((_8, k4) => {
disp[k4] = { x: 0, y: 0 };
});
self2.getRepulsion();
self2.updatePositions();
}
return positions;
}
getRepulsion() {
const self2 = this;
const positions = self2.positions;
const nodes = self2.nodes;
const disp = self2.disp;
const k4 = self2.k;
const radii = self2.radii || [];
positions.forEach((v3, i4) => {
disp[i4] = { x: 0, y: 0 };
positions.forEach((u3, j4) => {
if (i4 === j4) {
return;
}
if (radii[i4] !== radii[j4]) {
return;
}
let vecx = v3[0] - u3[0];
let vecy = v3[1] - u3[1];
let vecLength = Math.sqrt(vecx * vecx + vecy * vecy);
if (vecLength === 0) {
vecLength = 1;
const sign = i4 > j4 ? 1 : -1;
vecx = 0.01 * sign;
vecy = 0.01 * sign;
}
if (vecLength < self2.nodeSizeFunc(nodes[i4]) / 2 + self2.nodeSizeFunc(nodes[j4]) / 2) {
const common2 = k4 * k4 / vecLength;
disp[i4].x += vecx / vecLength * common2;
disp[i4].y += vecy / vecLength * common2;
}
});
});
}
updatePositions() {
const self2 = this;
const positions = self2.positions;
const disp = self2.disp;
const speed = self2.speed;
const strictRadial = self2.strictRadial;
const f3 = self2.focusID;
const maxDisplace = self2.maxDisplace || self2.width / 10;
if (strictRadial) {
disp.forEach((di, i4) => {
const vx = positions[i4][0] - positions[f3][0];
const vy = positions[i4][1] - positions[f3][1];
const vLength = Math.sqrt(vx * vx + vy * vy);
let vpx = vy / vLength;
let vpy = -vx / vLength;
const diLength = Math.sqrt(di.x * di.x + di.y * di.y);
let alpha = Math.acos((vpx * di.x + vpy * di.y) / diLength);
if (alpha > Math.PI / 2) {
alpha -= Math.PI / 2;
vpx *= -1;
vpy *= -1;
}
const tdispLength = Math.cos(alpha) * diLength;
di.x = vpx * tdispLength;
di.y = vpy * tdispLength;
});
}
const radii = self2.radii;
positions.forEach((n3, i4) => {
if (i4 === f3) {
return;
}
const distLength = Math.sqrt(disp[i4].x * disp[i4].x + disp[i4].y * disp[i4].y);
if (distLength > 0 && i4 !== f3) {
const limitedDist = Math.min(maxDisplace * (speed / SPEED_DIVISOR), distLength);
n3[0] += disp[i4].x / distLength * limitedDist;
n3[1] += disp[i4].y / distLength * limitedDist;
if (strictRadial) {
let vx = n3[0] - positions[f3][0];
let vy = n3[1] - positions[f3][1];
const nfDis = Math.sqrt(vx * vx + vy * vy);
vx = vx / nfDis * radii[i4];
vy = vy / nfDis * radii[i4];
n3[0] = positions[f3][0] + vx;
n3[1] = positions[f3][1] + vy;
}
}
});
}
};
// node_modules/@antv/layout/es/layout/radial/radial.js
function getWeightMatrix(M3) {
const rows = M3.length;
const cols = M3[0].length;
const result = [];
for (let i4 = 0; i4 < rows; i4++) {
const row = [];
for (let j4 = 0; j4 < cols; j4++) {
if (M3[i4][j4] !== 0) {
row.push(1 / (M3[i4][j4] * M3[i4][j4]));
} else {
row.push(0);
}
}
result.push(row);
}
return result;
}
function getIndexById(array, id) {
let index2 = -1;
array.forEach((a4, i4) => {
if (a4.id === id) {
index2 = i4;
}
});
return index2;
}
function getEDistance(p1, p22) {
return Math.sqrt((p1[0] - p22[0]) * (p1[0] - p22[0]) + (p1[1] - p22[1]) * (p1[1] - p22[1]));
}
var RadialLayout = class extends Base3 {
constructor(options) {
super();
this.maxIteration = 1e3;
this.focusNode = null;
this.unitRadius = null;
this.linkDistance = 50;
this.preventOverlap = false;
this.strictRadial = true;
this.maxPreventOverlapIteration = 200;
this.sortStrength = 10;
this.nodes = [];
this.edges = [];
this.updateCfg(options);
}
getDefaultCfg() {
return {
maxIteration: 1e3,
focusNode: null,
unitRadius: null,
linkDistance: 50,
preventOverlap: false,
nodeSize: void 0,
nodeSpacing: void 0,
strictRadial: true,
maxPreventOverlapIteration: 200,
sortBy: void 0,
sortStrength: 10
};
}
execute() {
const self2 = this;
const nodes = self2.nodes;
const edges = self2.edges || [];
if (!nodes || nodes.length === 0) {
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return;
}
if (!self2.width && typeof window !== "undefined") {
self2.width = window.innerWidth;
}
if (!self2.height && typeof window !== "undefined") {
self2.height = window.innerHeight;
}
if (!self2.center) {
self2.center = [self2.width / 2, self2.height / 2];
}
const center2 = self2.center;
if (nodes.length === 1) {
nodes[0].x = center2[0];
nodes[0].y = center2[1];
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return;
}
const linkDistance = self2.linkDistance;
let focusNode = null;
if (isString(self2.focusNode)) {
let found = false;
for (let i4 = 0; i4 < nodes.length; i4++) {
if (nodes[i4].id === self2.focusNode) {
focusNode = nodes[i4];
self2.focusNode = focusNode;
found = true;
i4 = nodes.length;
}
}
if (!found) {
focusNode = null;
}
} else {
focusNode = self2.focusNode;
}
if (!focusNode) {
focusNode = nodes[0];
self2.focusNode = focusNode;
}
const focusIndex = getIndexById(nodes, focusNode.id);
self2.focusIndex = focusIndex;
const adjMatrix3 = getAdjMatrix3({ nodes, edges }, false);
const D3 = floydWarshall5(adjMatrix3);
const maxDistance = self2.maxToFocus(D3, focusIndex);
self2.handleInfinity(D3, focusIndex, maxDistance + 1);
self2.distances = D3;
const focusNodeD = D3[focusIndex];
const width2 = self2.width || 500;
const height = self2.height || 500;
let semiWidth = width2 - center2[0] > center2[0] ? center2[0] : width2 - center2[0];
let semiHeight = height - center2[1] > center2[1] ? center2[1] : height - center2[1];
if (semiWidth === 0) {
semiWidth = width2 / 2;
}
if (semiHeight === 0) {
semiHeight = height / 2;
}
const maxRadius = semiHeight > semiWidth ? semiWidth : semiHeight;
const maxD = Math.max(...focusNodeD);
const radii = [];
focusNodeD.forEach((value2, i4) => {
if (!self2.unitRadius) {
self2.unitRadius = maxRadius / maxD;
}
radii[i4] = value2 * self2.unitRadius;
});
self2.radii = radii;
const eIdealD = self2.eIdealDisMatrix();
self2.eIdealDistances = eIdealD;
const W2 = getWeightMatrix(eIdealD);
self2.weights = W2;
const mds = new MDS({ linkDistance, distances: eIdealD });
let positions = mds.layout();
positions.forEach((p4) => {
if (isNaN4(p4[0])) {
p4[0] = Math.random() * linkDistance;
}
if (isNaN4(p4[1])) {
p4[1] = Math.random() * linkDistance;
}
});
self2.positions = positions;
positions.forEach((p4, i4) => {
nodes[i4].x = p4[0] + center2[0];
nodes[i4].y = p4[1] + center2[1];
});
positions.forEach((p4) => {
p4[0] -= positions[focusIndex][0];
p4[1] -= positions[focusIndex][1];
});
self2.run();
const preventOverlap = self2.preventOverlap;
const nodeSize = self2.nodeSize;
let nodeSizeFunc;
const strictRadial = self2.strictRadial;
if (preventOverlap) {
const nodeSpacing = self2.nodeSpacing;
let nodeSpacingFunc;
if (isNumber3(nodeSpacing)) {
nodeSpacingFunc = () => nodeSpacing;
} else if (isFunction(nodeSpacing)) {
nodeSpacingFunc = nodeSpacing;
} else {
nodeSpacingFunc = () => 0;
}
if (!nodeSize) {
nodeSizeFunc = (d3) => {
if (d3.size) {
if (isArray2(d3.size)) {
const res = d3.size[0] > d3.size[1] ? d3.size[0] : d3.size[1];
return res + nodeSpacingFunc(d3);
}
if (isObject2(d3.size)) {
const res = d3.size.width > d3.size.height ? d3.size.width : d3.size.height;
return res + nodeSpacingFunc(d3);
}
return d3.size + nodeSpacingFunc(d3);
}
return 10 + nodeSpacingFunc(d3);
};
} else if (isArray2(nodeSize)) {
nodeSizeFunc = (d3) => {
const res = nodeSize[0] > nodeSize[1] ? nodeSize[0] : nodeSize[1];
return res + nodeSpacingFunc(d3);
};
} else {
nodeSizeFunc = (d3) => nodeSize + nodeSpacingFunc(d3);
}
const nonoverlapForceParams = {
nodes,
nodeSizeFunc,
adjMatrix: adjMatrix3,
positions,
radii,
height,
width: width2,
strictRadial,
focusID: focusIndex,
iterations: self2.maxPreventOverlapIteration || 200,
k: positions.length / 4.5
};
const nonoverlapForce = new RadialNonoverlapForce(nonoverlapForceParams);
positions = nonoverlapForce.layout();
}
positions.forEach((p4, i4) => {
nodes[i4].x = p4[0] + center2[0];
nodes[i4].y = p4[1] + center2[1];
});
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return {
nodes,
edges
};
}
run() {
const self2 = this;
const maxIteration = self2.maxIteration;
const positions = self2.positions || [];
const W2 = self2.weights || [];
const eIdealDis = self2.eIdealDistances || [];
const radii = self2.radii || [];
for (let i4 = 0; i4 <= maxIteration; i4++) {
const param = i4 / maxIteration;
self2.oneIteration(param, positions, radii, eIdealDis, W2);
}
}
oneIteration(param, positions, radii, D3, W2) {
const self2 = this;
const vparam = 1 - param;
const focusIndex = self2.focusIndex;
positions.forEach((v3, i4) => {
const originDis = getEDistance(v3, [0, 0]);
const reciODis = originDis === 0 ? 0 : 1 / originDis;
if (i4 === focusIndex) {
return;
}
let xMolecule = 0;
let yMolecule = 0;
let denominator = 0;
positions.forEach((u3, j4) => {
if (i4 === j4) {
return;
}
const edis = getEDistance(v3, u3);
const reciEdis = edis === 0 ? 0 : 1 / edis;
const idealDis = D3[j4][i4];
denominator += W2[i4][j4];
xMolecule += W2[i4][j4] * (u3[0] + idealDis * (v3[0] - u3[0]) * reciEdis);
yMolecule += W2[i4][j4] * (u3[1] + idealDis * (v3[1] - u3[1]) * reciEdis);
});
const reciR = radii[i4] === 0 ? 0 : 1 / radii[i4];
denominator *= vparam;
denominator += param * reciR * reciR;
xMolecule *= vparam;
xMolecule += param * reciR * v3[0] * reciODis;
v3[0] = xMolecule / denominator;
yMolecule *= vparam;
yMolecule += param * reciR * v3[1] * reciODis;
v3[1] = yMolecule / denominator;
});
}
eIdealDisMatrix() {
const self2 = this;
const nodes = self2.nodes;
if (!nodes)
return [];
const D3 = self2.distances;
const linkDis = self2.linkDistance;
const radii = self2.radii || [];
const unitRadius = self2.unitRadius || 50;
const result = [];
if (D3) {
D3.forEach((row, i4) => {
const newRow = [];
row.forEach((v3, j4) => {
if (i4 === j4) {
newRow.push(0);
} else if (radii[i4] === radii[j4]) {
if (self2.sortBy === "data") {
newRow.push(v3 * (Math.abs(i4 - j4) * self2.sortStrength) / (radii[i4] / unitRadius));
} else if (self2.sortBy) {
let iValue = nodes[i4][self2.sortBy] || 0;
let jValue = nodes[j4][self2.sortBy] || 0;
if (isString(iValue)) {
iValue = iValue.charCodeAt(0);
}
if (isString(jValue)) {
jValue = jValue.charCodeAt(0);
}
newRow.push(v3 * (Math.abs(iValue - jValue) * self2.sortStrength) / (radii[i4] / unitRadius));
} else {
newRow.push(v3 * linkDis / (radii[i4] / unitRadius));
}
} else {
const link = (linkDis + unitRadius) / 2;
newRow.push(v3 * link);
}
});
result.push(newRow);
});
}
return result;
}
handleInfinity(matrix, focusIndex, step) {
const length5 = matrix.length;
for (let i4 = 0; i4 < length5; i4++) {
if (matrix[focusIndex][i4] === Infinity) {
matrix[focusIndex][i4] = step;
matrix[i4][focusIndex] = step;
for (let j4 = 0; j4 < length5; j4++) {
if (matrix[i4][j4] !== Infinity && matrix[focusIndex][j4] === Infinity) {
matrix[focusIndex][j4] = step + matrix[i4][j4];
matrix[j4][focusIndex] = step + matrix[i4][j4];
}
}
}
}
for (let i4 = 0; i4 < length5; i4++) {
if (i4 === focusIndex) {
continue;
}
for (let j4 = 0; j4 < length5; j4++) {
if (matrix[i4][j4] === Infinity) {
let minus = Math.abs(matrix[focusIndex][i4] - matrix[focusIndex][j4]);
minus = minus === 0 ? 1 : minus;
matrix[i4][j4] = minus;
}
}
}
}
maxToFocus(matrix, focusIndex) {
let max8 = 0;
for (let i4 = 0; i4 < matrix[focusIndex].length; i4++) {
if (matrix[focusIndex][i4] === Infinity) {
continue;
}
max8 = matrix[focusIndex][i4] > max8 ? matrix[focusIndex][i4] : max8;
}
return max8;
}
getType() {
return "radial";
}
};
// node_modules/@antv/layout/es/layout/concentric.js
var ConcentricLayout = class extends Base3 {
constructor(options) {
super();
this.nodeSize = 30;
this.minNodeSpacing = 10;
this.preventOverlap = false;
this.equidistant = false;
this.startAngle = 3 / 2 * Math.PI;
this.clockwise = true;
this.sortBy = "degree";
this.nodes = [];
this.edges = [];
this.width = 300;
this.height = 300;
this.onLayoutEnd = () => {
};
this.updateCfg(options);
}
getDefaultCfg() {
return {
nodeSize: 30,
minNodeSpacing: 10,
preventOverlap: false,
sweep: void 0,
equidistant: false,
startAngle: 3 / 2 * Math.PI,
clockwise: true,
maxLevelDiff: void 0,
sortBy: "degree"
};
}
execute() {
const self2 = this;
const nodes = self2.nodes;
const edges = self2.edges;
const n3 = nodes.length;
if (n3 === 0) {
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return;
}
if (!self2.width && typeof window !== "undefined") {
self2.width = window.innerWidth;
}
if (!self2.height && typeof window !== "undefined") {
self2.height = window.innerHeight;
}
if (!self2.center) {
self2.center = [self2.width / 2, self2.height / 2];
}
const center2 = self2.center;
if (n3 === 1) {
nodes[0].x = center2[0];
nodes[0].y = center2[1];
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return;
}
const layoutNodes2 = [];
let maxNodeSize;
if (isArray2(self2.nodeSize)) {
maxNodeSize = Math.max(self2.nodeSize[0], self2.nodeSize[1]);
} else {
maxNodeSize = self2.nodeSize;
}
nodes.forEach((node) => {
layoutNodes2.push(node);
let nodeSize = maxNodeSize;
if (isArray2(node.size)) {
nodeSize = Math.max(node.size[0], node.size[1]);
} else if (isNumber3(node.size)) {
nodeSize = node.size;
} else if (isObject2(node.size)) {
nodeSize = Math.max(node.size.width, node.size.height);
}
maxNodeSize = Math.max(maxNodeSize, nodeSize);
});
self2.clockwise = self2.counterclockwise !== void 0 ? !self2.counterclockwise : self2.clockwise;
const nodeMap = {};
const indexMap = {};
layoutNodes2.forEach((node, i4) => {
nodeMap[node.id] = node;
indexMap[node.id] = i4;
});
if (self2.sortBy === "degree" || !isString(self2.sortBy) || layoutNodes2[0][self2.sortBy] === void 0) {
self2.sortBy = "degree";
if (!isNumber3(nodes[0].degree)) {
const values2 = getDegree3(nodes.length, indexMap, edges);
layoutNodes2.forEach((node, i4) => {
node.degree = values2[i4];
});
}
}
layoutNodes2.sort((n1, n22) => n22[self2.sortBy] - n1[self2.sortBy]);
self2.maxValueNode = layoutNodes2[0];
self2.maxLevelDiff = self2.maxLevelDiff || self2.maxValueNode[self2.sortBy] / 4;
const levels = [[]];
let currentLevel = levels[0];
layoutNodes2.forEach((node) => {
if (currentLevel.length > 0) {
const diff2 = Math.abs(currentLevel[0][self2.sortBy] - node[self2.sortBy]);
if (self2.maxLevelDiff && diff2 >= self2.maxLevelDiff) {
currentLevel = [];
levels.push(currentLevel);
}
}
currentLevel.push(node);
});
let minDist = maxNodeSize + self2.minNodeSpacing;
if (!self2.preventOverlap) {
const firstLvlHasMulti = levels.length > 0 && levels[0].length > 1;
const maxR = Math.min(self2.width, self2.height) / 2 - minDist;
const rStep = maxR / (levels.length + (firstLvlHasMulti ? 1 : 0));
minDist = Math.min(minDist, rStep);
}
let r4 = 0;
levels.forEach((level) => {
let sweep = self2.sweep;
if (sweep === void 0) {
sweep = 2 * Math.PI - 2 * Math.PI / level.length;
}
const dTheta = level.dTheta = sweep / Math.max(1, level.length - 1);
if (level.length > 1 && self2.preventOverlap) {
const dcos = Math.cos(dTheta) - Math.cos(0);
const dsin = Math.sin(dTheta) - Math.sin(0);
const rMin = Math.sqrt(minDist * minDist / (dcos * dcos + dsin * dsin));
r4 = Math.max(rMin, r4);
}
level.r = r4;
r4 += minDist;
});
if (self2.equidistant) {
let rDeltaMax = 0;
let rr = 0;
for (let i4 = 0; i4 < levels.length; i4++) {
const level = levels[i4];
const rDelta = level.r - rr;
rDeltaMax = Math.max(rDeltaMax, rDelta);
}
rr = 0;
levels.forEach((level, i4) => {
if (i4 === 0) {
rr = level.r;
}
level.r = rr;
rr += rDeltaMax;
});
}
levels.forEach((level) => {
const dTheta = level.dTheta;
const rr = level.r;
level.forEach((node, j4) => {
const theta = self2.startAngle + (self2.clockwise ? 1 : -1) * dTheta * j4;
node.x = center2[0] + rr * Math.cos(theta);
node.y = center2[1] + rr * Math.sin(theta);
});
});
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return {
nodes,
edges
};
}
getType() {
return "concentric";
}
};
// node_modules/@antv/layout/es/layout/mds.js
var MDSLayout = class extends Base3 {
constructor(options) {
super();
this.center = [0, 0];
this.linkDistance = 50;
this.nodes = [];
this.edges = [];
this.onLayoutEnd = () => {
};
this.updateCfg(options);
}
getDefaultCfg() {
return {
center: [0, 0],
linkDistance: 50
};
}
execute() {
const self2 = this;
const { nodes, edges = [] } = self2;
const center2 = self2.center;
if (!nodes || nodes.length === 0) {
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return;
}
if (nodes.length === 1) {
nodes[0].x = center2[0];
nodes[0].y = center2[1];
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return;
}
const linkDistance = self2.linkDistance;
const adjMatrix3 = getAdjMatrix3({ nodes, edges }, false);
const distances = floydWarshall5(adjMatrix3);
self2.handleInfinity(distances);
const scaledD = scaleMatrix3(distances, linkDistance);
self2.scaledDistances = scaledD;
const positions = self2.runMDS();
self2.positions = positions;
positions.forEach((p4, i4) => {
nodes[i4].x = p4[0] + center2[0];
nodes[i4].y = p4[1] + center2[1];
});
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return {
nodes,
edges
};
}
runMDS() {
const self2 = this;
const dimension = 2;
const distances = self2.scaledDistances;
const M3 = Matrix2.mul(Matrix2.pow(distances, 2), -0.5);
const rowMeans = M3.mean("row");
const colMeans = M3.mean("column");
const totalMean = M3.mean();
M3.add(totalMean).subRowVector(rowMeans).subColumnVector(colMeans);
const ret = new SingularValueDecomposition(M3);
const eigenValues = Matrix2.sqrt(ret.diagonalMatrix).diagonal();
return ret.leftSingularVectors.toJSON().map((row) => {
return Matrix2.mul([row], [eigenValues]).toJSON()[0].splice(0, dimension);
});
}
handleInfinity(distances) {
let maxDistance = -999999;
distances.forEach((row) => {
row.forEach((value2) => {
if (value2 === Infinity) {
return;
}
if (maxDistance < value2) {
maxDistance = value2;
}
});
});
distances.forEach((row, i4) => {
row.forEach((value2, j4) => {
if (value2 === Infinity) {
distances[i4][j4] = maxDistance;
}
});
});
}
getType() {
return "mds";
}
};
// node_modules/@antv/layout/es/layout/fruchterman.js
var SPEED_DIVISOR2 = 800;
var FruchtermanLayout = class extends Base3 {
constructor(options) {
super();
this.maxIteration = 1e3;
this.workerEnabled = false;
this.gravity = 10;
this.speed = 5;
this.clustering = false;
this.clusterGravity = 10;
this.nodes = [];
this.edges = [];
this.width = 300;
this.height = 300;
this.nodeMap = {};
this.nodeIdxMap = {};
this.onLayoutEnd = () => {
};
this.tick = () => {
};
this.updateCfg(options);
}
getDefaultCfg() {
return {
maxIteration: 1e3,
gravity: 10,
speed: 1,
clustering: false,
clusterGravity: 10
};
}
execute() {
var _a6, _b;
const self2 = this;
const nodes = self2.nodes;
if (self2.timeInterval !== void 0 && typeof window !== "undefined") {
window.clearInterval(self2.timeInterval);
}
if (!nodes || nodes.length === 0) {
(_a6 = self2.onLayoutEnd) === null || _a6 === void 0 ? void 0 : _a6.call(self2);
return;
}
if (!self2.width && typeof window !== "undefined") {
self2.width = window.innerWidth;
}
if (!self2.height && typeof window !== "undefined") {
self2.height = window.innerHeight;
}
if (!self2.center) {
self2.center = [self2.width / 2, self2.height / 2];
}
const center2 = self2.center;
if (nodes.length === 1) {
nodes[0].x = center2[0];
nodes[0].y = center2[1];
(_b = self2.onLayoutEnd) === null || _b === void 0 ? void 0 : _b.call(self2);
return;
}
const nodeMap = {};
const nodeIdxMap = {};
nodes.forEach((node, i4) => {
if (!isNumber3(node.x))
node.x = Math.random() * this.width;
if (!isNumber3(node.y))
node.y = Math.random() * this.height;
nodeMap[node.id] = node;
nodeIdxMap[node.id] = i4;
});
self2.nodeMap = nodeMap;
self2.nodeIdxMap = nodeIdxMap;
return self2.run();
}
run() {
var _a6;
const self2 = this;
const nodes = self2.nodes;
if (!nodes)
return;
const { edges, maxIteration, workerEnabled, clustering } = self2;
const clusterMap = {};
if (clustering) {
nodes.forEach((n3) => {
if (clusterMap[n3.cluster] === void 0) {
clusterMap[n3.cluster] = {
name: n3.cluster,
cx: 0,
cy: 0,
count: 0
};
}
});
}
if (workerEnabled) {
for (let i4 = 0; i4 < maxIteration; i4++) {
self2.runOneStep(clusterMap);
}
(_a6 = self2.onLayoutEnd) === null || _a6 === void 0 ? void 0 : _a6.call(self2);
} else {
if (typeof window === "undefined")
return;
let iter = 0;
this.timeInterval = window.setInterval(() => {
var _a7;
self2.runOneStep(clusterMap);
iter++;
if (iter >= maxIteration) {
(_a7 = self2.onLayoutEnd) === null || _a7 === void 0 ? void 0 : _a7.call(self2);
window.clearInterval(self2.timeInterval);
}
}, 0);
}
return {
nodes,
edges
};
}
runOneStep(clusterMap) {
var _a6;
const self2 = this;
const nodes = self2.nodes;
if (!nodes)
return;
const { edges, center: center2, gravity, speed, clustering } = self2;
const area2 = self2.height * self2.width;
const maxDisplace = Math.sqrt(area2) / 10;
const k22 = area2 / (nodes.length + 1);
const k4 = Math.sqrt(k22);
const displacements = [];
nodes.forEach((_8, j4) => {
displacements[j4] = { x: 0, y: 0 };
});
self2.applyCalculate(nodes, edges, displacements, k4, k22);
if (clustering) {
for (const key in clusterMap) {
clusterMap[key].cx = 0;
clusterMap[key].cy = 0;
clusterMap[key].count = 0;
}
nodes.forEach((n3) => {
const c5 = clusterMap[n3.cluster];
if (isNumber3(n3.x)) {
c5.cx += n3.x;
}
if (isNumber3(n3.y)) {
c5.cy += n3.y;
}
c5.count++;
});
for (const key in clusterMap) {
clusterMap[key].cx /= clusterMap[key].count;
clusterMap[key].cy /= clusterMap[key].count;
}
const clusterGravity = self2.clusterGravity || gravity;
nodes.forEach((n3, j4) => {
if (!isNumber3(n3.x) || !isNumber3(n3.y))
return;
const c5 = clusterMap[n3.cluster];
const distLength = Math.sqrt((n3.x - c5.cx) * (n3.x - c5.cx) + (n3.y - c5.cy) * (n3.y - c5.cy));
const gravityForce = k4 * clusterGravity;
displacements[j4].x -= gravityForce * (n3.x - c5.cx) / distLength;
displacements[j4].y -= gravityForce * (n3.y - c5.cy) / distLength;
});
}
nodes.forEach((n3, j4) => {
if (!isNumber3(n3.x) || !isNumber3(n3.y))
return;
const gravityForce = 0.01 * k4 * gravity;
displacements[j4].x -= gravityForce * (n3.x - center2[0]);
displacements[j4].y -= gravityForce * (n3.y - center2[1]);
});
nodes.forEach((n3, j4) => {
if (isNumber3(n3.fx) && isNumber3(n3.fy)) {
n3.x = n3.fx;
n3.y = n3.fy;
return;
}
if (!isNumber3(n3.x) || !isNumber3(n3.y))
return;
const distLength = Math.sqrt(displacements[j4].x * displacements[j4].x + displacements[j4].y * displacements[j4].y);
if (distLength > 0) {
const limitedDist = Math.min(maxDisplace * (speed / SPEED_DIVISOR2), distLength);
n3.x += displacements[j4].x / distLength * limitedDist;
n3.y += displacements[j4].y / distLength * limitedDist;
}
});
(_a6 = self2.tick) === null || _a6 === void 0 ? void 0 : _a6.call(self2);
}
applyCalculate(nodes, edges, displacements, k4, k22) {
const self2 = this;
self2.calRepulsive(nodes, displacements, k22);
if (edges)
self2.calAttractive(edges, displacements, k4);
}
calRepulsive(nodes, displacements, k22) {
nodes.forEach((v3, i4) => {
displacements[i4] = { x: 0, y: 0 };
nodes.forEach((u3, j4) => {
if (i4 === j4) {
return;
}
if (!isNumber3(v3.x) || !isNumber3(u3.x) || !isNumber3(v3.y) || !isNumber3(u3.y)) {
return;
}
let vecX = v3.x - u3.x;
let vecY = v3.y - u3.y;
let vecLengthSqr = vecX * vecX + vecY * vecY;
if (vecLengthSqr === 0) {
vecLengthSqr = 1;
const sign = i4 > j4 ? 1 : -1;
vecX = 0.01 * sign;
vecY = 0.01 * sign;
}
const common2 = k22 / vecLengthSqr;
displacements[i4].x += vecX * common2;
displacements[i4].y += vecY * common2;
});
});
}
calAttractive(edges, displacements, k4) {
edges.forEach((e4) => {
const source = getEdgeTerminal(e4, "source");
const target = getEdgeTerminal(e4, "target");
if (!source || !target)
return;
const uIndex = this.nodeIdxMap[source];
const vIndex = this.nodeIdxMap[target];
if (uIndex === vIndex) {
return;
}
const u3 = this.nodeMap[source];
const v3 = this.nodeMap[target];
if (!isNumber3(v3.x) || !isNumber3(u3.x) || !isNumber3(v3.y) || !isNumber3(u3.y)) {
return;
}
const vecX = v3.x - u3.x;
const vecY = v3.y - u3.y;
const vecLength = Math.sqrt(vecX * vecX + vecY * vecY);
const common2 = vecLength * vecLength / k4;
displacements[vIndex].x -= vecX / vecLength * common2;
displacements[vIndex].y -= vecY / vecLength * common2;
displacements[uIndex].x += vecX / vecLength * common2;
displacements[uIndex].y += vecY / vecLength * common2;
});
}
stop() {
if (this.timeInterval && typeof window !== "undefined") {
window.clearInterval(this.timeInterval);
}
}
destroy() {
const self2 = this;
self2.stop();
self2.tick = null;
self2.nodes = null;
self2.edges = null;
self2.destroyed = true;
}
getType() {
return "fruchterman";
}
};
// node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js
function _initializerDefineProperty(target, property, descriptor, context) {
if (!descriptor)
return;
Object.defineProperty(target, property, {
enumerable: descriptor.enumerable,
configurable: descriptor.configurable,
writable: descriptor.writable,
value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
});
}
// node_modules/@babel/runtime/helpers/esm/classCallCheck.js
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
// node_modules/@babel/runtime/helpers/esm/createClass.js
function _defineProperties(target, props) {
for (var i4 = 0; i4 < props.length; i4++) {
var descriptor = props[i4];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor)
descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps)
_defineProperties(Constructor.prototype, protoProps);
if (staticProps)
_defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
// node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
var desc = {};
Object.keys(descriptor).forEach(function(key) {
desc[key] = descriptor[key];
});
desc.enumerable = !!desc.enumerable;
desc.configurable = !!desc.configurable;
if ("value" in desc || desc.initializer) {
desc.writable = true;
}
desc = decorators.slice().reverse().reduce(function(desc2, decorator) {
return decorator(target, property, desc2) || desc2;
}, desc);
if (context && desc.initializer !== void 0) {
desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
desc.initializer = void 0;
}
if (desc.initializer === void 0) {
Object.defineProperty(target, property, desc);
desc = null;
}
return desc;
}
// node_modules/reflect-metadata/Reflect.js
var Reflect2;
(function(Reflect3) {
(function(factory) {
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : Function("return this;")();
var exporter = makeExporter(Reflect3);
if (typeof root.Reflect === "undefined") {
root.Reflect = Reflect3;
} else {
exporter = makeExporter(root.Reflect, exporter);
}
factory(exporter);
function makeExporter(target, previous) {
return function(key, value2) {
if (typeof target[key] !== "function") {
Object.defineProperty(target, key, { configurable: true, writable: true, value: value2 });
}
if (previous)
previous(key, value2);
};
}
})(function(exporter) {
var hasOwn = Object.prototype.hasOwnProperty;
var supportsSymbol = typeof Symbol === "function";
var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== "undefined" ? Symbol.toPrimitive : "@@toPrimitive";
var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== "undefined" ? Symbol.iterator : "@@iterator";
var supportsCreate = typeof Object.create === "function";
var supportsProto = { __proto__: [] } instanceof Array;
var downLevel = !supportsCreate && !supportsProto;
var HashMap = {
create: supportsCreate ? function() {
return MakeDictionary(Object.create(null));
} : supportsProto ? function() {
return MakeDictionary({ __proto__: null });
} : function() {
return MakeDictionary({});
},
has: downLevel ? function(map6, key) {
return hasOwn.call(map6, key);
} : function(map6, key) {
return key in map6;
},
get: downLevel ? function(map6, key) {
return hasOwn.call(map6, key) ? map6[key] : void 0;
} : function(map6, key) {
return map6[key];
}
};
var functionPrototype = Object.getPrototypeOf(Function);
var usePolyfill = typeof process === "object" && process.env && process.env["REFLECT_METADATA_USE_MAP_POLYFILL"] === "true";
var _Map = !usePolyfill && typeof Map === "function" && typeof Map.prototype.entries === "function" ? Map : CreateMapPolyfill();
var _Set = !usePolyfill && typeof Set === "function" && typeof Set.prototype.entries === "function" ? Set : CreateSetPolyfill();
var _WeakMap = !usePolyfill && typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill();
var Metadata = new _WeakMap();
function decorate(decorators, target, propertyKey, attributes) {
if (!IsUndefined(propertyKey)) {
if (!IsArray(decorators))
throw new TypeError();
if (!IsObject(target))
throw new TypeError();
if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes))
throw new TypeError();
if (IsNull(attributes))
attributes = void 0;
propertyKey = ToPropertyKey(propertyKey);
return DecorateProperty(decorators, target, propertyKey, attributes);
} else {
if (!IsArray(decorators))
throw new TypeError();
if (!IsConstructor(target))
throw new TypeError();
return DecorateConstructor(decorators, target);
}
}
exporter("decorate", decorate);
function metadata(metadataKey, metadataValue) {
function decorator(target, propertyKey) {
if (!IsObject(target))
throw new TypeError();
if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey))
throw new TypeError();
OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
}
return decorator;
}
exporter("metadata", metadata);
function defineMetadata(metadataKey, metadataValue, target, propertyKey) {
if (!IsObject(target))
throw new TypeError();
if (!IsUndefined(propertyKey))
propertyKey = ToPropertyKey(propertyKey);
return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
}
exporter("defineMetadata", defineMetadata);
function hasMetadata(metadataKey, target, propertyKey) {
if (!IsObject(target))
throw new TypeError();
if (!IsUndefined(propertyKey))
propertyKey = ToPropertyKey(propertyKey);
return OrdinaryHasMetadata(metadataKey, target, propertyKey);
}
exporter("hasMetadata", hasMetadata);
function hasOwnMetadata(metadataKey, target, propertyKey) {
if (!IsObject(target))
throw new TypeError();
if (!IsUndefined(propertyKey))
propertyKey = ToPropertyKey(propertyKey);
return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);
}
exporter("hasOwnMetadata", hasOwnMetadata);
function getMetadata(metadataKey, target, propertyKey) {
if (!IsObject(target))
throw new TypeError();
if (!IsUndefined(propertyKey))
propertyKey = ToPropertyKey(propertyKey);
return OrdinaryGetMetadata(metadataKey, target, propertyKey);
}
exporter("getMetadata", getMetadata);
function getOwnMetadata(metadataKey, target, propertyKey) {
if (!IsObject(target))
throw new TypeError();
if (!IsUndefined(propertyKey))
propertyKey = ToPropertyKey(propertyKey);
return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey);
}
exporter("getOwnMetadata", getOwnMetadata);
function getMetadataKeys(target, propertyKey) {
if (!IsObject(target))
throw new TypeError();
if (!IsUndefined(propertyKey))
propertyKey = ToPropertyKey(propertyKey);
return OrdinaryMetadataKeys(target, propertyKey);
}
exporter("getMetadataKeys", getMetadataKeys);
function getOwnMetadataKeys(target, propertyKey) {
if (!IsObject(target))
throw new TypeError();
if (!IsUndefined(propertyKey))
propertyKey = ToPropertyKey(propertyKey);
return OrdinaryOwnMetadataKeys(target, propertyKey);
}
exporter("getOwnMetadataKeys", getOwnMetadataKeys);
function deleteMetadata(metadataKey, target, propertyKey) {
if (!IsObject(target))
throw new TypeError();
if (!IsUndefined(propertyKey))
propertyKey = ToPropertyKey(propertyKey);
var metadataMap = GetOrCreateMetadataMap(target, propertyKey, false);
if (IsUndefined(metadataMap))
return false;
if (!metadataMap.delete(metadataKey))
return false;
if (metadataMap.size > 0)
return true;
var targetMetadata = Metadata.get(target);
targetMetadata.delete(propertyKey);
if (targetMetadata.size > 0)
return true;
Metadata.delete(target);
return true;
}
exporter("deleteMetadata", deleteMetadata);
function DecorateConstructor(decorators, target) {
for (var i4 = decorators.length - 1; i4 >= 0; --i4) {
var decorator = decorators[i4];
var decorated = decorator(target);
if (!IsUndefined(decorated) && !IsNull(decorated)) {
if (!IsConstructor(decorated))
throw new TypeError();
target = decorated;
}
}
return target;
}
function DecorateProperty(decorators, target, propertyKey, descriptor) {
for (var i4 = decorators.length - 1; i4 >= 0; --i4) {
var decorator = decorators[i4];
var decorated = decorator(target, propertyKey, descriptor);
if (!IsUndefined(decorated) && !IsNull(decorated)) {
if (!IsObject(decorated))
throw new TypeError();
descriptor = decorated;
}
}
return descriptor;
}
function GetOrCreateMetadataMap(O3, P4, Create) {
var targetMetadata = Metadata.get(O3);
if (IsUndefined(targetMetadata)) {
if (!Create)
return void 0;
targetMetadata = new _Map();
Metadata.set(O3, targetMetadata);
}
var metadataMap = targetMetadata.get(P4);
if (IsUndefined(metadataMap)) {
if (!Create)
return void 0;
metadataMap = new _Map();
targetMetadata.set(P4, metadataMap);
}
return metadataMap;
}
function OrdinaryHasMetadata(MetadataKey, O3, P4) {
var hasOwn2 = OrdinaryHasOwnMetadata(MetadataKey, O3, P4);
if (hasOwn2)
return true;
var parent = OrdinaryGetPrototypeOf(O3);
if (!IsNull(parent))
return OrdinaryHasMetadata(MetadataKey, parent, P4);
return false;
}
function OrdinaryHasOwnMetadata(MetadataKey, O3, P4) {
var metadataMap = GetOrCreateMetadataMap(O3, P4, false);
if (IsUndefined(metadataMap))
return false;
return ToBoolean(metadataMap.has(MetadataKey));
}
function OrdinaryGetMetadata(MetadataKey, O3, P4) {
var hasOwn2 = OrdinaryHasOwnMetadata(MetadataKey, O3, P4);
if (hasOwn2)
return OrdinaryGetOwnMetadata(MetadataKey, O3, P4);
var parent = OrdinaryGetPrototypeOf(O3);
if (!IsNull(parent))
return OrdinaryGetMetadata(MetadataKey, parent, P4);
return void 0;
}
function OrdinaryGetOwnMetadata(MetadataKey, O3, P4) {
var metadataMap = GetOrCreateMetadataMap(O3, P4, false);
if (IsUndefined(metadataMap))
return void 0;
return metadataMap.get(MetadataKey);
}
function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O3, P4) {
var metadataMap = GetOrCreateMetadataMap(O3, P4, true);
metadataMap.set(MetadataKey, MetadataValue);
}
function OrdinaryMetadataKeys(O3, P4) {
var ownKeys12 = OrdinaryOwnMetadataKeys(O3, P4);
var parent = OrdinaryGetPrototypeOf(O3);
if (parent === null)
return ownKeys12;
var parentKeys = OrdinaryMetadataKeys(parent, P4);
if (parentKeys.length <= 0)
return ownKeys12;
if (ownKeys12.length <= 0)
return parentKeys;
var set10 = new _Set();
var keys2 = [];
for (var _i = 0, ownKeys_1 = ownKeys12; _i < ownKeys_1.length; _i++) {
var key = ownKeys_1[_i];
var hasKey = set10.has(key);
if (!hasKey) {
set10.add(key);
keys2.push(key);
}
}
for (var _a6 = 0, parentKeys_1 = parentKeys; _a6 < parentKeys_1.length; _a6++) {
var key = parentKeys_1[_a6];
var hasKey = set10.has(key);
if (!hasKey) {
set10.add(key);
keys2.push(key);
}
}
return keys2;
}
function OrdinaryOwnMetadataKeys(O3, P4) {
var keys2 = [];
var metadataMap = GetOrCreateMetadataMap(O3, P4, false);
if (IsUndefined(metadataMap))
return keys2;
var keysObj = metadataMap.keys();
var iterator = GetIterator(keysObj);
var k4 = 0;
while (true) {
var next = IteratorStep(iterator);
if (!next) {
keys2.length = k4;
return keys2;
}
var nextValue = IteratorValue(next);
try {
keys2[k4] = nextValue;
} catch (e4) {
try {
IteratorClose(iterator);
} finally {
throw e4;
}
}
k4++;
}
}
function Type2(x6) {
if (x6 === null)
return 1;
switch (typeof x6) {
case "undefined":
return 0;
case "boolean":
return 2;
case "string":
return 3;
case "symbol":
return 4;
case "number":
return 5;
case "object":
return x6 === null ? 1 : 6;
default:
return 6;
}
}
function IsUndefined(x6) {
return x6 === void 0;
}
function IsNull(x6) {
return x6 === null;
}
function IsSymbol(x6) {
return typeof x6 === "symbol";
}
function IsObject(x6) {
return typeof x6 === "object" ? x6 !== null : typeof x6 === "function";
}
function ToPrimitive(input, PreferredType) {
switch (Type2(input)) {
case 0:
return input;
case 1:
return input;
case 2:
return input;
case 3:
return input;
case 4:
return input;
case 5:
return input;
}
var hint = PreferredType === 3 ? "string" : PreferredType === 5 ? "number" : "default";
var exoticToPrim = GetMethod(input, toPrimitiveSymbol);
if (exoticToPrim !== void 0) {
var result = exoticToPrim.call(input, hint);
if (IsObject(result))
throw new TypeError();
return result;
}
return OrdinaryToPrimitive(input, hint === "default" ? "number" : hint);
}
function OrdinaryToPrimitive(O3, hint) {
if (hint === "string") {
var toString_1 = O3.toString;
if (IsCallable(toString_1)) {
var result = toString_1.call(O3);
if (!IsObject(result))
return result;
}
var valueOf = O3.valueOf;
if (IsCallable(valueOf)) {
var result = valueOf.call(O3);
if (!IsObject(result))
return result;
}
} else {
var valueOf = O3.valueOf;
if (IsCallable(valueOf)) {
var result = valueOf.call(O3);
if (!IsObject(result))
return result;
}
var toString_2 = O3.toString;
if (IsCallable(toString_2)) {
var result = toString_2.call(O3);
if (!IsObject(result))
return result;
}
}
throw new TypeError();
}
function ToBoolean(argument) {
return !!argument;
}
function ToString(argument) {
return "" + argument;
}
function ToPropertyKey(argument) {
var key = ToPrimitive(argument, 3);
if (IsSymbol(key))
return key;
return ToString(key);
}
function IsArray(argument) {
return Array.isArray ? Array.isArray(argument) : argument instanceof Object ? argument instanceof Array : Object.prototype.toString.call(argument) === "[object Array]";
}
function IsCallable(argument) {
return typeof argument === "function";
}
function IsConstructor(argument) {
return typeof argument === "function";
}
function IsPropertyKey(argument) {
switch (Type2(argument)) {
case 3:
return true;
case 4:
return true;
default:
return false;
}
}
function GetMethod(V2, P4) {
var func = V2[P4];
if (func === void 0 || func === null)
return void 0;
if (!IsCallable(func))
throw new TypeError();
return func;
}
function GetIterator(obj) {
var method = GetMethod(obj, iteratorSymbol);
if (!IsCallable(method))
throw new TypeError();
var iterator = method.call(obj);
if (!IsObject(iterator))
throw new TypeError();
return iterator;
}
function IteratorValue(iterResult) {
return iterResult.value;
}
function IteratorStep(iterator) {
var result = iterator.next();
return result.done ? false : result;
}
function IteratorClose(iterator) {
var f3 = iterator["return"];
if (f3)
f3.call(iterator);
}
function OrdinaryGetPrototypeOf(O3) {
var proto = Object.getPrototypeOf(O3);
if (typeof O3 !== "function" || O3 === functionPrototype)
return proto;
if (proto !== functionPrototype)
return proto;
var prototype = O3.prototype;
var prototypeProto = prototype && Object.getPrototypeOf(prototype);
if (prototypeProto == null || prototypeProto === Object.prototype)
return proto;
var constructor = prototypeProto.constructor;
if (typeof constructor !== "function")
return proto;
if (constructor === O3)
return proto;
return constructor;
}
function CreateMapPolyfill() {
var cacheSentinel = {};
var arraySentinel = [];
var MapIterator = function() {
function MapIterator2(keys2, values2, selector) {
this._index = 0;
this._keys = keys2;
this._values = values2;
this._selector = selector;
}
MapIterator2.prototype["@@iterator"] = function() {
return this;
};
MapIterator2.prototype[iteratorSymbol] = function() {
return this;
};
MapIterator2.prototype.next = function() {
var index2 = this._index;
if (index2 >= 0 && index2 < this._keys.length) {
var result = this._selector(this._keys[index2], this._values[index2]);
if (index2 + 1 >= this._keys.length) {
this._index = -1;
this._keys = arraySentinel;
this._values = arraySentinel;
} else {
this._index++;
}
return { value: result, done: false };
}
return { value: void 0, done: true };
};
MapIterator2.prototype.throw = function(error) {
if (this._index >= 0) {
this._index = -1;
this._keys = arraySentinel;
this._values = arraySentinel;
}
throw error;
};
MapIterator2.prototype.return = function(value2) {
if (this._index >= 0) {
this._index = -1;
this._keys = arraySentinel;
this._values = arraySentinel;
}
return { value: value2, done: true };
};
return MapIterator2;
}();
return function() {
function Map2() {
this._keys = [];
this._values = [];
this._cacheKey = cacheSentinel;
this._cacheIndex = -2;
}
Object.defineProperty(Map2.prototype, "size", {
get: function() {
return this._keys.length;
},
enumerable: true,
configurable: true
});
Map2.prototype.has = function(key) {
return this._find(key, false) >= 0;
};
Map2.prototype.get = function(key) {
var index2 = this._find(key, false);
return index2 >= 0 ? this._values[index2] : void 0;
};
Map2.prototype.set = function(key, value2) {
var index2 = this._find(key, true);
this._values[index2] = value2;
return this;
};
Map2.prototype.delete = function(key) {
var index2 = this._find(key, false);
if (index2 >= 0) {
var size2 = this._keys.length;
for (var i4 = index2 + 1; i4 < size2; i4++) {
this._keys[i4 - 1] = this._keys[i4];
this._values[i4 - 1] = this._values[i4];
}
this._keys.length--;
this._values.length--;
if (key === this._cacheKey) {
this._cacheKey = cacheSentinel;
this._cacheIndex = -2;
}
return true;
}
return false;
};
Map2.prototype.clear = function() {
this._keys.length = 0;
this._values.length = 0;
this._cacheKey = cacheSentinel;
this._cacheIndex = -2;
};
Map2.prototype.keys = function() {
return new MapIterator(this._keys, this._values, getKey);
};
Map2.prototype.values = function() {
return new MapIterator(this._keys, this._values, getValue3);
};
Map2.prototype.entries = function() {
return new MapIterator(this._keys, this._values, getEntry);
};
Map2.prototype["@@iterator"] = function() {
return this.entries();
};
Map2.prototype[iteratorSymbol] = function() {
return this.entries();
};
Map2.prototype._find = function(key, insert) {
if (this._cacheKey !== key) {
this._cacheIndex = this._keys.indexOf(this._cacheKey = key);
}
if (this._cacheIndex < 0 && insert) {
this._cacheIndex = this._keys.length;
this._keys.push(key);
this._values.push(void 0);
}
return this._cacheIndex;
};
return Map2;
}();
function getKey(key, _8) {
return key;
}
function getValue3(_8, value2) {
return value2;
}
function getEntry(key, value2) {
return [key, value2];
}
}
function CreateSetPolyfill() {
return function() {
function Set2() {
this._map = new _Map();
}
Object.defineProperty(Set2.prototype, "size", {
get: function() {
return this._map.size;
},
enumerable: true,
configurable: true
});
Set2.prototype.has = function(value2) {
return this._map.has(value2);
};
Set2.prototype.add = function(value2) {
return this._map.set(value2, value2), this;
};
Set2.prototype.delete = function(value2) {
return this._map.delete(value2);
};
Set2.prototype.clear = function() {
this._map.clear();
};
Set2.prototype.keys = function() {
return this._map.keys();
};
Set2.prototype.values = function() {
return this._map.values();
};
Set2.prototype.entries = function() {
return this._map.entries();
};
Set2.prototype["@@iterator"] = function() {
return this.keys();
};
Set2.prototype[iteratorSymbol] = function() {
return this.keys();
};
return Set2;
}();
}
function CreateWeakMapPolyfill() {
var UUID_SIZE = 16;
var keys2 = HashMap.create();
var rootKey = CreateUniqueKey();
return function() {
function WeakMap2() {
this._key = CreateUniqueKey();
}
WeakMap2.prototype.has = function(target) {
var table = GetOrCreateWeakMapTable(target, false);
return table !== void 0 ? HashMap.has(table, this._key) : false;
};
WeakMap2.prototype.get = function(target) {
var table = GetOrCreateWeakMapTable(target, false);
return table !== void 0 ? HashMap.get(table, this._key) : void 0;
};
WeakMap2.prototype.set = function(target, value2) {
var table = GetOrCreateWeakMapTable(target, true);
table[this._key] = value2;
return this;
};
WeakMap2.prototype.delete = function(target) {
var table = GetOrCreateWeakMapTable(target, false);
return table !== void 0 ? delete table[this._key] : false;
};
WeakMap2.prototype.clear = function() {
this._key = CreateUniqueKey();
};
return WeakMap2;
}();
function CreateUniqueKey() {
var key;
do
key = "@@WeakMap@@" + CreateUUID();
while (HashMap.has(keys2, key));
keys2[key] = true;
return key;
}
function GetOrCreateWeakMapTable(target, create8) {
if (!hasOwn.call(target, rootKey)) {
if (!create8)
return void 0;
Object.defineProperty(target, rootKey, { value: HashMap.create() });
}
return target[rootKey];
}
function FillRandomBytes(buffer, size2) {
for (var i4 = 0; i4 < size2; ++i4)
buffer[i4] = Math.random() * 255 | 0;
return buffer;
}
function GenRandomBytes(size2) {
if (typeof Uint8Array === "function") {
if (typeof crypto !== "undefined")
return crypto.getRandomValues(new Uint8Array(size2));
if (typeof msCrypto !== "undefined")
return msCrypto.getRandomValues(new Uint8Array(size2));
return FillRandomBytes(new Uint8Array(size2), size2);
}
return FillRandomBytes(new Array(size2), size2);
}
function CreateUUID() {
var data3 = GenRandomBytes(UUID_SIZE);
data3[6] = data3[6] & 79 | 64;
data3[8] = data3[8] & 191 | 128;
var result = "";
for (var offset = 0; offset < UUID_SIZE; ++offset) {
var byte = data3[offset];
if (offset === 4 || offset === 6 || offset === 8)
result += "-";
if (byte < 16)
result += "0";
result += byte.toString(16).toLowerCase();
}
return result;
}
}
function MakeDictionary(obj) {
obj.__ = void 0;
delete obj.__;
return obj;
}
});
})(Reflect2 || (Reflect2 = {}));
// node_modules/@antv/g-webgpu-core/es/ComponentManager.js
var import_regenerator = __toModule(require_regenerator());
// node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value2 = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value2);
} else {
Promise.resolve(value2).then(_next, _throw);
}
}
function _asyncToGenerator(fn2) {
return function() {
var self2 = this, args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn2.apply(self2, args);
function _next(value2) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value2);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(void 0);
});
};
}
// node_modules/@antv/g-webgpu-core/es/Entity.js
var EMPTY = -1;
var entitySequence = 1;
function createEntity() {
return entitySequence++;
}
// node_modules/@antv/g-webgpu-core/es/ComponentManager.js
var Component2 = function Component3(data3) {
_classCallCheck(this, Component3);
};
var ComponentManager = /* @__PURE__ */ function() {
function ComponentManager2(clazz) {
_classCallCheck(this, ComponentManager2);
this.clazz = void 0;
this.components = [];
this.entities = [];
this.lookup = {};
this.clazz = clazz;
}
_createClass(ComponentManager2, [{
key: "clear",
value: function clear() {
this.components = [];
this.entities = [];
this.lookup = {};
}
}, {
key: "contains",
value: function contains2(entity) {
return this.lookup[entity] > -1;
}
}, {
key: "create",
value: function create8(entity, data3) {
this.lookup[entity] = this.components.length;
var component2 = new this.clazz(data3 || {});
this.components.push(component2);
this.entities.push(entity);
return component2;
}
}, {
key: "remove",
value: function remove2(entity) {
var componentIndex = this.lookup[entity];
if (componentIndex > -1) {
if (componentIndex < this.components.length - 1) {
this.components[componentIndex] = this.components[this.components.length - 1];
this.entities[componentIndex] = this.entities[this.entities.length - 1];
this.lookup[this.entities[componentIndex]] = componentIndex;
}
}
this.components.pop();
this.entities.pop();
delete this.lookup[entity];
}
}, {
key: "removeKeepSorted",
value: function removeKeepSorted(entity) {
var componentIndex = this.lookup[entity];
if (componentIndex > -1) {
var entity2 = this.entities[componentIndex];
if (componentIndex < this.components.length - 1) {
for (var _i = componentIndex + 1; _i < this.components.length; ++_i) {
this.components[_i - 1] = this.components[_i];
}
for (var _i2 = componentIndex + 1; _i2 < this.entities.length; ++_i2) {
this.entities[_i2 - 1] = this.entities[_i2];
this.lookup[this.entities[_i2 - 1]] = _i2 - 1;
}
}
this.components.pop();
this.entities.pop();
delete this.lookup[entity2];
}
}
}, {
key: "moveItem",
value: function moveItem(srcIndex, destIndex) {
if (srcIndex === destIndex) {
return;
}
var srcComponent = this.components[srcIndex];
var srcEntity = this.entities[srcIndex];
var direction5 = srcIndex < destIndex ? 1 : -1;
for (var _i3 = srcIndex; _i3 !== destIndex; _i3 += direction5) {
var next = _i3 + direction5;
this.components[_i3] = this.components[next];
this.entities[_i3] = this.entities[next];
this.lookup[this.entities[_i3]] = _i3;
}
this.components[destIndex] = srcComponent;
this.entities[destIndex] = srcEntity;
this.lookup[srcEntity] = destIndex;
}
}, {
key: "getEntity",
value: function getEntity(index2) {
return this.entities[index2];
}
}, {
key: "getComponent",
value: function getComponent(index2) {
return this.components[index2];
}
}, {
key: "getComponentByEntity",
value: function getComponentByEntity(entity) {
var componentIndex = this.lookup[entity];
if (componentIndex > -1) {
return this.components[componentIndex];
}
return null;
}
}, {
key: "getCount",
value: function getCount() {
return this.components.length;
}
}, {
key: "getEntityByComponentIndex",
value: function getEntityByComponentIndex(componentIdx) {
for (var _i4 = 0, _Object$keys = Object.keys(this.lookup); _i4 < _Object$keys.length; _i4++) {
var _entity = _Object$keys[_i4];
var entityInNum = Number(_entity);
if (this.lookup[entityInNum] === componentIdx) {
return entityInNum;
}
}
return EMPTY;
}
}, {
key: "find",
value: function find4(callback) {
for (var _i5 = 0; _i5 < this.getCount(); _i5++) {
var _component = this.getComponent(_i5);
if (callback(_component, _i5)) {
return _component;
}
}
return null;
}
}, {
key: "findIndex",
value: function findIndex2(callback) {
for (var _i6 = 0; _i6 < this.getCount(); _i6++) {
var _component2 = this.getComponent(_i6);
if (callback(_component2, _i6)) {
return _i6;
}
}
return -1;
}
}, {
key: "forEach",
value: function forEach4(callback) {
for (var _i7 = 0, _Object$keys2 = Object.keys(this.lookup); _i7 < _Object$keys2.length; _i7++) {
var _entity2 = _Object$keys2[_i7];
var entityInNum = Number(_entity2);
var componentIndex = this.lookup[entityInNum];
callback(entityInNum, this.getComponent(componentIndex));
}
}
}, {
key: "forEachAsync",
value: function() {
var _forEachAsync = _asyncToGenerator(/* @__PURE__ */ import_regenerator.default.mark(function _callee(callback) {
var _i8, _Object$keys3, _entity3, entityInNum, componentIndex;
return import_regenerator.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_i8 = 0, _Object$keys3 = Object.keys(this.lookup);
case 1:
if (!(_i8 < _Object$keys3.length)) {
_context.next = 10;
break;
}
_entity3 = _Object$keys3[_i8];
entityInNum = Number(_entity3);
componentIndex = this.lookup[entityInNum];
_context.next = 7;
return callback(entityInNum, this.getComponent(componentIndex));
case 7:
_i8++;
_context.next = 1;
break;
case 10:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
function forEachAsync(_x) {
return _forEachAsync.apply(this, arguments);
}
return forEachAsync;
}()
}, {
key: "map",
value: function map6(callback) {
var result = [];
for (var _i9 = 0, _Object$keys4 = Object.keys(this.lookup); _i9 < _Object$keys4.length; _i9++) {
var _entity4 = _Object$keys4[_i9];
var entityInNum = Number(_entity4);
var componentIndex = this.lookup[entityInNum];
result.push(callback(entityInNum, this.getComponent(componentIndex)));
}
return result;
}
}]);
return ComponentManager2;
}();
// node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
function _arrayWithHoles(arr) {
if (Array.isArray(arr))
return arr;
}
// node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
function _iterableToArrayLimit(arr, i4) {
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
if (_i == null)
return;
var _arr = [];
var _n = true;
var _d = false;
var _s, _e;
try {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i4 && _arr.length === i4)
break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null)
_i["return"]();
} finally {
if (_d)
throw _e;
}
}
return _arr;
}
// node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
function _arrayLikeToArray(arr, len5) {
if (len5 == null || len5 > arr.length)
len5 = arr.length;
for (var i4 = 0, arr2 = new Array(len5); i4 < len5; i4++) {
arr2[i4] = arr[i4];
}
return arr2;
}
// node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
function _unsupportedIterableToArray(o3, minLen) {
if (!o3)
return;
if (typeof o3 === "string")
return _arrayLikeToArray(o3, minLen);
var n3 = Object.prototype.toString.call(o3).slice(8, -1);
if (n3 === "Object" && o3.constructor)
n3 = o3.constructor.name;
if (n3 === "Map" || n3 === "Set")
return Array.from(o3);
if (n3 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n3))
return _arrayLikeToArray(o3, minLen);
}
// node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
// node_modules/@babel/runtime/helpers/esm/slicedToArray.js
function _slicedToArray(arr, i4) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i4) || _unsupportedIterableToArray(arr, i4) || _nonIterableRest();
}
// node_modules/@antv/g-webgpu-core/es/components/framegraph/System.js
var import_regenerator2 = __toModule(require_regenerator());
var import_inversify = __toModule(require_inversify());
// node_modules/@antv/g-webgpu-core/es/identifier.js
var IDENTIFIER = {
HierarchyComponentManager: Symbol("HierarchyComponentManager"),
TransformComponentManager: Symbol("TransformComponentManager"),
NameComponentManager: Symbol("NameComponentManager"),
SceneGraphSystem: Symbol("SceneGraphSystem"),
FrameGraphSystem: Symbol("FrameGraphSystem"),
ResourcePool: Symbol("ResourcePool"),
ResourceHandleComponentManager: Symbol("ResourceHandleComponentManager"),
PassNodeComponentManager: Symbol("PassNodeComponentManager"),
RendererSystem: Symbol("RendererSystem"),
RenderPass: Symbol("RenderPass"),
RenderPassFactory: Symbol("Factory"),
Renderable: Symbol("Factory"),
MeshSystem: Symbol("MeshSystem"),
MeshComponentManager: Symbol("MeshComponentManager"),
CullableComponentManager: Symbol("CullableComponentManager"),
Geometry: Symbol("Geometry"),
GeometrySystem: Symbol("GeometrySystem"),
GeometryComponentManager: Symbol("GeometryComponentManager"),
Material: Symbol("Material"),
MaterialSystem: Symbol("MaterialSystem"),
MaterialComponentManager: Symbol("MaterialComponentManager"),
ForwardRenderPath: Symbol("ForwardRenderPath"),
ComputeSystem: Symbol("ComputeSystem"),
ComputeComponentManager: Symbol("ComputeComponentManager"),
ComputeStrategy: Symbol("ComputeStrategy"),
Systems: Symbol("Systems"),
World: Symbol("World"),
RenderEngine: Symbol("RenderEngine"),
WebGPUEngine: Symbol("WebGPUEngine"),
WebGLEngine: Symbol("WebGLEngine"),
ShaderModuleService: Symbol("ShaderModuleService"),
ConfigService: Symbol("ConfigService"),
InteractorService: Symbol("InteractorService"),
IEventEmitter: Symbol("IEventEmitter"),
Light: Symbol("Light")
};
// node_modules/@antv/g-webgpu-core/es/components/framegraph/FrameGraphHandle.js
var FrameGraphHandle = function FrameGraphHandle2() {
_classCallCheck(this, FrameGraphHandle2);
this.index = void 0;
};
// node_modules/@antv/g-webgpu-core/es/components/framegraph/FrameGraphPass.js
var FrameGraphPass = function FrameGraphPass2() {
_classCallCheck(this, FrameGraphPass2);
this.name = void 0;
this.data = void 0;
this.execute = void 0;
this.tearDown = void 0;
};
// node_modules/@antv/g-webgpu-core/es/components/framegraph/PassNode.js
var PassNode = /* @__PURE__ */ function() {
function PassNode2() {
_classCallCheck(this, PassNode2);
this.name = void 0;
this.refCount = 0;
this.hasSideEffect = false;
this.devirtualize = [];
this.destroy = [];
this.reads = [];
this.writes = [];
}
_createClass(PassNode2, [{
key: "read",
value: function read(handle) {
if (!this.reads.find(function(h3) {
return h3.index === handle.index;
})) {
this.reads.push(handle);
}
return handle;
}
}, {
key: "sample",
value: function sample(handle) {
this.read(handle);
return handle;
}
}, {
key: "write",
value: function write(fg, handle) {
var existed = this.writes.find(function(h3) {
return h3.index === handle.index;
});
if (existed) {
return handle;
}
var node = fg.getResourceNode(handle);
node.resource.version++;
if (node.resource.imported) {
this.hasSideEffect = true;
}
var r4 = fg.createResourceNode(node.resource);
var newNode = fg.getResourceNode(r4);
newNode.writer = this;
this.writes.push(r4);
return r4;
}
}]);
return PassNode2;
}();
// node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
function _setPrototypeOf(o3, p4) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o4, p5) {
o4.__proto__ = p5;
return o4;
};
return _setPrototypeOf(o3, p4);
}
// node_modules/@babel/runtime/helpers/esm/inherits.js
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
Object.defineProperty(subClass, "prototype", {
writable: false
});
if (superClass)
_setPrototypeOf(subClass, superClass);
}
// node_modules/@babel/runtime/helpers/esm/typeof.js
function _typeof3(obj) {
"@babel/helpers - typeof";
return _typeof3 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) {
return typeof obj2;
} : function(obj2) {
return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
}, _typeof3(obj);
}
// node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
function _assertThisInitialized(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
// node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js
function _possibleConstructorReturn(self2, call) {
if (call && (_typeof3(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized(self2);
}
// node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
function _getPrototypeOf(o3) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o4) {
return o4.__proto__ || Object.getPrototypeOf(o4);
};
return _getPrototypeOf(o3);
}
// node_modules/@antv/g-webgpu-core/es/components/framegraph/VirtualResource.js
var VirtualResource = function VirtualResource2() {
_classCallCheck(this, VirtualResource2);
this.first = void 0;
this.last = void 0;
};
// node_modules/@antv/g-webgpu-core/es/components/framegraph/ResourceEntry.js
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived), result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct)
return false;
if (Reflect.construct.sham)
return false;
if (typeof Proxy === "function")
return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function() {
}));
return true;
} catch (e4) {
return false;
}
}
var ResourceEntry = /* @__PURE__ */ function(_VirtualResource) {
_inherits(ResourceEntry2, _VirtualResource);
var _super = _createSuper(ResourceEntry2);
function ResourceEntry2() {
var _this;
_classCallCheck(this, ResourceEntry2);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_this.version = 0;
_this.refs = 0;
_this.name = void 0;
_this.imported = void 0;
_this.priority = void 0;
_this.discardStart = true;
_this.discardEnd = false;
_this.descriptor = void 0;
_this.resource = void 0;
return _this;
}
_createClass(ResourceEntry2, [{
key: "preExecuteDestroy",
value: function preExecuteDestroy() {
this.discardEnd = true;
}
}, {
key: "postExecuteDestroy",
value: function postExecuteDestroy() {
if (!this.imported) {
}
}
}, {
key: "postExecuteDevirtualize",
value: function postExecuteDevirtualize() {
this.discardStart = false;
}
}, {
key: "preExecuteDevirtualize",
value: function preExecuteDevirtualize() {
if (!this.imported) {
}
}
}]);
return ResourceEntry2;
}(VirtualResource);
// node_modules/@antv/g-webgpu-core/es/components/framegraph/ResourceNode.js
var ResourceNode = function ResourceNode2() {
_classCallCheck(this, ResourceNode2);
this.resource = void 0;
this.writer = void 0;
this.readerCount = 0;
this.version = void 0;
};
// node_modules/@antv/g-webgpu-core/es/components/framegraph/System.js
var _dec;
var _dec2;
var _class2;
var _class22;
var _descriptor;
var _temp;
function _createForOfIteratorHelper(o3, allowArrayLike) {
var it;
if (typeof Symbol === "undefined" || o3[Symbol.iterator] == null) {
if (Array.isArray(o3) || (it = _unsupportedIterableToArray2(o3)) || allowArrayLike && o3 && typeof o3.length === "number") {
if (it)
o3 = it;
var i4 = 0;
var F3 = function F4() {
};
return { s: F3, n: function n3() {
if (i4 >= o3.length)
return { done: true };
return { done: false, value: o3[i4++] };
}, e: function e4(_e) {
throw _e;
}, f: F3 };
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var normalCompletion = true, didErr = false, err;
return { s: function s4() {
it = o3[Symbol.iterator]();
}, n: function n3() {
var step = it.next();
normalCompletion = step.done;
return step;
}, e: function e4(_e2) {
didErr = true;
err = _e2;
}, f: function f3() {
try {
if (!normalCompletion && it.return != null)
it.return();
} finally {
if (didErr)
throw err;
}
} };
}
function _unsupportedIterableToArray2(o3, minLen) {
if (!o3)
return;
if (typeof o3 === "string")
return _arrayLikeToArray2(o3, minLen);
var n3 = Object.prototype.toString.call(o3).slice(8, -1);
if (n3 === "Object" && o3.constructor)
n3 = o3.constructor.name;
if (n3 === "Map" || n3 === "Set")
return Array.from(o3);
if (n3 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n3))
return _arrayLikeToArray2(o3, minLen);
}
function _arrayLikeToArray2(arr, len5) {
if (len5 == null || len5 > arr.length)
len5 = arr.length;
for (var i4 = 0, arr2 = new Array(len5); i4 < len5; i4++) {
arr2[i4] = arr[i4];
}
return arr2;
}
var FrameGraphSystem = (_dec = (0, import_inversify.injectable)(), _dec2 = (0, import_inversify.inject)(IDENTIFIER.RenderEngine), _dec(_class2 = (_class22 = (_temp = /* @__PURE__ */ function() {
function FrameGraphSystem2() {
_classCallCheck(this, FrameGraphSystem2);
this.passNodes = [];
this.resourceNodes = [];
this.frameGraphPasses = [];
_initializerDefineProperty(this, "engine", _descriptor, this);
}
_createClass(FrameGraphSystem2, [{
key: "execute",
value: function() {
var _execute = _asyncToGenerator(/* @__PURE__ */ import_regenerator2.default.mark(function _callee(views) {
return import_regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
this.compile();
_context.next = 3;
return this.executePassNodes(views);
case 3:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
function execute(_x) {
return _execute.apply(this, arguments);
}
return execute;
}()
}, {
key: "tearDown",
value: function tearDown() {
this.frameGraphPasses.forEach(function(pass) {
if (pass.tearDown) {
pass.tearDown();
}
});
this.reset();
}
}, {
key: "addPass",
value: function addPass(name, setup, execute, tearDown) {
var frameGraphPass = new FrameGraphPass();
frameGraphPass.execute = execute;
if (tearDown) {
frameGraphPass.tearDown = tearDown;
}
frameGraphPass.name = name;
var passNode = new PassNode();
passNode.name = name;
this.passNodes.push(passNode);
this.frameGraphPasses.push(frameGraphPass);
setup(this, passNode, frameGraphPass);
return frameGraphPass;
}
}, {
key: "getPass",
value: function getPass(name) {
return this.frameGraphPasses.find(function(p4) {
return p4.name === name;
});
}
}, {
key: "compile",
value: function compile() {
var _this = this;
var _iterator = _createForOfIteratorHelper(this.passNodes), _step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
var _pass = _step.value;
_pass.refCount = _pass.writes.length + (_pass.hasSideEffect ? 1 : 0);
_pass.reads.forEach(function(handle) {
_this.resourceNodes[handle.index].readerCount++;
});
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
var stack = [];
var _iterator2 = _createForOfIteratorHelper(this.resourceNodes), _step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
var node = _step2.value;
if (node.readerCount === 0) {
stack.push(node);
}
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
while (stack.length) {
var pNode = stack.pop();
var writer = pNode && pNode.writer;
if (writer) {
if (--writer.refCount === 0) {
var _iterator3 = _createForOfIteratorHelper(writer.reads), _step3;
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) {
var resource = _step3.value;
var r4 = this.resourceNodes[resource.index];
if (--r4.readerCount === 0) {
stack.push(r4);
}
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
}
}
}
}
this.resourceNodes.forEach(function(node2) {
node2.resource.refs += node2.readerCount;
});
var _iterator4 = _createForOfIteratorHelper(this.passNodes), _step4;
try {
for (_iterator4.s(); !(_step4 = _iterator4.n()).done; ) {
var _pass2 = _step4.value;
if (!_pass2.refCount) {
continue;
}
var _iterator6 = _createForOfIteratorHelper(_pass2.reads), _step6;
try {
for (_iterator6.s(); !(_step6 = _iterator6.n()).done; ) {
var _resource2 = _step6.value;
var pResource = this.resourceNodes[_resource2.index].resource;
pResource.first = pResource.first ? pResource.first : _pass2;
pResource.last = _pass2;
}
} catch (err) {
_iterator6.e(err);
} finally {
_iterator6.f();
}
var _iterator7 = _createForOfIteratorHelper(_pass2.writes), _step7;
try {
for (_iterator7.s(); !(_step7 = _iterator7.n()).done; ) {
var _resource3 = _step7.value;
var _pResource = this.resourceNodes[_resource3.index].resource;
_pResource.first = _pResource.first ? _pResource.first : _pass2;
_pResource.last = _pass2;
}
} catch (err) {
_iterator7.e(err);
} finally {
_iterator7.f();
}
}
} catch (err) {
_iterator4.e(err);
} finally {
_iterator4.f();
}
for (var priority = 0; priority < 2; priority++) {
var _iterator5 = _createForOfIteratorHelper(this.resourceNodes), _step5;
try {
for (_iterator5.s(); !(_step5 = _iterator5.n()).done; ) {
var resoureNode = _step5.value;
var _resource = resoureNode.resource;
if (_resource.priority === priority && _resource.refs) {
var pFirst = _resource.first;
var pLast = _resource.last;
if (pFirst && pLast) {
pFirst.devirtualize.push(_resource);
pLast.destroy.push(_resource);
}
}
}
} catch (err) {
_iterator5.e(err);
} finally {
_iterator5.f();
}
}
}
}, {
key: "executePassNodes",
value: function() {
var _executePassNodes = _asyncToGenerator(/* @__PURE__ */ import_regenerator2.default.mark(function _callee2(views) {
var _iterator8, _step8, _step8$value, index2, node, _iterator9, _step9, resource, _iterator10, _step10, _resource4, _iterator11, _step11, _resource5, _iterator12, _step12, _resource6;
return import_regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_iterator8 = _createForOfIteratorHelper(this.passNodes.entries());
_context2.prev = 1;
_iterator8.s();
case 3:
if ((_step8 = _iterator8.n()).done) {
_context2.next = 18;
break;
}
_step8$value = _slicedToArray(_step8.value, 2), index2 = _step8$value[0], node = _step8$value[1];
if (!node.refCount) {
_context2.next = 16;
break;
}
_iterator9 = _createForOfIteratorHelper(node.devirtualize);
try {
for (_iterator9.s(); !(_step9 = _iterator9.n()).done; ) {
resource = _step9.value;
resource.preExecuteDevirtualize(this.engine);
}
} catch (err) {
_iterator9.e(err);
} finally {
_iterator9.f();
}
_iterator10 = _createForOfIteratorHelper(node.destroy);
try {
for (_iterator10.s(); !(_step10 = _iterator10.n()).done; ) {
_resource4 = _step10.value;
_resource4.preExecuteDestroy(this.engine);
}
} catch (err) {
_iterator10.e(err);
} finally {
_iterator10.f();
}
_context2.next = 12;
return this.frameGraphPasses[index2].execute(this, this.frameGraphPasses[index2], views);
case 12:
_iterator11 = _createForOfIteratorHelper(node.devirtualize);
try {
for (_iterator11.s(); !(_step11 = _iterator11.n()).done; ) {
_resource5 = _step11.value;
_resource5.postExecuteDevirtualize(this.engine);
}
} catch (err) {
_iterator11.e(err);
} finally {
_iterator11.f();
}
_iterator12 = _createForOfIteratorHelper(node.destroy);
try {
for (_iterator12.s(); !(_step12 = _iterator12.n()).done; ) {
_resource6 = _step12.value;
_resource6.postExecuteDestroy(this.engine);
}
} catch (err) {
_iterator12.e(err);
} finally {
_iterator12.f();
}
case 16:
_context2.next = 3;
break;
case 18:
_context2.next = 23;
break;
case 20:
_context2.prev = 20;
_context2.t0 = _context2["catch"](1);
_iterator8.e(_context2.t0);
case 23:
_context2.prev = 23;
_iterator8.f();
return _context2.finish(23);
case 26:
this.reset();
case 27:
case "end":
return _context2.stop();
}
}
}, _callee2, this, [[1, 20, 23, 26]]);
}));
function executePassNodes(_x2) {
return _executePassNodes.apply(this, arguments);
}
return executePassNodes;
}()
}, {
key: "reset",
value: function reset() {
this.passNodes = [];
this.resourceNodes = [];
this.frameGraphPasses = [];
}
}, {
key: "getResourceNode",
value: function getResourceNode(r4) {
return this.resourceNodes[r4.index];
}
}, {
key: "createResourceNode",
value: function createResourceNode(resourceEntry) {
var resourceNode = new ResourceNode();
resourceNode.resource = resourceEntry;
resourceNode.version = resourceEntry.version;
this.resourceNodes.push(resourceNode);
var fgh = new FrameGraphHandle();
fgh.index = this.resourceNodes.length - 1;
return fgh;
}
}, {
key: "createTexture",
value: function createTexture(passNode, name, descriptor) {
var resource = new ResourceEntry();
resource.name = name;
resource.descriptor = descriptor;
return this.createResourceNode(resource);
}
}, {
key: "createRenderTarget",
value: function createRenderTarget(passNode, name, descriptor) {
var resource = new ResourceEntry();
resource.name = name;
resource.descriptor = descriptor;
return this.createResourceNode(resource);
}
}, {
key: "present",
value: function present(input) {
this.addPass("Present", function(fg, passNode) {
passNode.read(input);
passNode.hasSideEffect = true;
}, /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ import_regenerator2.default.mark(function _callee3() {
return import_regenerator2.default.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
case "end":
return _context3.stop();
}
}
}, _callee3);
})));
}
}]);
return FrameGraphSystem2;
}(), _temp), _descriptor = _applyDecoratedDescriptor(_class22.prototype, "engine", [_dec2], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class22)) || _class2);
// node_modules/@babel/runtime/helpers/esm/defineProperty.js
function _defineProperty(obj, key, value2) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value2,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value2;
}
return obj;
}
// node_modules/@antv/g-webgpu-core/es/utils/is-typedarray.js
var MAX_SAFE_INTEGER = 9007199254740991;
var argsTag = "[object Arguments]";
var arrayTag = "[object Array]";
var boolTag = "[object Boolean]";
var dateTag = "[object Date]";
var errorTag = "[object Error]";
var funcTag = "[object Function]";
var mapTag = "[object Map]";
var numberTag = "[object Number]";
var objectTag = "[object Object]";
var regexpTag = "[object RegExp]";
var setTag = "[object Set]";
var stringTag = "[object String]";
var weakMapTag = "[object WeakMap]";
var arrayBufferTag = "[object ArrayBuffer]";
var dataViewTag = "[object DataView]";
var float32Tag = "[object Float32Array]";
var float64Tag = "[object Float64Array]";
var int8Tag = "[object Int8Array]";
var int16Tag = "[object Int16Array]";
var int32Tag = "[object Int32Array]";
var uint8Tag = "[object Uint8Array]";
var uint8ClampedTag = "[object Uint8ClampedArray]";
var uint16Tag = "[object Uint16Array]";
var uint32Tag = "[object Uint32Array]";
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
var objectProto2 = Object.prototype;
var objectToString = objectProto2.toString;
function baseIsTypedArray(value2) {
return isObjectLike3(value2) && isLength(value2.length) && !!typedArrayTags[objectToString.call(value2)];
}
function isLength(value2) {
return typeof value2 === "number" && value2 > -1 && value2 % 1 === 0 && value2 <= MAX_SAFE_INTEGER;
}
function isObjectLike3(value2) {
return !!value2 && _typeof3(value2) === "object";
}
var isTypedArray = baseIsTypedArray;
// node_modules/@antv/g-webgpu-core/es/components/geometry/GeometryComponent.js
function ownKeys(object, enumerableOnly) {
var keys2 = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys2.push.apply(keys2, symbols);
}
return keys2;
}
function _objectSpread(target) {
for (var i4 = 1; i4 < arguments.length; i4++) {
var source = arguments[i4] != null ? arguments[i4] : {};
if (i4 % 2) {
ownKeys(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _createSuper2(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct2();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived), result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _isNativeReflectConstruct2() {
if (typeof Reflect === "undefined" || !Reflect.construct)
return false;
if (Reflect.construct.sham)
return false;
if (typeof Proxy === "function")
return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function() {
}));
return true;
} catch (e4) {
return false;
}
}
var GeometryComponent = /* @__PURE__ */ function(_Component) {
_inherits(GeometryComponent2, _Component);
var _super = _createSuper2(GeometryComponent2);
function GeometryComponent2(data3) {
var _this;
_classCallCheck(this, GeometryComponent2);
_this = _super.call(this, data3);
_this.dirty = true;
_this.attributes = [];
_this.indices = void 0;
_this.indicesBuffer = void 0;
_this.vertexCount = 0;
_this.maxInstancedCount = void 0;
_this.aabb = void 0;
_this.entity = void 0;
Object.assign(_assertThisInitialized(_this), data3);
return _this;
}
_createClass(GeometryComponent2, [{
key: "setAttribute",
value: function setAttribute(name, data3, descriptor, bufferGetter) {
var existed = this.attributes.find(function(a4) {
return a4.name === name;
});
if (!existed) {
this.attributes.push(_objectSpread(_objectSpread({
dirty: true,
name,
data: data3
}, descriptor), {}, {
bufferGetter
}));
} else {
existed.data = data3;
existed.dirty = true;
}
this.dirty = true;
return this;
}
}, {
key: "setIndex",
value: function setIndex(data3) {
this.indices = new Uint32Array(data3.buffer ? data3.buffer : data3);
this.dirty = true;
return this;
}
}, {
key: "applyMatrix",
value: function applyMatrix4(matrix) {
var positionAttribute = this.attributes.find(function(_ref2) {
var name = _ref2.name;
return name === "position";
});
var normalAttribute = this.attributes.find(function(_ref2) {
var name = _ref2.name;
return name === "normal";
});
if (positionAttribute) {
positionAttribute.dirty = true;
if (positionAttribute.data && positionAttribute.data.length) {
for (var i4 = 0; i4 < positionAttribute.data.length; i4 += 3) {
var position2 = vec4_exports.fromValues(positionAttribute.data[i4], positionAttribute.data[i4 + 1], positionAttribute.data[i4 + 2], 1);
vec4_exports.transformMat4(position2, position2, matrix);
if (isTypedArray(positionAttribute.data)) {
positionAttribute.data.set([position2[0], position2[1], position2[2]], i4);
} else {
positionAttribute.data[i4] = position2[0];
positionAttribute.data[i4 + 1] = position2[1];
positionAttribute.data[i4 + 2] = position2[2];
}
}
}
}
if (normalAttribute) {
var normalMatrix = mat3_exports.normalFromMat4(mat3_exports.create(), matrix);
if (normalAttribute.data && normalAttribute.data.length) {
for (var _i = 0; _i < normalAttribute.data.length; _i += 3) {
var normal2 = vec3_exports.fromValues(normalAttribute.data[_i], normalAttribute.data[_i + 1], normalAttribute.data[_i + 2]);
vec3_exports.transformMat3(normal2, normal2, normalMatrix);
vec3_exports.normalize(normal2, normal2);
if (isTypedArray(normalAttribute.data)) {
normalAttribute.data.set([normal2[0], normal2[1], normal2[2]], _i);
} else {
normalAttribute.data[_i] = normal2[0];
normalAttribute.data[_i + 1] = normal2[1];
normalAttribute.data[_i + 2] = normal2[2];
}
}
}
}
}
}]);
return GeometryComponent2;
}(Component2);
// node_modules/@antv/g-webgpu-core/es/components/geometry/System.js
var import_regenerator3 = __toModule(require_regenerator());
var import_inversify2 = __toModule(require_inversify());
// node_modules/@antv/g-webgpu-core/es/components/renderer/gl.js
var gl;
(function(gl2) {
gl2[gl2["DEPTH_BUFFER_BIT"] = 256] = "DEPTH_BUFFER_BIT";
gl2[gl2["STENCIL_BUFFER_BIT"] = 1024] = "STENCIL_BUFFER_BIT";
gl2[gl2["COLOR_BUFFER_BIT"] = 16384] = "COLOR_BUFFER_BIT";
gl2[gl2["POINTS"] = 0] = "POINTS";
gl2[gl2["LINES"] = 1] = "LINES";
gl2[gl2["LINE_LOOP"] = 2] = "LINE_LOOP";
gl2[gl2["LINE_STRIP"] = 3] = "LINE_STRIP";
gl2[gl2["TRIANGLES"] = 4] = "TRIANGLES";
gl2[gl2["TRIANGLE_STRIP"] = 5] = "TRIANGLE_STRIP";
gl2[gl2["TRIANGLE_FAN"] = 6] = "TRIANGLE_FAN";
gl2[gl2["ZERO"] = 0] = "ZERO";
gl2[gl2["ONE"] = 1] = "ONE";
gl2[gl2["SRC_COLOR"] = 768] = "SRC_COLOR";
gl2[gl2["ONE_MINUS_SRC_COLOR"] = 769] = "ONE_MINUS_SRC_COLOR";
gl2[gl2["SRC_ALPHA"] = 770] = "SRC_ALPHA";
gl2[gl2["ONE_MINUS_SRC_ALPHA"] = 771] = "ONE_MINUS_SRC_ALPHA";
gl2[gl2["DST_ALPHA"] = 772] = "DST_ALPHA";
gl2[gl2["ONE_MINUS_DST_ALPHA"] = 773] = "ONE_MINUS_DST_ALPHA";
gl2[gl2["DST_COLOR"] = 774] = "DST_COLOR";
gl2[gl2["ONE_MINUS_DST_COLOR"] = 775] = "ONE_MINUS_DST_COLOR";
gl2[gl2["SRC_ALPHA_SATURATE"] = 776] = "SRC_ALPHA_SATURATE";
gl2[gl2["FUNC_ADD"] = 32774] = "FUNC_ADD";
gl2[gl2["BLEND_EQUATION"] = 32777] = "BLEND_EQUATION";
gl2[gl2["BLEND_EQUATION_RGB"] = 32777] = "BLEND_EQUATION_RGB";
gl2[gl2["BLEND_EQUATION_ALPHA"] = 34877] = "BLEND_EQUATION_ALPHA";
gl2[gl2["FUNC_SUBTRACT"] = 32778] = "FUNC_SUBTRACT";
gl2[gl2["FUNC_REVERSE_SUBTRACT"] = 32779] = "FUNC_REVERSE_SUBTRACT";
gl2[gl2["MAX_EXT"] = 32776] = "MAX_EXT";
gl2[gl2["MIN_EXT"] = 32775] = "MIN_EXT";
gl2[gl2["BLEND_DST_RGB"] = 32968] = "BLEND_DST_RGB";
gl2[gl2["BLEND_SRC_RGB"] = 32969] = "BLEND_SRC_RGB";
gl2[gl2["BLEND_DST_ALPHA"] = 32970] = "BLEND_DST_ALPHA";
gl2[gl2["BLEND_SRC_ALPHA"] = 32971] = "BLEND_SRC_ALPHA";
gl2[gl2["CONSTANT_COLOR"] = 32769] = "CONSTANT_COLOR";
gl2[gl2["ONE_MINUS_CONSTANT_COLOR"] = 32770] = "ONE_MINUS_CONSTANT_COLOR";
gl2[gl2["CONSTANT_ALPHA"] = 32771] = "CONSTANT_ALPHA";
gl2[gl2["ONE_MINUS_CONSTANT_ALPHA"] = 32772] = "ONE_MINUS_CONSTANT_ALPHA";
gl2[gl2["BLEND_COLOR"] = 32773] = "BLEND_COLOR";
gl2[gl2["ARRAY_BUFFER"] = 34962] = "ARRAY_BUFFER";
gl2[gl2["ELEMENT_ARRAY_BUFFER"] = 34963] = "ELEMENT_ARRAY_BUFFER";
gl2[gl2["ARRAY_BUFFER_BINDING"] = 34964] = "ARRAY_BUFFER_BINDING";
gl2[gl2["ELEMENT_ARRAY_BUFFER_BINDING"] = 34965] = "ELEMENT_ARRAY_BUFFER_BINDING";
gl2[gl2["STREAM_DRAW"] = 35040] = "STREAM_DRAW";
gl2[gl2["STATIC_DRAW"] = 35044] = "STATIC_DRAW";
gl2[gl2["DYNAMIC_DRAW"] = 35048] = "DYNAMIC_DRAW";
gl2[gl2["BUFFER_SIZE"] = 34660] = "BUFFER_SIZE";
gl2[gl2["BUFFER_USAGE"] = 34661] = "BUFFER_USAGE";
gl2[gl2["CURRENT_VERTEX_ATTRIB"] = 34342] = "CURRENT_VERTEX_ATTRIB";
gl2[gl2["FRONT"] = 1028] = "FRONT";
gl2[gl2["BACK"] = 1029] = "BACK";
gl2[gl2["FRONT_AND_BACK"] = 1032] = "FRONT_AND_BACK";
gl2[gl2["CULL_FACE"] = 2884] = "CULL_FACE";
gl2[gl2["BLEND"] = 3042] = "BLEND";
gl2[gl2["DITHER"] = 3024] = "DITHER";
gl2[gl2["STENCIL_TEST"] = 2960] = "STENCIL_TEST";
gl2[gl2["DEPTH_TEST"] = 2929] = "DEPTH_TEST";
gl2[gl2["SCISSOR_TEST"] = 3089] = "SCISSOR_TEST";
gl2[gl2["POLYGON_OFFSET_FILL"] = 32823] = "POLYGON_OFFSET_FILL";
gl2[gl2["SAMPLE_ALPHA_TO_COVERAGE"] = 32926] = "SAMPLE_ALPHA_TO_COVERAGE";
gl2[gl2["SAMPLE_COVERAGE"] = 32928] = "SAMPLE_COVERAGE";
gl2[gl2["NO_ERROR"] = 0] = "NO_ERROR";
gl2[gl2["INVALID_ENUM"] = 1280] = "INVALID_ENUM";
gl2[gl2["INVALID_VALUE"] = 1281] = "INVALID_VALUE";
gl2[gl2["INVALID_OPERATION"] = 1282] = "INVALID_OPERATION";
gl2[gl2["OUT_OF_MEMORY"] = 1285] = "OUT_OF_MEMORY";
gl2[gl2["CW"] = 2304] = "CW";
gl2[gl2["CCW"] = 2305] = "CCW";
gl2[gl2["LINE_WIDTH"] = 2849] = "LINE_WIDTH";
gl2[gl2["ALIASED_POINT_SIZE_RANGE"] = 33901] = "ALIASED_POINT_SIZE_RANGE";
gl2[gl2["ALIASED_LINE_WIDTH_RANGE"] = 33902] = "ALIASED_LINE_WIDTH_RANGE";
gl2[gl2["CULL_FACE_MODE"] = 2885] = "CULL_FACE_MODE";
gl2[gl2["FRONT_FACE"] = 2886] = "FRONT_FACE";
gl2[gl2["DEPTH_RANGE"] = 2928] = "DEPTH_RANGE";
gl2[gl2["DEPTH_WRITEMASK"] = 2930] = "DEPTH_WRITEMASK";
gl2[gl2["DEPTH_CLEAR_VALUE"] = 2931] = "DEPTH_CLEAR_VALUE";
gl2[gl2["DEPTH_FUNC"] = 2932] = "DEPTH_FUNC";
gl2[gl2["STENCIL_CLEAR_VALUE"] = 2961] = "STENCIL_CLEAR_VALUE";
gl2[gl2["STENCIL_FUNC"] = 2962] = "STENCIL_FUNC";
gl2[gl2["STENCIL_FAIL"] = 2964] = "STENCIL_FAIL";
gl2[gl2["STENCIL_PASS_DEPTH_FAIL"] = 2965] = "STENCIL_PASS_DEPTH_FAIL";
gl2[gl2["STENCIL_PASS_DEPTH_PASS"] = 2966] = "STENCIL_PASS_DEPTH_PASS";
gl2[gl2["STENCIL_REF"] = 2967] = "STENCIL_REF";
gl2[gl2["STENCIL_VALUE_MASK"] = 2963] = "STENCIL_VALUE_MASK";
gl2[gl2["STENCIL_WRITEMASK"] = 2968] = "STENCIL_WRITEMASK";
gl2[gl2["STENCIL_BACK_FUNC"] = 34816] = "STENCIL_BACK_FUNC";
gl2[gl2["STENCIL_BACK_FAIL"] = 34817] = "STENCIL_BACK_FAIL";
gl2[gl2["STENCIL_BACK_PASS_DEPTH_FAIL"] = 34818] = "STENCIL_BACK_PASS_DEPTH_FAIL";
gl2[gl2["STENCIL_BACK_PASS_DEPTH_PASS"] = 34819] = "STENCIL_BACK_PASS_DEPTH_PASS";
gl2[gl2["STENCIL_BACK_REF"] = 36003] = "STENCIL_BACK_REF";
gl2[gl2["STENCIL_BACK_VALUE_MASK"] = 36004] = "STENCIL_BACK_VALUE_MASK";
gl2[gl2["STENCIL_BACK_WRITEMASK"] = 36005] = "STENCIL_BACK_WRITEMASK";
gl2[gl2["VIEWPORT"] = 2978] = "VIEWPORT";
gl2[gl2["SCISSOR_BOX"] = 3088] = "SCISSOR_BOX";
gl2[gl2["COLOR_CLEAR_VALUE"] = 3106] = "COLOR_CLEAR_VALUE";
gl2[gl2["COLOR_WRITEMASK"] = 3107] = "COLOR_WRITEMASK";
gl2[gl2["UNPACK_ALIGNMENT"] = 3317] = "UNPACK_ALIGNMENT";
gl2[gl2["PACK_ALIGNMENT"] = 3333] = "PACK_ALIGNMENT";
gl2[gl2["MAX_TEXTURE_SIZE"] = 3379] = "MAX_TEXTURE_SIZE";
gl2[gl2["MAX_VIEWPORT_DIMS"] = 3386] = "MAX_VIEWPORT_DIMS";
gl2[gl2["SUBPIXEL_BITS"] = 3408] = "SUBPIXEL_BITS";
gl2[gl2["RED_BITS"] = 3410] = "RED_BITS";
gl2[gl2["GREEN_BITS"] = 3411] = "GREEN_BITS";
gl2[gl2["BLUE_BITS"] = 3412] = "BLUE_BITS";
gl2[gl2["ALPHA_BITS"] = 3413] = "ALPHA_BITS";
gl2[gl2["DEPTH_BITS"] = 3414] = "DEPTH_BITS";
gl2[gl2["STENCIL_BITS"] = 3415] = "STENCIL_BITS";
gl2[gl2["POLYGON_OFFSET_UNITS"] = 10752] = "POLYGON_OFFSET_UNITS";
gl2[gl2["POLYGON_OFFSET_FACTOR"] = 32824] = "POLYGON_OFFSET_FACTOR";
gl2[gl2["TEXTURE_BINDING_2D"] = 32873] = "TEXTURE_BINDING_2D";
gl2[gl2["SAMPLE_BUFFERS"] = 32936] = "SAMPLE_BUFFERS";
gl2[gl2["SAMPLES"] = 32937] = "SAMPLES";
gl2[gl2["SAMPLE_COVERAGE_VALUE"] = 32938] = "SAMPLE_COVERAGE_VALUE";
gl2[gl2["SAMPLE_COVERAGE_INVERT"] = 32939] = "SAMPLE_COVERAGE_INVERT";
gl2[gl2["COMPRESSED_TEXTURE_FORMATS"] = 34467] = "COMPRESSED_TEXTURE_FORMATS";
gl2[gl2["DONT_CARE"] = 4352] = "DONT_CARE";
gl2[gl2["FASTEST"] = 4353] = "FASTEST";
gl2[gl2["NICEST"] = 4354] = "NICEST";
gl2[gl2["GENERATE_MIPMAP_HINT"] = 33170] = "GENERATE_MIPMAP_HINT";
gl2[gl2["BYTE"] = 5120] = "BYTE";
gl2[gl2["UNSIGNED_BYTE"] = 5121] = "UNSIGNED_BYTE";
gl2[gl2["SHORT"] = 5122] = "SHORT";
gl2[gl2["UNSIGNED_SHORT"] = 5123] = "UNSIGNED_SHORT";
gl2[gl2["INT"] = 5124] = "INT";
gl2[gl2["UNSIGNED_INT"] = 5125] = "UNSIGNED_INT";
gl2[gl2["FLOAT"] = 5126] = "FLOAT";
gl2[gl2["DEPTH_COMPONENT"] = 6402] = "DEPTH_COMPONENT";
gl2[gl2["ALPHA"] = 6406] = "ALPHA";
gl2[gl2["RGB"] = 6407] = "RGB";
gl2[gl2["RGBA"] = 6408] = "RGBA";
gl2[gl2["LUMINANCE"] = 6409] = "LUMINANCE";
gl2[gl2["LUMINANCE_ALPHA"] = 6410] = "LUMINANCE_ALPHA";
gl2[gl2["UNSIGNED_SHORT_4_4_4_4"] = 32819] = "UNSIGNED_SHORT_4_4_4_4";
gl2[gl2["UNSIGNED_SHORT_5_5_5_1"] = 32820] = "UNSIGNED_SHORT_5_5_5_1";
gl2[gl2["UNSIGNED_SHORT_5_6_5"] = 33635] = "UNSIGNED_SHORT_5_6_5";
gl2[gl2["FRAGMENT_SHADER"] = 35632] = "FRAGMENT_SHADER";
gl2[gl2["VERTEX_SHADER"] = 35633] = "VERTEX_SHADER";
gl2[gl2["MAX_VERTEX_ATTRIBS"] = 34921] = "MAX_VERTEX_ATTRIBS";
gl2[gl2["MAX_VERTEX_UNIFORM_VECTORS"] = 36347] = "MAX_VERTEX_UNIFORM_VECTORS";
gl2[gl2["MAX_VARYING_VECTORS"] = 36348] = "MAX_VARYING_VECTORS";
gl2[gl2["MAX_COMBINED_TEXTURE_IMAGE_UNITS"] = 35661] = "MAX_COMBINED_TEXTURE_IMAGE_UNITS";
gl2[gl2["MAX_VERTEX_TEXTURE_IMAGE_UNITS"] = 35660] = "MAX_VERTEX_TEXTURE_IMAGE_UNITS";
gl2[gl2["MAX_TEXTURE_IMAGE_UNITS"] = 34930] = "MAX_TEXTURE_IMAGE_UNITS";
gl2[gl2["MAX_FRAGMENT_UNIFORM_VECTORS"] = 36349] = "MAX_FRAGMENT_UNIFORM_VECTORS";
gl2[gl2["SHADER_TYPE"] = 35663] = "SHADER_TYPE";
gl2[gl2["DELETE_STATUS"] = 35712] = "DELETE_STATUS";
gl2[gl2["LINK_STATUS"] = 35714] = "LINK_STATUS";
gl2[gl2["VALIDATE_STATUS"] = 35715] = "VALIDATE_STATUS";
gl2[gl2["ATTACHED_SHADERS"] = 35717] = "ATTACHED_SHADERS";
gl2[gl2["ACTIVE_UNIFORMS"] = 35718] = "ACTIVE_UNIFORMS";
gl2[gl2["ACTIVE_ATTRIBUTES"] = 35721] = "ACTIVE_ATTRIBUTES";
gl2[gl2["SHADING_LANGUAGE_VERSION"] = 35724] = "SHADING_LANGUAGE_VERSION";
gl2[gl2["CURRENT_PROGRAM"] = 35725] = "CURRENT_PROGRAM";
gl2[gl2["NEVER"] = 512] = "NEVER";
gl2[gl2["LESS"] = 513] = "LESS";
gl2[gl2["EQUAL"] = 514] = "EQUAL";
gl2[gl2["LEQUAL"] = 515] = "LEQUAL";
gl2[gl2["GREATER"] = 516] = "GREATER";
gl2[gl2["NOTEQUAL"] = 517] = "NOTEQUAL";
gl2[gl2["GEQUAL"] = 518] = "GEQUAL";
gl2[gl2["ALWAYS"] = 519] = "ALWAYS";
gl2[gl2["KEEP"] = 7680] = "KEEP";
gl2[gl2["REPLACE"] = 7681] = "REPLACE";
gl2[gl2["INCR"] = 7682] = "INCR";
gl2[gl2["DECR"] = 7683] = "DECR";
gl2[gl2["INVERT"] = 5386] = "INVERT";
gl2[gl2["INCR_WRAP"] = 34055] = "INCR_WRAP";
gl2[gl2["DECR_WRAP"] = 34056] = "DECR_WRAP";
gl2[gl2["VENDOR"] = 7936] = "VENDOR";
gl2[gl2["RENDERER"] = 7937] = "RENDERER";
gl2[gl2["VERSION"] = 7938] = "VERSION";
gl2[gl2["NEAREST"] = 9728] = "NEAREST";
gl2[gl2["LINEAR"] = 9729] = "LINEAR";
gl2[gl2["NEAREST_MIPMAP_NEAREST"] = 9984] = "NEAREST_MIPMAP_NEAREST";
gl2[gl2["LINEAR_MIPMAP_NEAREST"] = 9985] = "LINEAR_MIPMAP_NEAREST";
gl2[gl2["NEAREST_MIPMAP_LINEAR"] = 9986] = "NEAREST_MIPMAP_LINEAR";
gl2[gl2["LINEAR_MIPMAP_LINEAR"] = 9987] = "LINEAR_MIPMAP_LINEAR";
gl2[gl2["TEXTURE_MAG_FILTER"] = 10240] = "TEXTURE_MAG_FILTER";
gl2[gl2["TEXTURE_MIN_FILTER"] = 10241] = "TEXTURE_MIN_FILTER";
gl2[gl2["TEXTURE_WRAP_S"] = 10242] = "TEXTURE_WRAP_S";
gl2[gl2["TEXTURE_WRAP_T"] = 10243] = "TEXTURE_WRAP_T";
gl2[gl2["TEXTURE_2D"] = 3553] = "TEXTURE_2D";
gl2[gl2["TEXTURE"] = 5890] = "TEXTURE";
gl2[gl2["TEXTURE_CUBE_MAP"] = 34067] = "TEXTURE_CUBE_MAP";
gl2[gl2["TEXTURE_BINDING_CUBE_MAP"] = 34068] = "TEXTURE_BINDING_CUBE_MAP";
gl2[gl2["TEXTURE_CUBE_MAP_POSITIVE_X"] = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X";
gl2[gl2["TEXTURE_CUBE_MAP_NEGATIVE_X"] = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X";
gl2[gl2["TEXTURE_CUBE_MAP_POSITIVE_Y"] = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y";
gl2[gl2["TEXTURE_CUBE_MAP_NEGATIVE_Y"] = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y";
gl2[gl2["TEXTURE_CUBE_MAP_POSITIVE_Z"] = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z";
gl2[gl2["TEXTURE_CUBE_MAP_NEGATIVE_Z"] = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z";
gl2[gl2["MAX_CUBE_MAP_TEXTURE_SIZE"] = 34076] = "MAX_CUBE_MAP_TEXTURE_SIZE";
gl2[gl2["TEXTURE0"] = 33984] = "TEXTURE0";
gl2[gl2["TEXTURE1"] = 33985] = "TEXTURE1";
gl2[gl2["TEXTURE2"] = 33986] = "TEXTURE2";
gl2[gl2["TEXTURE3"] = 33987] = "TEXTURE3";
gl2[gl2["TEXTURE4"] = 33988] = "TEXTURE4";
gl2[gl2["TEXTURE5"] = 33989] = "TEXTURE5";
gl2[gl2["TEXTURE6"] = 33990] = "TEXTURE6";
gl2[gl2["TEXTURE7"] = 33991] = "TEXTURE7";
gl2[gl2["TEXTURE8"] = 33992] = "TEXTURE8";
gl2[gl2["TEXTURE9"] = 33993] = "TEXTURE9";
gl2[gl2["TEXTURE10"] = 33994] = "TEXTURE10";
gl2[gl2["TEXTURE11"] = 33995] = "TEXTURE11";
gl2[gl2["TEXTURE12"] = 33996] = "TEXTURE12";
gl2[gl2["TEXTURE13"] = 33997] = "TEXTURE13";
gl2[gl2["TEXTURE14"] = 33998] = "TEXTURE14";
gl2[gl2["TEXTURE15"] = 33999] = "TEXTURE15";
gl2[gl2["TEXTURE16"] = 34e3] = "TEXTURE16";
gl2[gl2["TEXTURE17"] = 34001] = "TEXTURE17";
gl2[gl2["TEXTURE18"] = 34002] = "TEXTURE18";
gl2[gl2["TEXTURE19"] = 34003] = "TEXTURE19";
gl2[gl2["TEXTURE20"] = 34004] = "TEXTURE20";
gl2[gl2["TEXTURE21"] = 34005] = "TEXTURE21";
gl2[gl2["TEXTURE22"] = 34006] = "TEXTURE22";
gl2[gl2["TEXTURE23"] = 34007] = "TEXTURE23";
gl2[gl2["TEXTURE24"] = 34008] = "TEXTURE24";
gl2[gl2["TEXTURE25"] = 34009] = "TEXTURE25";
gl2[gl2["TEXTURE26"] = 34010] = "TEXTURE26";
gl2[gl2["TEXTURE27"] = 34011] = "TEXTURE27";
gl2[gl2["TEXTURE28"] = 34012] = "TEXTURE28";
gl2[gl2["TEXTURE29"] = 34013] = "TEXTURE29";
gl2[gl2["TEXTURE30"] = 34014] = "TEXTURE30";
gl2[gl2["TEXTURE31"] = 34015] = "TEXTURE31";
gl2[gl2["ACTIVE_TEXTURE"] = 34016] = "ACTIVE_TEXTURE";
gl2[gl2["REPEAT"] = 10497] = "REPEAT";
gl2[gl2["CLAMP_TO_EDGE"] = 33071] = "CLAMP_TO_EDGE";
gl2[gl2["MIRRORED_REPEAT"] = 33648] = "MIRRORED_REPEAT";
gl2[gl2["FLOAT_VEC2"] = 35664] = "FLOAT_VEC2";
gl2[gl2["FLOAT_VEC3"] = 35665] = "FLOAT_VEC3";
gl2[gl2["FLOAT_VEC4"] = 35666] = "FLOAT_VEC4";
gl2[gl2["INT_VEC2"] = 35667] = "INT_VEC2";
gl2[gl2["INT_VEC3"] = 35668] = "INT_VEC3";
gl2[gl2["INT_VEC4"] = 35669] = "INT_VEC4";
gl2[gl2["BOOL"] = 35670] = "BOOL";
gl2[gl2["BOOL_VEC2"] = 35671] = "BOOL_VEC2";
gl2[gl2["BOOL_VEC3"] = 35672] = "BOOL_VEC3";
gl2[gl2["BOOL_VEC4"] = 35673] = "BOOL_VEC4";
gl2[gl2["FLOAT_MAT2"] = 35674] = "FLOAT_MAT2";
gl2[gl2["FLOAT_MAT3"] = 35675] = "FLOAT_MAT3";
gl2[gl2["FLOAT_MAT4"] = 35676] = "FLOAT_MAT4";
gl2[gl2["SAMPLER_2D"] = 35678] = "SAMPLER_2D";
gl2[gl2["SAMPLER_CUBE"] = 35680] = "SAMPLER_CUBE";
gl2[gl2["VERTEX_ATTRIB_ARRAY_ENABLED"] = 34338] = "VERTEX_ATTRIB_ARRAY_ENABLED";
gl2[gl2["VERTEX_ATTRIB_ARRAY_SIZE"] = 34339] = "VERTEX_ATTRIB_ARRAY_SIZE";
gl2[gl2["VERTEX_ATTRIB_ARRAY_STRIDE"] = 34340] = "VERTEX_ATTRIB_ARRAY_STRIDE";
gl2[gl2["VERTEX_ATTRIB_ARRAY_TYPE"] = 34341] = "VERTEX_ATTRIB_ARRAY_TYPE";
gl2[gl2["VERTEX_ATTRIB_ARRAY_NORMALIZED"] = 34922] = "VERTEX_ATTRIB_ARRAY_NORMALIZED";
gl2[gl2["VERTEX_ATTRIB_ARRAY_POINTER"] = 34373] = "VERTEX_ATTRIB_ARRAY_POINTER";
gl2[gl2["VERTEX_ATTRIB_ARRAY_BUFFER_BINDING"] = 34975] = "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING";
gl2[gl2["COMPILE_STATUS"] = 35713] = "COMPILE_STATUS";
gl2[gl2["LOW_FLOAT"] = 36336] = "LOW_FLOAT";
gl2[gl2["MEDIUM_FLOAT"] = 36337] = "MEDIUM_FLOAT";
gl2[gl2["HIGH_FLOAT"] = 36338] = "HIGH_FLOAT";
gl2[gl2["LOW_INT"] = 36339] = "LOW_INT";
gl2[gl2["MEDIUM_INT"] = 36340] = "MEDIUM_INT";
gl2[gl2["HIGH_INT"] = 36341] = "HIGH_INT";
gl2[gl2["FRAMEBUFFER"] = 36160] = "FRAMEBUFFER";
gl2[gl2["RENDERBUFFER"] = 36161] = "RENDERBUFFER";
gl2[gl2["RGBA4"] = 32854] = "RGBA4";
gl2[gl2["RGB5_A1"] = 32855] = "RGB5_A1";
gl2[gl2["RGB565"] = 36194] = "RGB565";
gl2[gl2["DEPTH_COMPONENT16"] = 33189] = "DEPTH_COMPONENT16";
gl2[gl2["STENCIL_INDEX"] = 6401] = "STENCIL_INDEX";
gl2[gl2["STENCIL_INDEX8"] = 36168] = "STENCIL_INDEX8";
gl2[gl2["DEPTH_STENCIL"] = 34041] = "DEPTH_STENCIL";
gl2[gl2["RENDERBUFFER_WIDTH"] = 36162] = "RENDERBUFFER_WIDTH";
gl2[gl2["RENDERBUFFER_HEIGHT"] = 36163] = "RENDERBUFFER_HEIGHT";
gl2[gl2["RENDERBUFFER_INTERNAL_FORMAT"] = 36164] = "RENDERBUFFER_INTERNAL_FORMAT";
gl2[gl2["RENDERBUFFER_RED_SIZE"] = 36176] = "RENDERBUFFER_RED_SIZE";
gl2[gl2["RENDERBUFFER_GREEN_SIZE"] = 36177] = "RENDERBUFFER_GREEN_SIZE";
gl2[gl2["RENDERBUFFER_BLUE_SIZE"] = 36178] = "RENDERBUFFER_BLUE_SIZE";
gl2[gl2["RENDERBUFFER_ALPHA_SIZE"] = 36179] = "RENDERBUFFER_ALPHA_SIZE";
gl2[gl2["RENDERBUFFER_DEPTH_SIZE"] = 36180] = "RENDERBUFFER_DEPTH_SIZE";
gl2[gl2["RENDERBUFFER_STENCIL_SIZE"] = 36181] = "RENDERBUFFER_STENCIL_SIZE";
gl2[gl2["FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE"] = 36048] = "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE";
gl2[gl2["FRAMEBUFFER_ATTACHMENT_OBJECT_NAME"] = 36049] = "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME";
gl2[gl2["FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL"] = 36050] = "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL";
gl2[gl2["FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE"] = 36051] = "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE";
gl2[gl2["COLOR_ATTACHMENT0"] = 36064] = "COLOR_ATTACHMENT0";
gl2[gl2["DEPTH_ATTACHMENT"] = 36096] = "DEPTH_ATTACHMENT";
gl2[gl2["STENCIL_ATTACHMENT"] = 36128] = "STENCIL_ATTACHMENT";
gl2[gl2["DEPTH_STENCIL_ATTACHMENT"] = 33306] = "DEPTH_STENCIL_ATTACHMENT";
gl2[gl2["NONE"] = 0] = "NONE";
gl2[gl2["FRAMEBUFFER_COMPLETE"] = 36053] = "FRAMEBUFFER_COMPLETE";
gl2[gl2["FRAMEBUFFER_INCOMPLETE_ATTACHMENT"] = 36054] = "FRAMEBUFFER_INCOMPLETE_ATTACHMENT";
gl2[gl2["FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT"] = 36055] = "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";
gl2[gl2["FRAMEBUFFER_INCOMPLETE_DIMENSIONS"] = 36057] = "FRAMEBUFFER_INCOMPLETE_DIMENSIONS";
gl2[gl2["FRAMEBUFFER_UNSUPPORTED"] = 36061] = "FRAMEBUFFER_UNSUPPORTED";
gl2[gl2["FRAMEBUFFER_BINDING"] = 36006] = "FRAMEBUFFER_BINDING";
gl2[gl2["RENDERBUFFER_BINDING"] = 36007] = "RENDERBUFFER_BINDING";
gl2[gl2["MAX_RENDERBUFFER_SIZE"] = 34024] = "MAX_RENDERBUFFER_SIZE";
gl2[gl2["INVALID_FRAMEBUFFER_OPERATION"] = 1286] = "INVALID_FRAMEBUFFER_OPERATION";
gl2[gl2["UNPACK_FLIP_Y_WEBGL"] = 37440] = "UNPACK_FLIP_Y_WEBGL";
gl2[gl2["UNPACK_PREMULTIPLY_ALPHA_WEBGL"] = 37441] = "UNPACK_PREMULTIPLY_ALPHA_WEBGL";
gl2[gl2["CONTEXT_LOST_WEBGL"] = 37442] = "CONTEXT_LOST_WEBGL";
gl2[gl2["UNPACK_COLORSPACE_CONVERSION_WEBGL"] = 37443] = "UNPACK_COLORSPACE_CONVERSION_WEBGL";
gl2[gl2["BROWSER_DEFAULT_WEBGL"] = 37444] = "BROWSER_DEFAULT_WEBGL";
gl2[gl2["COPY_SRC"] = 1] = "COPY_SRC";
gl2[gl2["COPY_DST"] = 2] = "COPY_DST";
gl2[gl2["SAMPLED"] = 4] = "SAMPLED";
gl2[gl2["STORAGE"] = 8] = "STORAGE";
gl2[gl2["RENDER_ATTACHMENT"] = 16] = "RENDER_ATTACHMENT";
})(gl || (gl = {}));
// node_modules/@antv/g-webgpu-core/es/components/geometry/System.js
var _dec3;
var _dec22;
var _dec32;
var _class3;
var _class23;
var _descriptor2;
var _descriptor22;
var _temp2;
var GeometrySystem = (_dec3 = (0, import_inversify2.injectable)(), _dec22 = (0, import_inversify2.inject)(IDENTIFIER.GeometryComponentManager), _dec32 = (0, import_inversify2.inject)(IDENTIFIER.RenderEngine), _dec3(_class3 = (_class23 = (_temp2 = /* @__PURE__ */ function() {
function GeometrySystem2() {
_classCallCheck(this, GeometrySystem2);
_initializerDefineProperty(this, "geometry", _descriptor2, this);
_initializerDefineProperty(this, "engine", _descriptor22, this);
}
_createClass(GeometrySystem2, [{
key: "execute",
value: function() {
var _execute = _asyncToGenerator(/* @__PURE__ */ import_regenerator3.default.mark(function _callee() {
var _this = this;
return import_regenerator3.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
this.geometry.forEach(function(entity, component2) {
if (component2.dirty) {
component2.attributes.forEach(function(attribute) {
if (attribute.dirty && attribute.data) {
if (!attribute.buffer) {
attribute.buffer = _this.engine.createBuffer({
data: attribute.data,
type: gl.FLOAT
});
} else {
var _attribute$buffer;
(_attribute$buffer = attribute.buffer) === null || _attribute$buffer === void 0 ? void 0 : _attribute$buffer.subData({
data: attribute.data,
offset: 0
});
}
attribute.dirty = false;
}
});
if (component2.indices) {
if (!component2.indicesBuffer) {
component2.indicesBuffer = _this.engine.createElements({
data: component2.indices,
count: component2.indices.length,
type: gl.UNSIGNED_INT,
usage: gl.STATIC_DRAW
});
} else {
component2.indicesBuffer.subData({
data: component2.indices,
offset: 0
});
}
}
component2.dirty = false;
}
});
case 1:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
function execute() {
return _execute.apply(this, arguments);
}
return execute;
}()
}, {
key: "tearDown",
value: function tearDown() {
this.geometry.forEach(function(_8, geometry35) {
if (geometry35.indicesBuffer) {
geometry35.indicesBuffer.destroy();
}
geometry35.attributes.forEach(function(attribute) {
if (attribute.buffer) {
attribute.buffer.destroy();
}
});
});
this.geometry.clear();
}
}, {
key: "createBufferGeometry",
value: function createBufferGeometry() {
var _ref2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
vertexCount: 3
}, vertexCount = _ref2.vertexCount;
var entity = createEntity();
return this.geometry.create(entity, {
vertexCount
});
}
}, {
key: "createInstancedBufferGeometry",
value: function createInstancedBufferGeometry(_ref2) {
var maxInstancedCount = _ref2.maxInstancedCount, vertexCount = _ref2.vertexCount;
var entity = createEntity();
return this.geometry.create(entity, {
maxInstancedCount,
vertexCount
});
}
}]);
return GeometrySystem2;
}(), _temp2), _descriptor2 = _applyDecoratedDescriptor(_class23.prototype, "geometry", [_dec22], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor22 = _applyDecoratedDescriptor(_class23.prototype, "engine", [_dec32], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class23)) || _class3);
// node_modules/@antv/g-webgpu-core/es/components/material/MaterialComponent.js
function ownKeys2(object, enumerableOnly) {
var keys2 = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys2.push.apply(keys2, symbols);
}
return keys2;
}
function _objectSpread2(target) {
for (var i4 = 1; i4 < arguments.length; i4++) {
var source = arguments[i4] != null ? arguments[i4] : {};
if (i4 % 2) {
ownKeys2(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys2(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _createSuper3(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct3();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived), result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _isNativeReflectConstruct3() {
if (typeof Reflect === "undefined" || !Reflect.construct)
return false;
if (Reflect.construct.sham)
return false;
if (typeof Proxy === "function")
return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function() {
}));
return true;
} catch (e4) {
return false;
}
}
var MaterialComponent = /* @__PURE__ */ function(_Component) {
_inherits(MaterialComponent2, _Component);
var _super = _createSuper3(MaterialComponent2);
function MaterialComponent2(data3) {
var _this;
_classCallCheck(this, MaterialComponent2);
_this = _super.call(this, data3);
_this.vertexShaderGLSL = void 0;
_this.fragmentShaderGLSL = void 0;
_this.defines = {};
_this.dirty = true;
_this.uniforms = [];
_this.cull = {
enable: true,
face: gl.BACK
};
_this.depth = {
enable: true
};
_this.blend = void 0;
_this.entity = void 0;
_this.type = void 0;
Object.assign(_assertThisInitialized(_this), data3);
return _this;
}
_createClass(MaterialComponent2, [{
key: "setDefines",
value: function setDefines(defines) {
this.defines = _objectSpread2(_objectSpread2({}, this.defines), defines);
return this;
}
}, {
key: "setCull",
value: function setCull(cull) {
this.cull = cull;
return this;
}
}, {
key: "setDepth",
value: function setDepth(depth) {
this.depth = depth;
return this;
}
}, {
key: "setBlend",
value: function setBlend(blend2) {
this.blend = blend2;
return this;
}
}, {
key: "setUniform",
value: function setUniform(name, data3) {
var _this2 = this;
if (typeof name !== "string") {
Object.keys(name).forEach(function(key) {
return _this2.setUniform(key, name[key]);
});
return this;
}
var existedUniform = this.uniforms.find(function(u3) {
return u3.name === name;
});
if (!existedUniform) {
this.uniforms.push({
name,
dirty: true,
data: data3
});
} else {
existedUniform.dirty = true;
existedUniform.data = data3;
}
this.dirty = true;
return this;
}
}]);
return MaterialComponent2;
}(Component2);
// node_modules/@antv/g-webgpu-core/es/components/material/System.js
var import_regenerator4 = __toModule(require_regenerator());
var import_inversify3 = __toModule(require_inversify());
var _dec4;
var _dec23;
var _dec33;
var _dec42;
var _class4;
var _class24;
var _descriptor3;
var _descriptor23;
var _descriptor32;
var _temp3;
function ownKeys3(object, enumerableOnly) {
var keys2 = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys2.push.apply(keys2, symbols);
}
return keys2;
}
function _objectSpread3(target) {
for (var i4 = 1; i4 < arguments.length; i4++) {
var source = arguments[i4] != null ? arguments[i4] : {};
if (i4 % 2) {
ownKeys3(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys3(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
var MaterialSystem = (_dec4 = (0, import_inversify3.injectable)(), _dec23 = (0, import_inversify3.inject)(IDENTIFIER.MaterialComponentManager), _dec33 = (0, import_inversify3.inject)(IDENTIFIER.RenderEngine), _dec42 = (0, import_inversify3.inject)(IDENTIFIER.ShaderModuleService), _dec4(_class4 = (_class24 = (_temp3 = /* @__PURE__ */ function() {
function MaterialSystem2() {
_classCallCheck(this, MaterialSystem2);
_initializerDefineProperty(this, "material", _descriptor3, this);
_initializerDefineProperty(this, "engine", _descriptor23, this);
_initializerDefineProperty(this, "shaderModule", _descriptor32, this);
}
_createClass(MaterialSystem2, [{
key: "execute",
value: function() {
var _execute = _asyncToGenerator(/* @__PURE__ */ import_regenerator4.default.mark(function _callee() {
return import_regenerator4.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
case "end":
return _context.stop();
}
}
}, _callee);
}));
function execute() {
return _execute.apply(this, arguments);
}
return execute;
}()
}, {
key: "tearDown",
value: function tearDown() {
this.material.clear();
}
}, {
key: "createShaderMaterial",
value: function createShaderMaterial(params) {
var entity = createEntity();
var vertexShaderGLSL = params.vertexShader;
var fragmentShaderGLSL = params.fragmentShader;
var uniforms = [];
if (!this.engine.supportWebGPU) {
var moduleName = "material-".concat(entity);
this.shaderModule.registerModule(moduleName, {
vs: params.vertexShader,
fs: params.fragmentShader
});
var materialModule = this.shaderModule.getModule(moduleName);
vertexShaderGLSL = materialModule.vs;
fragmentShaderGLSL = materialModule.fs;
if (materialModule.uniforms) {
uniforms = Object.keys(materialModule.uniforms).map(function(uniformName) {
return {
dirty: true,
name: uniformName,
data: materialModule.uniforms[uniformName]
};
});
}
}
return this.material.create(entity, _objectSpread3(_objectSpread3({
vertexShaderGLSL,
fragmentShaderGLSL
}, params), {}, {
uniforms
}));
}
}]);
return MaterialSystem2;
}(), _temp3), _descriptor3 = _applyDecoratedDescriptor(_class24.prototype, "material", [_dec23], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor23 = _applyDecoratedDescriptor(_class24.prototype, "engine", [_dec33], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor32 = _applyDecoratedDescriptor(_class24.prototype, "shaderModule", [_dec42], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class24)) || _class4);
// node_modules/@antv/g-webgpu-core/es/components/mesh/CullableComponent.js
function _createSuper4(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct4();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived), result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _isNativeReflectConstruct4() {
if (typeof Reflect === "undefined" || !Reflect.construct)
return false;
if (Reflect.construct.sham)
return false;
if (typeof Proxy === "function")
return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function() {
}));
return true;
} catch (e4) {
return false;
}
}
var Strategy;
(function(Strategy2) {
Strategy2[Strategy2["Standard"] = 0] = "Standard";
})(Strategy || (Strategy = {}));
var CullableComponent = /* @__PURE__ */ function(_Component) {
_inherits(CullableComponent2, _Component);
var _super = _createSuper4(CullableComponent2);
function CullableComponent2(data3) {
var _this;
_classCallCheck(this, CullableComponent2);
_this = _super.call(this, data3);
_this.strategy = Strategy.Standard;
_this.visibilityPlaneMask = 0;
_this.visible = false;
Object.assign(_assertThisInitialized(_this), data3);
return _this;
}
return CullableComponent2;
}(Component2);
// node_modules/@antv/g-webgpu-core/es/shape/AABB.js
var AABB = /* @__PURE__ */ function() {
function AABB2(center2, halfExtents) {
_classCallCheck(this, AABB2);
this.center = void 0;
this.halfExtents = void 0;
this.min = vec3_exports.create();
this.max = vec3_exports.create();
this.update(center2, halfExtents);
}
_createClass(AABB2, [{
key: "update",
value: function update15(center2, halfExtents) {
this.center = center2 || vec3_exports.create();
this.halfExtents = halfExtents || vec3_exports.fromValues(0.5, 0.5, 0.5);
this.min = vec3_exports.sub(this.min, this.center, this.halfExtents);
this.max = vec3_exports.add(this.max, this.center, this.halfExtents);
}
}, {
key: "setMinMax",
value: function setMinMax(min7, max8) {
vec3_exports.add(this.center, max8, min7);
vec3_exports.scale(this.center, this.center, 0.5);
vec3_exports.sub(this.halfExtents, max8, min7);
vec3_exports.scale(this.halfExtents, this.halfExtents, 0.5);
vec3_exports.copy(this.min, min7);
vec3_exports.copy(this.max, max8);
}
}, {
key: "getMin",
value: function getMin() {
return this.min;
}
}, {
key: "getMax",
value: function getMax() {
return this.max;
}
}, {
key: "add",
value: function add8(aabb) {
var tc = this.center;
var tcx = tc[0];
var tcy = tc[1];
var tcz = tc[2];
var th = this.halfExtents;
var thx = th[0];
var thy = th[1];
var thz = th[2];
var tminx = tcx - thx;
var tmaxx = tcx + thx;
var tminy = tcy - thy;
var tmaxy = tcy + thy;
var tminz = tcz - thz;
var tmaxz = tcz + thz;
var oc = aabb.center;
var ocx = oc[0];
var ocy = oc[1];
var ocz = oc[2];
var oh = aabb.halfExtents;
var ohx = oh[0];
var ohy = oh[1];
var ohz = oh[2];
var ominx = ocx - ohx;
var omaxx = ocx + ohx;
var ominy = ocy - ohy;
var omaxy = ocy + ohy;
var ominz = ocz - ohz;
var omaxz = ocz + ohz;
if (ominx < tminx) {
tminx = ominx;
}
if (omaxx > tmaxx) {
tmaxx = omaxx;
}
if (ominy < tminy) {
tminy = ominy;
}
if (omaxy > tmaxy) {
tmaxy = omaxy;
}
if (ominz < tminz) {
tminz = ominz;
}
if (omaxz > tmaxz) {
tmaxz = omaxz;
}
tc[0] = (tminx + tmaxx) * 0.5;
tc[1] = (tminy + tmaxy) * 0.5;
tc[2] = (tminz + tmaxz) * 0.5;
th[0] = (tmaxx - tminx) * 0.5;
th[1] = (tmaxy - tminy) * 0.5;
th[2] = (tmaxz - tminz) * 0.5;
this.min[0] = tminx;
this.min[1] = tminy;
this.min[2] = tminz;
this.max[0] = tmaxx;
this.max[1] = tmaxy;
this.max[2] = tmaxz;
}
}, {
key: "intersects",
value: function intersects2(aabb) {
var aMax = this.getMax();
var aMin = this.getMin();
var bMax = aabb.getMax();
var bMin = aabb.getMin();
return aMin[0] <= bMax[0] && aMax[0] >= bMin[0] && aMin[1] <= bMax[1] && aMax[1] >= bMin[1] && aMin[2] <= bMax[2] && aMax[2] >= bMin[2];
}
}, {
key: "containsPoint",
value: function containsPoint(point2) {
var min7 = this.getMin();
var max8 = this.getMax();
return !(point2[0] < min7[0] || point2[0] > max8[0] || point2[1] < min7[1] || point2[1] > max8[1] || point2[2] < min7[2] || point2[2] > max8[2]);
}
}, {
key: "getNegativeFarPoint",
value: function getNegativeFarPoint(plane) {
if (plane.pnVertexFlag === 273) {
return vec3_exports.copy(vec3_exports.create(), this.min);
} else if (plane.pnVertexFlag === 272) {
return vec3_exports.fromValues(this.min[0], this.min[1], this.max[2]);
} else if (plane.pnVertexFlag === 257) {
return vec3_exports.fromValues(this.min[0], this.max[1], this.min[2]);
} else if (plane.pnVertexFlag === 256) {
return vec3_exports.fromValues(this.min[0], this.max[1], this.max[2]);
} else if (plane.pnVertexFlag === 17) {
return vec3_exports.fromValues(this.max[0], this.min[1], this.min[2]);
} else if (plane.pnVertexFlag === 16) {
return vec3_exports.fromValues(this.max[0], this.min[1], this.max[2]);
} else if (plane.pnVertexFlag === 1) {
return vec3_exports.fromValues(this.max[0], this.max[1], this.min[2]);
} else {
return vec3_exports.fromValues(this.max[0], this.max[1], this.max[2]);
}
}
}, {
key: "getPositiveFarPoint",
value: function getPositiveFarPoint(plane) {
if (plane.pnVertexFlag === 273) {
return vec3_exports.copy(vec3_exports.create(), this.max);
} else if (plane.pnVertexFlag === 272) {
return vec3_exports.fromValues(this.max[0], this.max[1], this.min[2]);
} else if (plane.pnVertexFlag === 257) {
return vec3_exports.fromValues(this.max[0], this.min[1], this.max[2]);
} else if (plane.pnVertexFlag === 256) {
return vec3_exports.fromValues(this.max[0], this.min[1], this.min[2]);
} else if (plane.pnVertexFlag === 17) {
return vec3_exports.fromValues(this.min[0], this.max[1], this.max[2]);
} else if (plane.pnVertexFlag === 16) {
return vec3_exports.fromValues(this.min[0], this.max[1], this.min[2]);
} else if (plane.pnVertexFlag === 1) {
return vec3_exports.fromValues(this.min[0], this.min[1], this.max[2]);
} else {
return vec3_exports.fromValues(this.min[0], this.min[1], this.min[2]);
}
}
}]);
return AABB2;
}();
// node_modules/@antv/g-webgpu-core/es/components/mesh/MeshComponent.js
function _createSuper5(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct5();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived), result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _isNativeReflectConstruct5() {
if (typeof Reflect === "undefined" || !Reflect.construct)
return false;
if (Reflect.construct.sham)
return false;
if (typeof Proxy === "function")
return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function() {
}));
return true;
} catch (e4) {
return false;
}
}
var MeshComponent = /* @__PURE__ */ function(_Component) {
_inherits(MeshComponent2, _Component);
var _super = _createSuper5(MeshComponent2);
function MeshComponent2(data3) {
var _this;
_classCallCheck(this, MeshComponent2);
_this = _super.call(this, data3);
_this.material = void 0;
_this.geometry = void 0;
_this.aabb = new AABB();
_this.aabbDirty = true;
_this.model = void 0;
_this.visible = true;
_this.children = [];
Object.assign(_assertThisInitialized(_this), data3);
return _this;
}
return MeshComponent2;
}(Component2);
// node_modules/@antv/g-webgpu-core/es/components/mesh/System.js
var import_regenerator5 = __toModule(require_regenerator());
var import_inversify4 = __toModule(require_inversify());
// node_modules/@antv/g-webgpu-core/es/shape/Plane.js
var Plane = /* @__PURE__ */ function() {
function Plane3(distance15, normal2) {
_classCallCheck(this, Plane3);
this.distance = void 0;
this.normal = void 0;
this.pnVertexFlag = void 0;
this.distance = distance15 || 0;
this.normal = normal2 || vec3_exports.fromValues(0, 1, 0);
this.updatePNVertexFlag();
}
_createClass(Plane3, [{
key: "updatePNVertexFlag",
value: function updatePNVertexFlag() {
this.pnVertexFlag = (Number(this.normal[0] >= 0) << 8) + (Number(this.normal[1] >= 0) << 4) + Number(this.normal[2] >= 0);
}
}, {
key: "distanceToPoint",
value: function distanceToPoint(point2) {
return vec3_exports.dot(point2, this.normal) - this.distance;
}
}, {
key: "normalize",
value: function normalize5() {
var invLen = 1 / vec3_exports.len(this.normal);
vec3_exports.scale(this.normal, this.normal, invLen);
this.distance *= invLen;
}
}, {
key: "intersectsLine",
value: function intersectsLine(start, end2, point2) {
var d0 = this.distanceToPoint(start);
var d1 = this.distanceToPoint(end2);
var t4 = d0 / (d0 - d1);
var intersects2 = t4 >= 0 && t4 <= 1;
if (intersects2 && point2) {
vec3_exports.lerp(point2, start, end2, t4);
}
return intersects2;
}
}]);
return Plane3;
}();
// node_modules/@antv/g-webgpu-core/es/shape/Frustum.js
var Mask;
(function(Mask2) {
Mask2[Mask2["OUTSIDE"] = 4294967295] = "OUTSIDE";
Mask2[Mask2["INSIDE"] = 0] = "INSIDE";
Mask2[Mask2["INDETERMINATE"] = 2147483647] = "INDETERMINATE";
})(Mask || (Mask = {}));
var Frustum = /* @__PURE__ */ function() {
function Frustum2(planes) {
_classCallCheck(this, Frustum2);
this.planes = [];
if (planes) {
this.planes = planes;
} else {
for (var i4 = 0; i4 < 6; i4++) {
this.planes.push(new Plane());
}
}
}
_createClass(Frustum2, [{
key: "extractFromVPMatrix",
value: function extractFromVPMatrix(vpMatrix) {
var _vpMatrix = _slicedToArray(vpMatrix, 16), m0 = _vpMatrix[0], m1 = _vpMatrix[1], m22 = _vpMatrix[2], m32 = _vpMatrix[3], m4 = _vpMatrix[4], m5 = _vpMatrix[5], m6 = _vpMatrix[6], m7 = _vpMatrix[7], m8 = _vpMatrix[8], m9 = _vpMatrix[9], m10 = _vpMatrix[10], m11 = _vpMatrix[11], m12 = _vpMatrix[12], m13 = _vpMatrix[13], m14 = _vpMatrix[14], m15 = _vpMatrix[15];
vec3_exports.set(this.planes[0].normal, m32 - m0, m7 - m4, m11 - m8);
this.planes[0].distance = -(m15 - m12);
vec3_exports.set(this.planes[1].normal, m32 + m0, m7 + m4, m11 + m8);
this.planes[1].distance = -(m15 + m12);
vec3_exports.set(this.planes[2].normal, m32 + m1, m7 + m5, m11 + m9);
this.planes[2].distance = -(m15 + m13);
vec3_exports.set(this.planes[3].normal, m32 - m1, m7 - m5, m11 - m9);
this.planes[3].distance = -(m15 - m13);
vec3_exports.set(this.planes[4].normal, m32 - m22, m7 - m6, m11 - m10);
this.planes[4].distance = -(m15 - m14);
vec3_exports.set(this.planes[5].normal, m32 + m22, m7 + m6, m11 + m10);
this.planes[5].distance = -(m15 + m14);
this.planes.forEach(function(plane) {
plane.normalize();
plane.updatePNVertexFlag();
});
}
}]);
return Frustum2;
}();
// node_modules/@antv/g-webgpu-core/es/utils/math.js
function getRotationScale(matrix, result) {
result[0] = matrix[0];
result[1] = matrix[1];
result[2] = matrix[2];
result[3] = matrix[4];
result[4] = matrix[5];
result[5] = matrix[6];
result[6] = matrix[8];
result[7] = matrix[9];
result[8] = matrix[10];
return result;
}
function decodePickingColor(color4) {
var _color = _slicedToArray(color4, 3), i1 = _color[0], i22 = _color[1], i32 = _color[2];
var index2 = i1 + i22 * 256 + i32 * 65536 - 1;
return index2;
}
// node_modules/@antv/g-webgpu-core/es/components/mesh/System.js
var _dec5;
var _dec24;
var _dec34;
var _dec43;
var _dec52;
var _dec6;
var _class5;
var _class25;
var _descriptor4;
var _descriptor24;
var _descriptor33;
var _descriptor42;
var _descriptor5;
var _temp4;
function _createForOfIteratorHelper2(o3, allowArrayLike) {
var it;
if (typeof Symbol === "undefined" || o3[Symbol.iterator] == null) {
if (Array.isArray(o3) || (it = _unsupportedIterableToArray3(o3)) || allowArrayLike && o3 && typeof o3.length === "number") {
if (it)
o3 = it;
var i4 = 0;
var F3 = function F4() {
};
return { s: F3, n: function n3() {
if (i4 >= o3.length)
return { done: true };
return { done: false, value: o3[i4++] };
}, e: function e4(_e) {
throw _e;
}, f: F3 };
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var normalCompletion = true, didErr = false, err;
return { s: function s4() {
it = o3[Symbol.iterator]();
}, n: function n3() {
var step = it.next();
normalCompletion = step.done;
return step;
}, e: function e4(_e2) {
didErr = true;
err = _e2;
}, f: function f3() {
try {
if (!normalCompletion && it.return != null)
it.return();
} finally {
if (didErr)
throw err;
}
} };
}
function _unsupportedIterableToArray3(o3, minLen) {
if (!o3)
return;
if (typeof o3 === "string")
return _arrayLikeToArray3(o3, minLen);
var n3 = Object.prototype.toString.call(o3).slice(8, -1);
if (n3 === "Object" && o3.constructor)
n3 = o3.constructor.name;
if (n3 === "Map" || n3 === "Set")
return Array.from(o3);
if (n3 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n3))
return _arrayLikeToArray3(o3, minLen);
}
function _arrayLikeToArray3(arr, len5) {
if (len5 == null || len5 > arr.length)
len5 = arr.length;
for (var i4 = 0, arr2 = new Array(len5); i4 < len5; i4++) {
arr2[i4] = arr[i4];
}
return arr2;
}
var MeshSystem = (_dec5 = (0, import_inversify4.injectable)(), _dec24 = (0, import_inversify4.inject)(IDENTIFIER.MeshComponentManager), _dec34 = (0, import_inversify4.inject)(IDENTIFIER.CullableComponentManager), _dec43 = (0, import_inversify4.inject)(IDENTIFIER.GeometryComponentManager), _dec52 = (0, import_inversify4.inject)(IDENTIFIER.HierarchyComponentManager), _dec6 = (0, import_inversify4.inject)(IDENTIFIER.TransformComponentManager), _dec5(_class5 = (_class25 = (_temp4 = /* @__PURE__ */ function() {
function MeshSystem2() {
_classCallCheck(this, MeshSystem2);
_initializerDefineProperty(this, "mesh", _descriptor4, this);
_initializerDefineProperty(this, "cullable", _descriptor24, this);
_initializerDefineProperty(this, "geometry", _descriptor33, this);
_initializerDefineProperty(this, "hierarchy", _descriptor42, this);
_initializerDefineProperty(this, "transform", _descriptor5, this);
this.planes = void 0;
}
_createClass(MeshSystem2, [{
key: "setFrustumPlanes",
value: function setFrustumPlanes(planes) {
this.planes = planes;
}
}, {
key: "execute",
value: function() {
var _execute = _asyncToGenerator(/* @__PURE__ */ import_regenerator5.default.mark(function _callee(views) {
var _iterator, _step, view, scene, camera, _iterator2, _step2, entity, component2, hierarchyComponent, cullableComponent, geometryComponent, meshTransform, worldTransform, _geometryComponent$aa, center2, halfExtents, transformedCenter, rotationScale, transformedHalfExtents, parentCullableComponent;
return import_regenerator5.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_iterator = _createForOfIteratorHelper2(views);
try {
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
view = _step.value;
scene = view.getScene();
camera = view.getCamera();
_iterator2 = _createForOfIteratorHelper2(scene.getEntities());
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
entity = _step2.value;
component2 = this.mesh.getComponentByEntity(entity);
if (component2) {
hierarchyComponent = this.hierarchy.getComponentByEntity(entity);
cullableComponent = this.cullable.getComponentByEntity(entity);
geometryComponent = component2.geometry;
meshTransform = this.transform.getComponentByEntity(entity);
if (geometryComponent && geometryComponent.aabb && meshTransform && component2.aabbDirty) {
worldTransform = meshTransform.worldTransform;
_geometryComponent$aa = geometryComponent.aabb, center2 = _geometryComponent$aa.center, halfExtents = _geometryComponent$aa.halfExtents;
transformedCenter = vec3_exports.transformMat4(vec3_exports.create(), center2, worldTransform);
rotationScale = getRotationScale(worldTransform, mat3_exports.create());
transformedHalfExtents = vec3_exports.transformMat3(vec3_exports.create(), halfExtents, rotationScale);
component2.aabb.update(transformedCenter, transformedHalfExtents);
component2.aabbDirty = false;
}
if (cullableComponent && geometryComponent) {
parentCullableComponent = this.cullable.getComponentByEntity((hierarchyComponent === null || hierarchyComponent === void 0 ? void 0 : hierarchyComponent.parentID) || -1);
cullableComponent.visibilityPlaneMask = this.computeVisibilityWithPlaneMask(component2.aabb, (parentCullableComponent === null || parentCullableComponent === void 0 ? void 0 : parentCullableComponent.visibilityPlaneMask) || Mask.INDETERMINATE, this.planes || camera.getFrustum().planes);
cullableComponent.visible = cullableComponent.visibilityPlaneMask !== Mask.OUTSIDE;
}
}
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
case 2:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
function execute(_x) {
return _execute.apply(this, arguments);
}
return execute;
}()
}, {
key: "tearDown",
value: function tearDown() {
this.cullable.clear();
this.mesh.clear();
}
}, {
key: "computeVisibilityWithPlaneMask",
value: function computeVisibilityWithPlaneMask(aabb, parentPlaneMask, planes) {
if (parentPlaneMask === Mask.OUTSIDE || parentPlaneMask === Mask.INSIDE) {
return parentPlaneMask;
}
var mask = Mask.INSIDE;
for (var k4 = 0, len5 = planes.length; k4 < len5; ++k4) {
var flag = k4 < 31 ? 1 << k4 : 0;
if (k4 < 31 && (parentPlaneMask & flag) === 0) {
continue;
}
var _planes$k = planes[k4], normal2 = _planes$k.normal, distance15 = _planes$k.distance;
if (vec3_exports.dot(normal2, aabb.getNegativeFarPoint(planes[k4])) + distance15 > 0) {
return Mask.OUTSIDE;
}
if (vec3_exports.dot(normal2, aabb.getPositiveFarPoint(planes[k4])) + distance15 > 0) {
mask |= flag;
}
}
return mask;
}
}]);
return MeshSystem2;
}(), _temp4), _descriptor4 = _applyDecoratedDescriptor(_class25.prototype, "mesh", [_dec24], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor24 = _applyDecoratedDescriptor(_class25.prototype, "cullable", [_dec34], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor33 = _applyDecoratedDescriptor(_class25.prototype, "geometry", [_dec43], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor42 = _applyDecoratedDescriptor(_class25.prototype, "hierarchy", [_dec52], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor5 = _applyDecoratedDescriptor(_class25.prototype, "transform", [_dec6], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class25)) || _class5);
// node_modules/@antv/g-webgpu-core/es/components/renderer/passes/PixelPickingPass.js
var import_regenerator7 = __toModule(require_regenerator());
var import_inversify6 = __toModule(require_inversify());
// node_modules/@antv/g-webgpu-core/es/components/renderer/passes/RenderPass.js
var import_regenerator6 = __toModule(require_regenerator());
var import_inversify5 = __toModule(require_inversify());
var _dec7;
var _dec25;
var _dec35;
var _dec44;
var _dec53;
var _dec62;
var _dec72;
var _dec8;
var _dec9;
var _dec10;
var _dec11;
var _class6;
var _class26;
var _descriptor6;
var _descriptor25;
var _descriptor34;
var _descriptor43;
var _descriptor52;
var _descriptor62;
var _descriptor7;
var _descriptor8;
var _descriptor9;
var _class32;
var _temp5;
function _createForOfIteratorHelper3(o3, allowArrayLike) {
var it;
if (typeof Symbol === "undefined" || o3[Symbol.iterator] == null) {
if (Array.isArray(o3) || (it = _unsupportedIterableToArray4(o3)) || allowArrayLike && o3 && typeof o3.length === "number") {
if (it)
o3 = it;
var i4 = 0;
var F3 = function F4() {
};
return { s: F3, n: function n3() {
if (i4 >= o3.length)
return { done: true };
return { done: false, value: o3[i4++] };
}, e: function e4(_e) {
throw _e;
}, f: F3 };
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var normalCompletion = true, didErr = false, err;
return { s: function s4() {
it = o3[Symbol.iterator]();
}, n: function n3() {
var step = it.next();
normalCompletion = step.done;
return step;
}, e: function e4(_e2) {
didErr = true;
err = _e2;
}, f: function f3() {
try {
if (!normalCompletion && it.return != null)
it.return();
} finally {
if (didErr)
throw err;
}
} };
}
function _unsupportedIterableToArray4(o3, minLen) {
if (!o3)
return;
if (typeof o3 === "string")
return _arrayLikeToArray4(o3, minLen);
var n3 = Object.prototype.toString.call(o3).slice(8, -1);
if (n3 === "Object" && o3.constructor)
n3 = o3.constructor.name;
if (n3 === "Map" || n3 === "Set")
return Array.from(o3);
if (n3 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n3))
return _arrayLikeToArray4(o3, minLen);
}
function _arrayLikeToArray4(arr, len5) {
if (len5 == null || len5 > arr.length)
len5 = arr.length;
for (var i4 = 0, arr2 = new Array(len5); i4 < len5; i4++) {
arr2[i4] = arr[i4];
}
return arr2;
}
var RenderPass = (_dec7 = (0, import_inversify5.injectable)(), _dec25 = (0, import_inversify5.inject)(IDENTIFIER.MeshComponentManager), _dec35 = (0, import_inversify5.inject)(IDENTIFIER.GeometryComponentManager), _dec44 = (0, import_inversify5.inject)(IDENTIFIER.MaterialComponentManager), _dec53 = (0, import_inversify5.inject)(IDENTIFIER.CullableComponentManager), _dec62 = (0, import_inversify5.inject)(IDENTIFIER.TransformComponentManager), _dec72 = (0, import_inversify5.inject)(IDENTIFIER.HierarchyComponentManager), _dec8 = (0, import_inversify5.inject)(IDENTIFIER.Systems), _dec9 = (0, import_inversify5.named)(IDENTIFIER.FrameGraphSystem), _dec10 = (0, import_inversify5.inject)(IDENTIFIER.RenderEngine), _dec11 = (0, import_inversify5.inject)(IDENTIFIER.ResourcePool), _dec7(_class6 = (_class26 = (_temp5 = _class32 = /* @__PURE__ */ function() {
function RenderPass2() {
var _this = this;
_classCallCheck(this, RenderPass2);
_initializerDefineProperty(this, "mesh", _descriptor6, this);
_initializerDefineProperty(this, "geometry", _descriptor25, this);
_initializerDefineProperty(this, "material", _descriptor34, this);
_initializerDefineProperty(this, "cullable", _descriptor43, this);
_initializerDefineProperty(this, "transform", _descriptor52, this);
_initializerDefineProperty(this, "hierarchy", _descriptor62, this);
_initializerDefineProperty(this, "frameGraphSystem", _descriptor7, this);
_initializerDefineProperty(this, "engine", _descriptor8, this);
_initializerDefineProperty(this, "resourcePool", _descriptor9, this);
this.modelCache = {};
this.setup = function(fg, passNode, pass) {
var output = fg.createRenderTarget(passNode, "color buffer", {
width: 1,
height: 1,
usage: gl.RENDER_ATTACHMENT | gl.SAMPLED | gl.COPY_SRC
});
pass.data = {
output: passNode.write(fg, output)
};
};
this.execute = /* @__PURE__ */ function() {
var _ref2 = _asyncToGenerator(/* @__PURE__ */ import_regenerator6.default.mark(function _callee(fg, pass, views) {
var resourceNode, framebuffer, _iterator, _step, view, canvas;
return import_regenerator6.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
resourceNode = fg.getResourceNode(pass.data.output);
framebuffer = _this.resourcePool.getOrCreateResource(resourceNode.resource);
_iterator = _createForOfIteratorHelper3(views);
_context.prev = 3;
_iterator.s();
case 5:
if ((_step = _iterator.n()).done) {
_context.next = 11;
break;
}
view = _step.value;
_context.next = 9;
return _this.initView(view);
case 9:
_context.next = 5;
break;
case 11:
_context.next = 16;
break;
case 13:
_context.prev = 13;
_context.t0 = _context["catch"](3);
_iterator.e(_context.t0);
case 16:
_context.prev = 16;
_iterator.f();
return _context.finish(16);
case 19:
canvas = _this.engine.getCanvas();
framebuffer.resize({
width: canvas.width,
height: canvas.height
});
_this.engine.setScissor({
enable: false
});
_this.engine.clear({
framebuffer,
color: views[0].getClearColor(),
depth: 1
});
_this.engine.useFramebuffer(framebuffer, function() {
var _iterator2 = _createForOfIteratorHelper3(views), _step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
var view2 = _step2.value;
_this.renderView(view2);
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
});
case 24:
case "end":
return _context.stop();
}
}
}, _callee, null, [[3, 13, 16, 19]]);
}));
return function(_x, _x2, _x3) {
return _ref2.apply(this, arguments);
};
}();
}
_createClass(RenderPass2, [{
key: "renderView",
value: function renderView(view) {
var scene = view.getScene();
var camera = view.getCamera();
var viewMatrix = camera.getViewTransform();
var viewProjectionMatrix = mat4_exports.multiply(mat4_exports.create(), camera.getPerspective(), viewMatrix);
camera.getFrustum().extractFromVPMatrix(viewProjectionMatrix);
var _view$getViewport = view.getViewport(), x6 = _view$getViewport.x, y5 = _view$getViewport.y, width2 = _view$getViewport.width, height = _view$getViewport.height;
this.engine.viewport({
x: x6,
y: y5,
width: width2,
height
});
var _iterator3 = _createForOfIteratorHelper3(scene.getEntities()), _step3;
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) {
var meshEntity = _step3.value;
this.renderMesh(meshEntity, {
camera,
view,
viewMatrix
});
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
}
}
}, {
key: "renderMesh",
value: function renderMesh(meshEntity, _ref2) {
var camera = _ref2.camera, view = _ref2.view, viewMatrix = _ref2.viewMatrix;
var mesh = this.mesh.getComponentByEntity(meshEntity);
if (!mesh || !mesh.visible) {
return;
}
var material = mesh.material;
var geometry35 = mesh.geometry;
if (!geometry35 || geometry35.dirty || !material) {
return;
}
var transform18 = this.transform.getComponentByEntity(meshEntity);
var modelViewMatrix = mat4_exports.multiply(mat4_exports.create(), viewMatrix, transform18.worldTransform);
var _view$getViewport2 = view.getViewport(), width2 = _view$getViewport2.width, height = _view$getViewport2.height;
material.setUniform({
projectionMatrix: camera.getPerspective(),
modelViewMatrix,
modelMatrix: transform18.worldTransform,
viewMatrix,
cameraPosition: camera.getPosition(),
u_viewport: [width2, height]
});
if (mesh.model) {
mesh.model.draw({
uniforms: material.uniforms.reduce(function(cur, prev) {
cur[prev.name] = prev.data;
return cur;
}, {})
});
material.uniforms.forEach(function(u3) {
u3.dirty = false;
});
material.dirty = false;
}
}
}, {
key: "initMesh",
value: function() {
var _initMesh = _asyncToGenerator(/* @__PURE__ */ import_regenerator6.default.mark(function _callee2(meshEntity, view) {
var mesh, material, geometry35, modelCacheKey, _this$engine, createModel, createAttribute, modelInitializationOptions;
return import_regenerator6.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
mesh = this.mesh.getComponentByEntity(meshEntity);
if (mesh) {
_context2.next = 3;
break;
}
return _context2.abrupt("return");
case 3:
material = mesh.material;
geometry35 = mesh.geometry;
if (!(!geometry35 || geometry35.dirty || !material)) {
_context2.next = 7;
break;
}
return _context2.abrupt("return");
case 7:
if (mesh.model) {
_context2.next = 24;
break;
}
modelCacheKey = "m-".concat(material.entity, "-g-").concat(geometry35.entity);
if (!this.modelCache[modelCacheKey]) {
_context2.next = 12;
break;
}
mesh.model = this.modelCache[modelCacheKey];
return _context2.abrupt("return");
case 12:
material.setUniform({
projectionMatrix: 1,
modelViewMatrix: 1,
modelMatrix: 1,
viewMatrix: 1,
cameraPosition: 1,
u_viewport: 1
});
_this$engine = this.engine, createModel = _this$engine.createModel, createAttribute = _this$engine.createAttribute;
modelInitializationOptions = {
vs: material.vertexShaderGLSL,
fs: material.fragmentShaderGLSL,
defines: material.defines,
attributes: geometry35.attributes.reduce(function(cur, prev) {
if (prev.data && prev.buffer) {
cur[prev.name] = createAttribute({
buffer: prev.buffer,
attributes: prev.attributes,
arrayStride: prev.arrayStride,
stepMode: prev.stepMode,
divisor: prev.stepMode === "vertex" ? 0 : 1
});
}
return cur;
}, {}),
uniforms: material.uniforms.reduce(function(cur, prev) {
cur[prev.name] = prev.data;
return cur;
}, {}),
scissor: {
enable: true,
box: function box2() {
return view.getViewport();
}
}
};
if (material.cull) {
modelInitializationOptions.cull = material.cull;
}
if (material.depth) {
modelInitializationOptions.depth = material.depth;
}
if (material.blend) {
modelInitializationOptions.blend = material.blend;
}
if (geometry35.indicesBuffer) {
modelInitializationOptions.elements = geometry35.indicesBuffer;
}
if (geometry35.maxInstancedCount) {
modelInitializationOptions.instances = geometry35.maxInstancedCount;
modelInitializationOptions.count = geometry35.vertexCount || 3;
}
_context2.next = 22;
return createModel(modelInitializationOptions);
case 22:
mesh.model = _context2.sent;
this.modelCache[modelCacheKey] = mesh.model;
case 24:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
function initMesh(_x4, _x5) {
return _initMesh.apply(this, arguments);
}
return initMesh;
}()
}, {
key: "initView",
value: function() {
var _initView = _asyncToGenerator(/* @__PURE__ */ import_regenerator6.default.mark(function _callee3(view) {
var scene, _iterator4, _step4, meshEntity;
return import_regenerator6.default.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
scene = view.getScene();
_iterator4 = _createForOfIteratorHelper3(scene.getEntities());
_context3.prev = 2;
_iterator4.s();
case 4:
if ((_step4 = _iterator4.n()).done) {
_context3.next = 10;
break;
}
meshEntity = _step4.value;
_context3.next = 8;
return this.initMesh(meshEntity, view);
case 8:
_context3.next = 4;
break;
case 10:
_context3.next = 15;
break;
case 12:
_context3.prev = 12;
_context3.t0 = _context3["catch"](2);
_iterator4.e(_context3.t0);
case 15:
_context3.prev = 15;
_iterator4.f();
return _context3.finish(15);
case 18:
case "end":
return _context3.stop();
}
}
}, _callee3, this, [[2, 12, 15, 18]]);
}));
function initView(_x6) {
return _initView.apply(this, arguments);
}
return initView;
}()
}]);
return RenderPass2;
}(), _class32.IDENTIFIER = "Render Pass", _temp5), _descriptor6 = _applyDecoratedDescriptor(_class26.prototype, "mesh", [_dec25], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor25 = _applyDecoratedDescriptor(_class26.prototype, "geometry", [_dec35], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor34 = _applyDecoratedDescriptor(_class26.prototype, "material", [_dec44], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor43 = _applyDecoratedDescriptor(_class26.prototype, "cullable", [_dec53], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor52 = _applyDecoratedDescriptor(_class26.prototype, "transform", [_dec62], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor62 = _applyDecoratedDescriptor(_class26.prototype, "hierarchy", [_dec72], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor7 = _applyDecoratedDescriptor(_class26.prototype, "frameGraphSystem", [_dec8, _dec9], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor8 = _applyDecoratedDescriptor(_class26.prototype, "engine", [_dec10], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor9 = _applyDecoratedDescriptor(_class26.prototype, "resourcePool", [_dec11], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class26)) || _class6);
// node_modules/@antv/g-webgpu-core/es/components/renderer/passes/PixelPickingPass.js
var _dec12;
var _dec26;
var _dec36;
var _dec45;
var _dec54;
var _class7;
var _class27;
var _descriptor10;
var _descriptor26;
var _descriptor35;
var _descriptor44;
var _class33;
var _temp6;
function _createForOfIteratorHelper4(o3, allowArrayLike) {
var it;
if (typeof Symbol === "undefined" || o3[Symbol.iterator] == null) {
if (Array.isArray(o3) || (it = _unsupportedIterableToArray5(o3)) || allowArrayLike && o3 && typeof o3.length === "number") {
if (it)
o3 = it;
var i4 = 0;
var F3 = function F4() {
};
return { s: F3, n: function n3() {
if (i4 >= o3.length)
return { done: true };
return { done: false, value: o3[i4++] };
}, e: function e4(_e) {
throw _e;
}, f: F3 };
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var normalCompletion = true, didErr = false, err;
return { s: function s4() {
it = o3[Symbol.iterator]();
}, n: function n3() {
var step = it.next();
normalCompletion = step.done;
return step;
}, e: function e4(_e2) {
didErr = true;
err = _e2;
}, f: function f3() {
try {
if (!normalCompletion && it.return != null)
it.return();
} finally {
if (didErr)
throw err;
}
} };
}
function _unsupportedIterableToArray5(o3, minLen) {
if (!o3)
return;
if (typeof o3 === "string")
return _arrayLikeToArray5(o3, minLen);
var n3 = Object.prototype.toString.call(o3).slice(8, -1);
if (n3 === "Object" && o3.constructor)
n3 = o3.constructor.name;
if (n3 === "Map" || n3 === "Set")
return Array.from(o3);
if (n3 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n3))
return _arrayLikeToArray5(o3, minLen);
}
function _arrayLikeToArray5(arr, len5) {
if (len5 == null || len5 > arr.length)
len5 = arr.length;
for (var i4 = 0, arr2 = new Array(len5); i4 < len5; i4++) {
arr2[i4] = arr[i4];
}
return arr2;
}
var PickingStage = {
NONE: 0,
ENCODE: 1,
HIGHLIGHT: 2
};
var PixelPickingPass = (_dec12 = (0, import_inversify6.injectable)(), _dec26 = (0, import_inversify6.inject)(IDENTIFIER.RenderEngine), _dec36 = (0, import_inversify6.inject)(IDENTIFIER.ResourcePool), _dec45 = (0, import_inversify6.inject)(IDENTIFIER.RenderPassFactory), _dec54 = (0, import_inversify6.inject)(IDENTIFIER.MeshComponentManager), _dec12(_class7 = (_class27 = (_temp6 = _class33 = /* @__PURE__ */ function() {
function PixelPickingPass2() {
var _this = this;
_classCallCheck(this, PixelPickingPass2);
_initializerDefineProperty(this, "engine", _descriptor10, this);
_initializerDefineProperty(this, "resourcePool", _descriptor26, this);
_initializerDefineProperty(this, "renderPassFactory", _descriptor35, this);
_initializerDefineProperty(this, "mesh", _descriptor44, this);
this.pickingFBO = void 0;
this.views = void 0;
this.highlightEnabled = true;
this.highlightColor = [255, 0, 0, 255];
this.alreadyInRendering = false;
this.setup = function(fg, passNode, pass) {
var output = fg.createRenderTarget(passNode, "picking fbo", {
width: 1,
height: 1
});
pass.data = {
output: passNode.write(fg, output)
};
passNode.hasSideEffect = true;
};
this.execute = /* @__PURE__ */ function() {
var _ref2 = _asyncToGenerator(/* @__PURE__ */ import_regenerator7.default.mark(function _callee(fg, pass, views) {
var _iterator, _step, _loop;
return import_regenerator7.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_this.views = views;
if (!_this.alreadyInRendering) {
_context.next = 3;
break;
}
return _context.abrupt("return");
case 3:
_iterator = _createForOfIteratorHelper4(views);
try {
_loop = function _loop2() {
var view = _step.value;
var _view$getViewport = view.getViewport(), width2 = _view$getViewport.width, height = _view$getViewport.height;
_this.alreadyInRendering = true;
var resourceNode = fg.getResourceNode(pass.data.output);
_this.pickingFBO = _this.resourcePool.getOrCreateResource(resourceNode.resource);
_this.pickingFBO.resize({
width: width2,
height
});
_this.engine.useFramebuffer(_this.pickingFBO, function() {
_this.engine.clear({
framebuffer: _this.pickingFBO,
color: [0, 0, 0, 0],
stencil: 0,
depth: 1
});
var renderPass = _this.renderPassFactory(RenderPass.IDENTIFIER);
var meshes = [];
var scene = view.getScene();
var _iterator2 = _createForOfIteratorHelper4(scene.getEntities()), _step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
var meshEntity = _step2.value;
var mesh = _this.mesh.getComponentByEntity(meshEntity);
var material = mesh.material;
material.setUniform("u_PickingStage", PickingStage.ENCODE);
meshes.push(mesh);
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
renderPass.renderView(view);
meshes.forEach(function(mesh2) {
var material2 = mesh2.material;
material2.setUniform("u_PickingStage", PickingStage.HIGHLIGHT);
});
_this.alreadyInRendering = false;
});
};
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
_loop();
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
case 5:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return function(_x, _x2, _x3) {
return _ref2.apply(this, arguments);
};
}();
this.pick = function(_ref2, view) {
var x6 = _ref2.x, y5 = _ref2.y;
var _this$engine = _this.engine, readPixels = _this$engine.readPixels, useFramebuffer = _this$engine.useFramebuffer;
var _view$getViewport2 = view.getViewport(), width2 = _view$getViewport2.width, height = _view$getViewport2.height;
var xInDevicePixel = x6 * window.devicePixelRatio;
var yInDevicePixel = y5 * window.devicePixelRatio;
if (xInDevicePixel > width2 || xInDevicePixel < 0 || yInDevicePixel > height || yInDevicePixel < 0) {
return;
}
var pickedColors;
var pickedFeatureIdx;
useFramebuffer(_this.pickingFBO, function() {
pickedColors = readPixels({
x: Math.round(xInDevicePixel),
y: Math.round(height - (y5 + 1) * window.devicePixelRatio),
width: 1,
height: 1,
data: new Uint8Array(1 * 1 * 4),
framebuffer: _this.pickingFBO
});
if (pickedColors[0] !== 0 || pickedColors[1] !== 0 || pickedColors[2] !== 0) {
pickedFeatureIdx = decodePickingColor(pickedColors);
if (_this.highlightEnabled) {
_this.highlightPickedFeature(pickedColors, view);
}
}
});
return pickedFeatureIdx;
};
}
_createClass(PixelPickingPass2, [{
key: "enableHighlight",
value: function enableHighlight(enabled) {
this.highlightEnabled = enabled;
}
}, {
key: "setHighlightColor",
value: function setHighlightColor(color4) {
this.highlightColor = color4;
}
}, {
key: "highlightPickedFeature",
value: function highlightPickedFeature(pickedColors, view) {
if (pickedColors) {
var _iterator3 = _createForOfIteratorHelper4(view.getScene().getEntities()), _step3;
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) {
var meshEntity = _step3.value;
var mesh = this.mesh.getComponentByEntity(meshEntity);
var material = mesh.material;
material.setUniform("u_PickingStage", PickingStage.HIGHLIGHT);
material.setUniform("u_PickingColor", [pickedColors[0], pickedColors[1], pickedColors[2]]);
material.setUniform("u_HighlightColor", this.highlightColor);
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
}
}
}
}]);
return PixelPickingPass2;
}(), _class33.IDENTIFIER = "PixelPicking Pass", _temp6), _descriptor10 = _applyDecoratedDescriptor(_class27.prototype, "engine", [_dec26], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor26 = _applyDecoratedDescriptor(_class27.prototype, "resourcePool", [_dec36], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor35 = _applyDecoratedDescriptor(_class27.prototype, "renderPassFactory", [_dec45], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor44 = _applyDecoratedDescriptor(_class27.prototype, "mesh", [_dec54], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class27)) || _class7);
// node_modules/@antv/g-webgpu-core/es/components/renderer/System.js
var import_regenerator9 = __toModule(require_regenerator());
var import_inversify8 = __toModule(require_inversify());
// node_modules/@antv/g-webgpu-core/es/components/renderer/passes/CopyPass.js
var import_regenerator8 = __toModule(require_regenerator());
var import_inversify7 = __toModule(require_inversify());
var _dec13;
var _dec27;
var _dec37;
var _class8;
var _class28;
var _descriptor11;
var _descriptor27;
var _class34;
var _temp7;
var copyFrag = "varying vec2 v_UV;\n\nuniform sampler2D u_Texture;\n\nvoid main() {\n gl_FragColor = vec4(texture2D(u_Texture, v_UV));\n}";
var copyVert = "attribute vec2 a_Position;\n\nvarying vec2 v_UV;\n\nvoid main() {\n v_UV = 0.5 * (a_Position + 1.0);\n gl_Position = vec4(a_Position, 0., 1.);\n}";
var copyFragWebGPU = "layout(set = 0, binding = 0) uniform sampler u_TextureSampler;\nlayout(set = 0, binding = 1) uniform texture2D u_Texture;\n\nlayout(location = 0) in vec2 v_UV;\nlayout(location = 0) out vec4 outColor;\n\nvoid main() {\n outColor = texture(sampler2D(u_Texture, u_TextureSampler), v_UV);\n}";
var copyVertWebGPU = "layout(location = 0) in vec2 a_Position;\nlayout(location = 0) out vec2 v_UV;\n\nvoid main() {\n v_UV = 0.5 * (a_Position + 1.0);\n gl_Position = vec4(a_Position, 0., 1.);\n}";
var CopyPass = (_dec13 = (0, import_inversify7.injectable)(), _dec27 = (0, import_inversify7.inject)(IDENTIFIER.RenderEngine), _dec37 = (0, import_inversify7.inject)(IDENTIFIER.ResourcePool), _dec13(_class8 = (_class28 = (_temp7 = _class34 = function CopyPass2() {
var _this = this;
_classCallCheck(this, CopyPass2);
_initializerDefineProperty(this, "engine", _descriptor11, this);
_initializerDefineProperty(this, "resourcePool", _descriptor27, this);
this.model = void 0;
this.setup = function(fg, passNode, pass) {
var renderPass = fg.getPass(RenderPass.IDENTIFIER);
if (renderPass) {
var output = fg.createRenderTarget(passNode, "render to screen", {
width: 1,
height: 1
});
pass.data = {
input: passNode.read(renderPass.data.output),
output: passNode.write(fg, output)
};
}
};
this.execute = /* @__PURE__ */ function() {
var _ref2 = _asyncToGenerator(/* @__PURE__ */ import_regenerator8.default.mark(function _callee(fg, pass) {
var _this$engine, createModel, createAttribute, createBuffer, model, resourceNode, framebuffer;
return import_regenerator8.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_this$engine = _this.engine, createModel = _this$engine.createModel, createAttribute = _this$engine.createAttribute, createBuffer = _this$engine.createBuffer;
if (_this.model) {
_context.next = 6;
break;
}
_context.next = 4;
return createModel({
vs: _this.engine.supportWebGPU ? copyVertWebGPU : copyVert,
fs: _this.engine.supportWebGPU ? copyFragWebGPU : copyFrag,
attributes: {
a_Position: createAttribute({
buffer: createBuffer({
data: [-4, -4, 4, -4, 0, 4],
type: gl.FLOAT
}),
size: 2,
arrayStride: 2 * 4,
stepMode: "vertex",
attributes: [{
shaderLocation: 0,
offset: 0,
format: "float2"
}]
})
},
uniforms: {
u_Texture: null
},
depth: {
enable: false
},
count: 3,
blend: {
enable: true
}
});
case 4:
model = _context.sent;
_this.model = model;
case 6:
resourceNode = fg.getResourceNode(pass.data.input);
framebuffer = _this.resourcePool.getOrCreateResource(resourceNode.resource);
_this.engine.useFramebuffer(null, function() {
_this.engine.clear({
framebuffer: null,
color: [0, 0, 0, 0],
depth: 1,
stencil: 0
});
_this.model.draw({
uniforms: {
u_Texture: framebuffer
}
});
});
case 9:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return function(_x, _x2) {
return _ref2.apply(this, arguments);
};
}();
this.tearDown = function() {
_this.model = void 0;
};
}, _class34.IDENTIFIER = "Copy Pass", _temp7), _descriptor11 = _applyDecoratedDescriptor(_class28.prototype, "engine", [_dec27], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor27 = _applyDecoratedDescriptor(_class28.prototype, "resourcePool", [_dec37], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class28)) || _class8);
// node_modules/@antv/g-webgpu-core/es/components/renderer/System.js
var _dec14;
var _dec28;
var _dec38;
var _dec46;
var _dec55;
var _dec63;
var _class9;
var _class29;
var _descriptor12;
var _descriptor28;
var _descriptor36;
var _descriptor45;
var _temp8;
var RendererSystem = (_dec14 = (0, import_inversify8.injectable)(), _dec28 = (0, import_inversify8.inject)(IDENTIFIER.Systems), _dec38 = (0, import_inversify8.named)(IDENTIFIER.FrameGraphSystem), _dec46 = (0, import_inversify8.inject)(IDENTIFIER.RenderPassFactory), _dec55 = (0, import_inversify8.inject)(IDENTIFIER.ConfigService), _dec63 = (0, import_inversify8.inject)(IDENTIFIER.ResourcePool), _dec14(_class9 = (_class29 = (_temp8 = /* @__PURE__ */ function() {
function RendererSystem2() {
_classCallCheck(this, RendererSystem2);
_initializerDefineProperty(this, "frameGraphSystem", _descriptor12, this);
_initializerDefineProperty(this, "renderPassFactory", _descriptor28, this);
_initializerDefineProperty(this, "configService", _descriptor36, this);
_initializerDefineProperty(this, "resourcePool", _descriptor45, this);
}
_createClass(RendererSystem2, [{
key: "execute",
value: function() {
var _execute = _asyncToGenerator(/* @__PURE__ */ import_regenerator9.default.mark(function _callee(views) {
var _this$renderPassFacto, setupRenderPass, executeRenderPass, renderPass, _this$renderPassFacto2, setupCopyPass, executeCopyPass, tearDownCopyPass, copyPass;
return import_regenerator9.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_this$renderPassFacto = this.renderPassFactory(RenderPass.IDENTIFIER), setupRenderPass = _this$renderPassFacto.setup, executeRenderPass = _this$renderPassFacto.execute;
renderPass = this.frameGraphSystem.addPass(RenderPass.IDENTIFIER, setupRenderPass, executeRenderPass);
_this$renderPassFacto2 = this.renderPassFactory(CopyPass.IDENTIFIER), setupCopyPass = _this$renderPassFacto2.setup, executeCopyPass = _this$renderPassFacto2.execute, tearDownCopyPass = _this$renderPassFacto2.tearDown;
copyPass = this.frameGraphSystem.addPass(CopyPass.IDENTIFIER, setupCopyPass, executeCopyPass, tearDownCopyPass);
this.frameGraphSystem.present(copyPass.data.output);
case 5:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
function execute(_x) {
return _execute.apply(this, arguments);
}
return execute;
}()
}, {
key: "tearDown",
value: function tearDown() {
this.resourcePool.clean();
}
}, {
key: "pick",
value: function pick2(position2, view) {
var pickingPass = this.renderPassFactory(PixelPickingPass.IDENTIFIER);
return pickingPass.pick(position2, view);
}
}]);
return RendererSystem2;
}(), _temp8), _descriptor12 = _applyDecoratedDescriptor(_class29.prototype, "frameGraphSystem", [_dec28, _dec38], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor28 = _applyDecoratedDescriptor(_class29.prototype, "renderPassFactory", [_dec46], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor36 = _applyDecoratedDescriptor(_class29.prototype, "configService", [_dec55], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor45 = _applyDecoratedDescriptor(_class29.prototype, "resourcePool", [_dec63], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class29)) || _class9);
// node_modules/@antv/g-webgpu-core/es/components/scenegraph/HierarchyComponent.js
function _createSuper6(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct6();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived), result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _isNativeReflectConstruct6() {
if (typeof Reflect === "undefined" || !Reflect.construct)
return false;
if (Reflect.construct.sham)
return false;
if (typeof Proxy === "function")
return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function() {
}));
return true;
} catch (e4) {
return false;
}
}
var HierarchyComponent = /* @__PURE__ */ function(_Component) {
_inherits(HierarchyComponent2, _Component);
var _super = _createSuper6(HierarchyComponent2);
function HierarchyComponent2(data3) {
var _this;
_classCallCheck(this, HierarchyComponent2);
_this = _super.call(this, data3);
_this.parentID = void 0;
Object.assign(_assertThisInitialized(_this), data3);
return _this;
}
return HierarchyComponent2;
}(Component2);
// node_modules/@antv/g-webgpu-core/es/components/scenegraph/System.js
var import_regenerator10 = __toModule(require_regenerator());
var import_inversify9 = __toModule(require_inversify());
var _dec15;
var _dec29;
var _dec39;
var _dec47;
var _class10;
var _class210;
var _descriptor13;
var _descriptor29;
var _descriptor37;
var _temp9;
var SceneGraphSystem = (_dec15 = (0, import_inversify9.injectable)(), _dec29 = (0, import_inversify9.inject)(IDENTIFIER.HierarchyComponentManager), _dec39 = (0, import_inversify9.inject)(IDENTIFIER.TransformComponentManager), _dec47 = (0, import_inversify9.inject)(IDENTIFIER.MeshComponentManager), _dec15(_class10 = (_class210 = (_temp9 = /* @__PURE__ */ function() {
function SceneGraphSystem2() {
_classCallCheck(this, SceneGraphSystem2);
_initializerDefineProperty(this, "hierarchy", _descriptor13, this);
_initializerDefineProperty(this, "transform", _descriptor29, this);
_initializerDefineProperty(this, "mesh", _descriptor37, this);
}
_createClass(SceneGraphSystem2, [{
key: "execute",
value: function() {
var _execute = _asyncToGenerator(/* @__PURE__ */ import_regenerator10.default.mark(function _callee() {
return import_regenerator10.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
this.runTransformUpdateSystem();
this.runHierarchyUpdateSystem();
case 2:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
function execute() {
return _execute.apply(this, arguments);
}
return execute;
}()
}, {
key: "tearDown",
value: function tearDown() {
this.hierarchy.clear();
this.transform.clear();
}
}, {
key: "getHierarchyComponentManager",
value: function getHierarchyComponentManager() {
return this.hierarchy;
}
}, {
key: "getTransformComponentManager",
value: function getTransformComponentManager() {
return this.transform;
}
}, {
key: "runTransformUpdateSystem",
value: function runTransformUpdateSystem() {
var _this = this;
this.transform.forEach(function(entity, transform18) {
if (transform18.isDirty() || transform18.isLocalDirty()) {
_this.setMeshAABBDirty(_this.mesh.getComponentByEntity(entity));
transform18.updateTransform();
}
});
}
}, {
key: "runHierarchyUpdateSystem",
value: function runHierarchyUpdateSystem() {
var _this2 = this;
this.hierarchy.forEach(function(entity, parentComponent) {
var transformChild = _this2.transform.getComponentByEntity(entity);
var transformParent = _this2.transform.getComponentByEntity(parentComponent.parentID);
if (transformChild !== null && transformParent !== null) {
transformChild.updateTransformWithParent(transformParent);
}
});
}
}, {
key: "attach",
value: function attach(entity, parent, isChildAlreadyInLocalSpace) {
if (this.hierarchy.contains(entity)) {
this.detach(entity);
}
this.hierarchy.create(entity, {
parentID: parent
});
var mesh = this.mesh.getComponentByEntity(parent);
this.setMeshAABBDirty(mesh);
if (mesh && mesh.children.indexOf(entity) === -1) {
mesh.children.push(entity);
}
if (this.hierarchy.getCount() > 1) {
for (var i4 = this.hierarchy.getCount() - 1; i4 > 0; --i4) {
var parentCandidateEntity = this.hierarchy.getEntity(i4);
for (var j4 = 0; j4 < i4; ++j4) {
var childCandidateEntity = this.hierarchy.getComponent(j4);
if (childCandidateEntity.parentID === parentCandidateEntity) {
this.hierarchy.moveItem(i4, j4);
++i4;
break;
}
}
}
}
var parentcomponent = this.hierarchy.getComponentByEntity(entity);
var transformParent = this.transform.getComponentByEntity(parent);
if (transformParent === null) {
transformParent = this.transform.create(parent);
}
var transformChild = this.transform.getComponentByEntity(entity);
if (transformChild === null) {
transformChild = this.transform.create(entity);
transformParent = this.transform.getComponentByEntity(parent);
}
transformChild.parent = transformParent;
if (!isChildAlreadyInLocalSpace && transformParent) {
transformChild.matrixTransform(mat4_exports.invert(mat4_exports.create(), transformParent.worldTransform));
transformChild.updateTransform();
}
if (transformParent) {
transformChild.updateTransformWithParent(transformParent);
}
}
}, {
key: "detach",
value: function detach(entity) {
var self2 = this.hierarchy.getComponentByEntity(entity);
if (self2 !== null) {
var transform18 = this.transform.getComponentByEntity(entity);
if (transform18 !== null) {
transform18.parent = null;
transform18.applyTransform();
}
this.hierarchy.removeKeepSorted(entity);
var mesh = this.mesh.getComponentByEntity(self2.parentID);
if (mesh) {
var index2 = mesh.children.indexOf(entity);
mesh.children.splice(index2, 1);
}
this.setMeshAABBDirty(mesh);
}
}
}, {
key: "detachChildren",
value: function detachChildren(parent) {
var mesh = this.mesh.getComponentByEntity(parent);
if (mesh) {
mesh.children = [];
}
for (var i4 = 0; i4 < this.hierarchy.getCount(); ) {
var _this$hierarchy$getCo;
if (((_this$hierarchy$getCo = this.hierarchy.getComponent(i4)) === null || _this$hierarchy$getCo === void 0 ? void 0 : _this$hierarchy$getCo.parentID) === parent) {
var entity = this.hierarchy.getEntity(i4);
this.detach(entity);
} else {
++i4;
}
}
}
}, {
key: "setMeshAABBDirty",
value: function setMeshAABBDirty(mesh) {
if (mesh) {
mesh.aabbDirty = true;
}
}
}]);
return SceneGraphSystem2;
}(), _temp9), _descriptor13 = _applyDecoratedDescriptor(_class210.prototype, "hierarchy", [_dec29], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor29 = _applyDecoratedDescriptor(_class210.prototype, "transform", [_dec39], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor37 = _applyDecoratedDescriptor(_class210.prototype, "mesh", [_dec47], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class210)) || _class10);
// node_modules/@antv/g-webgpu-core/es/components/scenegraph/TransformComponent.js
function _createSuper7(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct7();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived), result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _isNativeReflectConstruct7() {
if (typeof Reflect === "undefined" || !Reflect.construct)
return false;
if (Reflect.construct.sham)
return false;
if (typeof Proxy === "function")
return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function() {
}));
return true;
} catch (e4) {
return false;
}
}
var TransformComponent = /* @__PURE__ */ function(_Component) {
_inherits(TransformComponent2, _Component);
var _super = _createSuper7(TransformComponent2);
function TransformComponent2(data3) {
var _this;
_classCallCheck(this, TransformComponent2);
_this = _super.call(this, data3);
_this.dirtyFlag = void 0;
_this.localDirtyFlag = void 0;
_this.parent = null;
_this.localPosition = vec3_exports.fromValues(0, 0, 0);
_this.localRotation = quat_exports.fromValues(0, 0, 0, 1);
_this.localScale = vec3_exports.fromValues(1, 1, 1);
_this.localTransform = mat4_exports.create();
_this.position = vec3_exports.fromValues(0, 0, 0);
_this.rotation = quat_exports.fromValues(0, 0, 0, 1);
_this.scaling = vec3_exports.fromValues(1, 1, 1);
_this.worldTransform = mat4_exports.create();
_this.matrixTransform = function() {
var transformed = mat4_exports.create();
return function(mat) {
mat4_exports.multiply(transformed, _this.getLocalTransform(), mat);
mat4_exports.getScaling(_this.localScale, transformed);
mat4_exports.getTranslation(_this.localPosition, transformed);
mat4_exports.getRotation(_this.localRotation, transformed);
};
}();
_this.rotateRollPitchYaw = function() {
var quatX = quat_exports.create();
var quatY = quat_exports.create();
var quatZ = quat_exports.create();
return function(x6, y5, z3) {
_this.setDirty();
quat_exports.fromEuler(quatX, x6, 0, 0);
quat_exports.fromEuler(quatY, 0, y5, 0);
quat_exports.fromEuler(quatZ, 0, 0, z3);
quat_exports.multiply(_this.localRotation, quatX, _this.localRotation);
quat_exports.multiply(_this.localRotation, _this.localRotation, quatY);
quat_exports.multiply(_this.localRotation, quatZ, _this.localRotation);
quat_exports.normalize(_this.localRotation, _this.localRotation);
};
}();
_this.lerp = function() {
var aS = vec3_exports.create();
var aR = quat_exports.create();
var aT = vec3_exports.create();
var bS = vec3_exports.create();
var bR = quat_exports.create();
var bT = vec3_exports.create();
return function(a4, b10, t4) {
_this.setDirty();
mat4_exports.getScaling(aS, a4.worldTransform);
mat4_exports.getTranslation(aT, a4.worldTransform);
mat4_exports.getRotation(aR, a4.worldTransform);
mat4_exports.getScaling(bS, b10.worldTransform);
mat4_exports.getTranslation(bT, b10.worldTransform);
mat4_exports.getRotation(bR, b10.worldTransform);
vec3_exports.lerp(_this.localScale, aS, bS, t4);
quat_exports.slerp(_this.localRotation, aR, bR, t4);
vec3_exports.lerp(_this.localPosition, aT, bT, t4);
};
}();
_this.translate = function() {
var tr = vec3_exports.create();
return function(translation) {
vec3_exports.add(tr, _this.getPosition(), translation);
_this.setPosition(tr);
_this.setDirty(true);
return _assertThisInitialized(_this);
};
}();
_this.translateLocal = function() {
return function(translation) {
vec3_exports.transformQuat(translation, translation, _this.localRotation);
vec3_exports.add(_this.localPosition, _this.localPosition, translation);
_this.setLocalDirty(true);
return _assertThisInitialized(_this);
};
}();
_this.setPosition = function() {
var parentInvertMatrix = mat4_exports.create();
return function(position2) {
_this.position = position2;
_this.setLocalDirty(true);
if (_this.parent === null) {
vec3_exports.copy(_this.localPosition, position2);
} else {
mat4_exports.copy(parentInvertMatrix, _this.parent.worldTransform);
mat4_exports.invert(parentInvertMatrix, parentInvertMatrix);
vec3_exports.transformMat4(_this.localPosition, position2, parentInvertMatrix);
}
return _assertThisInitialized(_this);
};
}();
_this.rotate = function() {
var parentInvertRotation = quat_exports.create();
return function(quaternion) {
if (_this.parent === null) {
quat_exports.multiply(_this.localRotation, _this.localRotation, quaternion);
quat_exports.normalize(_this.localRotation, _this.localRotation);
} else {
var rot = _this.getRotation();
var parentRot = _this.parent.getRotation();
quat_exports.copy(parentInvertRotation, parentRot);
quat_exports.invert(parentInvertRotation, parentInvertRotation);
quat_exports.multiply(parentInvertRotation, parentInvertRotation, quaternion);
quat_exports.multiply(_this.localRotation, quaternion, rot);
quat_exports.normalize(_this.localRotation, _this.localRotation);
}
_this.setLocalDirty();
return _assertThisInitialized(_this);
};
}();
_this.rotateLocal = function() {
return function(quaternion) {
quat_exports.multiply(_this.localRotation, _this.localRotation, quaternion);
quat_exports.normalize(_this.localRotation, _this.localRotation);
_this.setLocalDirty(true);
return _assertThisInitialized(_this);
};
}();
_this.setRotation = function() {
var invParentRot = quat_exports.create();
return function(rotation) {
if (_this.parent === null) {
quat_exports.copy(_this.localRotation, rotation);
} else {
quat_exports.copy(invParentRot, _this.parent.getRotation());
quat_exports.invert(invParentRot, invParentRot);
quat_exports.copy(_this.localRotation, invParentRot);
quat_exports.mul(_this.localRotation, _this.localRotation, rotation);
}
_this.setLocalDirty(true);
return _assertThisInitialized(_this);
};
}();
return _this;
}
_createClass(TransformComponent2, [{
key: "setLocalPosition",
value: function setLocalPosition(position2) {
vec3_exports.copy(this.localPosition, position2);
this.setLocalDirty(true);
}
}, {
key: "setLocalScale",
value: function setLocalScale(scale12) {
vec3_exports.copy(this.localScale, scale12);
this.setLocalDirty(true);
}
}, {
key: "setLocalRotation",
value: function setLocalRotation(rotation) {
quat_exports.copy(this.localRotation, rotation);
this.setLocalDirty(true);
return this;
}
}, {
key: "isDirty",
value: function isDirty() {
return this.dirtyFlag;
}
}, {
key: "setDirty",
value: function setDirty() {
var value2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
if (value2) {
this.dirtyFlag |= TransformComponent2.DIRTY;
} else {
this.dirtyFlag &= ~TransformComponent2.DIRTY;
}
}
}, {
key: "isLocalDirty",
value: function isLocalDirty() {
return this.localDirtyFlag;
}
}, {
key: "setLocalDirty",
value: function setLocalDirty() {
var value2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
if (value2) {
this.localDirtyFlag |= TransformComponent2.DIRTY;
this.setDirty(true);
} else {
this.localDirtyFlag &= ~TransformComponent2.DIRTY;
}
}
}, {
key: "updateTransform",
value: function updateTransform() {
if (this.isLocalDirty()) {
this.getLocalTransform();
}
if (this.isDirty()) {
if (this.parent === null) {
mat4_exports.copy(this.worldTransform, this.getLocalTransform());
this.setDirty(false);
}
}
}
}, {
key: "updateTransformWithParent",
value: function updateTransformWithParent(parent) {
mat4_exports.multiply(this.worldTransform, parent.worldTransform, this.getLocalTransform());
}
}, {
key: "applyTransform",
value: function applyTransform() {
this.setDirty();
mat4_exports.getScaling(this.localScale, this.worldTransform);
mat4_exports.getTranslation(this.localPosition, this.worldTransform);
mat4_exports.getRotation(this.localRotation, this.worldTransform);
}
}, {
key: "clearTransform",
value: function clearTransform() {
this.setDirty();
this.localPosition = vec3_exports.fromValues(0, 0, 0);
this.localRotation = quat_exports.fromValues(0, 0, 0, 1);
this.localScale = vec3_exports.fromValues(1, 1, 1);
}
}, {
key: "scaleLocal",
value: function scaleLocal(scaling) {
this.setLocalDirty();
vec3_exports.multiply(this.localScale, this.localScale, scaling);
return this;
}
}, {
key: "getLocalPosition",
value: function getLocalPosition() {
return this.localPosition;
}
}, {
key: "getLocalRotation",
value: function getLocalRotation() {
return this.localRotation;
}
}, {
key: "getLocalScale",
value: function getLocalScale() {
return this.localScale;
}
}, {
key: "getLocalTransform",
value: function getLocalTransform() {
if (this.localDirtyFlag) {
mat4_exports.fromRotationTranslationScale(this.localTransform, this.localRotation, this.localPosition, this.localScale);
this.setLocalDirty(false);
}
return this.localTransform;
}
}, {
key: "getWorldTransform",
value: function getWorldTransform() {
if (!this.isLocalDirty() && !this.isDirty()) {
return this.worldTransform;
}
if (this.parent) {
this.parent.getWorldTransform();
}
this.updateTransform();
return this.worldTransform;
}
}, {
key: "getPosition",
value: function getPosition() {
mat4_exports.getTranslation(this.position, this.worldTransform);
return this.position;
}
}, {
key: "getRotation",
value: function getRotation2() {
mat4_exports.getRotation(this.rotation, this.worldTransform);
return this.rotation;
}
}, {
key: "getScale",
value: function getScale() {
mat4_exports.getScaling(this.scaling, this.worldTransform);
return this.scaling;
}
}]);
return TransformComponent2;
}(Component2);
TransformComponent.DIRTY = 1 << 0;
// node_modules/@antv/g-webgpu-core/es/inversify.config.js
var import_inversify14 = __toModule(require_inversify());
var import_inversify_inject_decorators = __toModule(require_lib3());
// node_modules/@antv/g-webgpu-core/es/components/framegraph/ResourcePool.js
var import_inversify10 = __toModule(require_inversify());
var _dec16;
var _dec210;
var _class11;
var _class211;
var _descriptor14;
var _temp10;
var ResourcePool = (_dec16 = (0, import_inversify10.injectable)(), _dec210 = (0, import_inversify10.inject)(IDENTIFIER.RenderEngine), _dec16(_class11 = (_class211 = (_temp10 = /* @__PURE__ */ function() {
function ResourcePool2() {
_classCallCheck(this, ResourcePool2);
_initializerDefineProperty(this, "engine", _descriptor14, this);
this.resourcePool = {};
}
_createClass(ResourcePool2, [{
key: "getOrCreateResource",
value: function getOrCreateResource(resource) {
if (!this.resourcePool[resource.name]) {
var _resource$descriptor = resource.descriptor, width2 = _resource$descriptor.width, height = _resource$descriptor.height, usage = _resource$descriptor.usage;
this.resourcePool[resource.name] = this.engine.createFramebuffer({
color: this.engine.createTexture2D({
width: width2,
height,
wrapS: gl.CLAMP_TO_EDGE,
wrapT: gl.CLAMP_TO_EDGE,
usage
})
});
}
return this.resourcePool[resource.name];
}
}, {
key: "clean",
value: function clean() {
this.resourcePool = {};
}
}]);
return ResourcePool2;
}(), _temp10), _descriptor14 = _applyDecoratedDescriptor(_class211.prototype, "engine", [_dec210], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class211)) || _class11);
// node_modules/@antv/g-webgpu-core/es/components/scenegraph/NameComponent.js
function _createSuper8(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct8();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived), result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _isNativeReflectConstruct8() {
if (typeof Reflect === "undefined" || !Reflect.construct)
return false;
if (Reflect.construct.sham)
return false;
if (typeof Proxy === "function")
return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function() {
}));
return true;
} catch (e4) {
return false;
}
}
var NameComponent = /* @__PURE__ */ function(_Component) {
_inherits(NameComponent2, _Component);
var _super = _createSuper8(NameComponent2);
function NameComponent2(data3) {
var _this;
_classCallCheck(this, NameComponent2);
_this = _super.call(this, data3);
_this.name = void 0;
_this.name = data3.name || "";
return _this;
}
return NameComponent2;
}(Component2);
// node_modules/@antv/g-webgpu-core/es/services/config/ConfigService.js
var import_inversify11 = __toModule(require_inversify());
var _dec17;
var _class12;
var _temp11;
var ConfigService = (_dec17 = (0, import_inversify11.injectable)(), _dec17(_class12 = (_temp11 = /* @__PURE__ */ function() {
function ConfigService2() {
_classCallCheck(this, ConfigService2);
this.config = void 0;
}
_createClass(ConfigService2, [{
key: "get",
value: function get3() {
return this.config;
}
}, {
key: "set",
value: function set10(config) {
this.config = config;
}
}]);
return ConfigService2;
}(), _temp11)) || _class12);
// node_modules/@antv/g-webgpu-core/es/services/interactor/IteractorService.js
var import_inversify12 = __toModule(require_inversify());
var _dec18;
var _class13;
var IInteractorEvent;
(function(IInteractorEvent2) {
IInteractorEvent2["PANSTART"] = "PANSTART";
IInteractorEvent2["PANEND"] = "PANEND";
IInteractorEvent2["PANMOVE"] = "PANMOVE";
IInteractorEvent2["PINCH"] = "PINCH";
IInteractorEvent2["KEYDOWN"] = "KEYDOWN";
IInteractorEvent2["KEYUP"] = "KEYUP";
IInteractorEvent2["HOVER"] = "HOVER";
})(IInteractorEvent || (IInteractorEvent = {}));
var InteractorService = (_dec18 = (0, import_inversify12.injectable)(), _dec18(_class13 = /* @__PURE__ */ function() {
function InteractorService2() {
_classCallCheck(this, InteractorService2);
}
_createClass(InteractorService2, [{
key: "listen",
value: function listen(canvas) {
}
}, {
key: "on",
value: function on2(event, args) {
}
}, {
key: "connect",
value: function connect2() {
}
}, {
key: "disconnect",
value: function disconnect() {
}
}, {
key: "destroy",
value: function destroy() {
}
}]);
return InteractorService2;
}()) || _class13);
// node_modules/@antv/g-webgpu-core/es/services/shader-module/ShaderModuleService.js
var import_inversify13 = __toModule(require_inversify());
// node_modules/@antv/g-webgpu-core/es/utils/shader-module.js
function getUniformLengthByType(type2) {
var arrayLength = 0;
switch (type2) {
case "vec2":
case "ivec2":
arrayLength = 2;
break;
case "vec3":
case "ivec3":
arrayLength = 3;
break;
case "vec4":
case "ivec4":
case "mat2":
arrayLength = 4;
break;
case "mat3":
arrayLength = 9;
break;
case "mat4":
arrayLength = 16;
break;
default:
}
return arrayLength;
}
var uniformRegExp = /uniform\s+(bool|float|int|vec2|vec3|vec4|ivec2|ivec3|ivec4|mat2|mat3|mat4|sampler2D|samplerCube)\s+([\s\S]*?);/g;
function extractUniforms(content) {
var uniforms = {};
content = content.replace(uniformRegExp, function(_8, type2, c5) {
var defaultValues = c5.split(":");
var uniformName = defaultValues[0].trim();
var defaultValue = "";
if (defaultValues.length > 1) {
defaultValue = defaultValues[1].trim();
}
switch (type2) {
case "bool":
defaultValue = defaultValue === "true";
break;
case "float":
case "int":
defaultValue = Number(defaultValue);
break;
case "vec2":
case "vec3":
case "vec4":
case "ivec2":
case "ivec3":
case "ivec4":
case "mat2":
case "mat3":
case "mat4":
if (defaultValue) {
defaultValue = defaultValue.replace("[", "").replace("]", "").split(",").reduce(function(prev, cur) {
prev.push(Number(cur.trim()));
return prev;
}, []);
} else {
defaultValue = new Array(getUniformLengthByType(type2)).fill(0);
}
break;
default:
}
uniforms[uniformName] = defaultValue;
return "uniform ".concat(type2, " ").concat(uniformName, ";\n");
});
return {
content,
uniforms
};
}
// node_modules/@antv/g-webgpu-core/es/utils/uniq.js
function uniq4(array) {
return array.filter(function(v3, i4, a4) {
return a4.indexOf(v3) === i4;
});
}
// node_modules/@antv/g-webgpu-core/es/services/shader-module/ShaderModuleService.js
var _dec19;
var _class14;
var _temp12;
function ownKeys4(object, enumerableOnly) {
var keys2 = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys2.push.apply(keys2, symbols);
}
return keys2;
}
function _objectSpread4(target) {
for (var i4 = 1; i4 < arguments.length; i4++) {
var source = arguments[i4] != null ? arguments[i4] : {};
if (i4 % 2) {
ownKeys4(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys4(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
var pickingFrag = "varying vec4 v_PickingResult;\nuniform vec4 u_HighlightColor : [0, 0, 0, 0];\nuniform float u_PickingStage : 0.0;\n\n#define PICKING_ENCODE 1.0\n#define PICKING_HIGHLIGHT 2.0\n#define COLOR_SCALE 1. / 255.\n\n/*\n * Returns highlight color if this item is selected.\n */\nvec4 filterHighlightColor(vec4 color) {\n bool selected = bool(v_PickingResult.a);\n\n if (selected) {\n vec4 highLightColor = u_HighlightColor * COLOR_SCALE;\n\n float highLightAlpha = highLightColor.a;\n float highLightRatio = highLightAlpha / (highLightAlpha + color.a * (1.0 - highLightAlpha));\n\n vec3 resultRGB = mix(color.rgb, highLightColor.rgb, highLightRatio);\n return vec4(resultRGB, color.a);\n } else {\n return color;\n }\n}\n\n/*\n * Returns picking color if picking enabled else unmodified argument.\n */\nvec4 filterPickingColor(vec4 color) {\n vec3 pickingColor = v_PickingResult.rgb;\n if (u_PickingStage == PICKING_ENCODE && length(pickingColor) < 0.001) {\n discard;\n }\n return u_PickingStage == PICKING_ENCODE ? vec4(pickingColor, step(0.001,color.a)): color;\n}\n\n/*\n * Returns picking color if picking is enabled if not\n * highlight color if this item is selected, otherwise unmodified argument.\n */\nvec4 filterColor(vec4 color) {\n return filterPickingColor(filterHighlightColor(color));\n}\n";
var pickingVert = "attribute vec3 a_PickingColor;\nvarying vec4 v_PickingResult;\n\nuniform vec3 u_PickingColor : [0, 0, 0];\nuniform vec4 u_HighlightColor : [0, 0, 0, 0];\nuniform float u_PickingStage : 0.0;\nuniform float u_PickingThreshold : 1.0;\nuniform float u_PickingBuffer: 0.0;\n\n#define PICKING_ENCODE 1.0\n#define PICKING_HIGHLIGHT 2.0\n#define COLOR_SCALE 1. / 255.\n\nbool isVertexPicked(vec3 vertexColor) {\n return\n abs(vertexColor.r - u_PickingColor.r) < u_PickingThreshold &&\n abs(vertexColor.g - u_PickingColor.g) < u_PickingThreshold &&\n abs(vertexColor.b - u_PickingColor.b) < u_PickingThreshold;\n}\n\nvoid setPickingColor(vec3 pickingColor) {\n // compares only in highlight stage\n v_PickingResult.a = float((u_PickingStage == PICKING_HIGHLIGHT) && isVertexPicked(pickingColor));\n\n // Stores the picking color so that the fragment shader can render it during picking\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\n\nfloat setPickingSize(float x) {\n return u_PickingStage == PICKING_ENCODE ? x + u_PickingBuffer : x;\n}";
var sdf2dFrag = "/**\n * 2D signed distance field functions\n * @see http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm\n */\n\nfloat ndot(vec2 a, vec2 b ) { return a.x*b.x - a.y*b.y; }\n\nfloat sdCircle(vec2 p, float r) {\n return length(p) - r;\n}\n\nfloat sdEquilateralTriangle(vec2 p) {\n float k = sqrt(3.0);\n p.x = abs(p.x) - 1.0;\n p.y = p.y + 1.0/k;\n if( p.x + k*p.y > 0.0 ) p = vec2(p.x-k*p.y,-k*p.x-p.y)/2.0;\n p.x -= clamp( p.x, -2.0, 0.0 );\n return -length(p)*sign(p.y);\n}\n\nfloat sdBox(vec2 p, vec2 b) {\n vec2 d = abs(p)-b;\n return length(max(d,vec2(0))) + min(max(d.x,d.y),0.0);\n}\n\nfloat sdPentagon(vec2 p, float r) {\n vec3 k = vec3(0.809016994,0.587785252,0.726542528);\n p.x = abs(p.x);\n p -= 2.0*min(dot(vec2(-k.x,k.y),p),0.0)*vec2(-k.x,k.y);\n p -= 2.0*min(dot(vec2( k.x,k.y),p),0.0)*vec2( k.x,k.y);\n p -= vec2(clamp(p.x,-r*k.z,r*k.z),r);\n return length(p)*sign(p.y);\n}\n\nfloat sdHexagon(vec2 p, float r) {\n vec3 k = vec3(-0.866025404,0.5,0.577350269);\n p = abs(p);\n p -= 2.0*min(dot(k.xy,p),0.0)*k.xy;\n p -= vec2(clamp(p.x, -k.z*r, k.z*r), r);\n return length(p)*sign(p.y);\n}\n\nfloat sdOctogon(vec2 p, float r) {\n vec3 k = vec3(-0.9238795325, 0.3826834323, 0.4142135623 );\n p = abs(p);\n p -= 2.0*min(dot(vec2( k.x,k.y),p),0.0)*vec2( k.x,k.y);\n p -= 2.0*min(dot(vec2(-k.x,k.y),p),0.0)*vec2(-k.x,k.y);\n p -= vec2(clamp(p.x, -k.z*r, k.z*r), r);\n return length(p)*sign(p.y);\n}\n\nfloat sdHexagram(vec2 p, float r) {\n vec4 k=vec4(-0.5,0.8660254038,0.5773502692,1.7320508076);\n p = abs(p);\n p -= 2.0*min(dot(k.xy,p),0.0)*k.xy;\n p -= 2.0*min(dot(k.yx,p),0.0)*k.yx;\n p -= vec2(clamp(p.x,r*k.z,r*k.w),r);\n return length(p)*sign(p.y);\n}\n\nfloat sdRhombus(vec2 p, vec2 b) {\n vec2 q = abs(p);\n float h = clamp((-2.0*ndot(q,b)+ndot(b,b))/dot(b,b),-1.0,1.0);\n float d = length( q - 0.5*b*vec2(1.0-h,1.0+h) );\n return d * sign( q.x*b.y + q.y*b.x - b.x*b.y );\n}\n\nfloat sdVesica(vec2 p, float r, float d) {\n p = abs(p);\n float b = sqrt(r*r-d*d); // can delay this sqrt\n return ((p.y-b)*d>p.x*b)\n ? length(p-vec2(0.0,b))\n : length(p-vec2(-d,0.0))-r;\n}";
var precisionRegExp = /precision\s+(high|low|medium)p\s+float/;
var globalDefaultprecision = "#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n#endif\n";
var includeRegExp = /#pragma include (["^+"]?["\ "[a-zA-Z_0-9](.*)"]*?)/g;
var ShaderModuleService = (_dec19 = (0, import_inversify13.injectable)(), _dec19(_class14 = (_temp12 = /* @__PURE__ */ function() {
function ShaderModuleService2() {
_classCallCheck(this, ShaderModuleService2);
this.moduleCache = {};
this.rawContentCache = {};
}
_createClass(ShaderModuleService2, [{
key: "registerBuiltinModules",
value: function registerBuiltinModules() {
this.destroy();
this.registerModule("picking", {
vs: pickingVert,
fs: pickingFrag
});
this.registerModule("sdf2d", {
vs: "",
fs: sdf2dFrag
});
}
}, {
key: "registerModule",
value: function registerModule(moduleName, moduleParams) {
if (this.rawContentCache[moduleName]) {
return;
}
var _moduleParams$vs = moduleParams.vs, vs = _moduleParams$vs === void 0 ? "" : _moduleParams$vs, _moduleParams$fs = moduleParams.fs, fs = _moduleParams$fs === void 0 ? "" : _moduleParams$fs, declaredUniforms = moduleParams.uniforms;
var _extractUniforms = extractUniforms(vs), extractedVS = _extractUniforms.content, vsUniforms = _extractUniforms.uniforms;
var _extractUniforms2 = extractUniforms(fs), extractedFS = _extractUniforms2.content, fsUniforms = _extractUniforms2.uniforms;
this.rawContentCache[moduleName] = {
fs: extractedFS,
uniforms: _objectSpread4(_objectSpread4(_objectSpread4({}, vsUniforms), fsUniforms), declaredUniforms),
vs: extractedVS
};
}
}, {
key: "destroy",
value: function destroy() {
this.moduleCache = {};
this.rawContentCache = {};
}
}, {
key: "getModule",
value: function getModule(moduleName) {
var _this = this;
if (this.moduleCache[moduleName]) {
return this.moduleCache[moduleName];
}
var rawVS = this.rawContentCache[moduleName].vs || "";
var rawFS = this.rawContentCache[moduleName].fs || "";
var _this$processModule = this.processModule(rawVS, [], "vs"), vs = _this$processModule.content, vsIncludeList = _this$processModule.includeList;
var _this$processModule2 = this.processModule(rawFS, [], "fs"), fs = _this$processModule2.content, fsIncludeList = _this$processModule2.includeList;
var compiledFs = fs;
var uniforms = uniq4(vsIncludeList.concat(fsIncludeList).concat(moduleName)).reduce(function(prev, cur) {
return _objectSpread4(_objectSpread4({}, prev), _this.rawContentCache[cur].uniforms);
}, {});
if (!precisionRegExp.test(fs)) {
compiledFs = globalDefaultprecision + fs;
}
this.moduleCache[moduleName] = {
fs: compiledFs.trim(),
uniforms,
vs: vs.trim()
};
return this.moduleCache[moduleName];
}
}, {
key: "processModule",
value: function processModule(rawContent, includeList, type2) {
var _this2 = this;
var compiled = rawContent.replace(includeRegExp, function(_8, strMatch) {
var includeOpt = strMatch.split(" ");
var includeName = includeOpt[0].replace(/"/g, "");
if (includeList.indexOf(includeName) > -1) {
return "";
}
var txt = _this2.rawContentCache[includeName][type2];
includeList.push(includeName);
var _this2$processModule = _this2.processModule(txt || "", includeList, type2), content = _this2$processModule.content;
return content;
});
return {
content: compiled,
includeList
};
}
}]);
return ShaderModuleService2;
}(), _temp12)) || _class14);
// node_modules/@antv/g-webgpu-core/es/inversify.config.js
var container = new import_inversify14.Container();
var DECORATORS = (0, import_inversify_inject_decorators.default)(container, false);
container.bind(IDENTIFIER.ShaderModuleService).to(ShaderModuleService).inSingletonScope();
container.bind(IDENTIFIER.NameComponentManager).toConstantValue(new ComponentManager(NameComponent));
container.bind(IDENTIFIER.HierarchyComponentManager).toConstantValue(new ComponentManager(HierarchyComponent));
container.bind(IDENTIFIER.TransformComponentManager).toConstantValue(new ComponentManager(TransformComponent));
container.bind(IDENTIFIER.MeshComponentManager).toConstantValue(new ComponentManager(MeshComponent));
container.bind(IDENTIFIER.CullableComponentManager).toConstantValue(new ComponentManager(CullableComponent));
container.bind(IDENTIFIER.GeometryComponentManager).toConstantValue(new ComponentManager(GeometryComponent));
container.bind(IDENTIFIER.MaterialComponentManager).toConstantValue(new ComponentManager(MaterialComponent));
function createWorldContainer() {
var worldContainer = new import_inversify14.Container();
worldContainer.parent = container;
worldContainer.bind(IDENTIFIER.Systems).to(SceneGraphSystem).inSingletonScope().whenTargetNamed(IDENTIFIER.SceneGraphSystem);
worldContainer.bind(IDENTIFIER.Systems).to(FrameGraphSystem).inSingletonScope().whenTargetNamed(IDENTIFIER.FrameGraphSystem);
worldContainer.bind(IDENTIFIER.Systems).to(MeshSystem).inSingletonScope().whenTargetNamed(IDENTIFIER.MeshSystem);
worldContainer.bind(IDENTIFIER.Systems).to(GeometrySystem).inSingletonScope().whenTargetNamed(IDENTIFIER.GeometrySystem);
worldContainer.bind(IDENTIFIER.Systems).to(MaterialSystem).inSingletonScope().whenTargetNamed(IDENTIFIER.MaterialSystem);
worldContainer.bind(IDENTIFIER.Systems).to(RendererSystem).inSingletonScope().whenTargetNamed(IDENTIFIER.RendererSystem);
worldContainer.bind(IDENTIFIER.ResourcePool).to(ResourcePool).inSingletonScope();
worldContainer.bind(IDENTIFIER.ConfigService).to(ConfigService).inSingletonScope();
worldContainer.bind(IDENTIFIER.InteractorService).to(InteractorService).inSingletonScope();
worldContainer.bind(IDENTIFIER.RenderPass).to(RenderPass).inSingletonScope().whenTargetNamed(RenderPass.IDENTIFIER);
worldContainer.bind(IDENTIFIER.RenderPass).to(CopyPass).inSingletonScope().whenTargetNamed(CopyPass.IDENTIFIER);
worldContainer.bind(IDENTIFIER.RenderPass).to(PixelPickingPass).inSingletonScope().whenTargetNamed(PixelPickingPass.IDENTIFIER);
worldContainer.bind(IDENTIFIER.RenderPassFactory).toFactory(function(context) {
return function(name) {
return context.container.getNamed(IDENTIFIER.RenderPass, name);
};
});
return worldContainer;
}
// node_modules/@antv/g-webgpu-core/es/utils/aabb.js
function generateAABBFromVertices(positions) {
var aabb = new AABB();
var min7 = vec3_exports.fromValues(positions[0], positions[1], positions[2]);
var max8 = vec3_exports.fromValues(positions[0], positions[1], positions[2]);
for (var i4 = 3; i4 < positions.length; ) {
var x6 = positions[i4++];
var y5 = positions[i4++];
var z3 = positions[i4++];
if (x6 < min7[0]) {
min7[0] = x6;
}
if (y5 < min7[1]) {
min7[1] = y5;
}
if (z3 < min7[2]) {
min7[2] = z3;
}
if (x6 > max8[0]) {
max8[0] = x6;
}
if (y5 > max8[1]) {
max8[1] = y5;
}
if (z3 > max8[2]) {
max8[2] = z3;
}
}
aabb.setMinMax(min7, max8);
return aabb;
}
// node_modules/@antv/g-webgpu-core/es/utils/isSafari.js
var isSafari = typeof navigator !== "undefined" && /Version\/[\d\.]+.*Safari/.test(navigator.userAgent);
// node_modules/@antv/g-webgpu-core/es/shape/BoundingSphere.js
var tmpVecA = vec3_exports.create();
// node_modules/@antv/g-webgpu-core/es/shape/Ray.js
var tmpVecA2 = vec3_exports.create();
var tmpVecB = vec3_exports.create();
var tmpVecC = vec3_exports.create();
var tmpVecD = vec3_exports.create();
var tmpVecE = vec3_exports.create();
// node_modules/@antv/g-webgpu-core/es/components/renderer/IMultiPassRenderer.js
var PassType;
(function(PassType2) {
PassType2["Normal"] = "normal";
PassType2["PostProcessing"] = "post-processing";
})(PassType || (PassType = {}));
// node_modules/@antv/g-webgpu-core/es/index.js
var AST_TOKEN_TYPES;
(function(AST_TOKEN_TYPES2) {
AST_TOKEN_TYPES2["Void"] = "Void";
AST_TOKEN_TYPES2["Boolean"] = "Boolean";
AST_TOKEN_TYPES2["Float"] = "Float";
AST_TOKEN_TYPES2["Uint32"] = "Uint32";
AST_TOKEN_TYPES2["Int32"] = "Int32";
AST_TOKEN_TYPES2["Vector"] = "Vector";
AST_TOKEN_TYPES2["Vector2Float"] = "vec2";
AST_TOKEN_TYPES2["Vector3Float"] = "vec3";
AST_TOKEN_TYPES2["Vector4Float"] = "vec4";
AST_TOKEN_TYPES2["Vector2Boolean"] = "vec2";
AST_TOKEN_TYPES2["Vector3Boolean"] = "vec3";
AST_TOKEN_TYPES2["Vector4Boolean"] = "vec4";
AST_TOKEN_TYPES2["Vector2Uint"] = "vec2";
AST_TOKEN_TYPES2["Vector3Uint"] = "vec3";
AST_TOKEN_TYPES2["Vector4Uint"] = "vec4";
AST_TOKEN_TYPES2["Vector2Int"] = "vec2";
AST_TOKEN_TYPES2["Vector3Int"] = "vec3";
AST_TOKEN_TYPES2["Vector4Int"] = "vec4";
AST_TOKEN_TYPES2["Matrix"] = "Matrix";
AST_TOKEN_TYPES2["Matrix3x3Float"] = "mat3x3";
AST_TOKEN_TYPES2["Matrix4x4Float"] = "mat4x4";
AST_TOKEN_TYPES2["Struct"] = "Struct";
AST_TOKEN_TYPES2["FloatArray"] = "Float[]";
AST_TOKEN_TYPES2["Vector4FloatArray"] = "vec4[]";
})(AST_TOKEN_TYPES || (AST_TOKEN_TYPES = {}));
var AST_NODE_TYPES;
(function(AST_NODE_TYPES2) {
AST_NODE_TYPES2["Program"] = "Program";
AST_NODE_TYPES2["Identifier"] = "Identifier";
AST_NODE_TYPES2["VariableDeclaration"] = "VariableDeclaration";
AST_NODE_TYPES2["BlockStatement"] = "BlockStatement";
AST_NODE_TYPES2["ReturnStatement"] = "ReturnStatement";
AST_NODE_TYPES2["FunctionDeclaration"] = "FunctionDeclaration";
AST_NODE_TYPES2["VariableDeclarator"] = "VariableDeclarator";
AST_NODE_TYPES2["AssignmentExpression"] = "AssignmentExpression";
AST_NODE_TYPES2["LogicalExpression"] = "LogicalExpression";
AST_NODE_TYPES2["BinaryExpression"] = "BinaryExpression";
AST_NODE_TYPES2["ArrayExpression"] = "ArrayExpression";
AST_NODE_TYPES2["UnaryExpression"] = "UnaryExpression";
AST_NODE_TYPES2["UpdateExpression"] = "UpdateExpression";
AST_NODE_TYPES2["FunctionExpression"] = "FunctionExpression";
AST_NODE_TYPES2["MemberExpression"] = "MemberExpression";
AST_NODE_TYPES2["ConditionalExpression"] = "ConditionalExpression";
AST_NODE_TYPES2["ExpressionStatement"] = "ExpressionStatement";
AST_NODE_TYPES2["CallExpression"] = "CallExpression";
AST_NODE_TYPES2["NumThreadStatement"] = "NumThreadStatement";
AST_NODE_TYPES2["StorageStatement"] = "StorageStatement";
AST_NODE_TYPES2["DoWhileStatement"] = "DoWhileStatement";
AST_NODE_TYPES2["WhileStatement"] = "WhileStatement";
AST_NODE_TYPES2["ForStatement"] = "ForStatement";
AST_NODE_TYPES2["BreakStatement"] = "BreakStatement";
AST_NODE_TYPES2["ContinueStatement"] = "ContinueStatement";
AST_NODE_TYPES2["IfStatement"] = "IfStatement";
AST_NODE_TYPES2["ImportedFunctionStatement"] = "ImportedFunctionStatement";
})(AST_NODE_TYPES || (AST_NODE_TYPES = {}));
var STORAGE_CLASS;
(function(STORAGE_CLASS2) {
STORAGE_CLASS2["Input"] = "Input";
STORAGE_CLASS2["Output"] = "Output";
STORAGE_CLASS2["Uniform"] = "Uniform";
STORAGE_CLASS2["Workgroup"] = "Workgroup";
STORAGE_CLASS2["UniformConstant"] = "UniformConstant";
STORAGE_CLASS2["Image"] = "Image";
STORAGE_CLASS2["StorageBuffer"] = "StorageBuffer";
STORAGE_CLASS2["Private"] = "Private";
STORAGE_CLASS2["Function"] = "Function";
})(STORAGE_CLASS || (STORAGE_CLASS = {}));
var Target;
(function(Target2) {
Target2["GLSL100"] = "GLSL100";
Target2["GLSL450"] = "GLSL450";
Target2["WGSL"] = "WGSL";
})(Target || (Target = {}));
var DefineValuePlaceholder = "__DefineValuePlaceholder__";
// node_modules/@antv/g-webgpu/es/camera/Camera.js
var import_inversify16 = __toModule(require_inversify());
// node_modules/@antv/g-webgpu/es/utils/is-number.js
function isNumber5(value2) {
return typeof value2 === "number";
}
// node_modules/@antv/g-webgpu/es/utils/math.js
function getAngle5(angle3) {
if (angle3 === void 0) {
return 0;
} else if (angle3 > 360 || angle3 < -360) {
return angle3 % 360;
}
return angle3;
}
function createVec3(x6, y5, z3) {
if (isNumber5(x6)) {
return vec3_exports.fromValues(x6, y5, z3);
}
if (x6.length === 3) {
return vec3_exports.clone(x6);
}
return vec3_exports.fromValues(x6[0], x6[1], x6[2]);
}
// node_modules/@antv/g-webgpu/es/camera/Landmark.js
var Landmark = /* @__PURE__ */ function() {
function Landmark2(name, c5) {
_classCallCheck(this, Landmark2);
this.name = void 0;
this.matrix = void 0;
this.right = void 0;
this.up = void 0;
this.forward = void 0;
this.position = void 0;
this.focalPoint = void 0;
this.distanceVector = void 0;
this.distance = void 0;
this.dollyingStep = void 0;
this.azimuth = 0;
this.elevation = 0;
this.roll = 0;
this.relAzimuth = 0;
this.relElevation = 0;
this.relRoll = 0;
this.name = name;
this.matrix = mat4_exports.clone(c5.matrix);
this.right = vec3_exports.clone(c5.right);
this.up = vec3_exports.clone(c5.up);
this.forward = vec3_exports.clone(c5.forward);
this.position = vec3_exports.clone(c5.position);
this.focalPoint = vec3_exports.clone(c5.focalPoint);
this.distanceVector = vec3_exports.clone(c5.distanceVector);
this.azimuth = c5.azimuth;
this.elevation = c5.elevation;
this.roll = c5.roll;
this.relAzimuth = c5.relAzimuth;
this.relElevation = c5.relElevation;
this.relRoll = c5.relRoll;
this.dollyingStep = c5.dollyingStep;
this.distance = c5.distance;
}
_createClass(Landmark2, [{
key: "getPosition",
value: function getPosition() {
return this.position;
}
}, {
key: "getFocalPoint",
value: function getFocalPoint() {
return this.focalPoint;
}
}, {
key: "getRoll",
value: function getRoll() {
return this.roll;
}
}, {
key: "retrieve",
value: function retrieve(c5) {
c5.matrix = mat4_exports.copy(c5.matrix, this.matrix);
c5.right = vec3_exports.copy(c5.right, this.right);
c5.up = vec3_exports.copy(c5.up, this.up);
c5.forward = vec3_exports.copy(c5.forward, this.forward);
c5.position = vec3_exports.copy(c5.position, this.position);
c5.focalPoint = vec3_exports.copy(c5.focalPoint, this.focalPoint);
c5.distanceVector = vec3_exports.copy(c5.distanceVector, this.distanceVector);
c5.azimuth = this.azimuth;
c5.elevation = this.elevation;
c5.roll = this.roll;
c5.relAzimuth = this.relAzimuth;
c5.relElevation = this.relElevation;
c5.relRoll = this.relRoll;
c5.dollyingStep = this.dollyingStep;
c5.distance = this.distance;
}
}]);
return Landmark2;
}();
// node_modules/@antv/g-webgpu/es/camera/Camera.js
var _dec20;
var _dec211;
var _class15;
var _class212;
var _descriptor15;
var _class35;
var _temp13;
var CAMERA_TYPE;
(function(CAMERA_TYPE2) {
CAMERA_TYPE2["ORBITING"] = "ORBITING";
CAMERA_TYPE2["EXPLORING"] = "EXPLORING";
CAMERA_TYPE2["TRACKING"] = "TRACKING";
})(CAMERA_TYPE || (CAMERA_TYPE = {}));
var CAMERA_TRACKING_MODE;
(function(CAMERA_TRACKING_MODE2) {
CAMERA_TRACKING_MODE2["DEFAULT"] = "DEFAULT";
CAMERA_TRACKING_MODE2["ROTATIONAL"] = "ROTATIONAL";
CAMERA_TRACKING_MODE2["TRANSLATIONAL"] = "TRANSLATIONAL";
CAMERA_TRACKING_MODE2["CINEMATIC"] = "CINEMATIC";
})(CAMERA_TRACKING_MODE || (CAMERA_TRACKING_MODE = {}));
var CAMERA_PROJECTION_MODE;
(function(CAMERA_PROJECTION_MODE2) {
CAMERA_PROJECTION_MODE2["ORTHOGRAPHIC"] = "ORTHOGRAPHIC";
CAMERA_PROJECTION_MODE2["PERSPECTIVE"] = "PERSPECTIVE";
})(CAMERA_PROJECTION_MODE || (CAMERA_PROJECTION_MODE = {}));
var DEG_2_RAD = Math.PI / 180;
var RAD_2_DEG = 180 / Math.PI;
var Camera = (_dec20 = (0, import_inversify16.injectable)(), _dec211 = (0, import_inversify16.inject)(IDENTIFIER.InteractorService), _dec20(_class15 = (_class212 = (_temp13 = _class35 = /* @__PURE__ */ function() {
function Camera2() {
_classCallCheck(this, Camera2);
this.matrix = mat4_exports.create();
this.right = vec3_exports.fromValues(1, 0, 0);
this.up = vec3_exports.fromValues(0, 1, 0);
this.forward = vec3_exports.fromValues(0, 0, 1);
this.position = vec3_exports.fromValues(0, 0, 1);
this.focalPoint = vec3_exports.fromValues(0, 0, 0);
this.distanceVector = vec3_exports.fromValues(0, 0, 0);
this.distance = 1;
this.azimuth = 0;
this.elevation = 0;
this.roll = 0;
this.relAzimuth = 0;
this.relElevation = 0;
this.relRoll = 0;
this.dollyingStep = 0;
this.maxDistance = Infinity;
this.minDistance = -Infinity;
this.rotateWorld = false;
_initializerDefineProperty(this, "interactor", _descriptor15, this);
this.fov = 30;
this.near = 0.1;
this.far = 1e4;
this.aspect = 1;
this.left = void 0;
this.rright = void 0;
this.top = void 0;
this.bottom = void 0;
this.zoom = 1;
this.perspective = mat4_exports.create();
this.view = void 0;
this.following = void 0;
this.type = CAMERA_TYPE.EXPLORING;
this.trackingMode = CAMERA_TRACKING_MODE.DEFAULT;
this.projectionMode = CAMERA_PROJECTION_MODE.PERSPECTIVE;
this.frustum = new Frustum();
this.landmarks = [];
this.landmarkAnimationID = void 0;
}
_createClass(Camera2, [{
key: "clone",
value: function clone10() {
var camera = new Camera2();
camera.setType(this.type, void 0);
camera.interactor = this.interactor;
return camera;
}
}, {
key: "getProjectionMode",
value: function getProjectionMode() {
return this.projectionMode;
}
}, {
key: "getPerspective",
value: function getPerspective() {
return this.perspective;
}
}, {
key: "getFrustum",
value: function getFrustum() {
return this.frustum;
}
}, {
key: "getPosition",
value: function getPosition() {
return this.position;
}
}, {
key: "setType",
value: function setType(type2, trackingMode) {
this.type = type2;
if (this.type === CAMERA_TYPE.EXPLORING) {
this.setWorldRotation(true);
} else {
this.setWorldRotation(false);
}
this._getAngles();
if (this.type === CAMERA_TYPE.TRACKING && trackingMode !== void 0) {
this.setTrackingMode(trackingMode);
}
return this;
}
}, {
key: "setProjectionMode",
value: function setProjectionMode(projectionMode) {
this.projectionMode = projectionMode;
return this;
}
}, {
key: "setTrackingMode",
value: function setTrackingMode(trackingMode) {
if (this.type !== CAMERA_TYPE.TRACKING) {
throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");
}
this.trackingMode = trackingMode;
return this;
}
}, {
key: "setWorldRotation",
value: function setWorldRotation(flag) {
this.rotateWorld = flag;
this._getAngles();
}
}, {
key: "getViewTransform",
value: function getViewTransform() {
return mat4_exports.invert(mat4_exports.create(), this.matrix);
}
}, {
key: "getWorldTransform",
value: function getWorldTransform() {
return this.matrix;
}
}, {
key: "setMatrix",
value: function setMatrix(matrix) {
this.matrix = matrix;
this._update();
return this;
}
}, {
key: "setAspect",
value: function setAspect(aspect) {
this.setPerspective(this.near, this.far, this.fov, aspect);
return this;
}
}, {
key: "setViewOffset",
value: function setViewOffset(fullWidth, fullHeight, x6, y5, width2, height) {
this.aspect = fullWidth / fullHeight;
if (this.view === void 0) {
this.view = {
enabled: true,
fullWidth: 1,
fullHeight: 1,
offsetX: 0,
offsetY: 0,
width: 1,
height: 1
};
}
this.view.enabled = true;
this.view.fullWidth = fullWidth;
this.view.fullHeight = fullHeight;
this.view.offsetX = x6;
this.view.offsetY = y5;
this.view.width = width2;
this.view.height = height;
if (this.projectionMode === CAMERA_PROJECTION_MODE.PERSPECTIVE) {
this.setPerspective(this.near, this.far, this.fov, this.aspect);
} else {
this.setOrthographic(this.left, this.rright, this.top, this.bottom, this.near, this.far);
}
return this;
}
}, {
key: "clearViewOffset",
value: function clearViewOffset() {
if (this.view !== void 0) {
this.view.enabled = false;
}
if (this.projectionMode === CAMERA_PROJECTION_MODE.PERSPECTIVE) {
this.setPerspective(this.near, this.far, this.fov, this.aspect);
} else {
this.setOrthographic(this.left, this.rright, this.top, this.bottom, this.near, this.far);
}
return this;
}
}, {
key: "setPerspective",
value: function setPerspective(near2, far, fov, aspect) {
this.projectionMode = CAMERA_PROJECTION_MODE.PERSPECTIVE;
this.fov = fov;
this.near = near2;
this.far = far;
this.aspect = aspect;
mat4_exports.perspective(this.perspective, this.fov * DEG_2_RAD, this.aspect, this.near, this.far);
return this;
}
}, {
key: "setOrthographic",
value: function setOrthographic(l4, r4, t4, b10, near2, far) {
this.projectionMode = CAMERA_PROJECTION_MODE.ORTHOGRAPHIC;
this.rright = r4;
this.left = l4;
this.top = t4;
this.bottom = b10;
this.near = near2;
this.far = far;
var dx = (this.rright - this.left) / (2 * this.zoom);
var dy = (this.top - this.bottom) / (2 * this.zoom);
var cx = (this.rright + this.left) / 2;
var cy = (this.top + this.bottom) / 2;
var left2 = cx - dx;
var right2 = cx + dx;
var top = cy + dy;
var bottom = cy - dy;
if (this.view !== void 0 && this.view.enabled) {
var scaleW = (this.rright - this.left) / this.view.fullWidth / this.zoom;
var scaleH = (this.top - this.bottom) / this.view.fullHeight / this.zoom;
left2 += scaleW * this.view.offsetX;
right2 = left2 + scaleW * this.view.width;
top -= scaleH * this.view.offsetY;
bottom = top - scaleH * this.view.height;
}
mat4_exports.ortho(this.perspective, left2, right2, top, bottom, near2, far);
return this;
}
}, {
key: "setPosition",
value: function setPosition(x6, y5, z3) {
this._setPosition(x6, y5, z3);
this.setFocalPoint(this.focalPoint);
return this;
}
}, {
key: "setFocalPoint",
value: function setFocalPoint(x6, y5, z3) {
var up = vec3_exports.fromValues(0, 1, 0);
this.focalPoint = createVec3(x6, y5, z3);
if (this.trackingMode === CAMERA_TRACKING_MODE.CINEMATIC) {
var d3 = vec3_exports.subtract(vec3_exports.create(), this.focalPoint, this.position);
x6 = d3[0];
y5 = d3[1];
z3 = d3[2];
var r4 = vec3_exports.length(d3);
var el = Math.asin(y5 / r4) * RAD_2_DEG;
var az = 90 + Math.atan2(z3, x6) * RAD_2_DEG;
var m4 = mat4_exports.create();
mat4_exports.rotateY(m4, m4, az * DEG_2_RAD);
mat4_exports.rotateX(m4, m4, el * DEG_2_RAD);
up = vec3_exports.transformMat4(vec3_exports.create(), [0, 1, 0], m4);
}
mat4_exports.invert(this.matrix, mat4_exports.lookAt(mat4_exports.create(), this.position, this.focalPoint, up));
this._getAxes();
this._getDistance();
this._getAngles();
return this;
}
}, {
key: "setDistance",
value: function setDistance(d3) {
if (this.distance === d3 || d3 < 0) {
return;
}
this.distance = d3;
if (this.distance < 2e-4) {
this.distance = 2e-4;
}
this.dollyingStep = this.distance / 100;
var pos = vec3_exports.create();
d3 = this.distance;
var n3 = this.forward;
var f3 = this.focalPoint;
pos[0] = d3 * n3[0] + f3[0];
pos[1] = d3 * n3[1] + f3[1];
pos[2] = d3 * n3[2] + f3[2];
this._setPosition(pos);
return this;
}
}, {
key: "setMaxDistance",
value: function setMaxDistance(d3) {
this.maxDistance = d3;
return this;
}
}, {
key: "setMinDistance",
value: function setMinDistance(d3) {
this.minDistance = d3;
return this;
}
}, {
key: "changeAzimuth",
value: function changeAzimuth(az) {
this.setAzimuth(this.azimuth + az);
return this;
}
}, {
key: "changeElevation",
value: function changeElevation(el) {
this.setElevation(this.elevation + el);
return this;
}
}, {
key: "changeRoll",
value: function changeRoll(rl) {
this.setRoll(this.roll + rl);
return this;
}
}, {
key: "setAzimuth",
value: function setAzimuth(az) {
this.azimuth = getAngle5(az);
this.computeMatrix();
this._getAxes();
if (this.type === CAMERA_TYPE.ORBITING || this.type === CAMERA_TYPE.EXPLORING) {
this._getPosition();
} else if (this.type === CAMERA_TYPE.TRACKING) {
this._getFocalPoint();
}
return this;
}
}, {
key: "getAzimuth",
value: function getAzimuth() {
return this.azimuth;
}
}, {
key: "setElevation",
value: function setElevation(el) {
this.elevation = getAngle5(el);
this.computeMatrix();
this._getAxes();
if (this.type === CAMERA_TYPE.ORBITING || this.type === CAMERA_TYPE.EXPLORING) {
this._getPosition();
} else if (this.type === CAMERA_TYPE.TRACKING) {
this._getFocalPoint();
}
return this;
}
}, {
key: "setRoll",
value: function setRoll(angle3) {
this.roll = getAngle5(angle3);
this.computeMatrix();
this._getAxes();
if (this.type === CAMERA_TYPE.ORBITING || this.type === CAMERA_TYPE.EXPLORING) {
this._getPosition();
} else if (this.type === CAMERA_TYPE.TRACKING) {
this._getFocalPoint();
}
return this;
}
}, {
key: "rotate",
value: function rotate8(azimuth, elevation, roll) {
if (this.type === CAMERA_TYPE.EXPLORING) {
azimuth = getAngle5(azimuth);
elevation = getAngle5(elevation);
roll = getAngle5(roll);
var rotX = quat_exports.setAxisAngle(quat_exports.create(), [1, 0, 0], (this.rotateWorld ? 1 : -1) * elevation * DEG_2_RAD);
var rotY = quat_exports.setAxisAngle(quat_exports.create(), [0, 1, 0], (this.rotateWorld ? 1 : -1) * azimuth * DEG_2_RAD);
var rotZ = quat_exports.setAxisAngle(quat_exports.create(), [0, 0, 1], roll * DEG_2_RAD);
var rotQ = quat_exports.multiply(quat_exports.create(), rotY, rotX);
rotQ = quat_exports.multiply(quat_exports.create(), rotQ, rotZ);
var rotMatrix = mat4_exports.fromQuat(mat4_exports.create(), rotQ);
mat4_exports.translate(this.matrix, this.matrix, [0, 0, -this.distance]);
mat4_exports.multiply(this.matrix, this.matrix, rotMatrix);
mat4_exports.translate(this.matrix, this.matrix, [0, 0, this.distance]);
} else {
if (Math.abs(this.elevation + elevation) > 90) {
return;
}
this.relElevation = getAngle5(elevation);
this.relAzimuth = getAngle5(azimuth);
this.relRoll = getAngle5(roll);
this.elevation += this.relElevation;
this.azimuth += this.relAzimuth;
this.roll += this.relRoll;
this.computeMatrix();
}
this._getAxes();
if (this.type === CAMERA_TYPE.ORBITING || this.type === CAMERA_TYPE.EXPLORING) {
this._getPosition();
} else if (this.type === CAMERA_TYPE.TRACKING) {
this._getFocalPoint();
}
this._update();
return this;
}
}, {
key: "pan",
value: function pan(tx, ty) {
var coords = createVec3(tx, ty, 0);
var pos = vec3_exports.clone(this.position);
vec3_exports.add(pos, pos, vec3_exports.scale(vec3_exports.create(), this.right, coords[0]));
vec3_exports.add(pos, pos, vec3_exports.scale(vec3_exports.create(), this.up, coords[1]));
this._setPosition(pos);
return this;
}
}, {
key: "dolly",
value: function dolly(value2) {
var n3 = this.forward;
var pos = vec3_exports.clone(this.position);
var step = value2 * this.dollyingStep;
var updatedDistance = this.distance + value2 * this.dollyingStep;
step = Math.max(Math.min(updatedDistance, this.maxDistance), this.minDistance) - this.distance;
pos[0] += step * n3[0];
pos[1] += step * n3[1];
pos[2] += step * n3[2];
this._setPosition(pos);
if (this.type === CAMERA_TYPE.ORBITING || this.type === CAMERA_TYPE.EXPLORING) {
this._getDistance();
} else if (this.type === CAMERA_TYPE.TRACKING) {
vec3_exports.add(this.focalPoint, pos, this.distanceVector);
}
return this;
}
}, {
key: "createLandmark",
value: function createLandmark(name, params) {
var camera = this.clone();
camera.setPosition(params.position);
camera.setFocalPoint(params.focalPoint);
if (params.roll !== void 0) {
camera.setRoll(params.roll);
}
var landmark = new Landmark(name, camera);
this.landmarks.push(landmark);
return landmark;
}
}, {
key: "setLandmark",
value: function setLandmark(name) {
var landmark = new Landmark(name, this);
this.landmarks.push(landmark);
return this;
}
}, {
key: "gotoLandmark",
value: function gotoLandmark(name) {
var _this = this;
var duration = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1e3;
var landmark = this.landmarks.find(function(l4) {
return l4.name === name;
});
if (landmark) {
if (duration === 0) {
landmark.retrieve(this);
return;
}
if (this.landmarkAnimationID !== void 0) {
window.cancelAnimationFrame(this.landmarkAnimationID);
}
this.interactor.disconnect();
var destPosition = landmark.getPosition();
var destFocalPoint = landmark.getFocalPoint();
var destRoll = landmark.getRoll();
var timeStart;
var animate = function animate2(timestamp2) {
if (timeStart === void 0) {
timeStart = timestamp2;
}
var elapsed = timestamp2 - timeStart;
var t4 = (1 - Math.cos(elapsed / duration * Math.PI)) / 2;
var interFocalPoint = vec3_exports.create();
var interPosition = vec3_exports.create();
var interRoll = 0;
vec3_exports.lerp(interFocalPoint, _this.focalPoint, destFocalPoint, t4);
vec3_exports.lerp(interPosition, _this.position, destPosition, t4);
interRoll = _this.roll * (1 - t4) + destRoll * t4;
_this.setFocalPoint(interFocalPoint);
_this.setPosition(interPosition);
_this.setRoll(interRoll);
_this.computeMatrix();
var dist4 = vec3_exports.dist(interFocalPoint, destFocalPoint) + vec3_exports.dist(interPosition, destPosition);
if (dist4 > 0.01) {
} else {
_this.setFocalPoint(interFocalPoint);
_this.setPosition(interPosition);
_this.setRoll(interRoll);
_this.computeMatrix();
_this.interactor.connect();
return;
}
if (elapsed < duration) {
_this.landmarkAnimationID = window.requestAnimationFrame(animate2);
}
};
window.requestAnimationFrame(animate);
}
}
}, {
key: "_update",
value: function _update2() {
this._getAxes();
this._getPosition();
this._getDistance();
this._getAngles();
}
}, {
key: "computeMatrix",
value: function computeMatrix() {
var rotX;
var rotY;
var rotZ = quat_exports.setAxisAngle(quat_exports.create(), [0, 0, 1], this.roll * DEG_2_RAD);
mat4_exports.identity(this.matrix);
rotX = quat_exports.setAxisAngle(quat_exports.create(), [1, 0, 0], (this.rotateWorld && this.type !== CAMERA_TYPE.TRACKING || this.type === CAMERA_TYPE.TRACKING ? 1 : -1) * this.elevation * DEG_2_RAD);
rotY = quat_exports.setAxisAngle(quat_exports.create(), [0, 1, 0], (this.rotateWorld && this.type !== CAMERA_TYPE.TRACKING || this.type === CAMERA_TYPE.TRACKING ? 1 : -1) * this.azimuth * DEG_2_RAD);
var rotQ = quat_exports.multiply(quat_exports.create(), rotY, rotX);
rotQ = quat_exports.multiply(quat_exports.create(), rotQ, rotZ);
var rotMatrix = mat4_exports.fromQuat(mat4_exports.create(), rotQ);
if (this.type === CAMERA_TYPE.ORBITING || this.type === CAMERA_TYPE.EXPLORING) {
mat4_exports.translate(this.matrix, this.matrix, this.focalPoint);
mat4_exports.multiply(this.matrix, this.matrix, rotMatrix);
mat4_exports.translate(this.matrix, this.matrix, [0, 0, this.distance]);
} else if (this.type === CAMERA_TYPE.TRACKING) {
mat4_exports.translate(this.matrix, this.matrix, this.position);
mat4_exports.multiply(this.matrix, this.matrix, rotMatrix);
}
}
}, {
key: "_setPosition",
value: function _setPosition(x6, y5, z3) {
this.position = createVec3(x6, y5, z3);
var m4 = this.matrix;
m4[12] = this.position[0];
m4[13] = this.position[1];
m4[14] = this.position[2];
m4[15] = 1;
}
}, {
key: "_getAxes",
value: function _getAxes() {
vec3_exports.copy(this.right, createVec3(vec4_exports.transformMat4(vec4_exports.create(), [1, 0, 0, 0], this.matrix)));
vec3_exports.copy(this.up, createVec3(vec4_exports.transformMat4(vec4_exports.create(), [0, 1, 0, 0], this.matrix)));
vec3_exports.copy(this.forward, createVec3(vec4_exports.transformMat4(vec4_exports.create(), [0, 0, 1, 0], this.matrix)));
vec3_exports.normalize(this.right, this.right);
vec3_exports.normalize(this.up, this.up);
vec3_exports.normalize(this.forward, this.forward);
}
}, {
key: "_getAngles",
value: function _getAngles() {
var x6 = this.distanceVector[0];
var y5 = this.distanceVector[1];
var z3 = this.distanceVector[2];
var r4 = vec3_exports.length(this.distanceVector);
if (r4 === 0) {
this.elevation = 0;
this.azimuth = 0;
return;
}
if (this.type === CAMERA_TYPE.TRACKING) {
this.elevation = Math.asin(y5 / r4) * RAD_2_DEG;
this.azimuth = Math.atan2(-x6, -z3) * RAD_2_DEG;
} else {
if (this.rotateWorld) {
this.elevation = Math.asin(y5 / r4) * RAD_2_DEG;
this.azimuth = Math.atan2(-x6, -z3) * RAD_2_DEG;
} else {
this.elevation = -Math.asin(y5 / r4) * RAD_2_DEG;
this.azimuth = -Math.atan2(-x6, -z3) * RAD_2_DEG;
}
}
}
}, {
key: "_getPosition",
value: function _getPosition() {
vec3_exports.copy(this.position, createVec3(vec4_exports.transformMat4(vec4_exports.create(), [0, 0, 0, 1], this.matrix)));
this._getDistance();
}
}, {
key: "_getFocalPoint",
value: function _getFocalPoint() {
vec3_exports.transformMat3(this.distanceVector, [0, 0, -this.distance], mat3_exports.fromMat4(mat3_exports.create(), this.matrix));
vec3_exports.add(this.focalPoint, this.position, this.distanceVector);
this._getDistance();
}
}, {
key: "_getDistance",
value: function _getDistance() {
this.distanceVector = vec3_exports.subtract(vec3_exports.create(), this.focalPoint, this.position);
this.distance = vec3_exports.length(this.distanceVector);
this.dollyingStep = this.distance / 100;
}
}]);
return Camera2;
}(), _class35.ProjectionMode = {
ORTHOGRAPHIC: "ORTHOGRAPHIC",
PERSPECTIVE: "PERSPECTIVE"
}, _temp13), _descriptor15 = _applyDecoratedDescriptor(_class212.prototype, "interactor", [_dec211], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class212)) || _class15);
// node_modules/@antv/g-webgpu/es/geometry/index.js
var import_inversify17 = __toModule(require_inversify());
var _dec21;
var _dec212;
var _class16;
var _class213;
var _descriptor16;
var _class36;
var _temp14;
var Geometry2 = (_dec21 = (0, import_inversify17.injectable)(), _dec212 = (0, import_inversify17.inject)(IDENTIFIER.GeometryComponentManager), _dec21(_class16 = (_class213 = (_temp14 = _class36 = /* @__PURE__ */ function() {
function Geometry3() {
_classCallCheck(this, Geometry3);
this.config = void 0;
_initializerDefineProperty(this, "geometry", _descriptor16, this);
this.entity = void 0;
this.component = void 0;
}
_createClass(Geometry3, [{
key: "getEntity",
value: function getEntity() {
return this.entity;
}
}, {
key: "getComponent",
value: function getComponent() {
return this.component;
}
}, {
key: "setConfig",
value: function setConfig(config) {
this.config = config;
}
}, {
key: "setEntity",
value: function setEntity(entity) {
this.entity = entity;
this.component = this.geometry.create(entity);
this.component.entity = entity;
this.onEntityCreated();
}
}, {
key: "onEntityCreated",
value: function onEntityCreated() {
}
}]);
return Geometry3;
}(), _class36.BOX = "box", _class36.SPHERE = "sphere", _class36.PLANE = "plane", _class36.MERGED = "merged", _temp14), _descriptor16 = _applyDecoratedDescriptor(_class213.prototype, "geometry", [_dec212], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class213)) || _class16);
// node_modules/@antv/g-webgpu/es/Kernel.js
var import_regenerator11 = __toModule(require_regenerator());
var WebGPUConstants = __toModule(require_constants());
var import_inversify18 = __toModule(require_inversify());
// node_modules/@antv/g-webgpu/es/utils/canvas.js
function createCanvas() {
if (typeof document !== "undefined") {
return document.createElement("canvas");
} else {
throw new Error("Cannot create a canvas in this context");
}
}
// node_modules/@antv/g-webgpu/es/utils/is-type.js
var toString6 = {}.toString;
var isType4 = function isType5(value2, type2) {
return toString6.call(value2) === "[object " + type2 + "]";
};
var is_type_default2 = isType4;
// node_modules/@antv/g-webgpu/es/utils/is-array.js
var is_array_default2 = function(value2) {
return Array.isArray ? Array.isArray(value2) : is_type_default2(value2, "Array");
};
// node_modules/@antv/g-webgpu/es/utils/is-typedarray.js
var MAX_SAFE_INTEGER2 = 9007199254740991;
var argsTag2 = "[object Arguments]";
var arrayTag2 = "[object Array]";
var boolTag2 = "[object Boolean]";
var dateTag2 = "[object Date]";
var errorTag2 = "[object Error]";
var funcTag2 = "[object Function]";
var mapTag2 = "[object Map]";
var numberTag2 = "[object Number]";
var objectTag2 = "[object Object]";
var regexpTag2 = "[object RegExp]";
var setTag2 = "[object Set]";
var stringTag2 = "[object String]";
var weakMapTag2 = "[object WeakMap]";
var arrayBufferTag2 = "[object ArrayBuffer]";
var dataViewTag2 = "[object DataView]";
var float32Tag2 = "[object Float32Array]";
var float64Tag2 = "[object Float64Array]";
var int8Tag2 = "[object Int8Array]";
var int16Tag2 = "[object Int16Array]";
var int32Tag2 = "[object Int32Array]";
var uint8Tag2 = "[object Uint8Array]";
var uint8ClampedTag2 = "[object Uint8ClampedArray]";
var uint16Tag2 = "[object Uint16Array]";
var uint32Tag2 = "[object Uint32Array]";
var typedArrayTags2 = {};
typedArrayTags2[float32Tag2] = typedArrayTags2[float64Tag2] = typedArrayTags2[int8Tag2] = typedArrayTags2[int16Tag2] = typedArrayTags2[int32Tag2] = typedArrayTags2[uint8Tag2] = typedArrayTags2[uint8ClampedTag2] = typedArrayTags2[uint16Tag2] = typedArrayTags2[uint32Tag2] = true;
typedArrayTags2[argsTag2] = typedArrayTags2[arrayTag2] = typedArrayTags2[arrayBufferTag2] = typedArrayTags2[boolTag2] = typedArrayTags2[dataViewTag2] = typedArrayTags2[dateTag2] = typedArrayTags2[errorTag2] = typedArrayTags2[funcTag2] = typedArrayTags2[mapTag2] = typedArrayTags2[numberTag2] = typedArrayTags2[objectTag2] = typedArrayTags2[regexpTag2] = typedArrayTags2[setTag2] = typedArrayTags2[stringTag2] = typedArrayTags2[weakMapTag2] = false;
var objectProto3 = Object.prototype;
var objectToString2 = objectProto3.toString;
function baseIsTypedArray2(value2) {
return isObjectLike4(value2) && isLength2(value2.length) && !!typedArrayTags2[objectToString2.call(value2)];
}
function isLength2(value2) {
return typeof value2 === "number" && value2 > -1 && value2 % 1 === 0 && value2 <= MAX_SAFE_INTEGER2;
}
function isObjectLike4(value2) {
return !!value2 && _typeof3(value2) === "object";
}
var isTypedArray2 = baseIsTypedArray2;
// node_modules/@antv/g-webgpu/es/Kernel.js
var _dec30;
var _dec213;
var _dec310;
var _class17;
var _class214;
var _descriptor17;
var _descriptor210;
var _temp15;
function ownKeys5(object, enumerableOnly) {
var keys2 = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys2.push.apply(keys2, symbols);
}
return keys2;
}
function _objectSpread5(target) {
for (var i4 = 1; i4 < arguments.length; i4++) {
var source = arguments[i4] != null ? arguments[i4] : {};
if (i4 % 2) {
ownKeys5(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys5(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
var Kernel = (_dec30 = (0, import_inversify18.injectable)(), _dec213 = (0, import_inversify18.inject)(IDENTIFIER.RenderEngine), _dec310 = (0, import_inversify18.inject)(IDENTIFIER.ConfigService), _dec30(_class17 = (_class214 = (_temp15 = /* @__PURE__ */ function() {
function Kernel2() {
_classCallCheck(this, Kernel2);
_initializerDefineProperty(this, "engine", _descriptor17, this);
_initializerDefineProperty(this, "configService", _descriptor210, this);
this.entity = createEntity();
this.model = void 0;
this.dirty = true;
this.compiledBundle = void 0;
this.initPromise = void 0;
}
_createClass(Kernel2, [{
key: "init",
value: function init() {
var _this$configService$g = this.configService.get(), canvas = _this$configService$g.canvas, engineOptions = _this$configService$g.engineOptions;
this.initPromise = this.engine.init(_objectSpread5({
canvas: canvas || createCanvas(),
swapChainFormat: WebGPUConstants.TextureFormat.BGRA8Unorm,
antialiasing: false
}, engineOptions));
}
}, {
key: "setBundle",
value: function setBundle(bundle) {
this.compiledBundle = JSON.parse(JSON.stringify(bundle));
}
}, {
key: "setDispatch",
value: function setDispatch(dispatch2) {
if (this.compiledBundle.context) {
this.compiledBundle.context.dispatch = dispatch2;
}
return this;
}
}, {
key: "setMaxIteration",
value: function setMaxIteration(maxIteration) {
if (this.compiledBundle.context) {
this.compiledBundle.context.maxIteration = maxIteration;
}
return this;
}
}, {
key: "setBinding",
value: function setBinding(name, data3) {
var _this = this;
if (typeof name === "string") {
var isNumberLikeData = isNumber5(data3) || isTypedArray2(data3) || is_array_default2(data3);
if (this.compiledBundle && this.compiledBundle.context) {
var existedDefine = this.compiledBundle.context.defines.find(function(b10) {
return b10.name === name;
});
if (existedDefine) {
existedDefine.value = data3;
return this;
}
var existedBinding = this.compiledBundle.context.uniforms.find(function(b10) {
return b10.name === name;
});
if (existedBinding) {
if (isNumberLikeData) {
existedBinding.data = data3;
existedBinding.isReferer = false;
if (existedBinding.storageClass === STORAGE_CLASS.Uniform) {
if (this.model) {
this.model.updateUniform(name, data3);
}
} else {
if (this.model) {
this.model.updateBuffer(name, data3);
}
}
} else {
existedBinding.isReferer = true;
existedBinding.data = data3;
}
}
}
} else {
Object.keys(name).forEach(function(key) {
_this.setBinding(key, name[key]);
});
}
return this;
}
}, {
key: "execute",
value: function() {
var _execute = _asyncToGenerator(/* @__PURE__ */ import_regenerator11.default.mark(function _callee() {
var _this2 = this;
var iteration, i4, _args = arguments;
return import_regenerator11.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
iteration = _args.length > 0 && _args[0] !== void 0 ? _args[0] : 1;
if (!this.dirty) {
_context.next = 6;
break;
}
if (this.compiledBundle.context) {
if (iteration > 1) {
this.compiledBundle.context.maxIteration = iteration;
} else {
this.compiledBundle.context.maxIteration++;
}
}
_context.next = 5;
return this.compile();
case 5:
this.dirty = false;
case 6:
this.engine.beginFrame();
this.engine.clear({});
if (this.compiledBundle.context) {
this.compiledBundle.context.uniforms.filter(function(_ref2) {
var isReferer = _ref2.isReferer;
return isReferer;
}).forEach(function(_ref2) {
var data3 = _ref2.data, name = _ref2.name;
_this2.model.confirmInput(data3.model, name);
});
}
for (i4 = 0; i4 < iteration; i4++) {
this.model.run();
}
this.engine.endFrame();
return _context.abrupt("return", this);
case 12:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
function execute() {
return _execute.apply(this, arguments);
}
return execute;
}()
}, {
key: "getOutput",
value: function() {
var _getOutput = _asyncToGenerator(/* @__PURE__ */ import_regenerator11.default.mark(function _callee2() {
return import_regenerator11.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
return _context2.abrupt("return", this.model.readData());
case 1:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
function getOutput() {
return _getOutput.apply(this, arguments);
}
return getOutput;
}()
}, {
key: "compile",
value: function() {
var _compile = _asyncToGenerator(/* @__PURE__ */ import_regenerator11.default.mark(function _callee3() {
var context, target, shader;
return import_regenerator11.default.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return this.initPromise;
case 2:
context = _objectSpread5({}, this.compiledBundle.context);
target = this.engine.supportWebGPU ? this.engine.useWGSL ? Target.WGSL : Target.GLSL450 : Target.GLSL100;
shader = this.compiledBundle.shaders[target];
context.defines.filter(function(define2) {
return define2.runtime;
}).forEach(function(define2) {
var valuePlaceHolder = "".concat(DefineValuePlaceholder).concat(define2.name);
shader = shader.replace(valuePlaceHolder, "".concat(define2.value));
});
context.shader = shader;
context.uniforms.forEach(function(uniform) {
if (!uniform.data) {
if (uniform.storageClass === STORAGE_CLASS.StorageBuffer) {
var sizePerElement = 1;
if (uniform.type === AST_TOKEN_TYPES.FloatArray) {
sizePerElement = 1;
} else if (uniform.type === AST_TOKEN_TYPES.Vector4FloatArray) {
sizePerElement = 4;
}
uniform.data = new Float32Array(context.output.length * sizePerElement).fill(0);
}
}
});
this.compiledBundle.context = context;
_context3.next = 11;
return this.engine.createComputeModel(this.compiledBundle.context);
case 11:
this.model = _context3.sent;
case 12:
case "end":
return _context3.stop();
}
}
}, _callee3, this);
}));
function compile() {
return _compile.apply(this, arguments);
}
return compile;
}()
}]);
return Kernel2;
}(), _temp15), _descriptor17 = _applyDecoratedDescriptor(_class214.prototype, "engine", [_dec213], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor210 = _applyDecoratedDescriptor(_class214.prototype, "configService", [_dec310], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class214)) || _class17);
// node_modules/@antv/g-webgpu/es/material/index.js
var import_inversify19 = __toModule(require_inversify());
var _dec31;
var _dec214;
var _class18;
var _class215;
var _descriptor18;
var _class37;
var _temp16;
var Material = (_dec31 = (0, import_inversify19.injectable)(), _dec214 = (0, import_inversify19.inject)(IDENTIFIER.MaterialComponentManager), _dec31(_class18 = (_class215 = (_temp16 = _class37 = /* @__PURE__ */ function() {
function Material2() {
_classCallCheck(this, Material2);
this.config = void 0;
_initializerDefineProperty(this, "material", _descriptor18, this);
this.entity = void 0;
this.component = void 0;
}
_createClass(Material2, [{
key: "getEntity",
value: function getEntity() {
return this.entity;
}
}, {
key: "getComponent",
value: function getComponent() {
return this.component;
}
}, {
key: "setConfig",
value: function setConfig(config) {
this.config = config;
}
}, {
key: "setEntity",
value: function setEntity(entity, type2) {
this.entity = entity;
this.component = this.material.create(entity);
this.component.entity = entity;
this.component.type = type2;
this.onEntityCreated();
}
}, {
key: "onEntityCreated",
value: function onEntityCreated() {
}
}]);
return Material2;
}(), _class37.BASIC = "basic", _temp16), _descriptor18 = _applyDecoratedDescriptor(_class215.prototype, "material", [_dec214], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class215)) || _class18);
// node_modules/@antv/g-webgpu/es/renderable/Renderable.js
var import_inversify20 = __toModule(require_inversify());
var _dec40;
var _dec215;
var _dec311;
var _dec48;
var _dec56;
var _dec64;
var _class19;
var _class216;
var _descriptor19;
var _descriptor211;
var _descriptor38;
var _descriptor46;
var _class38;
var _temp17;
var Renderable = (_dec40 = (0, import_inversify20.injectable)(), _dec215 = (0, import_inversify20.inject)(IDENTIFIER.MeshComponentManager), _dec311 = (0, import_inversify20.inject)(IDENTIFIER.CullableComponentManager), _dec48 = (0, import_inversify20.inject)(IDENTIFIER.TransformComponentManager), _dec56 = (0, import_inversify20.inject)(IDENTIFIER.Systems), _dec64 = (0, import_inversify20.named)(IDENTIFIER.SceneGraphSystem), _dec40(_class19 = (_class216 = (_temp17 = _class38 = /* @__PURE__ */ function() {
function Renderable2() {
_classCallCheck(this, Renderable2);
this.attributes = {};
this.config = void 0;
_initializerDefineProperty(this, "mesh", _descriptor19, this);
_initializerDefineProperty(this, "cullable", _descriptor211, this);
_initializerDefineProperty(this, "transform", _descriptor38, this);
_initializerDefineProperty(this, "sceneGraphSystem", _descriptor46, this);
this.meshComponent = void 0;
this.transformComponent = void 0;
this.entity = void 0;
}
_createClass(Renderable2, [{
key: "getEntity",
value: function getEntity() {
return this.entity;
}
}, {
key: "getTransformComponent",
value: function getTransformComponent() {
return this.transformComponent;
}
}, {
key: "getMeshComponent",
value: function getMeshComponent() {
return this.meshComponent;
}
}, {
key: "setConfig",
value: function setConfig(config) {
this.config = config;
}
}, {
key: "setEntity",
value: function setEntity(entity) {
this.entity = entity;
this.cullable.create(entity);
this.meshComponent = this.mesh.create(entity);
this.transformComponent = this.transform.create(entity);
this.onEntityCreated();
}
}, {
key: "setMaterial",
value: function setMaterial(material) {
this.meshComponent.material = material;
return this;
}
}, {
key: "setGeometry",
value: function setGeometry(geometry35) {
this.meshComponent.geometry = geometry35;
return this;
}
}, {
key: "setAttributes",
value: function setAttributes(attributes) {
var _this = this;
Object.keys(attributes).forEach(function(name) {
if (attributes[name] !== void 0 && attributes[name] !== _this.attributes[name]) {
_this.onAttributeChanged({
name,
data: attributes[name]
});
_this.attributes[name] = attributes[name];
}
});
}
}, {
key: "setVisible",
value: function setVisible(visible) {
var _this2 = this;
this.meshComponent.visible = visible;
this.meshComponent.children.forEach(function(childEntity) {
var child = _this2.mesh.getComponentByEntity(childEntity);
if (child) {
child.visible = visible;
}
});
return this;
}
}, {
key: "isVisible",
value: function isVisible() {
return this.meshComponent.visible;
}
}, {
key: "attach",
value: function attach(parentRenderable) {
this.sceneGraphSystem.attach(this.entity, parentRenderable.entity);
return this;
}
}, {
key: "detach",
value: function detach() {
this.sceneGraphSystem.detach(this.entity);
return this;
}
}, {
key: "detachChildren",
value: function detachChildren() {
this.sceneGraphSystem.detachChildren(this.entity);
return this;
}
}, {
key: "onEntityCreated",
value: function onEntityCreated() {
}
}, {
key: "onAttributeChanged",
value: function onAttributeChanged(_ref2) {
var name = _ref2.name, data3 = _ref2.data;
if (this.meshComponent && this.meshComponent.material) {
this.meshComponent.material.setUniform(this.convertAttributeName2UniformName(name), data3);
}
}
}, {
key: "convertAttributeName2UniformName",
value: function convertAttributeName2UniformName(attributeName) {
return attributeName;
}
}]);
return Renderable2;
}(), _class38.POINT = "point", _class38.LINE = "line", _class38.GRID = "grid", _temp17), _descriptor19 = _applyDecoratedDescriptor(_class216.prototype, "mesh", [_dec215], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor211 = _applyDecoratedDescriptor(_class216.prototype, "cullable", [_dec311], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor38 = _applyDecoratedDescriptor(_class216.prototype, "transform", [_dec48], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor46 = _applyDecoratedDescriptor(_class216.prototype, "sceneGraphSystem", [_dec56, _dec64], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class216)) || _class19);
// node_modules/@antv/g-webgpu/es/World.js
var import_regenerator20 = __toModule(require_regenerator());
// node_modules/@antv/g-webgpu-engine/es/webgl/index.js
var import_regenerator13 = __toModule(require_regenerator());
var import_inversify21 = __toModule(require_inversify());
var import_regl = __toModule(require_regl());
// node_modules/@antv/g-webgpu-engine/es/webgl/ReglAttribute.js
var ReglAttribute = /* @__PURE__ */ function() {
function ReglAttribute2(gl2, options) {
_classCallCheck(this, ReglAttribute2);
this.attribute = void 0;
this.buffer = void 0;
var buffer = options.buffer, offset = options.offset, stride = options.stride, normalized = options.normalized, size2 = options.size, divisor = options.divisor;
this.buffer = buffer;
this.attribute = {
buffer: buffer.get(),
offset: offset || 0,
stride: stride || 0,
normalized: normalized || false,
divisor: divisor || 0
};
if (size2) {
this.attribute.size = size2;
}
}
_createClass(ReglAttribute2, [{
key: "get",
value: function get3() {
return this.attribute;
}
}, {
key: "updateBuffer",
value: function updateBuffer(options) {
this.buffer.subData(options);
}
}, {
key: "destroy",
value: function destroy() {
this.buffer.destroy();
}
}]);
return ReglAttribute2;
}();
// node_modules/@antv/g-webgpu-engine/es/webgl/constants.js
var _primitiveMap;
var _usageMap;
var _dataTypeMap;
var _formatMap;
var _mipmapMap;
var _filterMap;
var _wrapModeMap;
var _colorSpaceMap;
var _depthFuncMap;
var _blendEquationMap;
var _blendFuncMap;
var _stencilFuncMap;
var _stencilOpMap;
var _cullFaceMap;
var primitiveMap = (_primitiveMap = {}, _defineProperty(_primitiveMap, gl.POINTS, "points"), _defineProperty(_primitiveMap, gl.LINES, "lines"), _defineProperty(_primitiveMap, gl.LINE_LOOP, "line loop"), _defineProperty(_primitiveMap, gl.LINE_STRIP, "line strip"), _defineProperty(_primitiveMap, gl.TRIANGLES, "triangles"), _defineProperty(_primitiveMap, gl.TRIANGLE_FAN, "triangle fan"), _defineProperty(_primitiveMap, gl.TRIANGLE_STRIP, "triangle strip"), _primitiveMap);
var usageMap = (_usageMap = {}, _defineProperty(_usageMap, gl.STATIC_DRAW, "static"), _defineProperty(_usageMap, gl.DYNAMIC_DRAW, "dynamic"), _defineProperty(_usageMap, gl.STREAM_DRAW, "stream"), _usageMap);
var dataTypeMap = (_dataTypeMap = {}, _defineProperty(_dataTypeMap, gl.BYTE, "int8"), _defineProperty(_dataTypeMap, gl.UNSIGNED_INT, "int16"), _defineProperty(_dataTypeMap, gl.INT, "int32"), _defineProperty(_dataTypeMap, gl.UNSIGNED_BYTE, "uint8"), _defineProperty(_dataTypeMap, gl.UNSIGNED_SHORT, "uint16"), _defineProperty(_dataTypeMap, gl.UNSIGNED_INT, "uint32"), _defineProperty(_dataTypeMap, gl.FLOAT, "float"), _dataTypeMap);
var formatMap = (_formatMap = {}, _defineProperty(_formatMap, gl.ALPHA, "alpha"), _defineProperty(_formatMap, gl.LUMINANCE, "luminance"), _defineProperty(_formatMap, gl.LUMINANCE_ALPHA, "luminance alpha"), _defineProperty(_formatMap, gl.RGB, "rgb"), _defineProperty(_formatMap, gl.RGBA, "rgba"), _defineProperty(_formatMap, gl.RGBA4, "rgba4"), _defineProperty(_formatMap, gl.RGB5_A1, "rgb5 a1"), _defineProperty(_formatMap, gl.RGB565, "rgb565"), _defineProperty(_formatMap, gl.DEPTH_COMPONENT, "depth"), _defineProperty(_formatMap, gl.DEPTH_STENCIL, "depth stencil"), _formatMap);
var mipmapMap = (_mipmapMap = {}, _defineProperty(_mipmapMap, gl.DONT_CARE, "dont care"), _defineProperty(_mipmapMap, gl.NICEST, "nice"), _defineProperty(_mipmapMap, gl.FASTEST, "fast"), _mipmapMap);
var filterMap = (_filterMap = {}, _defineProperty(_filterMap, gl.NEAREST, "nearest"), _defineProperty(_filterMap, gl.LINEAR, "linear"), _defineProperty(_filterMap, gl.LINEAR_MIPMAP_LINEAR, "mipmap"), _defineProperty(_filterMap, gl.NEAREST_MIPMAP_LINEAR, "nearest mipmap linear"), _defineProperty(_filterMap, gl.LINEAR_MIPMAP_NEAREST, "linear mipmap nearest"), _defineProperty(_filterMap, gl.NEAREST_MIPMAP_NEAREST, "nearest mipmap nearest"), _filterMap);
var wrapModeMap = (_wrapModeMap = {}, _defineProperty(_wrapModeMap, gl.REPEAT, "repeat"), _defineProperty(_wrapModeMap, gl.CLAMP_TO_EDGE, "clamp"), _defineProperty(_wrapModeMap, gl.MIRRORED_REPEAT, "mirror"), _wrapModeMap);
var colorSpaceMap = (_colorSpaceMap = {}, _defineProperty(_colorSpaceMap, gl.NONE, "none"), _defineProperty(_colorSpaceMap, gl.BROWSER_DEFAULT_WEBGL, "browser"), _colorSpaceMap);
var depthFuncMap = (_depthFuncMap = {}, _defineProperty(_depthFuncMap, gl.NEVER, "never"), _defineProperty(_depthFuncMap, gl.ALWAYS, "always"), _defineProperty(_depthFuncMap, gl.LESS, "less"), _defineProperty(_depthFuncMap, gl.LEQUAL, "lequal"), _defineProperty(_depthFuncMap, gl.GREATER, "greater"), _defineProperty(_depthFuncMap, gl.GEQUAL, "gequal"), _defineProperty(_depthFuncMap, gl.EQUAL, "equal"), _defineProperty(_depthFuncMap, gl.NOTEQUAL, "notequal"), _depthFuncMap);
var blendEquationMap = (_blendEquationMap = {}, _defineProperty(_blendEquationMap, gl.FUNC_ADD, "add"), _defineProperty(_blendEquationMap, gl.MIN_EXT, "min"), _defineProperty(_blendEquationMap, gl.MAX_EXT, "max"), _defineProperty(_blendEquationMap, gl.FUNC_SUBTRACT, "subtract"), _defineProperty(_blendEquationMap, gl.FUNC_REVERSE_SUBTRACT, "reverse subtract"), _blendEquationMap);
var blendFuncMap = (_blendFuncMap = {}, _defineProperty(_blendFuncMap, gl.ZERO, "zero"), _defineProperty(_blendFuncMap, gl.ONE, "one"), _defineProperty(_blendFuncMap, gl.SRC_COLOR, "src color"), _defineProperty(_blendFuncMap, gl.ONE_MINUS_SRC_COLOR, "one minus src color"), _defineProperty(_blendFuncMap, gl.SRC_ALPHA, "src alpha"), _defineProperty(_blendFuncMap, gl.ONE_MINUS_SRC_ALPHA, "one minus src alpha"), _defineProperty(_blendFuncMap, gl.DST_COLOR, "dst color"), _defineProperty(_blendFuncMap, gl.ONE_MINUS_DST_COLOR, "one minus dst color"), _defineProperty(_blendFuncMap, gl.DST_ALPHA, "dst alpha"), _defineProperty(_blendFuncMap, gl.ONE_MINUS_DST_ALPHA, "one minus dst alpha"), _defineProperty(_blendFuncMap, gl.CONSTANT_COLOR, "constant color"), _defineProperty(_blendFuncMap, gl.ONE_MINUS_CONSTANT_COLOR, "one minus constant color"), _defineProperty(_blendFuncMap, gl.CONSTANT_ALPHA, "constant alpha"), _defineProperty(_blendFuncMap, gl.ONE_MINUS_CONSTANT_ALPHA, "one minus constant alpha"), _defineProperty(_blendFuncMap, gl.SRC_ALPHA_SATURATE, "src alpha saturate"), _blendFuncMap);
var stencilFuncMap = (_stencilFuncMap = {}, _defineProperty(_stencilFuncMap, gl.NEVER, "never"), _defineProperty(_stencilFuncMap, gl.ALWAYS, "always"), _defineProperty(_stencilFuncMap, gl.LESS, "less"), _defineProperty(_stencilFuncMap, gl.LEQUAL, "lequal"), _defineProperty(_stencilFuncMap, gl.GREATER, "greater"), _defineProperty(_stencilFuncMap, gl.GEQUAL, "gequal"), _defineProperty(_stencilFuncMap, gl.EQUAL, "equal"), _defineProperty(_stencilFuncMap, gl.NOTEQUAL, "notequal"), _stencilFuncMap);
var stencilOpMap = (_stencilOpMap = {}, _defineProperty(_stencilOpMap, gl.ZERO, "zero"), _defineProperty(_stencilOpMap, gl.KEEP, "keep"), _defineProperty(_stencilOpMap, gl.REPLACE, "replace"), _defineProperty(_stencilOpMap, gl.INVERT, "invert"), _defineProperty(_stencilOpMap, gl.INCR, "increment"), _defineProperty(_stencilOpMap, gl.DECR, "decrement"), _defineProperty(_stencilOpMap, gl.INCR_WRAP, "increment wrap"), _defineProperty(_stencilOpMap, gl.DECR_WRAP, "decrement wrap"), _stencilOpMap);
var cullFaceMap = (_cullFaceMap = {}, _defineProperty(_cullFaceMap, gl.FRONT, "front"), _defineProperty(_cullFaceMap, gl.BACK, "back"), _cullFaceMap);
// node_modules/@antv/g-webgpu-engine/es/webgl/ReglBuffer.js
var ReglBuffer = /* @__PURE__ */ function() {
function ReglBuffer2(reGl, options) {
_classCallCheck(this, ReglBuffer2);
this.buffer = void 0;
var data3 = options.data, usage = options.usage, type2 = options.type;
this.buffer = reGl.buffer({
data: data3,
usage: usageMap[usage || gl.STATIC_DRAW],
type: dataTypeMap[type2 || gl.UNSIGNED_BYTE]
});
}
_createClass(ReglBuffer2, [{
key: "get",
value: function get3() {
return this.buffer;
}
}, {
key: "destroy",
value: function destroy() {
}
}, {
key: "subData",
value: function subData(_ref2) {
var data3 = _ref2.data, offset = _ref2.offset;
this.buffer.subdata(data3, offset);
}
}]);
return ReglBuffer2;
}();
// node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr))
return _arrayLikeToArray(arr);
}
// node_modules/@babel/runtime/helpers/esm/iterableToArray.js
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
return Array.from(iter);
}
// node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
// node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
// node_modules/@antv/g-webgpu-engine/es/webgl/ReglComputeModel.js
var import_regenerator12 = __toModule(require_regenerator());
// node_modules/@antv/g-webgpu-engine/es/utils/is-typedarray.js
var MAX_SAFE_INTEGER3 = 9007199254740991;
var argsTag3 = "[object Arguments]";
var arrayTag3 = "[object Array]";
var boolTag3 = "[object Boolean]";
var dateTag3 = "[object Date]";
var errorTag3 = "[object Error]";
var funcTag3 = "[object Function]";
var mapTag3 = "[object Map]";
var numberTag3 = "[object Number]";
var objectTag3 = "[object Object]";
var regexpTag3 = "[object RegExp]";
var setTag3 = "[object Set]";
var stringTag3 = "[object String]";
var weakMapTag3 = "[object WeakMap]";
var arrayBufferTag3 = "[object ArrayBuffer]";
var dataViewTag3 = "[object DataView]";
var float32Tag3 = "[object Float32Array]";
var float64Tag3 = "[object Float64Array]";
var int8Tag3 = "[object Int8Array]";
var int16Tag3 = "[object Int16Array]";
var int32Tag3 = "[object Int32Array]";
var uint8Tag3 = "[object Uint8Array]";
var uint8ClampedTag3 = "[object Uint8ClampedArray]";
var uint16Tag3 = "[object Uint16Array]";
var uint32Tag3 = "[object Uint32Array]";
var typedArrayTags3 = {};
typedArrayTags3[float32Tag3] = typedArrayTags3[float64Tag3] = typedArrayTags3[int8Tag3] = typedArrayTags3[int16Tag3] = typedArrayTags3[int32Tag3] = typedArrayTags3[uint8Tag3] = typedArrayTags3[uint8ClampedTag3] = typedArrayTags3[uint16Tag3] = typedArrayTags3[uint32Tag3] = true;
typedArrayTags3[argsTag3] = typedArrayTags3[arrayTag3] = typedArrayTags3[arrayBufferTag3] = typedArrayTags3[boolTag3] = typedArrayTags3[dataViewTag3] = typedArrayTags3[dateTag3] = typedArrayTags3[errorTag3] = typedArrayTags3[funcTag3] = typedArrayTags3[mapTag3] = typedArrayTags3[numberTag3] = typedArrayTags3[objectTag3] = typedArrayTags3[regexpTag3] = typedArrayTags3[setTag3] = typedArrayTags3[stringTag3] = typedArrayTags3[weakMapTag3] = false;
var objectProto4 = Object.prototype;
var objectToString3 = objectProto4.toString;
function baseIsTypedArray3(value2) {
return isObjectLike5(value2) && isLength3(value2.length) && !!typedArrayTags3[objectToString3.call(value2)];
}
function isLength3(value2) {
return typeof value2 === "number" && value2 > -1 && value2 % 1 === 0 && value2 <= MAX_SAFE_INTEGER3;
}
function isObjectLike5(value2) {
return !!value2 && _typeof3(value2) === "object";
}
var isTypedArray3 = baseIsTypedArray3;
// node_modules/@antv/g-webgpu-engine/es/webgl/ReglComputeModel.js
function ownKeys6(object, enumerableOnly) {
var keys2 = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys2.push.apply(keys2, symbols);
}
return keys2;
}
function _objectSpread6(target) {
for (var i4 = 1; i4 < arguments.length; i4++) {
var source = arguments[i4] != null ? arguments[i4] : {};
if (i4 % 2) {
ownKeys6(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys6(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
var quadVert = "attribute vec3 a_Position;\nattribute vec2 a_TexCoord;\n\nvarying vec2 v_TexCoord;\n\nvoid main() {\n gl_Position = vec4(a_Position, 1.0);\n v_TexCoord = a_TexCoord;\n}";
var textureId = 0;
var debug = false;
var ReglComputeModel = /* @__PURE__ */ function() {
function ReglComputeModel2(reGl, context) {
var _this = this;
_classCallCheck(this, ReglComputeModel2);
this.reGl = reGl;
this.context = context;
this.entity = createEntity();
this.texFBO = void 0;
this.computeCommand = void 0;
this.textureCache = {};
this.outputTextureName = void 0;
this.swapOutputTextureName = void 0;
this.compiledPingpong = void 0;
this.dynamicPingpong = void 0;
var uniforms = {};
this.context.uniforms.forEach(function(uniform) {
var name = uniform.name, type2 = uniform.type, data3 = uniform.data, isReferer = uniform.isReferer, storageClass = uniform.storageClass;
if (storageClass === STORAGE_CLASS.StorageBuffer) {
if (!isReferer) {
_this.textureCache[name] = _this.calcDataTexture(name, type2, data3);
var _this$textureCache$na = _this.textureCache[name], width2 = _this$textureCache$na.textureWidth, isOutput = _this$textureCache$na.isOutput;
uniforms["".concat(name, "Size")] = [width2, width2];
if (isOutput) {
_this.outputTextureName = name;
if (_this.context.needPingpong) {
_this.outputTextureName = "".concat(name, "Output");
_this.textureCache[_this.outputTextureName] = _this.calcDataTexture(name, type2, data3);
}
}
} else {
_this.textureCache[name] = {
data: void 0
};
uniforms["".concat(name, "Size")] = function() {
return data3.compiledBundle.context.output.textureSize;
};
}
uniforms[name] = function() {
if (debug) {
console.log("[".concat(_this.entity, "]: ").concat(name, " ").concat(_this.textureCache[name].id));
}
return _this.textureCache[name].texture;
};
} else if (storageClass === STORAGE_CLASS.Uniform) {
if (data3 && (Array.isArray(data3) || isTypedArray3(data3)) && data3.length > 16) {
throw new Error("invalid data type ".concat(type2));
}
uniforms[name] = function() {
return uniform.data;
};
}
});
var _this$getOuputDataTex = this.getOuputDataTexture(), textureWidth = _this$getOuputDataTex.textureWidth, texelCount = _this$getOuputDataTex.texelCount;
uniforms.u_OutputTextureSize = [textureWidth, textureWidth];
uniforms.u_OutputTexelCount = texelCount;
this.context.output.textureSize = [textureWidth, textureWidth];
var drawParams = {
attributes: {
a_Position: [[-1, 1, 0], [-1, -1, 0], [1, 1, 0], [1, -1, 0]],
a_TexCoord: [[0, 1], [0, 0], [1, 1], [1, 0]]
},
frag: "#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n#else\n precision mediump float;\n#endif\n".concat(this.context.shader),
uniforms,
vert: quadVert,
primitive: "triangle strip",
count: 4
};
this.computeCommand = this.reGl(drawParams);
}
_createClass(ReglComputeModel2, [{
key: "run",
value: function run4() {
var _this2 = this;
if (this.context.maxIteration > 1 && this.context.needPingpong) {
this.compiledPingpong = true;
}
if (this.compiledPingpong || this.dynamicPingpong) {
this.swap();
}
this.texFBO = this.reGl.framebuffer({
color: this.getOuputDataTexture().texture
});
this.texFBO.use(function() {
_this2.computeCommand();
});
if (debug) {
console.log("[".concat(this.entity, "]: output ").concat(this.getOuputDataTexture().id));
}
}
}, {
key: "readData",
value: function() {
var _readData = _asyncToGenerator(/* @__PURE__ */ import_regenerator12.default.mark(function _callee() {
var _this3 = this;
var pixels, _this$getOuputDataTex2, originalDataLength, elementsPerTexel, _this$getOuputDataTex3, typedArrayConstructor, formattedPixels, i4;
return import_regenerator12.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
this.reGl({
framebuffer: this.texFBO
})(function() {
pixels = _this3.reGl.read();
});
if (!pixels) {
_context.next = 6;
break;
}
_this$getOuputDataTex2 = this.getOuputDataTexture(), originalDataLength = _this$getOuputDataTex2.originalDataLength, elementsPerTexel = _this$getOuputDataTex2.elementsPerTexel, _this$getOuputDataTex3 = _this$getOuputDataTex2.typedArrayConstructor, typedArrayConstructor = _this$getOuputDataTex3 === void 0 ? Float32Array : _this$getOuputDataTex3;
formattedPixels = [];
if (elementsPerTexel !== 4) {
for (i4 = 0; i4 < pixels.length; i4 += 4) {
if (elementsPerTexel === 1) {
formattedPixels.push(pixels[i4]);
} else if (elementsPerTexel === 2) {
formattedPixels.push(pixels[i4], pixels[i4 + 1]);
} else {
formattedPixels.push(pixels[i4], pixels[i4 + 1], pixels[i4 + 2]);
}
}
} else {
formattedPixels = pixels;
}
return _context.abrupt("return", new typedArrayConstructor(formattedPixels.slice(0, originalDataLength)));
case 6:
return _context.abrupt("return", new Float32Array());
case 7:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
function readData() {
return _readData.apply(this, arguments);
}
return readData;
}()
}, {
key: "confirmInput",
value: function confirmInput(model, inputName) {
var inputModel;
if (this.entity === model.entity) {
this.dynamicPingpong = true;
inputModel = this;
} else {
inputModel = model;
}
this.textureCache[inputName].id = inputModel.getOuputDataTexture().id;
this.textureCache[inputName].texture = inputModel.getOuputDataTexture().texture;
if (debug) {
console.log("[".concat(this.entity, "]: confirm input ").concat(inputName, " from model ").concat(inputModel.entity, ", ").concat(inputModel.getOuputDataTexture().id));
}
}
}, {
key: "updateUniform",
value: function updateUniform() {
}
}, {
key: "updateBuffer",
value: function updateBuffer(bufferName, data3) {
var offset = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
var buffer = this.context.uniforms.find(function(_ref2) {
var name = _ref2.name;
return name === bufferName;
});
if (buffer) {
var _this$calcDataTexture = this.calcDataTexture(bufferName, buffer.type, data3), texture = _this$calcDataTexture.texture, paddingData = _this$calcDataTexture.data;
this.textureCache[bufferName].data = paddingData;
this.textureCache[bufferName].texture = texture;
}
}
}, {
key: "destroy",
value: function destroy() {
}
}, {
key: "swap",
value: function swap3() {
if (!this.swapOutputTextureName) {
this.createSwapOutputDataTexture();
}
if (this.compiledPingpong) {
var outputTextureUniformName = this.context.output.name;
this.textureCache[outputTextureUniformName].id = this.getOuputDataTexture().id;
this.textureCache[outputTextureUniformName].texture = this.getOuputDataTexture().texture;
}
var tmp = this.outputTextureName;
this.outputTextureName = this.swapOutputTextureName;
this.swapOutputTextureName = tmp;
if (debug) {
console.log("[".concat(this.entity, "]: after swap, output ").concat(this.getOuputDataTexture().id));
}
}
}, {
key: "getOuputDataTexture",
value: function getOuputDataTexture() {
return this.textureCache[this.outputTextureName];
}
}, {
key: "createSwapOutputDataTexture",
value: function createSwapOutputDataTexture() {
var texture = this.cloneDataTexture(this.getOuputDataTexture());
this.swapOutputTextureName = "".concat(this.entity, "-swap");
this.textureCache[this.swapOutputTextureName] = texture;
}
}, {
key: "cloneDataTexture",
value: function cloneDataTexture(texture) {
var data3 = texture.data, textureWidth = texture.textureWidth;
return _objectSpread6(_objectSpread6({}, texture), {}, {
id: textureId++,
texture: this.reGl.texture({
width: textureWidth,
height: textureWidth,
data: data3,
type: "float"
})
});
}
}, {
key: "calcDataTexture",
value: function calcDataTexture(name, type2, data3) {
var elementsPerTexel = 1;
if (type2 === AST_TOKEN_TYPES.Vector4FloatArray) {
elementsPerTexel = 4;
}
var paddingData = [];
for (var i4 = 0; i4 < data3.length; i4 += elementsPerTexel) {
if (elementsPerTexel === 1) {
paddingData.push(data3[i4], 0, 0, 0);
} else if (elementsPerTexel === 2) {
paddingData.push(data3[i4], data3[i4 + 1], 0, 0);
} else if (elementsPerTexel === 3) {
paddingData.push(data3[i4], data3[i4 + 1], data3[i4 + 2], 0);
} else if (elementsPerTexel === 4) {
paddingData.push(data3[i4], data3[i4 + 1], data3[i4 + 2], data3[i4 + 3]);
}
}
var originalDataLength = data3.length;
var texelCount = Math.ceil(originalDataLength / elementsPerTexel);
var width2 = Math.ceil(Math.sqrt(texelCount));
var paddingTexelCount = width2 * width2;
if (texelCount < paddingTexelCount) {
paddingData.push.apply(paddingData, _toConsumableArray(new Array((paddingTexelCount - texelCount) * 4).fill(0)));
}
var texture = this.reGl.texture({
width: width2,
height: width2,
data: paddingData,
type: "float"
});
return {
id: textureId++,
data: paddingData,
originalDataLength,
typedArrayConstructor: isTypedArray3(data3) ? data3.constructor : void 0,
textureWidth: width2,
texture,
texelCount,
elementsPerTexel,
isOutput: name === this.context.output.name
};
}
}]);
return ReglComputeModel2;
}();
// node_modules/@antv/g-webgpu-engine/es/webgl/ReglElements.js
var ReglElements = /* @__PURE__ */ function() {
function ReglElements2(reGl, options) {
_classCallCheck(this, ReglElements2);
this.elements = void 0;
var data3 = options.data, usage = options.usage, type2 = options.type, count2 = options.count;
this.elements = reGl.elements({
data: data3,
usage: usageMap[usage || gl.STATIC_DRAW],
type: dataTypeMap[type2 || gl.UNSIGNED_BYTE],
count: count2
});
}
_createClass(ReglElements2, [{
key: "get",
value: function get3() {
return this.elements;
}
}, {
key: "subData",
value: function subData(_ref2) {
var data3 = _ref2.data;
this.elements.subdata(data3);
}
}, {
key: "destroy",
value: function destroy() {
this.elements.destroy();
}
}]);
return ReglElements2;
}();
// node_modules/@antv/g-webgpu-engine/es/webgl/ReglFramebuffer.js
var ReglFramebuffer = /* @__PURE__ */ function() {
function ReglFramebuffer2(reGl, options) {
_classCallCheck(this, ReglFramebuffer2);
this.framebuffer = void 0;
var width2 = options.width, height = options.height, color4 = options.color, colors = options.colors, depth = options.depth, stencil = options.stencil;
var framebufferOptions = {
width: width2,
height
};
if (Array.isArray(colors)) {
framebufferOptions.colors = colors.map(function(c5) {
return c5.get();
});
}
if (color4 && typeof color4 !== "boolean") {
framebufferOptions.color = color4.get();
}
this.framebuffer = reGl.framebuffer(framebufferOptions);
}
_createClass(ReglFramebuffer2, [{
key: "get",
value: function get3() {
return this.framebuffer;
}
}, {
key: "destroy",
value: function destroy() {
this.framebuffer.destroy();
}
}, {
key: "resize",
value: function resize(_ref2) {
var width2 = _ref2.width, height = _ref2.height;
this.framebuffer.resize(width2, height);
}
}]);
return ReglFramebuffer2;
}();
// node_modules/@antv/g-webgpu-engine/es/utils/is-object.js
function isObject3(value2) {
var type2 = _typeof3(value2);
return value2 != null && (type2 === "object" || type2 === "function");
}
// node_modules/@antv/g-webgpu-engine/es/utils/uniform.js
function extractUniforms2(uniforms) {
var extractedUniforms = {};
Object.keys(uniforms).forEach(function(uniformName) {
extractUniformsRecursively(uniformName, uniforms[uniformName], extractedUniforms, "");
});
return extractedUniforms;
}
function extractUniformsRecursively(uniformName, uniformValue, uniforms, prefix2) {
if (uniformValue === null || typeof uniformValue === "number" || typeof uniformValue === "boolean" || Array.isArray(uniformValue) && typeof uniformValue[0] === "number" || isTypedArray3(uniformValue) || uniformValue === "" || uniformValue.resize !== void 0) {
uniforms["".concat(prefix2 && prefix2 + ".").concat(uniformName)] = uniformValue;
return;
}
if (isObject3(uniformValue)) {
Object.keys(uniformValue).forEach(function(childName) {
extractUniformsRecursively(childName, uniformValue[childName], uniforms, "".concat(prefix2 && prefix2 + ".").concat(uniformName));
});
}
if (Array.isArray(uniformValue)) {
uniformValue.forEach(function(child, idx) {
Object.keys(child).forEach(function(childName) {
extractUniformsRecursively(childName, child[childName], uniforms, "".concat(prefix2 && prefix2 + ".").concat(uniformName, "[").concat(idx, "]"));
});
});
}
}
// node_modules/@antv/g-webgpu-engine/es/webgl/ReglModel.js
function ownKeys7(object, enumerableOnly) {
var keys2 = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys2.push.apply(keys2, symbols);
}
return keys2;
}
function _objectSpread7(target) {
for (var i4 = 1; i4 < arguments.length; i4++) {
var source = arguments[i4] != null ? arguments[i4] : {};
if (i4 % 2) {
ownKeys7(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys7(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
var ReglModel = /* @__PURE__ */ function() {
function ReglModel2(reGl, options) {
_classCallCheck(this, ReglModel2);
this.reGl = void 0;
this.drawCommand = void 0;
this.uniforms = {};
this.reGl = reGl;
var vs = options.vs, fs = options.fs, defines = options.defines, attributes = options.attributes, uniforms = options.uniforms, primitive = options.primitive, count2 = options.count, elements = options.elements, depth = options.depth, blend2 = options.blend, stencil = options.stencil, cull = options.cull, instances = options.instances, scissor = options.scissor, viewport = options.viewport;
var reglUniforms = {};
if (uniforms) {
this.uniforms = extractUniforms2(uniforms);
Object.keys(uniforms).forEach(function(uniformName) {
reglUniforms[uniformName] = reGl.prop(uniformName);
});
}
var reglAttributes = {};
Object.keys(attributes).forEach(function(name) {
reglAttributes[name] = attributes[name].get();
});
var defineStmts = defines && this.generateDefines(defines) || "";
var drawParams = {
attributes: reglAttributes,
frag: "#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n#else\n precision mediump float;\n#endif\n".concat(defineStmts, "\n").concat(fs),
uniforms: reglUniforms,
vert: "\n".concat(defineStmts, "\n").concat(vs),
primitive: primitiveMap[primitive === void 0 ? gl.TRIANGLES : primitive]
};
if (instances) {
drawParams.instances = instances;
}
if (count2) {
drawParams.count = count2;
}
if (elements) {
drawParams.elements = elements.get();
}
if (scissor) {
drawParams.scissor = scissor;
}
if (viewport) {
drawParams.viewport = viewport;
}
this.initDepthDrawParams({
depth
}, drawParams);
this.initBlendDrawParams({
blend: blend2
}, drawParams);
this.initStencilDrawParams({
stencil
}, drawParams);
this.initCullDrawParams({
cull
}, drawParams);
this.drawCommand = reGl(drawParams);
}
_createClass(ReglModel2, [{
key: "addUniforms",
value: function addUniforms(uniforms) {
this.uniforms = _objectSpread7(_objectSpread7({}, this.uniforms), extractUniforms2(uniforms));
}
}, {
key: "draw",
value: function draw4(options) {
var uniforms = _objectSpread7(_objectSpread7({}, this.uniforms), extractUniforms2(options.uniforms || {}));
var reglDrawProps = {};
Object.keys(uniforms).forEach(function(uniformName) {
var type2 = _typeof3(uniforms[uniformName]);
if (type2 === "boolean" || type2 === "number" || Array.isArray(uniforms[uniformName]) || uniforms[uniformName].BYTES_PER_ELEMENT) {
reglDrawProps[uniformName] = uniforms[uniformName];
} else if (type2 === "string") {
} else {
reglDrawProps[uniformName] = uniforms[uniformName].get();
}
});
this.drawCommand(reglDrawProps);
}
}, {
key: "destroy",
value: function destroy() {
}
}, {
key: "initDepthDrawParams",
value: function initDepthDrawParams(_ref2, drawParams) {
var depth = _ref2.depth;
if (depth) {
drawParams.depth = {
enable: depth.enable === void 0 ? true : !!depth.enable,
mask: depth.mask === void 0 ? true : !!depth.mask,
func: depthFuncMap[depth.func || gl.LESS],
range: depth.range || [0, 1]
};
}
}
}, {
key: "initBlendDrawParams",
value: function initBlendDrawParams(_ref2, drawParams) {
var blend2 = _ref2.blend;
if (blend2) {
var enable = blend2.enable, func = blend2.func, equation = blend2.equation, _blend$color = blend2.color, color4 = _blend$color === void 0 ? [0, 0, 0, 0] : _blend$color;
drawParams.blend = {
enable: !!enable,
func: {
srcRGB: blendFuncMap[func && func.srcRGB || gl.SRC_ALPHA],
srcAlpha: blendFuncMap[func && func.srcAlpha || gl.SRC_ALPHA],
dstRGB: blendFuncMap[func && func.dstRGB || gl.ONE_MINUS_SRC_ALPHA],
dstAlpha: blendFuncMap[func && func.dstAlpha || gl.ONE_MINUS_SRC_ALPHA]
},
equation: {
rgb: blendEquationMap[equation && equation.rgb || gl.FUNC_ADD],
alpha: blendEquationMap[equation && equation.alpha || gl.FUNC_ADD]
},
color: color4
};
}
}
}, {
key: "initStencilDrawParams",
value: function initStencilDrawParams(_ref3, drawParams) {
var stencil = _ref3.stencil;
if (stencil) {
var enable = stencil.enable, _stencil$mask = stencil.mask, mask = _stencil$mask === void 0 ? -1 : _stencil$mask, _stencil$func = stencil.func, func = _stencil$func === void 0 ? {
cmp: gl.ALWAYS,
ref: 0,
mask: -1
} : _stencil$func, _stencil$opFront = stencil.opFront, opFront = _stencil$opFront === void 0 ? {
fail: gl.KEEP,
zfail: gl.KEEP,
zpass: gl.KEEP
} : _stencil$opFront, _stencil$opBack = stencil.opBack, opBack = _stencil$opBack === void 0 ? {
fail: gl.KEEP,
zfail: gl.KEEP,
zpass: gl.KEEP
} : _stencil$opBack;
drawParams.stencil = {
enable: !!enable,
mask,
func: _objectSpread7(_objectSpread7({}, func), {}, {
cmp: stencilFuncMap[func.cmp]
}),
opFront: {
fail: stencilOpMap[opFront.fail],
zfail: stencilOpMap[opFront.zfail],
zpass: stencilOpMap[opFront.zpass]
},
opBack: {
fail: stencilOpMap[opBack.fail],
zfail: stencilOpMap[opBack.zfail],
zpass: stencilOpMap[opBack.zpass]
}
};
}
}
}, {
key: "initCullDrawParams",
value: function initCullDrawParams(_ref4, drawParams) {
var cull = _ref4.cull;
if (cull) {
var enable = cull.enable, _cull$face = cull.face, face = _cull$face === void 0 ? gl.BACK : _cull$face;
drawParams.cull = {
enable: !!enable,
face: cullFaceMap[face]
};
}
}
}, {
key: "generateDefines",
value: function generateDefines(defines) {
return Object.keys(defines).map(function(name) {
return "#define ".concat(name, " ").concat(Number(defines[name]));
}).join("\n");
}
}]);
return ReglModel2;
}();
// node_modules/@antv/g-webgpu-engine/es/webgl/ReglTexture2D.js
var ReglTexture2D = /* @__PURE__ */ function() {
function ReglTexture2D2(reGl, options) {
_classCallCheck(this, ReglTexture2D2);
this.texture = void 0;
this.width = void 0;
this.height = void 0;
var data3 = options.data, _options$type = options.type, type2 = _options$type === void 0 ? gl.UNSIGNED_BYTE : _options$type, width2 = options.width, height = options.height, _options$flipY = options.flipY, flipY = _options$flipY === void 0 ? false : _options$flipY, _options$format = options.format, format2 = _options$format === void 0 ? gl.RGBA : _options$format, _options$mipmap = options.mipmap, mipmap = _options$mipmap === void 0 ? false : _options$mipmap, _options$wrapS = options.wrapS, wrapS = _options$wrapS === void 0 ? gl.CLAMP_TO_EDGE : _options$wrapS, _options$wrapT = options.wrapT, wrapT = _options$wrapT === void 0 ? gl.CLAMP_TO_EDGE : _options$wrapT, _options$aniso = options.aniso, aniso = _options$aniso === void 0 ? 0 : _options$aniso, _options$alignment = options.alignment, alignment = _options$alignment === void 0 ? 1 : _options$alignment, _options$premultiplyA = options.premultiplyAlpha, premultiplyAlpha = _options$premultiplyA === void 0 ? false : _options$premultiplyA, _options$mag = options.mag, mag = _options$mag === void 0 ? gl.NEAREST : _options$mag, _options$min = options.min, min7 = _options$min === void 0 ? gl.NEAREST : _options$min, _options$colorSpace = options.colorSpace, colorSpace = _options$colorSpace === void 0 ? gl.BROWSER_DEFAULT_WEBGL : _options$colorSpace;
this.width = width2;
this.height = height;
var textureOptions = {
width: width2,
height,
type: dataTypeMap[type2],
format: formatMap[format2],
wrapS: wrapModeMap[wrapS],
wrapT: wrapModeMap[wrapT],
mag: filterMap[mag],
min: filterMap[min7],
alignment,
flipY,
colorSpace: colorSpaceMap[colorSpace],
premultiplyAlpha,
aniso
};
if (data3) {
textureOptions.data = data3;
}
if (typeof mipmap === "number") {
textureOptions.mipmap = mipmapMap[mipmap];
} else if (typeof mipmap === "boolean") {
textureOptions.mipmap = mipmap;
}
this.texture = reGl.texture(textureOptions);
}
_createClass(ReglTexture2D2, [{
key: "get",
value: function get3() {
return this.texture;
}
}, {
key: "update",
value: function update15() {
this.texture._texture.bind();
}
}, {
key: "resize",
value: function resize(_ref2) {
var width2 = _ref2.width, height = _ref2.height;
this.texture.resize(width2, height);
this.width = width2;
this.height = height;
}
}, {
key: "destroy",
value: function destroy() {
this.texture.destroy();
}
}]);
return ReglTexture2D2;
}();
// node_modules/@antv/g-webgpu-engine/es/webgl/index.js
var _dec41;
var _class20;
var _temp18;
var WebGLEngine = (_dec41 = (0, import_inversify21.injectable)(), _dec41(_class20 = (_temp18 = /* @__PURE__ */ function() {
function WebGLEngine2() {
var _this = this;
_classCallCheck(this, WebGLEngine2);
this.supportWebGPU = false;
this.useWGSL = false;
this.$canvas = void 0;
this.gl = void 0;
this.inited = void 0;
this.createModel = /* @__PURE__ */ function() {
var _ref2 = _asyncToGenerator(/* @__PURE__ */ import_regenerator13.default.mark(function _callee2(options) {
return import_regenerator13.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!options.uniforms) {
_context2.next = 3;
break;
}
_context2.next = 3;
return Promise.all(Object.keys(options.uniforms).map(/* @__PURE__ */ function() {
var _ref22 = _asyncToGenerator(/* @__PURE__ */ import_regenerator13.default.mark(function _callee(name) {
var texture;
return import_regenerator13.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!(options.uniforms[name] && options.uniforms[name].load !== void 0)) {
_context.next = 5;
break;
}
_context.next = 3;
return options.uniforms[name].load();
case 3:
texture = _context.sent;
options.uniforms[name] = texture;
case 5:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return function(_x2) {
return _ref22.apply(this, arguments);
};
}()));
case 3:
return _context2.abrupt("return", new ReglModel(_this.gl, options));
case 4:
case "end":
return _context2.stop();
}
}
}, _callee2);
}));
return function(_x) {
return _ref2.apply(this, arguments);
};
}();
this.createAttribute = function(options) {
return new ReglAttribute(_this.gl, options);
};
this.createBuffer = function(options) {
return new ReglBuffer(_this.gl, options);
};
this.createElements = function(options) {
return new ReglElements(_this.gl, options);
};
this.createTexture2D = function(options) {
return new ReglTexture2D(_this.gl, options);
};
this.createFramebuffer = function(options) {
return new ReglFramebuffer(_this.gl, options);
};
this.useFramebuffer = function(framebuffer, drawCommands) {
_this.gl({
framebuffer: framebuffer ? framebuffer.get() : null
})(drawCommands);
};
this.createComputeModel = /* @__PURE__ */ function() {
var _ref3 = _asyncToGenerator(/* @__PURE__ */ import_regenerator13.default.mark(function _callee3(context) {
return import_regenerator13.default.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
return _context3.abrupt("return", new ReglComputeModel(_this.gl, context));
case 1:
case "end":
return _context3.stop();
}
}
}, _callee3);
}));
return function(_x3) {
return _ref3.apply(this, arguments);
};
}();
this.clear = function(options) {
var color4 = options.color, depth = options.depth, stencil = options.stencil, _options$framebuffer = options.framebuffer, framebuffer = _options$framebuffer === void 0 ? null : _options$framebuffer;
var reglClearOptions = {
color: color4,
depth,
stencil
};
reglClearOptions.framebuffer = framebuffer === null ? framebuffer : framebuffer.get();
_this.gl.clear(reglClearOptions);
};
this.setScissor = function(scissor) {
if (_this.gl && _this.gl._gl) {
if (scissor.enable && scissor.box) {
_this.gl._gl.enable(gl.SCISSOR_TEST);
_this.gl._gl.scissor(scissor.box.x, scissor.box.y, scissor.box.width, scissor.box.height);
} else {
_this.gl._gl.disable(gl.SCISSOR_TEST);
}
_this.gl._refresh();
}
};
this.viewport = function(_ref4) {
var x6 = _ref4.x, y5 = _ref4.y, width2 = _ref4.width, height = _ref4.height;
if (_this.gl && _this.gl._gl) {
_this.gl._gl.viewport(x6, y5, width2, height);
_this.gl._refresh();
}
};
this.readPixels = function(options) {
var framebuffer = options.framebuffer, x6 = options.x, y5 = options.y, width2 = options.width, height = options.height;
var readPixelsOptions = {
x: x6,
y: y5,
width: width2,
height
};
if (framebuffer) {
readPixelsOptions.framebuffer = framebuffer.get();
}
return _this.gl.read(readPixelsOptions);
};
this.getCanvas = function() {
return _this.$canvas;
};
this.getGLContext = function() {
return _this.gl._gl;
};
this.destroy = function() {
if (_this.gl) {
_this.gl.destroy();
_this.inited = false;
}
};
}
_createClass(WebGLEngine2, [{
key: "init",
value: function() {
var _init = _asyncToGenerator(/* @__PURE__ */ import_regenerator13.default.mark(function _callee4(cfg) {
return import_regenerator13.default.wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
if (!this.inited) {
_context4.next = 2;
break;
}
return _context4.abrupt("return");
case 2:
this.$canvas = cfg.canvas;
_context4.next = 5;
return new Promise(function(resolve, reject) {
(0, import_regl.default)({
canvas: cfg.canvas,
attributes: {
alpha: true,
antialias: cfg.antialias,
premultipliedAlpha: true
},
pixelRatio: 1,
extensions: [
"OES_element_index_uint",
"OES_texture_float",
"OES_standard_derivatives",
"angle_instanced_arrays"
],
optionalExtensions: ["EXT_texture_filter_anisotropic", "EXT_blend_minmax", "WEBGL_depth_texture"],
profile: true,
onDone: function onDone(err, r4) {
if (err || !r4) {
reject(err);
}
resolve(r4);
}
});
});
case 5:
this.gl = _context4.sent;
this.inited = true;
case 7:
case "end":
return _context4.stop();
}
}
}, _callee4, this);
}));
function init(_x4) {
return _init.apply(this, arguments);
}
return init;
}()
}, {
key: "isFloatSupported",
value: function isFloatSupported() {
return this.gl.limits.readFloat;
}
}, {
key: "beginFrame",
value: function beginFrame() {
}
}, {
key: "endFrame",
value: function endFrame() {
}
}]);
return WebGLEngine2;
}(), _temp18)) || _class20);
// node_modules/@antv/g-webgpu-engine/es/webgpu/index.js
var import_regenerator17 = __toModule(require_regenerator());
var WebGPUConstants8 = __toModule(require_constants());
var import_inversify22 = __toModule(require_inversify());
// node_modules/@antv/g-webgpu-engine/es/webgpu/glslang.js
var import_regenerator14 = __toModule(require_regenerator());
// node_modules/@antv/g-webgpu-engine/es/utils/dom.js
function isWindowObjectExist() {
return typeof window !== "undefined";
}
function loadScript(scriptUrl, onSuccess, onError, scriptId) {
if (!isWindowObjectExist()) {
return;
}
var head2 = document.getElementsByTagName("head")[0];
var script = document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute("src", scriptUrl);
if (scriptId) {
script.id = scriptId;
}
script.onload = function() {
if (onSuccess) {
onSuccess();
}
};
script.onerror = function(e4) {
if (onError) {
onError("Unable to load script '".concat(scriptUrl, "'"), e4);
}
};
head2.appendChild(script);
}
function loadScriptAsync(scriptUrl, scriptId) {
return new Promise(function(resolve, reject) {
loadScript(scriptUrl, function() {
resolve();
}, function(message, exception2) {
reject(exception2);
});
});
}
// node_modules/@antv/g-webgpu-engine/es/webgpu/glslang.js
var glslang;
function glslang_default() {
return _ref.apply(this, arguments);
}
function _ref() {
_ref = _asyncToGenerator(/* @__PURE__ */ import_regenerator14.default.mark(function _callee() {
return import_regenerator14.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!glslang) {
_context.next = 2;
break;
}
return _context.abrupt("return", glslang);
case 2:
_context.next = 4;
return loadScriptAsync("https://preview.babylonjs.com/glslang/glslang.js");
case 4:
glslang = window.glslang("https://preview.babylonjs.com/glslang/glslang.wasm");
return _context.abrupt("return", glslang);
case 6:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return _ref.apply(this, arguments);
}
// node_modules/@antv/g-webgpu-engine/es/webgpu/WebGPUAttribute.js
var WebGPUAttribute = /* @__PURE__ */ function() {
function WebGPUAttribute2(engine, options) {
_classCallCheck(this, WebGPUAttribute2);
this.engine = engine;
this.options = options;
this.attribute = void 0;
this.buffer = void 0;
var _options = options, buffer = _options.buffer, offset = _options.offset, stride = _options.stride, normalized = _options.normalized, size2 = _options.size, divisor = _options.divisor, arrayStride = _options.arrayStride, attributes = _options.attributes, stepMode = _options.stepMode;
this.buffer = buffer;
this.attribute = {
buffer: buffer.get(),
offset: offset || 0,
stride: stride || 0,
normalized: normalized || false,
divisor: divisor || 0,
arrayStride: arrayStride || 0,
attributes,
stepMode: stepMode || "vertex"
};
if (size2) {
this.attribute.size = size2;
}
}
_createClass(WebGPUAttribute2, [{
key: "get",
value: function get3() {
return this.attribute;
}
}, {
key: "updateBuffer",
value: function updateBuffer(options) {
this.buffer.subData(options);
}
}, {
key: "destroy",
value: function destroy() {
this.buffer.destroy();
}
}]);
return WebGPUAttribute2;
}();
// node_modules/@antv/g-webgpu-engine/es/webgpu/WebGPUBuffer.js
var WebGPUConstants2 = __toModule(require_constants());
var WebGPUBuffer = /* @__PURE__ */ function() {
function WebGPUBuffer2(engine, options) {
_classCallCheck(this, WebGPUBuffer2);
this.engine = engine;
this.options = options;
this.buffer = void 0;
var _options = options, data3 = _options.data, usage = _options.usage, type2 = _options.type;
this.buffer = this.createBuffer(data3 instanceof Array ? new Float32Array(data3) : data3, usage || WebGPUConstants2.BufferUsage.Vertex | WebGPUConstants2.BufferUsage.CopyDst);
}
_createClass(WebGPUBuffer2, [{
key: "get",
value: function get3() {
return this.buffer;
}
}, {
key: "destroy",
value: function destroy() {
this.buffer.destroy();
}
}, {
key: "subData",
value: function subData(_ref2) {
var data3 = _ref2.data, offset = _ref2.offset;
this.setSubData(this.buffer, offset, data3 instanceof Array ? new Float32Array(data3) : data3);
}
}, {
key: "createBuffer",
value: function createBuffer(view, flags) {
var padding3 = view.byteLength % 4;
var verticesBufferDescriptor = {
size: view.byteLength + padding3,
usage: flags
};
var buffer = this.engine.device.createBuffer(verticesBufferDescriptor);
this.setSubData(buffer, 0, view);
return buffer;
}
}, {
key: "setSubData",
value: function setSubData(destBuffer, destOffset, srcArrayBuffer) {
var queue = isSafari ? this.engine.device.getQueue() : this.engine.device.defaultQueue;
queue.writeBuffer(destBuffer, destOffset, srcArrayBuffer);
}
}]);
return WebGPUBuffer2;
}();
// node_modules/@antv/g-webgpu-engine/es/webgpu/WebGPUComputeModel.js
var import_regenerator15 = __toModule(require_regenerator());
var WebGPUConstants3 = __toModule(require_constants());
// node_modules/@antv/g-webgpu-engine/es/utils/is-number.js
function isNumber6(value2) {
return typeof value2 === "number";
}
// node_modules/@antv/g-webgpu-engine/es/webgpu/WebGPUComputeModel.js
var WebGPUComputeModel = /* @__PURE__ */ function() {
function WebGPUComputeModel2(engine, context) {
_classCallCheck(this, WebGPUComputeModel2);
this.engine = engine;
this.context = context;
this.entity = createEntity();
this.uniformGPUBufferLayout = [];
this.uniformBuffer = void 0;
this.vertexBuffers = {};
this.outputBuffer = void 0;
this.bindGroupEntries = void 0;
this.bindGroup = void 0;
this.computePipeline = void 0;
}
_createClass(WebGPUComputeModel2, [{
key: "init",
value: function() {
var _init = _asyncToGenerator(/* @__PURE__ */ import_regenerator15.default.mark(function _callee() {
var _this = this;
var _yield$this$compileCo, computeStage, buffers, uniforms, bufferBindingIndex, offset, mergedUniformData;
return import_regenerator15.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return this.compileComputePipelineStageDescriptor(this.context.shader);
case 2:
_yield$this$compileCo = _context.sent;
computeStage = _yield$this$compileCo.computeStage;
buffers = this.context.uniforms.filter(function(uniform) {
return uniform.storageClass === STORAGE_CLASS.StorageBuffer;
});
uniforms = this.context.uniforms.filter(function(uniform) {
return uniform.storageClass === STORAGE_CLASS.Uniform;
});
bufferBindingIndex = uniforms.length ? 1 : 0;
this.bindGroupEntries = [];
if (bufferBindingIndex) {
offset = 0;
mergedUniformData = [];
uniforms.forEach(function(uniform) {
if (isNumber6(uniform.data)) {
_this.uniformGPUBufferLayout.push({
name: uniform.name,
offset
});
offset += 4;
mergedUniformData.push(uniform.data);
} else {
var _uniform$data;
var originDataLength = ((_uniform$data = uniform.data) === null || _uniform$data === void 0 ? void 0 : _uniform$data.length) || 1;
if (originDataLength === 3) {
originDataLength = 4;
uniform.data.push(0);
}
var padding3 = offset / 4 % 4;
if (padding3 > 0) {
var space = 4 - padding3;
if (originDataLength > 1 && originDataLength <= space) {
if (originDataLength === 2) {
if (space === 3) {
offset += 4;
mergedUniformData.push(0);
}
mergedUniformData.push.apply(mergedUniformData, _toConsumableArray(uniform.data));
_this.uniformGPUBufferLayout.push({
name: uniform.name,
offset
});
}
} else {
for (var i4 = 0; i4 < space; i4++) {
offset += 4;
mergedUniformData.push(0);
}
mergedUniformData.push.apply(mergedUniformData, _toConsumableArray(uniform.data));
_this.uniformGPUBufferLayout.push({
name: uniform.name,
offset
});
}
}
offset += 4 * originDataLength;
}
});
this.uniformBuffer = new WebGPUBuffer(this.engine, {
data: mergedUniformData instanceof Array ? new Float32Array(mergedUniformData) : mergedUniformData,
usage: WebGPUConstants3.BufferUsage.Uniform | WebGPUConstants3.BufferUsage.CopyDst
});
this.bindGroupEntries.push({
binding: 0,
resource: {
buffer: this.uniformBuffer.get()
}
});
}
buffers.forEach(function(buffer) {
if (buffer.data !== null) {
if (buffer.type === AST_TOKEN_TYPES.Vector4FloatArray || buffer.type === AST_TOKEN_TYPES.FloatArray) {
var gpuBuffer;
if (buffer.name === _this.context.output.name) {
gpuBuffer = new WebGPUBuffer(_this.engine, {
data: isFinite(Number(buffer.data)) ? [buffer.data] : buffer.data,
usage: WebGPUConstants3.BufferUsage.Storage | WebGPUConstants3.BufferUsage.CopyDst | WebGPUConstants3.BufferUsage.CopySrc
});
_this.outputBuffer = gpuBuffer;
_this.context.output = {
name: buffer.name,
length: isFinite(Number(buffer.data)) ? 1 : buffer.data.length,
typedArrayConstructor: Float32Array,
gpuBuffer: gpuBuffer.get()
};
} else {
if (buffer.isReferer) {
if (buffer.data.model && buffer.data.model.outputBuffer) {
gpuBuffer = buffer.data.model.outputBuffer;
} else {
}
} else {
gpuBuffer = new WebGPUBuffer(_this.engine, {
data: isFinite(Number(buffer.data)) ? [buffer.data] : buffer.data,
usage: WebGPUConstants3.BufferUsage.Storage | WebGPUConstants3.BufferUsage.CopyDst | WebGPUConstants3.BufferUsage.CopySrc
});
}
}
_this.vertexBuffers[buffer.name] = gpuBuffer;
_this.bindGroupEntries.push({
binding: bufferBindingIndex,
resource: {
name: buffer.name,
refer: gpuBuffer ? void 0 : buffer.data,
buffer: gpuBuffer ? gpuBuffer.get() : void 0
}
});
bufferBindingIndex++;
}
}
});
this.computePipeline = this.engine.device.createComputePipeline({
computeStage
});
console.log(this.bindGroupEntries);
this.bindGroup = this.engine.device.createBindGroup({
layout: this.computePipeline.getBindGroupLayout(0),
entries: this.bindGroupEntries
});
case 13:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
function init() {
return _init.apply(this, arguments);
}
return init;
}()
}, {
key: "destroy",
value: function destroy() {
var _this2 = this;
if (this.uniformBuffer) {
this.uniformBuffer.destroy();
}
Object.keys(this.vertexBuffers).forEach(function(bufferName) {
return _this2.vertexBuffers[bufferName].destroy();
});
}
}, {
key: "readData",
value: function() {
var _readData = _asyncToGenerator(/* @__PURE__ */ import_regenerator15.default.mark(function _callee2() {
var output, length5, typedArrayConstructor, gpuBuffer, byteCount, gpuReadBuffer, encoder, queue, arraybuffer, typedArray;
return import_regenerator15.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
output = this.context.output;
if (!output) {
_context2.next = 16;
break;
}
length5 = output.length, typedArrayConstructor = output.typedArrayConstructor, gpuBuffer = output.gpuBuffer;
if (!gpuBuffer) {
_context2.next = 16;
break;
}
byteCount = length5 * typedArrayConstructor.BYTES_PER_ELEMENT;
gpuReadBuffer = this.engine.device.createBuffer({
size: byteCount,
usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ
});
encoder = this.engine.device.createCommandEncoder();
encoder.copyBufferToBuffer(gpuBuffer, 0, gpuReadBuffer, 0, byteCount);
queue = isSafari ? this.engine.device.getQueue() : this.engine.device.defaultQueue;
queue.submit([encoder.finish()]);
_context2.next = 12;
return gpuReadBuffer.mapAsync(WebGPUConstants3.MapMode.Read);
case 12:
arraybuffer = gpuReadBuffer.getMappedRange();
typedArray = new typedArrayConstructor(arraybuffer.slice(0));
gpuReadBuffer.unmap();
return _context2.abrupt("return", typedArray);
case 16:
return _context2.abrupt("return", new Float32Array());
case 17:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
function readData() {
return _readData.apply(this, arguments);
}
return readData;
}()
}, {
key: "run",
value: function run4() {
if (this.engine.currentComputePass) {
var _this$engine$currentC;
this.engine.currentComputePass.setPipeline(this.computePipeline);
this.engine.currentComputePass.setBindGroup(0, this.bindGroup);
(_this$engine$currentC = this.engine.currentComputePass).dispatch.apply(_this$engine$currentC, _toConsumableArray(this.context.dispatch));
}
}
}, {
key: "updateBuffer",
value: function updateBuffer(bufferName, data3) {
var offset = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
var buffer = this.vertexBuffers[bufferName];
if (buffer) {
buffer.subData({
data: data3,
offset
});
}
}
}, {
key: "updateUniform",
value: function updateUniform(uniformName, data3) {
var layout6 = this.uniformGPUBufferLayout.find(function(l4) {
return l4.name === uniformName;
});
if (layout6) {
this.uniformBuffer.subData({
data: Number.isFinite(data3) ? new Float32Array([data3]) : new Float32Array(data3),
offset: layout6.offset
});
}
}
}, {
key: "confirmInput",
value: function confirmInput(model, inputName) {
var inputBuffer = this.vertexBuffers[inputName];
var outputBuffer = model.outputBuffer;
if (inputBuffer && outputBuffer && inputBuffer !== outputBuffer) {
var encoder = this.engine.device.createCommandEncoder();
var _context$output = model.context.output, length5 = _context$output.length, typedArrayConstructor = _context$output.typedArrayConstructor;
var byteCount = length5 * typedArrayConstructor.BYTES_PER_ELEMENT;
encoder.copyBufferToBuffer(outputBuffer.get(), 0, inputBuffer.get(), 0, byteCount);
var queue = isSafari ? this.engine.device.getQueue() : this.engine.device.defaultQueue;
queue.submit([encoder.finish()]);
}
}
}, {
key: "compileShaderToSpirV",
value: function compileShaderToSpirV(source, type2, shaderVersion) {
return this.compileRawShaderToSpirV(shaderVersion + source, type2);
}
}, {
key: "compileRawShaderToSpirV",
value: function compileRawShaderToSpirV(source, type2) {
return this.engine.glslang.compileGLSL(source, type2);
}
}, {
key: "compileComputePipelineStageDescriptor",
value: function() {
var _compileComputePipelineStageDescriptor = _asyncToGenerator(/* @__PURE__ */ import_regenerator15.default.mark(function _callee3(computeCode) {
var computeShader, shaderVersion;
return import_regenerator15.default.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
computeShader = computeCode;
shaderVersion = "#version 450\n";
if (this.engine.options.useWGSL) {
_context3.next = 6;
break;
}
_context3.next = 5;
return this.compileShaderToSpirV(computeCode, "compute", shaderVersion);
case 5:
computeShader = _context3.sent;
case 6:
return _context3.abrupt("return", {
computeStage: {
module: this.engine.device.createShaderModule({
code: computeShader,
isWHLSL: isSafari
}),
entryPoint: "main"
}
});
case 7:
case "end":
return _context3.stop();
}
}
}, _callee3, this);
}));
function compileComputePipelineStageDescriptor(_x) {
return _compileComputePipelineStageDescriptor.apply(this, arguments);
}
return compileComputePipelineStageDescriptor;
}()
}]);
return WebGPUComputeModel2;
}();
// node_modules/@antv/g-webgpu-engine/es/webgpu/WebGPUElements.js
var WebGPUConstants4 = __toModule(require_constants());
var WebGPUElements = /* @__PURE__ */ function() {
function WebGPUElements2(engine, options) {
_classCallCheck(this, WebGPUElements2);
this.engine = engine;
this.options = options;
this.indexCount = void 0;
this.buffer = void 0;
var _options = options, data3 = _options.data, usage = _options.usage, type2 = _options.type, count2 = _options.count;
this.indexCount = count2 || 0;
this.buffer = new WebGPUBuffer(engine, {
data: data3 instanceof Array ? new Uint16Array(data3) : data3,
usage: WebGPUConstants4.BufferUsage.Index | WebGPUConstants4.BufferUsage.CopyDst
});
}
_createClass(WebGPUElements2, [{
key: "get",
value: function get3() {
return this.buffer;
}
}, {
key: "subData",
value: function subData(options) {
this.buffer.subData(options);
}
}, {
key: "destroy",
value: function destroy() {
this.buffer.destroy();
}
}]);
return WebGPUElements2;
}();
// node_modules/@antv/g-webgpu-engine/es/webgpu/WebGPUFramebuffer.js
var WebGPUFramebuffer = /* @__PURE__ */ function() {
function WebGPUFramebuffer2(engine, options) {
_classCallCheck(this, WebGPUFramebuffer2);
this.engine = engine;
this.options = options;
this.colorTexture = void 0;
this.depthTexture = void 0;
this.width = 0;
this.height = 0;
var _options = options, width2 = _options.width, height = _options.height, color4 = _options.color, colors = _options.colors, depth = _options.depth, stencil = _options.stencil;
if (color4) {
this.colorTexture = color4;
}
if (depth) {
this.depthTexture = depth;
}
}
_createClass(WebGPUFramebuffer2, [{
key: "get",
value: function get3() {
var _this$colorTexture, _this$depthTexture;
return {
color: (_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0 ? void 0 : _this$colorTexture.get(),
depth: (_this$depthTexture = this.depthTexture) === null || _this$depthTexture === void 0 ? void 0 : _this$depthTexture.get()
};
}
}, {
key: "destroy",
value: function destroy() {
var _this$colorTexture2, _this$depthTexture2;
(_this$colorTexture2 = this.colorTexture) === null || _this$colorTexture2 === void 0 ? void 0 : _this$colorTexture2.destroy();
(_this$depthTexture2 = this.depthTexture) === null || _this$depthTexture2 === void 0 ? void 0 : _this$depthTexture2.destroy();
}
}, {
key: "resize",
value: function resize(_ref2) {
var width2 = _ref2.width, height = _ref2.height;
if (width2 !== this.width || height !== this.height) {
var _this$colorTexture3, _this$depthTexture3;
(_this$colorTexture3 = this.colorTexture) === null || _this$colorTexture3 === void 0 ? void 0 : _this$colorTexture3.resize({
width: width2,
height
});
(_this$depthTexture3 = this.depthTexture) === null || _this$depthTexture3 === void 0 ? void 0 : _this$depthTexture3.resize({
width: width2,
height
});
}
this.width = width2;
this.height = height;
}
}]);
return WebGPUFramebuffer2;
}();
// node_modules/@antv/g-webgpu-engine/es/webgpu/WebGPUModel.js
var import_regenerator16 = __toModule(require_regenerator());
var WebGPUConstants6 = __toModule(require_constants());
// node_modules/@antv/g-webgpu-engine/es/webgpu/constants.js
var WebGPUConstants5 = __toModule(require_constants());
var _primitiveMap2;
var _depthFuncMap2;
var _blendEquationMap2;
var _blendFuncMap2;
var _formatMap2;
var _filterMap2;
var _wrapModeMap2;
var primitiveMap2 = (_primitiveMap2 = {}, _defineProperty(_primitiveMap2, gl.POINTS, WebGPUConstants5.PrimitiveTopology.PointList), _defineProperty(_primitiveMap2, gl.LINES, WebGPUConstants5.PrimitiveTopology.LineList), _defineProperty(_primitiveMap2, gl.LINE_LOOP, WebGPUConstants5.PrimitiveTopology.LineList), _defineProperty(_primitiveMap2, gl.LINE_STRIP, WebGPUConstants5.PrimitiveTopology.LineStrip), _defineProperty(_primitiveMap2, gl.TRIANGLES, WebGPUConstants5.PrimitiveTopology.TriangleList), _defineProperty(_primitiveMap2, gl.TRIANGLE_FAN, WebGPUConstants5.PrimitiveTopology.TriangleList), _defineProperty(_primitiveMap2, gl.TRIANGLE_STRIP, WebGPUConstants5.PrimitiveTopology.TriangleStrip), _primitiveMap2);
var depthFuncMap2 = (_depthFuncMap2 = {}, _defineProperty(_depthFuncMap2, gl.NEVER, WebGPUConstants5.CompareFunction.Never), _defineProperty(_depthFuncMap2, gl.ALWAYS, WebGPUConstants5.CompareFunction.Always), _defineProperty(_depthFuncMap2, gl.LESS, WebGPUConstants5.CompareFunction.Less), _defineProperty(_depthFuncMap2, gl.LEQUAL, WebGPUConstants5.CompareFunction.LessEqual), _defineProperty(_depthFuncMap2, gl.GREATER, WebGPUConstants5.CompareFunction.Greater), _defineProperty(_depthFuncMap2, gl.GEQUAL, WebGPUConstants5.CompareFunction.GreaterEqual), _defineProperty(_depthFuncMap2, gl.EQUAL, WebGPUConstants5.CompareFunction.Equal), _defineProperty(_depthFuncMap2, gl.NOTEQUAL, WebGPUConstants5.CompareFunction.NotEqual), _depthFuncMap2);
var blendEquationMap2 = (_blendEquationMap2 = {}, _defineProperty(_blendEquationMap2, gl.FUNC_ADD, WebGPUConstants5.BlendOperation.Add), _defineProperty(_blendEquationMap2, gl.MIN_EXT, WebGPUConstants5.BlendOperation.Min), _defineProperty(_blendEquationMap2, gl.MAX_EXT, WebGPUConstants5.BlendOperation.Max), _defineProperty(_blendEquationMap2, gl.FUNC_SUBTRACT, WebGPUConstants5.BlendOperation.Subtract), _defineProperty(_blendEquationMap2, gl.FUNC_REVERSE_SUBTRACT, WebGPUConstants5.BlendOperation.ReverseSubtract), _blendEquationMap2);
var blendFuncMap2 = (_blendFuncMap2 = {}, _defineProperty(_blendFuncMap2, gl.ZERO, WebGPUConstants5.BlendFactor.Zero), _defineProperty(_blendFuncMap2, gl.ONE, WebGPUConstants5.BlendFactor.One), _defineProperty(_blendFuncMap2, gl.SRC_COLOR, WebGPUConstants5.BlendFactor.SrcColor), _defineProperty(_blendFuncMap2, gl.ONE_MINUS_SRC_COLOR, WebGPUConstants5.BlendFactor.OneMinusSrcColor), _defineProperty(_blendFuncMap2, gl.SRC_ALPHA, WebGPUConstants5.BlendFactor.SrcAlpha), _defineProperty(_blendFuncMap2, gl.ONE_MINUS_SRC_ALPHA, WebGPUConstants5.BlendFactor.OneMinusSrcAlpha), _defineProperty(_blendFuncMap2, gl.DST_COLOR, WebGPUConstants5.BlendFactor.DstColor), _defineProperty(_blendFuncMap2, gl.ONE_MINUS_DST_COLOR, WebGPUConstants5.BlendFactor.OneMinusDstColor), _defineProperty(_blendFuncMap2, gl.DST_ALPHA, WebGPUConstants5.BlendFactor.DstAlpha), _defineProperty(_blendFuncMap2, gl.ONE_MINUS_DST_ALPHA, WebGPUConstants5.BlendFactor.OneMinusDstAlpha), _defineProperty(_blendFuncMap2, gl.CONSTANT_COLOR, WebGPUConstants5.BlendFactor.BlendColor), _defineProperty(_blendFuncMap2, gl.ONE_MINUS_CONSTANT_COLOR, WebGPUConstants5.BlendFactor.OneMinusBlendColor), _defineProperty(_blendFuncMap2, gl.SRC_ALPHA_SATURATE, WebGPUConstants5.BlendFactor.SrcAlphaSaturated), _blendFuncMap2);
var formatMap2 = (_formatMap2 = {}, _defineProperty(_formatMap2, gl.ALPHA, "r8unorm"), _defineProperty(_formatMap2, gl.RGBA, "rgba8unorm"), _defineProperty(_formatMap2, gl.DEPTH_COMPONENT, "depth32float"), _defineProperty(_formatMap2, gl.DEPTH_STENCIL, "depth24plus-stencil8"), _formatMap2);
var filterMap2 = (_filterMap2 = {}, _defineProperty(_filterMap2, gl.NEAREST, "nearest"), _defineProperty(_filterMap2, gl.LINEAR, "linear"), _filterMap2);
var wrapModeMap2 = (_wrapModeMap2 = {}, _defineProperty(_wrapModeMap2, gl.REPEAT, "repeat"), _defineProperty(_wrapModeMap2, gl.CLAMP_TO_EDGE, "clamp-to-edge"), _defineProperty(_wrapModeMap2, gl.MIRRORED_REPEAT, "mirror-repeat"), _wrapModeMap2);
function getCullMode(_ref2) {
var cull = _ref2.cull;
if (!cull || !cull.enable) {
return WebGPUConstants5.CullMode.None;
}
if (cull.face) {
return cull.face === gl.FRONT ? WebGPUConstants5.CullMode.Front : WebGPUConstants5.CullMode.Back;
}
}
function getDepthStencilStateDescriptor(_ref2) {
var depth = _ref2.depth, stencil = _ref2.stencil;
var stencilFrontBack = {
compare: WebGPUConstants5.CompareFunction.Always,
depthFailOp: WebGPUConstants5.StencilOperation.Keep,
failOp: WebGPUConstants5.StencilOperation.Keep,
passOp: WebGPUConstants5.StencilOperation.Keep
};
return {
depthWriteEnabled: depth && depth.enable,
depthCompare: depthFuncMap2[(depth === null || depth === void 0 ? void 0 : depth.func) || gl.ALWAYS],
format: WebGPUConstants5.TextureFormat.Depth24PlusStencil8,
stencilFront: stencilFrontBack,
stencilBack: stencilFrontBack,
stencilReadMask: 4294967295,
stencilWriteMask: 4294967295
};
}
function getColorStateDescriptors(_ref3, swapChainFormat) {
var blend2 = _ref3.blend;
return [{
format: swapChainFormat,
alphaBlend: {
srcFactor: blendFuncMap2[blend2 && blend2.func && blend2.func.srcAlpha || gl.ONE],
dstFactor: blendFuncMap2[blend2 && blend2.func && blend2.func.dstAlpha || gl.ZERO],
operation: blendEquationMap2[blend2 && blend2.equation && blend2.equation.alpha || gl.FUNC_ADD]
},
colorBlend: {
srcFactor: blendFuncMap2[blend2 && blend2.func && blend2.func.srcRGB || gl.ONE],
dstFactor: blendFuncMap2[blend2 && blend2.func && blend2.func.dstRGB || gl.ZERO],
operation: blendEquationMap2[blend2 && blend2.equation && blend2.equation.rgb || gl.FUNC_ADD]
},
writeMask: WebGPUConstants5.ColorWrite.All
}];
}
// node_modules/@antv/g-webgpu-engine/es/webgpu/WebGPUModel.js
function ownKeys8(object, enumerableOnly) {
var keys2 = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys2.push.apply(keys2, symbols);
}
return keys2;
}
function _objectSpread8(target) {
for (var i4 = 1; i4 < arguments.length; i4++) {
var source = arguments[i4] != null ? arguments[i4] : {};
if (i4 % 2) {
ownKeys8(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys8(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function concatenate(resultConstructor) {
var totalLength = 0;
for (var _len = arguments.length, arrays = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
arrays[_key - 1] = arguments[_key];
}
for (var _i = 0, _arrays = arrays; _i < _arrays.length; _i++) {
var arr = _arrays[_i];
totalLength += arr.length;
}
var result = new resultConstructor(totalLength);
var offset = 0;
for (var _i2 = 0, _arrays2 = arrays; _i2 < _arrays2.length; _i2++) {
var _arr = _arrays2[_i2];
result.set(_arr, offset);
offset += _arr.length;
}
return result;
}
var WebGPUModel = /* @__PURE__ */ function() {
function WebGPUModel2(engine, options) {
_classCallCheck(this, WebGPUModel2);
this.engine = engine;
this.options = options;
this.pipelineLayout = void 0;
this.renderPipeline = void 0;
this.uniformsBindGroupLayout = void 0;
this.uniformBindGroup = void 0;
this.uniformBuffer = void 0;
this.uniforms = {};
this.uniformGPUBufferLayout = [];
this.attributeCache = {};
this.indexBuffer = void 0;
this.indexCount = void 0;
}
_createClass(WebGPUModel2, [{
key: "init",
value: function() {
var _init = _asyncToGenerator(/* @__PURE__ */ import_regenerator16.default.mark(function _callee() {
var _this = this;
var _this$options, vs, fs, attributes, uniforms, primitive, count2, elements, depth, blend2, stencil, cull, instances, _yield$this$compilePi, vertexStage, fragmentStage, vertexState, descriptor;
return import_regenerator16.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_this$options = this.options, vs = _this$options.vs, fs = _this$options.fs, attributes = _this$options.attributes, uniforms = _this$options.uniforms, primitive = _this$options.primitive, count2 = _this$options.count, elements = _this$options.elements, depth = _this$options.depth, blend2 = _this$options.blend, stencil = _this$options.stencil, cull = _this$options.cull, instances = _this$options.instances;
_context.next = 3;
return this.compilePipelineStageDescriptor(vs, fs, null);
case 3:
_yield$this$compilePi = _context.sent;
vertexStage = _yield$this$compilePi.vertexStage;
fragmentStage = _yield$this$compilePi.fragmentStage;
if (uniforms) {
this.buildUniformBindGroup(uniforms);
}
if (elements) {
this.indexBuffer = elements.get();
this.indexCount = elements.indexCount;
}
vertexState = {
vertexBuffers: Object.keys(attributes).map(function(attributeName, i4) {
var attribute = attributes[attributeName];
var _attribute$get = attribute.get(), arrayStride = _attribute$get.arrayStride, stepMode = _attribute$get.stepMode, ats = _attribute$get.attributes;
_this.attributeCache[attributeName] = attribute;
return {
arrayStride,
stepMode,
attributes: ats
};
})
};
descriptor = {
sampleCount: this.engine.mainPassSampleCount,
primitiveTopology: primitiveMap2[primitive || gl.TRIANGLES],
rasterizationState: _objectSpread8(_objectSpread8({}, this.getDefaultRasterizationStateDescriptor()), {}, {
cullMode: getCullMode({
cull
})
}),
depthStencilState: getDepthStencilStateDescriptor({
depth,
stencil
}),
colorStates: getColorStateDescriptors({
blend: blend2
}, this.engine.options.swapChainFormat),
layout: this.pipelineLayout,
vertexStage,
fragmentStage,
vertexState
};
this.renderPipeline = this.engine.device.createRenderPipeline(descriptor);
case 11:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
function init() {
return _init.apply(this, arguments);
}
return init;
}()
}, {
key: "addUniforms",
value: function addUniforms(uniforms) {
this.uniforms = _objectSpread8(_objectSpread8({}, this.uniforms), extractUniforms2(uniforms));
}
}, {
key: "draw",
value: function draw4(options) {
var _this2 = this;
var renderPass = this.engine.getCurrentRenderPass();
var uniforms = _objectSpread8(_objectSpread8({}, this.uniforms), extractUniforms2(options.uniforms || {}));
var bindGroupBindings = [];
Object.keys(uniforms).forEach(function(uniformName) {
var type2 = _typeof3(uniforms[uniformName]);
if (type2 === "boolean" || type2 === "number" || Array.isArray(uniforms[uniformName]) || uniforms[uniformName].BYTES_PER_ELEMENT) {
var _this2$uniformGPUBuff;
var offset = (_this2$uniformGPUBuff = _this2.uniformGPUBufferLayout.find(function(_ref2) {
var name = _ref2.name;
return name === uniformName;
})) === null || _this2$uniformGPUBuff === void 0 ? void 0 : _this2$uniformGPUBuff.offset;
if (offset !== null) {
_this2.uniformBuffer.subData({
data: uniforms[uniformName],
offset
});
}
} else {
var _this2$uniformGPUBuff2;
var _offset = (_this2$uniformGPUBuff2 = _this2.uniformGPUBufferLayout.find(function(_ref2) {
var name = _ref2.name;
return name === uniformName;
})) === null || _this2$uniformGPUBuff2 === void 0 ? void 0 : _this2$uniformGPUBuff2.offset;
if (_offset !== null) {
var textureOrFramebuffer = uniforms[uniformName].get();
var _ref3 = textureOrFramebuffer.color || textureOrFramebuffer, texture = _ref3.texture, sampler = _ref3.sampler;
if (sampler) {
bindGroupBindings.push({
binding: _offset,
resource: sampler
});
_offset++;
}
bindGroupBindings.push({
binding: _offset,
resource: texture.createView()
});
}
}
});
if (this.uniformBuffer) {
bindGroupBindings[0] = {
binding: 0,
resource: {
buffer: this.uniformBuffer.get()
}
};
}
this.uniformBindGroup = this.engine.device.createBindGroup({
layout: this.uniformsBindGroupLayout,
entries: bindGroupBindings
});
if (this.renderPipeline) {
renderPass.setPipeline(this.renderPipeline);
}
renderPass.setBindGroup(0, this.uniformBindGroup);
if (this.indexBuffer) {
renderPass.setIndexBuffer(this.indexBuffer.get(), WebGPUConstants6.IndexFormat.Uint32, 0);
}
Object.keys(this.attributeCache).forEach(function(attributeName, i4) {
renderPass.setVertexBuffer(0 + i4, _this2.attributeCache[attributeName].get().buffer, 0);
});
if (this.indexBuffer) {
renderPass.drawIndexed(this.indexCount, this.options.instances || 1, 0, 0, 0);
} else {
renderPass.draw(this.options.count || 0, this.options.instances || 0, 0, 0);
}
}
}, {
key: "destroy",
value: function destroy() {
throw new Error("Method not implemented.");
}
}, {
key: "compilePipelineStageDescriptor",
value: function() {
var _compilePipelineStageDescriptor = _asyncToGenerator(/* @__PURE__ */ import_regenerator16.default.mark(function _callee2(vertexCode, fragmentCode, defines) {
var shaderVersion, vertexShader, fragmentShader;
return import_regenerator16.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
shaderVersion = "#version 450\n";
vertexShader = vertexCode;
fragmentShader = fragmentCode;
if (this.engine.options.useWGSL) {
_context2.next = 10;
break;
}
_context2.next = 6;
return this.compileShaderToSpirV(vertexCode, "vertex", shaderVersion);
case 6:
vertexShader = _context2.sent;
_context2.next = 9;
return this.compileShaderToSpirV(fragmentCode, "fragment", shaderVersion);
case 9:
fragmentShader = _context2.sent;
case 10:
return _context2.abrupt("return", this.createPipelineStageDescriptor(vertexShader, fragmentShader));
case 11:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
function compilePipelineStageDescriptor(_x, _x2, _x3) {
return _compilePipelineStageDescriptor.apply(this, arguments);
}
return compilePipelineStageDescriptor;
}()
}, {
key: "compileShaderToSpirV",
value: function compileShaderToSpirV(source, type2, shaderVersion) {
return this.compileRawShaderToSpirV(shaderVersion + source, type2);
}
}, {
key: "compileRawShaderToSpirV",
value: function compileRawShaderToSpirV(source, type2) {
return this.engine.glslang.compileGLSL(source, type2);
}
}, {
key: "createPipelineStageDescriptor",
value: function createPipelineStageDescriptor(vertexShader, fragmentShader) {
return {
vertexStage: {
module: this.engine.device.createShaderModule({
code: vertexShader,
isWHLSL: isSafari
}),
entryPoint: "main"
},
fragmentStage: {
module: this.engine.device.createShaderModule({
code: fragmentShader,
isWHLSL: isSafari
}),
entryPoint: "main"
}
};
}
}, {
key: "getDefaultRasterizationStateDescriptor",
value: function getDefaultRasterizationStateDescriptor() {
return {
frontFace: WebGPUConstants6.FrontFace.CCW,
cullMode: WebGPUConstants6.CullMode.None,
depthBias: 0,
depthBiasSlopeScale: 0,
depthBiasClamp: 0
};
}
}, {
key: "buildUniformBindGroup",
value: function buildUniformBindGroup(uniforms) {
var _this3 = this;
var offset = 0;
var mergedUniformData = concatenate.apply(void 0, [Float32Array].concat(_toConsumableArray(Object.keys(uniforms).map(function(uniformName) {
if (uniforms[uniformName]) {
_this3.uniformGPUBufferLayout.push({
name: uniformName,
offset
});
offset += (uniforms[uniformName].length || 1) * 4;
return uniforms[uniformName];
} else {
return [];
}
}))));
var entries = [];
var hasUniform = false;
if (mergedUniformData.length) {
hasUniform = true;
entries.push({
binding: 0,
visibility: WebGPUConstants6.ShaderStage.Fragment | WebGPUConstants6.ShaderStage.Vertex,
type: WebGPUConstants6.BindingType.UniformBuffer
});
}
Object.keys(uniforms).filter(function(uniformName) {
return uniforms[uniformName] === null;
}).forEach(function(uniformName, i4) {
_this3.uniformGPUBufferLayout.push({
name: uniformName,
offset: i4 * 2 + (hasUniform ? 1 : 0)
});
entries.push({
binding: i4 * 2 + (hasUniform ? 1 : 0),
visibility: WebGPUConstants6.ShaderStage.Fragment,
type: WebGPUConstants6.BindingType.Sampler
}, {
binding: i4 * 2 + (hasUniform ? 1 : 0) + 1,
visibility: WebGPUConstants6.ShaderStage.Fragment,
type: WebGPUConstants6.BindingType.SampledTexture
});
});
this.uniformsBindGroupLayout = this.engine.device.createBindGroupLayout({
entries
});
this.pipelineLayout = this.engine.device.createPipelineLayout({
bindGroupLayouts: [this.uniformsBindGroupLayout]
});
if (hasUniform) {
this.uniformBuffer = new WebGPUBuffer(this.engine, {
data: mergedUniformData instanceof Array ? new Float32Array(mergedUniformData) : mergedUniformData,
usage: WebGPUConstants6.BufferUsage.Uniform | WebGPUConstants6.BufferUsage.CopyDst
});
}
}
}]);
return WebGPUModel2;
}();
// node_modules/@antv/g-webgpu-engine/es/webgpu/WebGPUTexture2D.js
var WebGPUConstants7 = __toModule(require_constants());
var WebGPUTexture2D = /* @__PURE__ */ function() {
function WebGPUTexture2D2(engine, options) {
_classCallCheck(this, WebGPUTexture2D2);
this.engine = engine;
this.options = options;
this.texture = void 0;
this.sampler = void 0;
this.width = void 0;
this.height = void 0;
this.createTexture();
}
_createClass(WebGPUTexture2D2, [{
key: "get",
value: function get3() {
return {
texture: this.texture,
sampler: this.sampler
};
}
}, {
key: "update",
value: function update15() {
}
}, {
key: "resize",
value: function resize(_ref2) {
var width2 = _ref2.width, height = _ref2.height;
if (width2 !== this.width || height !== this.height) {
this.destroy();
this.createTexture();
}
this.width = width2;
this.height = height;
}
}, {
key: "destroy",
value: function destroy() {
if (this.texture) {
this.texture.destroy();
}
}
}, {
key: "createTexture",
value: function createTexture() {
var _this$options = this.options, data3 = _this$options.data, _this$options$type = _this$options.type, type2 = _this$options$type === void 0 ? gl.UNSIGNED_BYTE : _this$options$type, width2 = _this$options.width, height = _this$options.height, _this$options$flipY = _this$options.flipY, flipY = _this$options$flipY === void 0 ? false : _this$options$flipY, _this$options$format = _this$options.format, format2 = _this$options$format === void 0 ? gl.RGBA : _this$options$format, _this$options$mipmap = _this$options.mipmap, mipmap = _this$options$mipmap === void 0 ? false : _this$options$mipmap, _this$options$wrapS = _this$options.wrapS, wrapS = _this$options$wrapS === void 0 ? gl.CLAMP_TO_EDGE : _this$options$wrapS, _this$options$wrapT = _this$options.wrapT, wrapT = _this$options$wrapT === void 0 ? gl.CLAMP_TO_EDGE : _this$options$wrapT, _this$options$aniso = _this$options.aniso, aniso = _this$options$aniso === void 0 ? 0 : _this$options$aniso, _this$options$alignme = _this$options.alignment, alignment = _this$options$alignme === void 0 ? 1 : _this$options$alignme, _this$options$premult = _this$options.premultiplyAlpha, premultiplyAlpha = _this$options$premult === void 0 ? false : _this$options$premult, _this$options$mag = _this$options.mag, mag = _this$options$mag === void 0 ? gl.NEAREST : _this$options$mag, _this$options$min = _this$options.min, min7 = _this$options$min === void 0 ? gl.NEAREST : _this$options$min, _this$options$colorSp = _this$options.colorSpace, colorSpace = _this$options$colorSp === void 0 ? gl.BROWSER_DEFAULT_WEBGL : _this$options$colorSp, usage = _this$options.usage;
this.width = width2;
this.height = height;
this.texture = this.engine.device.createTexture({
size: [width2, height, 1],
mipLevelCount: 1,
sampleCount: 1,
dimension: WebGPUConstants7.TextureDimension.E2d,
format: formatMap2[format2],
usage: usage || WebGPUConstants7.TextureUsage.Sampled | WebGPUConstants7.TextureUsage.CopyDst
});
if (!usage || usage & WebGPUConstants7.TextureUsage.Sampled) {
this.sampler = this.engine.device.createSampler({
addressModeU: wrapModeMap2[wrapS],
addressModeV: wrapModeMap2[wrapT],
addressModeW: wrapModeMap2[wrapS],
magFilter: filterMap2[mag],
minFilter: filterMap2[min7],
maxAnisotropy: aniso
});
}
}
}]);
return WebGPUTexture2D2;
}();
// node_modules/@antv/g-webgpu-engine/es/webgpu/index.js
var _dec49;
var _class21;
var _temp19;
var WebGPUEngine = (_dec49 = (0, import_inversify22.injectable)(), _dec49(_class21 = (_temp19 = /* @__PURE__ */ function() {
function WebGPUEngine2() {
var _this = this;
_classCallCheck(this, WebGPUEngine2);
this.supportWebGPU = true;
this.useWGSL = false;
this.options = void 0;
this.canvas = void 0;
this.context = void 0;
this.glslang = void 0;
this.adapter = void 0;
this.device = void 0;
this.swapChain = void 0;
this.mainPassSampleCount = void 0;
this.mainTexture = void 0;
this.depthTexture = void 0;
this.mainColorAttachments = void 0;
this.mainTextureExtends = void 0;
this.mainDepthAttachment = void 0;
this.uploadEncoder = void 0;
this.renderEncoder = void 0;
this.computeEncoder = void 0;
this.renderTargetEncoder = void 0;
this.commandBuffers = new Array(4).fill(void 0);
this.currentRenderPass = null;
this.mainRenderPass = null;
this.currentRenderTargetViewDescriptor = void 0;
this.currentComputePass = null;
this.bundleEncoder = void 0;
this.tempBuffers = [];
this.currentRenderTarget = null;
this.uploadEncoderDescriptor = {
label: "upload"
};
this.renderEncoderDescriptor = {
label: "render"
};
this.renderTargetEncoderDescriptor = {
label: "renderTarget"
};
this.computeEncoderDescriptor = {
label: "compute"
};
this.pipelines = {};
this.computePipelines = {};
this.defaultSampleCount = 4;
this.clearDepthValue = 1;
this.clearStencilValue = 0;
this.transientViewport = {
x: Infinity,
y: 0,
width: 0,
height: 0
};
this.cachedViewport = {
x: 0,
y: 0,
width: 0,
height: 0
};
this.clear = function(options) {
var framebuffer = options.framebuffer, color4 = options.color, depth = options.depth, stencil = options.stencil;
if (_this.options.supportCompute) {
_this.startComputePass();
}
if (_this.currentRenderTarget) {
if (_this.currentRenderPass) {
_this.endRenderTargetRenderPass();
}
_this.startRenderTargetRenderPass(_this.currentRenderTarget, color4 ? color4 : null, !!depth, !!stencil);
} else {
_this.mainColorAttachments[0].loadValue = color4 ? color4 : WebGPUConstants8.LoadOp.Load;
_this.mainDepthAttachment.depthLoadValue = depth ? depth : WebGPUConstants8.LoadOp.Load;
_this.mainDepthAttachment.stencilLoadValue = stencil ? _this.clearStencilValue : WebGPUConstants8.LoadOp.Load;
if (_this.mainRenderPass) {
_this.endMainRenderPass();
}
_this.startMainRenderPass();
}
};
this.createModel = /* @__PURE__ */ function() {
var _ref2 = _asyncToGenerator(/* @__PURE__ */ import_regenerator17.default.mark(function _callee(options) {
var model;
return import_regenerator17.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
model = new WebGPUModel(_this, options);
_context.next = 3;
return model.init();
case 3:
return _context.abrupt("return", model);
case 4:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return function(_x) {
return _ref2.apply(this, arguments);
};
}();
this.createAttribute = function(options) {
return new WebGPUAttribute(_this, options);
};
this.createBuffer = function(options) {
return new WebGPUBuffer(_this, options);
};
this.createElements = function(options) {
return new WebGPUElements(_this, options);
};
this.createTexture2D = function(options) {
return new WebGPUTexture2D(_this, options);
};
this.createFramebuffer = function(options) {
return new WebGPUFramebuffer(_this, options);
};
this.useFramebuffer = function(framebuffer, drawCommands) {
if (_this.currentRenderTarget) {
_this.unbindFramebuffer(_this.currentRenderTarget);
}
_this.currentRenderTarget = framebuffer;
_this.currentRenderTargetViewDescriptor = {
dimension: WebGPUConstants8.TextureViewDimension.E2d,
arrayLayerCount: 1,
aspect: WebGPUConstants8.TextureAspect.All
};
_this.currentRenderPass = null;
drawCommands();
};
this.createComputeModel = /* @__PURE__ */ function() {
var _ref2 = _asyncToGenerator(/* @__PURE__ */ import_regenerator17.default.mark(function _callee2(context) {
var model;
return import_regenerator17.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
model = new WebGPUComputeModel(_this, context);
_context2.next = 3;
return model.init();
case 3:
return _context2.abrupt("return", model);
case 4:
case "end":
return _context2.stop();
}
}
}, _callee2);
}));
return function(_x2) {
return _ref2.apply(this, arguments);
};
}();
this.getCanvas = function() {
return _this.canvas;
};
this.getGLContext = function() {
throw new Error("Method not implemented.");
};
this.viewport = function(_ref3) {
var x6 = _ref3.x, y5 = _ref3.y, width2 = _ref3.width, height = _ref3.height;
if (!_this.currentRenderPass) {
_this.transientViewport = {
x: x6,
y: y5,
width: width2,
height
};
} else if (_this.transientViewport.x !== Infinity) {
var renderPass = _this.getCurrentRenderPass();
renderPass.setViewport(_this.transientViewport.x, _this.transientViewport.y, _this.transientViewport.width, _this.transientViewport.height, 0, 1);
} else if (x6 !== _this.cachedViewport.x || y5 !== _this.cachedViewport.y || width2 !== _this.cachedViewport.width || height !== _this.cachedViewport.height) {
_this.cachedViewport = {
x: x6,
y: y5,
width: width2,
height
};
var _renderPass = _this.getCurrentRenderPass();
_renderPass.setViewport(x6, y5, width2, height, 0, 1);
}
};
this.readPixels = function(options) {
throw new Error("Method not implemented.");
};
}
_createClass(WebGPUEngine2, [{
key: "isFloatSupported",
value: function isFloatSupported() {
return true;
}
}, {
key: "init",
value: function() {
var _init = _asyncToGenerator(/* @__PURE__ */ import_regenerator17.default.mark(function _callee3(config) {
return import_regenerator17.default.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
this.canvas = config.canvas;
this.options = config;
this.useWGSL = !!config.useWGSL;
this.mainPassSampleCount = config.antialiasing ? this.defaultSampleCount : 1;
_context3.next = 6;
return this.initGlslang();
case 6:
this.initContextAndSwapChain();
this.initMainAttachments();
case 8:
case "end":
return _context3.stop();
}
}
}, _callee3, this);
}));
function init(_x3) {
return _init.apply(this, arguments);
}
return init;
}()
}, {
key: "setScissor",
value: function setScissor(scissor) {
throw new Error("Method not implemented.");
}
}, {
key: "destroy",
value: function destroy() {
if (this.mainTexture) {
this.mainTexture.destroy();
}
if (this.depthTexture) {
this.depthTexture.destroy();
}
this.tempBuffers.forEach(function(buffer) {
return buffer.destroy();
});
this.tempBuffers = [];
}
}, {
key: "beginFrame",
value: function beginFrame() {
this.uploadEncoder = this.device.createCommandEncoder(this.uploadEncoderDescriptor);
this.renderEncoder = this.device.createCommandEncoder(this.renderEncoderDescriptor);
this.renderTargetEncoder = this.device.createCommandEncoder(this.renderTargetEncoderDescriptor);
if (this.options.supportCompute) {
this.computeEncoder = this.device.createCommandEncoder(this.computeEncoderDescriptor);
}
}
}, {
key: "endFrame",
value: function endFrame() {
if (this.options.supportCompute) {
this.endComputePass();
}
this.endMainRenderPass();
this.commandBuffers[0] = this.uploadEncoder.finish();
this.commandBuffers[1] = this.renderEncoder.finish();
if (this.options.supportCompute) {
this.commandBuffers[2] = this.computeEncoder.finish();
}
this.commandBuffers[3] = this.renderTargetEncoder.finish();
if (isSafari) {
this.device.getQueue().submit(this.commandBuffers.filter(function(buffer) {
return buffer;
}));
} else {
this.device.defaultQueue.submit(this.commandBuffers.filter(function(buffer) {
return buffer;
}));
}
}
}, {
key: "getCurrentRenderPass",
value: function getCurrentRenderPass() {
if (this.currentRenderTarget && !this.currentRenderPass) {
this.startRenderTargetRenderPass(this.currentRenderTarget, null, false, false);
} else if (!this.currentRenderPass) {
this.startMainRenderPass();
}
return this.currentRenderPass;
}
}, {
key: "initGlslang",
value: function() {
var _initGlslang = _asyncToGenerator(/* @__PURE__ */ import_regenerator17.default.mark(function _callee4() {
var _navigator, _navigator$gpu;
return import_regenerator17.default.wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
_context4.next = 2;
return glslang_default();
case 2:
this.glslang = _context4.sent;
_context4.next = 5;
return (_navigator = navigator) === null || _navigator === void 0 ? void 0 : (_navigator$gpu = _navigator.gpu) === null || _navigator$gpu === void 0 ? void 0 : _navigator$gpu.requestAdapter();
case 5:
this.adapter = _context4.sent;
_context4.next = 8;
return this.adapter.requestDevice();
case 8:
this.device = _context4.sent;
case 9:
case "end":
return _context4.stop();
}
}
}, _callee4, this);
}));
function initGlslang() {
return _initGlslang.apply(this, arguments);
}
return initGlslang;
}()
}, {
key: "initContextAndSwapChain",
value: function initContextAndSwapChain() {
this.context = this.canvas.getContext(isSafari ? "gpu" : "gpupresent");
this.swapChain = this.context.configureSwapChain({
device: this.device,
format: this.options.swapChainFormat,
usage: WebGPUConstants8.TextureUsage.OutputAttachment | WebGPUConstants8.TextureUsage.CopySrc
});
}
}, {
key: "initMainAttachments",
value: function initMainAttachments() {
this.mainTextureExtends = {
width: this.canvas.width,
height: this.canvas.height,
depth: 1
};
if (this.options.antialiasing) {
var mainTextureDescriptor = {
size: this.mainTextureExtends,
mipLevelCount: 1,
sampleCount: this.mainPassSampleCount,
dimension: WebGPUConstants8.TextureDimension.E2d,
format: WebGPUConstants8.TextureFormat.BGRA8Unorm,
usage: WebGPUConstants8.TextureUsage.OutputAttachment
};
if (this.mainTexture) {
this.mainTexture.destroy();
}
this.mainTexture = this.device.createTexture(mainTextureDescriptor);
this.mainColorAttachments = [{
attachment: isSafari ? this.mainTexture.createDefaultView() : this.mainTexture.createView(),
loadValue: [0, 0, 0, 1],
storeOp: WebGPUConstants8.StoreOp.Store
}];
} else {
this.mainColorAttachments = [{
attachment: isSafari ? this.swapChain.getCurrentTexture().createDefaultView() : this.swapChain.getCurrentTexture().createView(),
loadValue: [0, 0, 0, 1],
storeOp: WebGPUConstants8.StoreOp.Store
}];
}
var depthTextureDescriptor = {
size: this.mainTextureExtends,
mipLevelCount: 1,
sampleCount: this.mainPassSampleCount,
dimension: WebGPUConstants8.TextureDimension.E2d,
format: isSafari ? "depth32float-stencil8" : WebGPUConstants8.TextureFormat.Depth24PlusStencil8,
usage: WebGPUConstants8.TextureUsage.OutputAttachment
};
if (this.depthTexture) {
this.depthTexture.destroy();
}
this.depthTexture = this.device.createTexture(depthTextureDescriptor);
this.mainDepthAttachment = {
attachment: isSafari ? this.depthTexture.createDefaultView() : this.depthTexture.createView(),
depthLoadValue: this.clearDepthValue,
depthStoreOp: WebGPUConstants8.StoreOp.Store,
stencilLoadValue: this.clearStencilValue,
stencilStoreOp: WebGPUConstants8.StoreOp.Store
};
}
}, {
key: "startComputePass",
value: function startComputePass() {
if (this.currentComputePass) {
this.endComputePass();
}
this.currentComputePass = this.computeEncoder.beginComputePass();
}
}, {
key: "startMainRenderPass",
value: function startMainRenderPass() {
if (this.currentRenderPass && !this.currentRenderTarget) {
this.endMainRenderPass();
}
if (this.options.antialiasing) {
this.mainColorAttachments[0].resolveTarget = isSafari ? this.swapChain.getCurrentTexture().createDefaultView() : this.swapChain.getCurrentTexture().createView();
} else {
this.mainColorAttachments[0].attachment = isSafari ? this.swapChain.getCurrentTexture().createDefaultView() : this.swapChain.getCurrentTexture().createView();
}
this.currentRenderPass = this.renderEncoder.beginRenderPass({
colorAttachments: this.mainColorAttachments,
depthStencilAttachment: this.mainDepthAttachment
});
this.mainRenderPass = this.currentRenderPass;
if (this.cachedViewport) {
this.viewport(this.cachedViewport);
}
}
}, {
key: "startRenderTargetRenderPass",
value: function startRenderTargetRenderPass(renderTarget, clearColor, clearDepth) {
var _renderTarget$get$col, _renderTarget$get$dep;
var clearStencil = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
var gpuTexture = (_renderTarget$get$col = renderTarget.get().color) === null || _renderTarget$get$col === void 0 ? void 0 : _renderTarget$get$col.texture;
var colorTextureView;
if (gpuTexture) {
colorTextureView = gpuTexture.createView(this.currentRenderTargetViewDescriptor);
}
var depthStencilTexture = (_renderTarget$get$dep = renderTarget.get().depth) === null || _renderTarget$get$dep === void 0 ? void 0 : _renderTarget$get$dep.texture;
var depthStencilTextureView;
if (depthStencilTexture) {
depthStencilTextureView = depthStencilTexture.createView();
}
var renderPass = this.renderTargetEncoder.beginRenderPass({
colorAttachments: [{
attachment: colorTextureView,
loadValue: clearColor !== null ? clearColor : WebGPUConstants8.LoadOp.Load,
storeOp: WebGPUConstants8.StoreOp.Store
}],
depthStencilAttachment: depthStencilTexture && depthStencilTextureView ? {
attachment: depthStencilTextureView,
depthLoadValue: clearDepth ? this.clearDepthValue : WebGPUConstants8.LoadOp.Load,
depthStoreOp: WebGPUConstants8.StoreOp.Store,
stencilLoadValue: clearStencil ? this.clearStencilValue : WebGPUConstants8.LoadOp.Load,
stencilStoreOp: WebGPUConstants8.StoreOp.Store
} : void 0
});
this.currentRenderPass = renderPass;
if (this.cachedViewport) {
this.viewport(this.cachedViewport);
}
}
}, {
key: "endMainRenderPass",
value: function endMainRenderPass() {
if (this.currentRenderPass === this.mainRenderPass && this.currentRenderPass !== null) {
this.currentRenderPass.endPass();
this.resetCachedViewport();
this.currentRenderPass = null;
this.mainRenderPass = null;
}
}
}, {
key: "endComputePass",
value: function endComputePass() {
if (this.currentComputePass) {
this.currentComputePass.endPass();
this.currentComputePass = null;
}
}
}, {
key: "endRenderTargetRenderPass",
value: function endRenderTargetRenderPass() {
if (this.currentRenderPass) {
this.currentRenderPass.endPass();
this.resetCachedViewport();
}
}
}, {
key: "resetCachedViewport",
value: function resetCachedViewport() {
this.cachedViewport = {
x: 0,
y: 0,
width: 0,
height: 0
};
}
}, {
key: "unbindFramebuffer",
value: function unbindFramebuffer(framebuffer) {
if (this.currentRenderPass && this.currentRenderPass !== this.mainRenderPass) {
this.endRenderTargetRenderPass();
}
this.transientViewport.x = Infinity;
this.currentRenderTarget = null;
this.currentRenderPass = this.mainRenderPass;
}
}]);
return WebGPUEngine2;
}(), _temp19)) || _class21);
// node_modules/@antv/g-webgpu/es/World.js
var WebGPUConstants10 = __toModule(require_constants());
var import_inversify36 = __toModule(require_inversify());
// node_modules/@antv/g-webgpu/es/geometry/Box.js
var import_inversify23 = __toModule(require_inversify());
var _dec50;
var _class30;
function _createSuper9(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct9();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived), result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _isNativeReflectConstruct9() {
if (typeof Reflect === "undefined" || !Reflect.construct)
return false;
if (Reflect.construct.sham)
return false;
if (typeof Proxy === "function")
return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function() {
}));
return true;
} catch (e4) {
return false;
}
}
var primitiveUv1Padding = 4 / 64;
var primitiveUv1PaddingScale = 1 - primitiveUv1Padding * 2;
var Box2 = (_dec50 = (0, import_inversify23.injectable)(), _dec50(_class30 = /* @__PURE__ */ function(_Geometry) {
_inherits(Box3, _Geometry);
var _super = _createSuper9(Box3);
function Box3() {
_classCallCheck(this, Box3);
return _super.apply(this, arguments);
}
_createClass(Box3, [{
key: "onEntityCreated",
value: function onEntityCreated() {
var _this$config = this.config, _this$config$widthSeg = _this$config.widthSegments, widthSegments = _this$config$widthSeg === void 0 ? 1 : _this$config$widthSeg, _this$config$heightSe = _this$config.heightSegments, heightSegments = _this$config$heightSe === void 0 ? 1 : _this$config$heightSe, _this$config$depthSeg = _this$config.depthSegments, depthSegments = _this$config$depthSeg === void 0 ? 1 : _this$config$depthSeg, _this$config$halfExte = _this$config.halfExtents, halfExtents = _this$config$halfExte === void 0 ? vec3_exports.fromValues(0.5, 0.5, 0.5) : _this$config$halfExte;
var ws = widthSegments;
var hs = heightSegments;
var ds = depthSegments;
var _halfExtents = _slicedToArray(halfExtents, 3), hex2 = _halfExtents[0], hey = _halfExtents[1], hez = _halfExtents[2];
var corners = [vec3_exports.fromValues(-hex2, -hey, hez), vec3_exports.fromValues(hex2, -hey, hez), vec3_exports.fromValues(hex2, hey, hez), vec3_exports.fromValues(-hex2, hey, hez), vec3_exports.fromValues(hex2, -hey, -hez), vec3_exports.fromValues(-hex2, -hey, -hez), vec3_exports.fromValues(-hex2, hey, -hez), vec3_exports.fromValues(hex2, hey, -hez)];
var faceAxes = [
[0, 1, 3],
[4, 5, 7],
[3, 2, 6],
[1, 0, 4],
[1, 4, 2],
[5, 0, 6]
];
var faceNormals = [
[0, 0, 1],
[0, 0, -1],
[0, 1, 0],
[0, -1, 0],
[1, 0, 0],
[-1, 0, 0]
];
var sides = {
FRONT: 0,
BACK: 1,
TOP: 2,
BOTTOM: 3,
RIGHT: 4,
LEFT: 5
};
var positions = [];
var normals = [];
var uvs = [];
var uvs1 = [];
var indices = [];
var vcounter = 0;
var generateFace = function generateFace2(side, uSegments, vSegments) {
var u3;
var v3;
var i4;
var j4;
for (i4 = 0; i4 <= uSegments; i4++) {
for (j4 = 0; j4 <= vSegments; j4++) {
var temp1 = vec3_exports.create();
var temp2 = vec3_exports.create();
var temp3 = vec3_exports.create();
var r4 = vec3_exports.create();
vec3_exports.lerp(temp1, corners[faceAxes[side][0]], corners[faceAxes[side][1]], i4 / uSegments);
vec3_exports.lerp(temp2, corners[faceAxes[side][0]], corners[faceAxes[side][2]], j4 / vSegments);
vec3_exports.sub(temp3, temp2, corners[faceAxes[side][0]]);
vec3_exports.add(r4, temp1, temp3);
u3 = i4 / uSegments;
v3 = j4 / vSegments;
positions.push(r4[0], r4[1], r4[2]);
normals.push(faceNormals[side][0], faceNormals[side][1], faceNormals[side][2]);
uvs.push(u3, v3);
u3 /= 3;
v3 /= 3;
u3 = u3 * primitiveUv1PaddingScale + primitiveUv1Padding;
v3 = v3 * primitiveUv1PaddingScale + primitiveUv1Padding;
u3 += side % 3 / 3;
v3 += Math.floor(side / 3) / 3;
uvs1.push(u3, v3);
if (i4 < uSegments && j4 < vSegments) {
indices.push(vcounter + vSegments + 1, vcounter + 1, vcounter);
indices.push(vcounter + vSegments + 1, vcounter + vSegments + 2, vcounter + 1);
}
vcounter++;
}
}
};
generateFace(sides.FRONT, ws, hs);
generateFace(sides.BACK, ws, hs);
generateFace(sides.TOP, ws, ds);
generateFace(sides.BOTTOM, ws, ds);
generateFace(sides.RIGHT, ds, hs);
generateFace(sides.LEFT, ds, hs);
var aabb = generateAABBFromVertices(positions);
var component2 = this.getComponent();
component2.indices = Uint32Array.from(indices);
component2.aabb = aabb;
component2.vertexCount = vcounter;
component2.attributes = [{
dirty: true,
name: "position",
data: Float32Array.from(positions),
arrayStride: 4 * 3,
stepMode: "vertex",
attributes: [{
shaderLocation: 0,
offset: 0,
format: "float3"
}]
}, {
dirty: true,
name: "normal",
data: Float32Array.from(normals),
arrayStride: 4 * 3,
stepMode: "vertex",
attributes: [{
shaderLocation: 1,
offset: 0,
format: "float3"
}]
}, {
dirty: true,
name: "uv",
data: Float32Array.from(uvs),
arrayStride: 4 * 2,
stepMode: "vertex",
attributes: [{
shaderLocation: 2,
offset: 0,
format: "float2"
}]
}];
}
}]);
return Box3;
}(Geometry2)) || _class30);
// node_modules/@antv/g-webgpu/es/geometry/Merged.js
var import_inversify24 = __toModule(require_inversify());
// node_modules/@antv/g-webgpu/es/utils/typedarray.js
function merge2(a4, b10) {
if (!a4 && !b10) {
throw new Error("Please specify valid arguments for parameters a and b.");
}
if (!b10 || b10.length === 0) {
return a4;
}
if (!a4 || a4.length === 0) {
return b10;
}
if (Object.prototype.toString.call(a4) !== Object.prototype.toString.call(b10)) {
throw new Error("The types of the two arguments passed for parameters a and b do not match.");
}
var c5 = new a4.constructor(a4.length + b10.length);
c5.set(a4);
c5.set(b10, a4.length);
return c5;
}
// node_modules/@antv/g-webgpu/es/geometry/Merged.js
var _dec51;
var _class31;
function _createSuper10(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct10();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived), result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _isNativeReflectConstruct10() {
if (typeof Reflect === "undefined" || !Reflect.construct)
return false;
if (Reflect.construct.sham)
return false;
if (typeof Proxy === "function")
return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function() {
}));
return true;
} catch (e4) {
return false;
}
}
var Merged = (_dec51 = (0, import_inversify24.injectable)(), _dec51(_class31 = /* @__PURE__ */ function(_Geometry) {
_inherits(Merged2, _Geometry);
var _super = _createSuper10(Merged2);
function Merged2() {
_classCallCheck(this, Merged2);
return _super.apply(this, arguments);
}
_createClass(Merged2, [{
key: "onEntityCreated",
value: function onEntityCreated() {
var _this$config$geometri = this.config.geometries, geometries = _this$config$geometri === void 0 ? [] : _this$config$geometri;
var mergedComponent = this.getComponent();
mergedComponent.aabb = new AABB();
var mergedAttributes = [];
var mergedIndices = [];
var indexOffset = 0;
geometries.forEach(function(geometry35) {
var aabb = geometry35.aabb, indices = geometry35.indices, vertexCount = geometry35.vertexCount, attributes = geometry35.attributes;
mergedComponent.aabb.add(aabb);
mergedComponent.vertexCount += vertexCount;
if (indices) {
mergedIndices.push.apply(mergedIndices, _toConsumableArray(indices.map(function(index2) {
return index2 + indexOffset;
})));
}
indexOffset += vertexCount;
attributes.forEach(function(attribute, i4) {
if (!mergedAttributes[i4]) {
mergedAttributes[i4] = attribute;
mergedAttributes[i4].dirty = true;
} else {
if (attribute.data) {
if (isNumber5(attribute.data)) {
mergedAttributes[i4].push(attribute.data);
} else if (isTypedArray2(attribute.data)) {
mergedAttributes[i4].data = merge2(mergedAttributes[i4].data, attribute.data);
} else {
mergedAttributes[i4].data = mergedAttributes[i4].data.concat(attribute.data);
}
}
}
});
});
mergedComponent.attributes = mergedAttributes;
mergedComponent.indices = Uint32Array.from(mergedIndices);
mergedComponent.dirty = true;
}
}]);
return Merged2;
}(Geometry2)) || _class31);
// node_modules/@antv/g-webgpu/es/geometry/Plane.js
var import_inversify25 = __toModule(require_inversify());
var _dec57;
var _class39;
function _createSuper11(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct11();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived), result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _isNativeReflectConstruct11() {
if (typeof Reflect === "undefined" || !Reflect.construct)
return false;
if (Reflect.construct.sham)
return false;
if (typeof Proxy === "function")
return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function() {
}));
return true;
} catch (e4) {
return false;
}
}
var Plane2 = (_dec57 = (0, import_inversify25.injectable)(), _dec57(_class39 = /* @__PURE__ */ function(_Geometry) {
_inherits(Plane3, _Geometry);
var _super = _createSuper11(Plane3);
function Plane3() {
_classCallCheck(this, Plane3);
return _super.apply(this, arguments);
}
_createClass(Plane3, [{
key: "onEntityCreated",
value: function onEntityCreated() {
var _this$config = this.config, _this$config$halfExte = _this$config.halfExtents, halfExtents = _this$config$halfExte === void 0 ? [0.5, 0.5] : _this$config$halfExte, _this$config$widthSeg = _this$config.widthSegments, widthSegments = _this$config$widthSeg === void 0 ? 5 : _this$config$widthSeg, _this$config$lengthSe = _this$config.lengthSegments, lengthSegments = _this$config$lengthSe === void 0 ? 5 : _this$config$lengthSe;
var positions = [];
var normals = [];
var uvs = [];
var indices = [];
var vcounter = 0;
for (var i4 = 0; i4 <= widthSegments; i4++) {
for (var j4 = 0; j4 <= lengthSegments; j4++) {
var x6 = -halfExtents[0] + 2 * halfExtents[0] * i4 / widthSegments;
var y5 = 0;
var z3 = -(-halfExtents[1] + 2 * halfExtents[1] * j4 / lengthSegments);
var u3 = i4 / widthSegments;
var v3 = j4 / lengthSegments;
positions.push(x6, y5, z3);
normals.push(0, 1, 0);
uvs.push(u3, v3);
if (i4 < widthSegments && j4 < lengthSegments) {
indices.push(vcounter + lengthSegments + 1, vcounter + 1, vcounter);
indices.push(vcounter + lengthSegments + 1, vcounter + lengthSegments + 2, vcounter + 1);
}
vcounter++;
}
}
var aabb = generateAABBFromVertices(positions);
var component2 = this.getComponent();
component2.indices = Uint32Array.from(indices);
component2.aabb = aabb;
component2.vertexCount = vcounter;
component2.attributes = [{
dirty: true,
name: "position",
data: Float32Array.from(positions),
arrayStride: 4 * 3,
stepMode: "vertex",
attributes: [{
shaderLocation: 0,
offset: 0,
format: "float3"
}]
}, {
dirty: true,
name: "normal",
data: Float32Array.from(normals),
arrayStride: 4 * 3,
stepMode: "vertex",
attributes: [{
shaderLocation: 1,
offset: 0,
format: "float3"
}]
}, {
dirty: true,
name: "uv",
data: Float32Array.from(uvs),
arrayStride: 4 * 2,
stepMode: "vertex",
attributes: [{
shaderLocation: 2,
offset: 0,
format: "float2"
}]
}];
}
}]);
return Plane3;
}(Geometry2)) || _class39);
// node_modules/@antv/g-webgpu/es/geometry/Sphere.js
var import_inversify26 = __toModule(require_inversify());
var _dec58;
var _class40;
function _createSuper12(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct12();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived), result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _isNativeReflectConstruct12() {
if (typeof Reflect === "undefined" || !Reflect.construct)
return false;
if (Reflect.construct.sham)
return false;
if (typeof Proxy === "function")
return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function() {
}));
return true;
} catch (e4) {
return false;
}
}
var Sphere = (_dec58 = (0, import_inversify26.injectable)(), _dec58(_class40 = /* @__PURE__ */ function(_Geometry) {
_inherits(Sphere2, _Geometry);
var _super = _createSuper12(Sphere2);
function Sphere2() {
_classCallCheck(this, Sphere2);
return _super.apply(this, arguments);
}
_createClass(Sphere2, [{
key: "onEntityCreated",
value: function onEntityCreated() {
var _this$config = this.config, _this$config$radius = _this$config.radius, radius = _this$config$radius === void 0 ? 0.5 : _this$config$radius, _this$config$latitude = _this$config.latitudeBands, latitudeBands = _this$config$latitude === void 0 ? 16 : _this$config$latitude, _this$config$longitud = _this$config.longitudeBands, longitudeBands = _this$config$longitud === void 0 ? 16 : _this$config$longitud;
var positions = [];
var normals = [];
var uvs = [];
var indices = [];
for (var lat = 0; lat <= latitudeBands; lat++) {
var theta = lat * Math.PI / latitudeBands;
var sinTheta = Math.sin(theta);
var cosTheta = Math.cos(theta);
for (var lon = 0; lon <= longitudeBands; lon++) {
var phi2 = lon * 2 * Math.PI / longitudeBands - Math.PI / 2;
var sinPhi = Math.sin(phi2);
var cosPhi = Math.cos(phi2);
var x6 = cosPhi * sinTheta;
var y5 = cosTheta;
var z3 = sinPhi * sinTheta;
var u3 = 1 - lon / longitudeBands;
var v3 = 1 - lat / latitudeBands;
positions.push(x6 * radius, y5 * radius, z3 * radius);
normals.push(x6, y5, z3);
uvs.push(u3, v3);
}
}
for (var _lat = 0; _lat < latitudeBands; ++_lat) {
for (var _lon = 0; _lon < longitudeBands; ++_lon) {
var first = _lat * (longitudeBands + 1) + _lon;
var second = first + longitudeBands + 1;
indices.push(first + 1, second, first);
indices.push(first + 1, second + 1, second);
}
}
var aabb = generateAABBFromVertices(positions);
var component2 = this.getComponent();
component2.indices = Uint32Array.from(indices);
component2.aabb = aabb;
component2.vertexCount = positions.length / 3;
component2.attributes = [{
dirty: true,
name: "position",
data: Float32Array.from(positions),
arrayStride: 4 * 3,
stepMode: "vertex",
attributes: [{
shaderLocation: 0,
offset: 0,
format: "float3"
}]
}, {
dirty: true,
name: "normal",
data: Float32Array.from(normals),
arrayStride: 4 * 3,
stepMode: "vertex",
attributes: [{
shaderLocation: 1,
offset: 0,
format: "float3"
}]
}, {
dirty: true,
name: "uv",
data: Float32Array.from(uvs),
arrayStride: 4 * 2,
stepMode: "vertex",
attributes: [{
shaderLocation: 2,
offset: 0,
format: "float2"
}]
}];
}
}]);
return Sphere2;
}(Geometry2)) || _class40);
// node_modules/@antv/g-webgpu/es/material/basic/index.js
var import_inversify27 = __toModule(require_inversify());
var _dec59;
var _dec216;
var _dec312;
var _class41;
var _class217;
var _descriptor20;
var _descriptor212;
var _temp20;
function _createSuper13(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct13();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived), result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _isNativeReflectConstruct13() {
if (typeof Reflect === "undefined" || !Reflect.construct)
return false;
if (Reflect.construct.sham)
return false;
if (typeof Proxy === "function")
return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function() {
}));
return true;
} catch (e4) {
return false;
}
}
var webglFragmentShaderGLSL = 'varying vec4 fragColor;\n\n#pragma include "uv.frag.declaration"\n#pragma include "map.frag.declaration"\n\nvoid main() {\n vec4 diffuseColor = fragColor;\n\n #pragma include "map.frag.main"\n\n gl_FragColor = diffuseColor;\n}';
var webglVertexShaderGLSL = 'attribute vec3 position;\nattribute vec3 normal;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\nuniform vec4 color;\n\nvarying vec4 fragColor;\n\n#pragma include "uv.vert.declaration"\n\nvoid main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n fragColor = color;\n\n #pragma include "uv.vert.main"\n}';
var webgpuFragmentShaderGLSL = "// layout(set = 0, binding = 1) uniform WireframeUniforms {\n// float lineWidth;\n// vec4 lineColor;\n// } wireframe;\n\nlayout(location = 0) in vec4 fragColor;\n// layout(location = 1) in vec3 v_Barycentric;\n\nlayout(location = 0) out vec4 outColor;\n\n// wireframe\n// float edgeFactor() {\n// vec3 d = fwidth(v_Barycentric);\n// vec3 a3 = smoothstep(vec3(0.0), d * wireframe.lineWidth, v_Barycentric);\n// return min(min(a3.x, a3.y), a3.z);\n// }\n\nvoid main() {\n // outColor = mix(fragColor, wireframe.lineColor, (1.0 - edgeFactor()));\n outColor = fragColor;\n}";
var webgpuVertexShaderGLSL = "layout(set = 0, binding = 0) uniform Uniforms {\n vec4 color;\n mat4 projectionMatrix;\n mat4 modelViewMatrix;\n} uniforms;\n\nlayout(location = 0) in vec3 position;\n// layout(location = 1) in vec3 barycentric;\n\nlayout(location = 0) out vec4 fragColor;\n// layout(location = 1) out vec3 v_Barycentric;\n\nvoid main() {\n gl_Position = uniforms.projectionMatrix * uniforms.modelViewMatrix * vec4(position, 1.0);\n fragColor = uniforms.color;\n // v_Barycentric = barycentric;\n}";
var Basic = (_dec59 = (0, import_inversify27.injectable)(), _dec216 = (0, import_inversify27.inject)(IDENTIFIER.RenderEngine), _dec312 = (0, import_inversify27.inject)(IDENTIFIER.ShaderModuleService), _dec59(_class41 = (_class217 = (_temp20 = /* @__PURE__ */ function(_Material) {
_inherits(Basic2, _Material);
var _super = _createSuper13(Basic2);
function Basic2() {
var _this;
_classCallCheck(this, Basic2);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_initializerDefineProperty(_this, "engine", _descriptor20, _assertThisInitialized(_this));
_initializerDefineProperty(_this, "shaderModuleService", _descriptor212, _assertThisInitialized(_this));
return _this;
}
_createClass(Basic2, [{
key: "onEntityCreated",
value: function onEntityCreated() {
var component2 = this.getComponent();
var vertexShaderGLSL = this.engine.supportWebGPU ? webgpuVertexShaderGLSL : webglVertexShaderGLSL;
var fragmentShaderGLSL = this.engine.supportWebGPU ? webgpuFragmentShaderGLSL : webglFragmentShaderGLSL;
this.shaderModuleService.registerModule("material-basic", {
vs: vertexShaderGLSL,
fs: fragmentShaderGLSL
});
var _this$shaderModuleSer = this.shaderModuleService.getModule("material-basic"), vs = _this$shaderModuleSer.vs, fs = _this$shaderModuleSer.fs, extractedUniforms = _this$shaderModuleSer.uniforms;
component2.vertexShaderGLSL = vs;
component2.fragmentShaderGLSL = fs;
component2.setUniform(extractedUniforms);
if (this.config.map) {
component2.setDefines({
USE_UV: 1,
USE_MAP: 1
});
component2.setUniform({
map: this.config.map,
uvTransform: mat3_exports.create()
});
}
}
}]);
return Basic2;
}(Material), _temp20), _descriptor20 = _applyDecoratedDescriptor(_class217.prototype, "engine", [_dec216], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor212 = _applyDecoratedDescriptor(_class217.prototype, "shaderModuleService", [_dec312], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class217)) || _class41);
// node_modules/@antv/g-webgpu/es/renderable/grid/index.js
var import_inversify28 = __toModule(require_inversify());
var _dec60;
var _dec217;
var _dec313;
var _dec410;
var _dec510;
var _dec65;
var _class42;
var _class218;
var _descriptor21;
var _descriptor213;
var _descriptor39;
var _temp21;
function _createSuper14(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct14();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived), result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _isNativeReflectConstruct14() {
if (typeof Reflect === "undefined" || !Reflect.construct)
return false;
if (Reflect.construct.sham)
return false;
if (typeof Proxy === "function")
return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function() {
}));
return true;
} catch (e4) {
return false;
}
}
var gridFrag = "// generate grid, borrow from clay.gl viewer\n// @see https://github.com/pissang/clay-viewer/blob/master/src/graphic/ground.glsl\n#extension GL_OES_standard_derivatives : enable\n\nvarying vec3 v_Position;\n// varying vec3 v_Normal;\n\nuniform float u_GridSize : 5;\nuniform float u_GridSize2 : .5;\nuniform vec4 u_GridColor : [0, 0, 0, 1];\nuniform vec4 u_GridColor2 : [0.3, 0.3, 0.3, 1];\nuniform bool u_GridEnabled : true;\n\n// uniform vec3 u_LightDirection;\n// uniform vec3 u_LightColor;\n// uniform vec3 u_Camera;\n\nvoid main() {\n // vec3 n = v_Normal;\n // vec3 l = normalize(u_LightDirection);\n // float NdotL = clamp(dot(n, l), 0.001, 1.0);\n\n gl_FragColor = vec4(1.);\n\n if (u_GridEnabled) {\n float wx = v_Position.x;\n float wz = v_Position.z;\n // float x0 = abs(fract(wx / u_GridSize - 0.5) - 0.5) / fwidth(wx) * u_GridSize / 2.0;\n // float z0 = abs(fract(wz / u_GridSize - 0.5) - 0.5) / fwidth(wz) * u_GridSize / 2.0;\n\n float x1 = abs(fract(wx / u_GridSize2 - 0.5) - 0.5) / fwidth(wx) * u_GridSize2;\n float z1 = abs(fract(wz / u_GridSize2 - 0.5) - 0.5) / fwidth(wz) * u_GridSize2;\n\n // float v0 = 1.0 - clamp(min(x0, z0), 0.0, 1.0);\n float v1 = 1.0 - clamp(min(x1, z1), 0.0, 1.0);\n // if (v0 > 0.1) {\n // gl_FragColor = mix(gl_FragColor, u_GridColor, v0);\n // }\n // else {\n gl_FragColor = mix(gl_FragColor, u_GridColor2, v1);\n // }\n }\n\n // float shadowFactor = calcShadow(u_ShadowMap, v_PositionFromLight, l, n);\n // vec3 diffuseColor = u_LightColor * NdotL * shadowFactor;\n\n // gl_FragColor.rgb *= diffuseColor;\n}";
var gridVert = "attribute vec3 a_Position;\n\nvarying vec3 v_Position;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\n\nvoid main() {\n v_Position = a_Position;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(a_Position, 1.);\n}";
var Grid = (_dec60 = (0, import_inversify28.injectable)(), _dec217 = (0, import_inversify28.inject)(IDENTIFIER.Systems), _dec313 = (0, import_inversify28.named)(IDENTIFIER.MaterialSystem), _dec410 = (0, import_inversify28.inject)(IDENTIFIER.Systems), _dec510 = (0, import_inversify28.named)(IDENTIFIER.GeometrySystem), _dec65 = (0, import_inversify28.inject)(IDENTIFIER.ShaderModuleService), _dec60(_class42 = (_class218 = (_temp21 = /* @__PURE__ */ function(_Renderable) {
_inherits(Grid5, _Renderable);
var _super = _createSuper14(Grid5);
function Grid5() {
var _this;
_classCallCheck(this, Grid5);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_initializerDefineProperty(_this, "materialSystem", _descriptor21, _assertThisInitialized(_this));
_initializerDefineProperty(_this, "geometrySystem", _descriptor213, _assertThisInitialized(_this));
_initializerDefineProperty(_this, "shaderModuleService", _descriptor39, _assertThisInitialized(_this));
return _this;
}
_createClass(Grid5, [{
key: "onAttributeChanged",
value: function onAttributeChanged(_ref2) {
var name = _ref2.name, data3 = _ref2.data;
var mesh = this.getMeshComponent();
if (mesh && mesh.material) {
if (name === "gridColor") {
mesh.material.setUniform("u_GridColor", data3);
mesh.material.setUniform("u_GridColor2", data3);
} else if (name === "gridSize") {
mesh.material.setUniform("u_GridSize", data3);
mesh.material.setUniform("u_GridSize2", data3);
}
}
}
}, {
key: "onEntityCreated",
value: function onEntityCreated() {
this.shaderModuleService.registerModule("grid", {
vs: gridVert,
fs: gridFrag
});
var _this$shaderModuleSer = this.shaderModuleService.getModule("grid"), vs = _this$shaderModuleSer.vs, fs = _this$shaderModuleSer.fs, extractedUniforms = _this$shaderModuleSer.uniforms;
var material = this.materialSystem.createShaderMaterial({
vertexShader: vs,
fragmentShader: fs
});
this.setMaterial(material);
var geometry35 = this.geometrySystem.createBufferGeometry({
vertexCount: 4
});
this.setGeometry(geometry35);
material.setCull({
enable: false,
face: gl.BACK
}).setDepth({
enable: true,
func: gl.LESS
});
material.setUniform(extractedUniforms);
this.setAttributes({
gridColor: this.config.gridColor,
gridSize: this.config.gridSize
});
geometry35.setIndex([0, 3, 2, 2, 1, 0]);
geometry35.setAttribute("a_Position", Float32Array.from([-4, -1, -4, 4, -1, -4, 4, -1, 4, -4, -1, 4]), {
arrayStride: 4 * 2,
stepMode: "vertex",
attributes: [{
shaderLocation: 0,
offset: 0,
format: "float2"
}]
});
}
}]);
return Grid5;
}(Renderable), _temp21), _descriptor21 = _applyDecoratedDescriptor(_class218.prototype, "materialSystem", [_dec217, _dec313], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor213 = _applyDecoratedDescriptor(_class218.prototype, "geometrySystem", [_dec410, _dec510], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor39 = _applyDecoratedDescriptor(_class218.prototype, "shaderModuleService", [_dec65], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class218)) || _class42);
// node_modules/@antv/g-webgpu/es/renderable/line/index.js
var import_inversify29 = __toModule(require_inversify());
// node_modules/@antv/g-webgpu/es/utils/polyline-normals.js
var import_gl_vec2 = __toModule(require_gl_vec2());
var import_polyline_miter_util = __toModule(require_polyline_miter_util());
function extrusions(positions, out, point2, normal2, scale12) {
addNext(out, normal2, -scale12);
addNext(out, normal2, scale12);
positions.push(point2);
positions.push(point2);
}
function addNext(out, normal2, length5) {
out.push([[normal2[0], normal2[1]], length5]);
}
function polyline_normals_default(points, closed, indexOffset) {
var lineA = [0, 0];
var lineB = [0, 0];
var tangent = [0, 0];
var miter = [0, 0];
var _lastFlip = -1;
var _started = false;
var _normal = null;
var tmp = (0, import_gl_vec2.create)();
var count2 = indexOffset || 0;
var miterLimit = 3;
var out = [];
var attrPos = [];
var attrIndex = [];
var attrCounters = [0, 0];
if (closed) {
points = points.slice();
points.push(points[0]);
}
var total = points.length;
for (var i4 = 1; i4 < total; i4++) {
var index2 = count2;
var last2 = points[i4 - 1];
var cur = points[i4];
var next = i4 < points.length - 1 ? points[i4 + 1] : null;
attrCounters.push(i4 / total, i4 / total);
(0, import_polyline_miter_util.direction)(lineA, cur, last2);
if (!_normal) {
_normal = [0, 0];
(0, import_polyline_miter_util.normal)(_normal, lineA);
}
if (!_started) {
_started = true;
extrusions(attrPos, out, last2, _normal, 1);
}
attrIndex.push([index2 + 0, index2 + 1, index2 + 2]);
if (!next) {
(0, import_polyline_miter_util.normal)(_normal, lineA);
extrusions(attrPos, out, cur, _normal, 1);
attrIndex.push(_lastFlip === 1 ? [index2, index2 + 2, index2 + 3] : [index2 + 2, index2 + 1, index2 + 3]);
count2 += 2;
} else {
(0, import_polyline_miter_util.direction)(lineB, next, cur);
var miterLen = (0, import_polyline_miter_util.computeMiter)(tangent, miter, lineA, lineB, 1);
var flip = (0, import_gl_vec2.dot)(tangent, _normal) < 0 ? -1 : 1;
var bevel = miterLen > miterLimit;
if (!isFinite(miterLen)) {
(0, import_polyline_miter_util.normal)(_normal, lineA);
extrusions(attrPos, out, cur, _normal, 1);
attrIndex.push(_lastFlip === 1 ? [index2, index2 + 2, index2 + 3] : [index2 + 2, index2 + 1, index2 + 3]);
count2 += 2;
_lastFlip = flip;
continue;
}
if (bevel) {
miterLen = miterLimit;
attrCounters.push(i4 / total);
addNext(out, _normal, -flip);
attrPos.push(cur);
addNext(out, miter, miterLen * flip);
attrPos.push(cur);
attrIndex.push(_lastFlip !== -flip ? [index2, index2 + 2, index2 + 3] : [index2 + 2, index2 + 1, index2 + 3]);
attrIndex.push([index2 + 2, index2 + 3, index2 + 4]);
(0, import_polyline_miter_util.normal)(tmp, lineB);
(0, import_gl_vec2.copy)(_normal, tmp);
addNext(out, _normal, -flip);
attrPos.push(cur);
count2 += 3;
} else {
extrusions(attrPos, out, cur, miter, miterLen);
attrIndex.push(_lastFlip === 1 ? [index2, index2 + 2, index2 + 3] : [index2 + 2, index2 + 1, index2 + 3]);
flip = -1;
(0, import_gl_vec2.copy)(_normal, miter);
count2 += 2;
}
_lastFlip = flip;
}
}
return {
normals: out,
attrIndex,
attrPos,
attrCounters
};
}
// node_modules/@antv/g-webgpu/es/renderable/line/index.js
var _dec61;
var _dec218;
var _dec314;
var _dec411;
var _dec511;
var _dec66;
var _class43;
var _class219;
var _descriptor30;
var _descriptor214;
var _descriptor310;
var _temp22;
function _createSuper15(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct15();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived), result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _isNativeReflectConstruct15() {
if (typeof Reflect === "undefined" || !Reflect.construct)
return false;
if (Reflect.construct.sham)
return false;
if (typeof Proxy === "function")
return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function() {
}));
return true;
} catch (e4) {
return false;
}
}
var lineFrag = "uniform float u_dash_array : 0.02;\nuniform float u_dash_offset : 0;\nuniform float u_dash_ratio : 0;\nuniform float u_thickness : 0.02;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_counters;\n\nvoid main() {\n float blur = 1. - smoothstep(0.98, 1., length(v_normal));\n\n gl_FragColor = v_color;\n gl_FragColor.a *= blur * ceil(mod(v_counters + u_dash_offset, u_dash_array) - (u_dash_array * u_dash_ratio));\n}";
var lineVert = "attribute vec2 a_pos;\nattribute vec4 a_color;\nattribute float a_line_miter;\nattribute vec2 a_line_normal;\nattribute float a_counters;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\nuniform float u_thickness : 0.02;\nuniform vec2 u_viewport;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_counters;\n\nvoid main() {\n v_color = a_color;\n v_counters = a_counters;\n\n vec3 normal = normalize(vec3(a_line_normal, 0.0));\n\n vec4 offset = vec4(normal * u_thickness / 2.0 * a_line_miter, 0.0);\n\n v_normal = vec2(normal * sign(a_line_miter));\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4(a_pos, 0.0, 1.0) + offset;\n}\n";
var Line8 = (_dec61 = (0, import_inversify29.injectable)(), _dec218 = (0, import_inversify29.inject)(IDENTIFIER.Systems), _dec314 = (0, import_inversify29.named)(IDENTIFIER.MaterialSystem), _dec411 = (0, import_inversify29.inject)(IDENTIFIER.Systems), _dec511 = (0, import_inversify29.named)(IDENTIFIER.GeometrySystem), _dec66 = (0, import_inversify29.inject)(IDENTIFIER.ShaderModuleService), _dec61(_class43 = (_class219 = (_temp22 = /* @__PURE__ */ function(_Renderable) {
_inherits(Line9, _Renderable);
var _super = _createSuper15(Line9);
function Line9() {
var _this;
_classCallCheck(this, Line9);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_initializerDefineProperty(_this, "materialSystem", _descriptor30, _assertThisInitialized(_this));
_initializerDefineProperty(_this, "geometrySystem", _descriptor214, _assertThisInitialized(_this));
_initializerDefineProperty(_this, "shaderModuleService", _descriptor310, _assertThisInitialized(_this));
_this.vertexCount = void 0;
return _this;
}
_createClass(Line9, [{
key: "onAttributeChanged",
value: function onAttributeChanged(_ref2) {
var name = _ref2.name, data3 = _ref2.data;
var mesh = this.getMeshComponent();
if (mesh && mesh.material) {
switch (name) {
case "dashArray":
mesh.material.setUniform("u_dash_array", data3);
break;
case "dashOffset":
mesh.material.setUniform("u_dash_offset", data3);
break;
case "dashRatio":
mesh.material.setUniform("u_dash_ratio", data3);
break;
case "thickness":
mesh.material.setUniform("u_thickness", data3);
break;
case "color":
var colors = new Array(this.vertexCount).fill(void 0).map(function() {
return data3;
}).reduce(function(prev, cur) {
return [].concat(_toConsumableArray(prev), _toConsumableArray(cur));
}, []);
mesh.geometry.setAttribute("a_color", Float32Array.from(colors), {
arrayStride: 4 * 4,
stepMode: "vertex",
attributes: [{
shaderLocation: 1,
offset: 0,
format: "float4"
}]
});
break;
}
}
}
}, {
key: "onEntityCreated",
value: function onEntityCreated() {
var _this2 = this;
this.shaderModuleService.registerModule("line", {
vs: lineVert,
fs: lineFrag
});
var _this$shaderModuleSer = this.shaderModuleService.getModule("line"), vs = _this$shaderModuleSer.vs, fs = _this$shaderModuleSer.fs, extractedUniforms = _this$shaderModuleSer.uniforms;
var material = this.materialSystem.createShaderMaterial({
vertexShader: vs,
fragmentShader: fs
});
var _getNormals = polyline_normals_default(this.config.points, false), normals = _getNormals.normals, attrIndex = _getNormals.attrIndex, attrPos = _getNormals.attrPos, attrCounters = _getNormals.attrCounters;
var vertexCount = attrPos.length;
this.vertexCount = vertexCount;
var geometry35 = this.geometrySystem.createBufferGeometry({
vertexCount
});
this.setMaterial(material);
this.setGeometry(geometry35);
material.setCull({
enable: false,
face: gl.BACK
}).setUniform(extractedUniforms);
this.setAttributes({
dashArray: this.config.dashArray,
dashOffset: this.config.dashOffset,
dashRatio: this.config.dashRatio,
thickness: this.config.thickness
});
var attrNormal = [];
var attrMiter = [];
normals.forEach(function(n3) {
var norm = n3[0];
var miter = n3[1];
attrNormal.push([norm[0], norm[1]]);
attrMiter.push(miter);
});
geometry35.setIndex(attrIndex.reduce(function(prev, cur) {
return [].concat(_toConsumableArray(prev), _toConsumableArray(cur));
}, []));
geometry35.setAttribute("a_pos", Float32Array.from(attrPos.reduce(function(prev, cur) {
return [].concat(_toConsumableArray(prev), _toConsumableArray(cur));
}, [])), {
arrayStride: 4 * 2,
stepMode: "vertex",
attributes: [{
shaderLocation: 0,
offset: 0,
format: "float2"
}]
});
var colors = new Array(vertexCount).fill(void 0).map(function() {
return _toConsumableArray(_this2.config.color);
}).reduce(function(prev, cur) {
return [].concat(_toConsumableArray(prev), _toConsumableArray(cur));
}, []);
geometry35.setAttribute("a_color", Float32Array.from(colors), {
arrayStride: 4 * 4,
stepMode: "vertex",
attributes: [{
shaderLocation: 1,
offset: 0,
format: "float4"
}]
});
geometry35.setAttribute("a_line_miter", Float32Array.from(attrMiter), {
arrayStride: 4 * 1,
stepMode: "vertex",
attributes: [{
shaderLocation: 2,
offset: 0,
format: "float"
}]
});
geometry35.setAttribute("a_line_normal", Float32Array.from(attrNormal.reduce(function(prev, cur) {
return [].concat(_toConsumableArray(prev), _toConsumableArray(cur));
}, [])), {
arrayStride: 4 * 2,
stepMode: "vertex",
attributes: [{
shaderLocation: 3,
offset: 0,
format: "float2"
}]
});
geometry35.setAttribute("a_counters", Float32Array.from(attrCounters), {
arrayStride: 4 * 1,
stepMode: "vertex",
attributes: [{
shaderLocation: 4,
offset: 0,
format: "float"
}]
});
}
}]);
return Line9;
}(Renderable), _temp22), _descriptor30 = _applyDecoratedDescriptor(_class219.prototype, "materialSystem", [_dec218, _dec314], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor214 = _applyDecoratedDescriptor(_class219.prototype, "geometrySystem", [_dec411, _dec511], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor310 = _applyDecoratedDescriptor(_class219.prototype, "shaderModuleService", [_dec66], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class219)) || _class43);
// node_modules/@antv/g-webgpu/es/renderable/point/index.js
var import_inversify30 = __toModule(require_inversify());
// node_modules/@antv/g-webgpu/es/utils/picking.js
function encodePickingColor(featureIdx) {
return [featureIdx + 1 & 255, featureIdx + 1 >> 8 & 255, featureIdx + 1 >> 8 >> 8 & 255];
}
// node_modules/@antv/g-webgpu/es/renderable/point/index.js
var _dec67;
var _dec219;
var _dec315;
var _dec412;
var _dec512;
var _dec68;
var _class44;
var _class220;
var _descriptor31;
var _descriptor215;
var _descriptor311;
var _temp23;
function ownKeys9(object, enumerableOnly) {
var keys2 = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys2.push.apply(keys2, symbols);
}
return keys2;
}
function _objectSpread9(target) {
for (var i4 = 1; i4 < arguments.length; i4++) {
var source = arguments[i4] != null ? arguments[i4] : {};
if (i4 % 2) {
ownKeys9(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys9(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _createSuper16(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct16();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived), result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _isNativeReflectConstruct16() {
if (typeof Reflect === "undefined" || !Reflect.construct)
return false;
if (Reflect.construct.sham)
return false;
if (typeof Proxy === "function")
return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function() {
}));
return true;
} catch (e4) {
return false;
}
}
var pointFrag = `uniform float u_blur : 0.05;
uniform float u_opacity : 0.7;
uniform float u_stroke_width : 0.01;
uniform vec4 u_stroke_color : [0, 0, 0, 0];
uniform float u_stroke_opacity : 1;
varying vec4 v_color;
varying vec4 v_data;
varying float v_radius;
#pragma include "sdf2d"
#pragma include "picking"
void main() {
int shape = int(floor(v_data.w + 0.5));
float antialiasblur = v_data.z;
float antialiased_blur = -max(u_blur, antialiasblur);
float r = v_radius / (v_radius + u_stroke_width);
float outer_df;
float inner_df;
// 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'
// if (shape == 0) {
outer_df = sdCircle(v_data.xy, 1.0);
inner_df = sdCircle(v_data.xy, r);
// } else if (shape == 1) {
// outer_df = sdEquilateralTriangle(1.1 * v_data.xy);
// inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);
// } else if (shape == 2) {
// outer_df = sdBox(v_data.xy, vec2(1.));
// inner_df = sdBox(v_data.xy, vec2(r));
// } else if (shape == 3) {
// outer_df = sdPentagon(v_data.xy, 0.8);
// inner_df = sdPentagon(v_data.xy, r * 0.8);
// } else if (shape == 4) {
// outer_df = sdHexagon(v_data.xy, 0.8);
// inner_df = sdHexagon(v_data.xy, r * 0.8);
// } else if (shape == 5) {
// outer_df = sdOctogon(v_data.xy, 1.0);
// inner_df = sdOctogon(v_data.xy, r);
// } else if (shape == 6) {
// outer_df = sdHexagram(v_data.xy, 0.52);
// inner_df = sdHexagram(v_data.xy, r * 0.52);
// } else if (shape == 7) {
// outer_df = sdRhombus(v_data.xy, vec2(1.0));
// inner_df = sdRhombus(v_data.xy, vec2(r));
// } else if (shape == 8) {
// outer_df = sdVesica(v_data.xy, 1.1, 0.8);
// inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);
// }
float opacity_t = smoothstep(0.0, antialiased_blur, outer_df);
float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep(
antialiased_blur,
0.0,
inner_df
);
vec4 strokeColor = u_stroke_color == vec4(0) ? v_color : u_stroke_color;
gl_FragColor = mix(vec4(v_color.rgb, v_color.a * u_opacity), strokeColor * u_stroke_opacity, color_t);
gl_FragColor.a = gl_FragColor.a * opacity_t;
gl_FragColor = filterColor(gl_FragColor);
}`;
var pointVert = 'attribute vec2 position;\nattribute vec4 color;\nattribute float shape;\nattribute vec2 offset;\nattribute float size;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\n\nuniform float u_stroke_width : 0.01;\nuniform float u_device_pixel_ratio;\nuniform vec2 u_viewport;\n\nvarying vec4 v_color;\nvarying vec4 v_data;\nvarying float v_radius;\n\n#pragma include "picking"\n\nvoid main() {\n v_color = color;\n v_radius = size;\n\n lowp float antialiasblur = 1.0 / u_device_pixel_ratio * (size + u_stroke_width);\n\n // construct point coords\n v_data = vec4(position, antialiasblur, shape);\n\n gl_Position = projectionMatrix * modelViewMatrix\n * vec4(position * size + offset, 0.0, 1.0);\n\n setPickingColor(a_PickingColor);\n}';
var pointShapes = ["circle", "triangle", "square", "pentagon", "hexagon", "octogon", "hexagram", "rhombus", "vesica"];
var Point2 = (_dec67 = (0, import_inversify30.injectable)(), _dec219 = (0, import_inversify30.inject)(IDENTIFIER.Systems), _dec315 = (0, import_inversify30.named)(IDENTIFIER.MaterialSystem), _dec412 = (0, import_inversify30.inject)(IDENTIFIER.Systems), _dec512 = (0, import_inversify30.named)(IDENTIFIER.GeometrySystem), _dec68 = (0, import_inversify30.inject)(IDENTIFIER.ShaderModuleService), _dec67(_class44 = (_class220 = (_temp23 = /* @__PURE__ */ function(_Renderable) {
_inherits(Point3, _Renderable);
var _super = _createSuper16(Point3);
function Point3() {
var _this;
_classCallCheck(this, Point3);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_initializerDefineProperty(_this, "materialSystem", _descriptor31, _assertThisInitialized(_this));
_initializerDefineProperty(_this, "geometrySystem", _descriptor215, _assertThisInitialized(_this));
_initializerDefineProperty(_this, "shaderModuleService", _descriptor311, _assertThisInitialized(_this));
return _this;
}
_createClass(Point3, [{
key: "onAttributeChanged",
value: function onAttributeChanged(_ref2) {
var name = _ref2.name, data3 = _ref2.data;
var mesh = this.getMeshComponent();
if (mesh && mesh.material) {
if (name === "strokeWidth") {
mesh.material.setUniform("u_stroke_width", data3);
} else if (name === "strokeColor") {
mesh.material.setUniform("u_stroke_color", data3);
} else if (name === "strokeOpacity") {
mesh.material.setUniform("u_stroke_opacity", data3);
} else if (name === "opacity") {
mesh.material.setUniform("u_opacity", data3);
} else if (name === "blur") {
mesh.material.setUniform("u_blur", data3);
}
}
}
}, {
key: "onEntityCreated",
value: function onEntityCreated() {
this.shaderModuleService.registerModule("grid", {
vs: pointVert,
fs: pointFrag
});
var _this$shaderModuleSer = this.shaderModuleService.getModule("grid"), vs = _this$shaderModuleSer.vs, fs = _this$shaderModuleSer.fs, extractedUniforms = _this$shaderModuleSer.uniforms;
var material = this.materialSystem.createShaderMaterial({
vertexShader: vs,
fragmentShader: fs,
cull: {
enable: false
},
depth: {
enable: false
},
blend: {
enable: true,
func: {
srcRGB: gl.SRC_ALPHA,
dstRGB: gl.ONE_MINUS_SRC_ALPHA,
srcAlpha: 1,
dstAlpha: 1
}
}
});
material.setUniform(_objectSpread9({
u_device_pixel_ratio: window.devicePixelRatio
}, extractedUniforms));
var attributes = this.buildAttributes();
var geometry35 = this.geometrySystem.createInstancedBufferGeometry({
maxInstancedCount: attributes.instancedOffsets.length / 2,
vertexCount: 6
});
geometry35.setIndex([0, 2, 1, 0, 3, 2]);
geometry35.setAttribute("position", Float32Array.from(attributes.positions), {
arrayStride: 4 * 2,
stepMode: "vertex",
attributes: [{
shaderLocation: 0,
offset: 0,
format: "float2"
}]
});
geometry35.setAttribute("offset", Float32Array.from(attributes.instancedOffsets), {
arrayStride: 4 * 2,
stepMode: "instance",
attributes: [{
shaderLocation: 1,
offset: 0,
format: "float2"
}]
});
geometry35.setAttribute("color", Float32Array.from(attributes.instancedColors), {
arrayStride: 4 * 4,
stepMode: "instance",
attributes: [{
shaderLocation: 2,
offset: 0,
format: "float4"
}]
});
geometry35.setAttribute("size", Float32Array.from(attributes.instancedSizes), {
arrayStride: 4,
stepMode: "instance",
attributes: [{
shaderLocation: 3,
offset: 0,
format: "float"
}]
});
geometry35.setAttribute("shape", Float32Array.from(attributes.instancedShapes), {
arrayStride: 4,
stepMode: "instance",
attributes: [{
shaderLocation: 4,
offset: 0,
format: "float"
}]
});
geometry35.setAttribute("a_PickingColor", Float32Array.from(attributes.instancedPickingColors), {
arrayStride: 4 * 3,
stepMode: "instance",
attributes: [{
shaderLocation: 6,
offset: 0,
format: "float3"
}]
});
this.setMaterial(material);
this.setGeometry(geometry35);
}
}, {
key: "buildAttribute",
value: function buildAttribute(config, attributes, index2) {
var _attributes$instanced, _attributes$instanced2, _attributes$instanced3, _attributes$instanced4;
(_attributes$instanced = attributes.instancedPickingColors).push.apply(_attributes$instanced, _toConsumableArray(encodePickingColor(config.id || index2)));
attributes.instancedShapes.push(pointShapes.indexOf(config.shape || "circle"));
(_attributes$instanced2 = attributes.instancedColors).push.apply(_attributes$instanced2, _toConsumableArray(config.color || [1, 0, 0, 1]));
(_attributes$instanced3 = attributes.instancedOffsets).push.apply(_attributes$instanced3, _toConsumableArray(config.position || [0, 0]));
(_attributes$instanced4 = attributes.instancedSizes).push.apply(_attributes$instanced4, _toConsumableArray(config.size || [0.2, 0.2]));
}
}, {
key: "buildAttributes",
value: function buildAttributes() {
var _this2 = this;
var attributes = {
positions: [1, 1, 1, -1, -1, -1, -1, 1],
instancedOffsets: [],
instancedColors: [],
instancedSizes: [],
instancedShapes: [],
instancedPickingColors: []
};
if (Array.isArray(this.config)) {
this.config.forEach(function(config, i4) {
_this2.buildAttribute(config, attributes, i4);
});
} else {
this.buildAttribute(this.config, attributes, 0);
}
return attributes;
}
}]);
return Point3;
}(Renderable), _temp23), _descriptor31 = _applyDecoratedDescriptor(_class220.prototype, "materialSystem", [_dec219, _dec315], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor215 = _applyDecoratedDescriptor(_class220.prototype, "geometrySystem", [_dec412, _dec512], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor311 = _applyDecoratedDescriptor(_class220.prototype, "shaderModuleService", [_dec68], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class220)) || _class44);
// node_modules/@antv/g-webgpu/es/Renderer.js
var import_regenerator18 = __toModule(require_regenerator());
var WebGPUConstants9 = __toModule(require_constants());
var import_inversify31 = __toModule(require_inversify());
var _dec69;
var _dec220;
var _dec316;
var _dec413;
var _class45;
var _class221;
var _descriptor40;
var _descriptor216;
var _descriptor312;
var _temp24;
function _createForOfIteratorHelper5(o3, allowArrayLike) {
var it;
if (typeof Symbol === "undefined" || o3[Symbol.iterator] == null) {
if (Array.isArray(o3) || (it = _unsupportedIterableToArray6(o3)) || allowArrayLike && o3 && typeof o3.length === "number") {
if (it)
o3 = it;
var i4 = 0;
var F3 = function F4() {
};
return { s: F3, n: function n3() {
if (i4 >= o3.length)
return { done: true };
return { done: false, value: o3[i4++] };
}, e: function e4(_e) {
throw _e;
}, f: F3 };
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var normalCompletion = true, didErr = false, err;
return { s: function s4() {
it = o3[Symbol.iterator]();
}, n: function n3() {
var step = it.next();
normalCompletion = step.done;
return step;
}, e: function e4(_e2) {
didErr = true;
err = _e2;
}, f: function f3() {
try {
if (!normalCompletion && it.return != null)
it.return();
} finally {
if (didErr)
throw err;
}
} };
}
function _unsupportedIterableToArray6(o3, minLen) {
if (!o3)
return;
if (typeof o3 === "string")
return _arrayLikeToArray6(o3, minLen);
var n3 = Object.prototype.toString.call(o3).slice(8, -1);
if (n3 === "Object" && o3.constructor)
n3 = o3.constructor.name;
if (n3 === "Map" || n3 === "Set")
return Array.from(o3);
if (n3 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n3))
return _arrayLikeToArray6(o3, minLen);
}
function _arrayLikeToArray6(arr, len5) {
if (len5 == null || len5 > arr.length)
len5 = arr.length;
for (var i4 = 0, arr2 = new Array(len5); i4 < len5; i4++) {
arr2[i4] = arr[i4];
}
return arr2;
}
var mapFragDeclaration = "#ifdef USE_MAP\n uniform sampler2D map;\n#endif";
var mapFragMain = "#ifdef USE_MAP\n vec4 texelColor = texture2D(map, vUv);\n // texelColor = mapTexelToLinear(texelColor);\n diffuseColor *= texelColor;\n#endif";
var uvFragDeclaration = "#if (defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ))\n varying vec2 vUv;\n#endif";
var uvVertDeclaration = "#ifdef USE_UV\n attribute vec2 uv;\n #ifdef UVS_VERTEX_ONLY\n vec2 vUv;\n #else\n varying vec2 vUv;\n #endif\n uniform mat3 uvTransform;\n#endif";
var uvVertMain = "#ifdef USE_UV\n vUv = (uvTransform * vec3(uv, 1)).xy;\n#endif";
var Renderer = (_dec69 = (0, import_inversify31.injectable)(), _dec220 = (0, import_inversify31.inject)(IDENTIFIER.RenderEngine), _dec316 = (0, import_inversify31.inject)(IDENTIFIER.ShaderModuleService), _dec413 = (0, import_inversify31.inject)(IDENTIFIER.ConfigService), _dec69(_class45 = (_class221 = (_temp24 = /* @__PURE__ */ function() {
function Renderer2() {
_classCallCheck(this, Renderer2);
this.container = void 0;
_initializerDefineProperty(this, "engine", _descriptor40, this);
_initializerDefineProperty(this, "shaderModule", _descriptor216, this);
_initializerDefineProperty(this, "configService", _descriptor312, this);
this.inited = false;
this.rendering = false;
this.pendings = [];
this.views = [];
this.size = void 0;
}
_createClass(Renderer2, [{
key: "init",
value: function() {
var _init = _asyncToGenerator(/* @__PURE__ */ import_regenerator18.default.mark(function _callee() {
var systems, config, _iterator, _step, system;
return import_regenerator18.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
this.shaderModule.registerBuiltinModules();
this.shaderModule.registerModule("uv.vert.declaration", {
vs: uvVertDeclaration
});
this.shaderModule.registerModule("uv.vert.main", {
vs: uvVertMain
});
this.shaderModule.registerModule("uv.frag.declaration", {
fs: uvFragDeclaration
});
this.shaderModule.registerModule("map.frag.declaration", {
fs: mapFragDeclaration
});
this.shaderModule.registerModule("map.frag.main", {
fs: mapFragMain
});
systems = this.container.getAll(IDENTIFIER.Systems);
config = this.configService.get();
if (!config.canvas) {
_context.next = 30;
break;
}
_context.next = 11;
return this.engine.init({
canvas: config.canvas,
swapChainFormat: WebGPUConstants9.TextureFormat.BGRA8Unorm,
antialiasing: false
});
case 11:
_iterator = _createForOfIteratorHelper5(systems);
_context.prev = 12;
_iterator.s();
case 14:
if ((_step = _iterator.n()).done) {
_context.next = 21;
break;
}
system = _step.value;
if (!system.initialize) {
_context.next = 19;
break;
}
_context.next = 19;
return system.initialize();
case 19:
_context.next = 14;
break;
case 21:
_context.next = 26;
break;
case 23:
_context.prev = 23;
_context.t0 = _context["catch"](12);
_iterator.e(_context.t0);
case 26:
_context.prev = 26;
_iterator.f();
return _context.finish(26);
case 29:
this.inited = true;
case 30:
case "end":
return _context.stop();
}
}
}, _callee, this, [[12, 23, 26, 29]]);
}));
function init() {
return _init.apply(this, arguments);
}
return init;
}()
}, {
key: "render",
value: function() {
var _render = _asyncToGenerator(/* @__PURE__ */ import_regenerator18.default.mark(function _callee2() {
var systems, _len, views, _key, _iterator2, _step2, system, _args2 = arguments;
return import_regenerator18.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!(!this.inited || this.rendering)) {
_context2.next = 2;
break;
}
return _context2.abrupt("return");
case 2:
if (this.pendings.length) {
this.pendings.forEach(function(pending) {
pending();
});
}
this.rendering = true;
this.engine.beginFrame();
systems = this.container.getAll(IDENTIFIER.Systems);
for (_len = _args2.length, views = new Array(_len), _key = 0; _key < _len; _key++) {
views[_key] = _args2[_key];
}
_iterator2 = _createForOfIteratorHelper5(systems);
_context2.prev = 8;
_iterator2.s();
case 10:
if ((_step2 = _iterator2.n()).done) {
_context2.next = 17;
break;
}
system = _step2.value;
if (!system.execute) {
_context2.next = 15;
break;
}
_context2.next = 15;
return system.execute(views);
case 15:
_context2.next = 10;
break;
case 17:
_context2.next = 22;
break;
case 19:
_context2.prev = 19;
_context2.t0 = _context2["catch"](8);
_iterator2.e(_context2.t0);
case 22:
_context2.prev = 22;
_iterator2.f();
return _context2.finish(22);
case 25:
this.engine.endFrame();
this.rendering = false;
case 27:
case "end":
return _context2.stop();
}
}
}, _callee2, this, [[8, 19, 22, 25]]);
}));
function render() {
return _render.apply(this, arguments);
}
return render;
}()
}, {
key: "clear",
value: function clear(options) {
var _this = this;
if (this.inited) {
this.engine.clear(options);
} else {
this.pendings.unshift(function() {
_this.engine.clear(options);
_this.pendings.shift();
});
}
return this;
}
}, {
key: "setSize",
value: function setSize(_ref2) {
var width2 = _ref2.width, height = _ref2.height;
var canvas = this.engine.getCanvas();
this.size = {
width: width2,
height
};
canvas.width = width2;
canvas.height = height;
return this;
}
}, {
key: "getSize",
value: function getSize5() {
return this.size;
}
}]);
return Renderer2;
}(), _temp24), _descriptor40 = _applyDecoratedDescriptor(_class221.prototype, "engine", [_dec220], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor216 = _applyDecoratedDescriptor(_class221.prototype, "shaderModule", [_dec316], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor312 = _applyDecoratedDescriptor(_class221.prototype, "configService", [_dec413], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class221)) || _class45);
// node_modules/@antv/g-webgpu/es/Scene.js
var import_inversify32 = __toModule(require_inversify());
var _dec70;
var _class46;
var _temp25;
var Scene = (_dec70 = (0, import_inversify32.injectable)(), _dec70(_class46 = (_temp25 = /* @__PURE__ */ function() {
function Scene2() {
_classCallCheck(this, Scene2);
this.entities = [];
}
_createClass(Scene2, [{
key: "getEntities",
value: function getEntities() {
return this.entities;
}
}, {
key: "addRenderable",
value: function addRenderable(renderable) {
this.addEntity(renderable.getEntity());
return this;
}
}, {
key: "removeRenderable",
value: function removeRenderable(renderable) {
this.removeEntity(renderable.getEntity());
return this;
}
}, {
key: "addLight",
value: function addLight() {
}
}, {
key: "addEntity",
value: function addEntity(entity) {
if (this.entities.indexOf(entity) === -1) {
this.entities.push(entity);
}
return this;
}
}, {
key: "removeEntity",
value: function removeEntity(entity) {
var index2 = this.entities.indexOf(entity);
this.entities.splice(index2, 1);
return this;
}
}]);
return Scene2;
}(), _temp25)) || _class46);
// node_modules/@antv/g-webgpu/es/texture/Cache.js
var import_inversify33 = __toModule(require_inversify());
var _dec71;
var _class47;
var _temp26;
var TextureCache = (_dec71 = (0, import_inversify33.injectable)(), _dec71(_class47 = (_temp26 = /* @__PURE__ */ function() {
function TextureCache2() {
_classCallCheck(this, TextureCache2);
this.cache = {};
}
_createClass(TextureCache2, [{
key: "get",
value: function get3(name) {
return this.cache[name];
}
}, {
key: "set",
value: function set10(name, texture) {
this.cache[name] = texture;
}
}]);
return TextureCache2;
}(), _temp26)) || _class47);
// node_modules/@antv/g-webgpu/es/texture/Texture2D.js
var import_regenerator19 = __toModule(require_regenerator());
var import_inversify34 = __toModule(require_inversify());
var _dec73;
var _dec221;
var _dec317;
var _class48;
var _class222;
var _descriptor41;
var _descriptor217;
var _temp27;
function ownKeys10(object, enumerableOnly) {
var keys2 = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys2.push.apply(keys2, symbols);
}
return keys2;
}
function _objectSpread10(target) {
for (var i4 = 1; i4 < arguments.length; i4++) {
var source = arguments[i4] != null ? arguments[i4] : {};
if (i4 % 2) {
ownKeys10(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys10(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
var Texture2D = (_dec73 = (0, import_inversify34.injectable)(), _dec221 = (0, import_inversify34.inject)(TextureCache), _dec317 = (0, import_inversify34.inject)(IDENTIFIER.RenderEngine), _dec73(_class48 = (_class222 = (_temp27 = /* @__PURE__ */ function() {
function Texture2D2() {
_classCallCheck(this, Texture2D2);
_initializerDefineProperty(this, "textureCache", _descriptor41, this);
_initializerDefineProperty(this, "engine", _descriptor217, this);
this.config = void 0;
this.loaded = false;
this.texture = void 0;
}
_createClass(Texture2D2, [{
key: "setConfig",
value: function setConfig(config) {
this.config = config;
}
}, {
key: "isLoaded",
value: function isLoaded() {
return this.loaded;
}
}, {
key: "load",
value: function() {
var _load = _asyncToGenerator(/* @__PURE__ */ import_regenerator19.default.mark(function _callee() {
var _this = this;
return import_regenerator19.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!this.config.url) {
_context.next = 4;
break;
}
return _context.abrupt("return", new Promise(function(resolve, reject) {
var existed = _this.textureCache.get(_this.config.url);
if (existed) {
resolve(existed);
} else {
var image = new Image();
image.crossOrigin = "Anonymous";
image.src = _this.config.url;
image.onload = function() {
var texture = _this.engine.createTexture2D(_objectSpread10(_objectSpread10({}, _this.config), {}, {
data: image,
width: image.width,
height: image.height,
flipY: true
}));
_this.textureCache.set(_this.config.url, texture);
_this.texture = texture;
_this.loaded = true;
resolve(texture);
};
image.onerror = function() {
reject();
};
}
}));
case 4:
this.loaded = true;
this.texture = this.engine.createTexture2D(this.config);
return _context.abrupt("return", this.texture);
case 7:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
function load2() {
return _load.apply(this, arguments);
}
return load2;
}()
}]);
return Texture2D2;
}(), _temp27), _descriptor41 = _applyDecoratedDescriptor(_class222.prototype, "textureCache", [_dec221], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor217 = _applyDecoratedDescriptor(_class222.prototype, "engine", [_dec317], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class222)) || _class48);
// node_modules/@antv/g-webgpu/es/View.js
var import_inversify35 = __toModule(require_inversify());
var _dec74;
var _dec222;
var _dec318;
var _class49;
var _class223;
var _descriptor47;
var _temp28;
var View2 = (_dec74 = (0, import_inversify35.injectable)(), _dec222 = (0, import_inversify35.inject)(IDENTIFIER.Systems), _dec318 = (0, import_inversify35.named)(IDENTIFIER.RendererSystem), _dec74(_class49 = (_class223 = (_temp28 = /* @__PURE__ */ function() {
function View3() {
_classCallCheck(this, View3);
_initializerDefineProperty(this, "rendererSystem", _descriptor47, this);
this.camera = void 0;
this.scene = void 0;
this.viewport = {
x: 0,
y: 0,
width: 0,
height: 0
};
this.clearColor = [1, 1, 1, 1];
}
_createClass(View3, [{
key: "getCamera",
value: function getCamera() {
return this.camera;
}
}, {
key: "getScene",
value: function getScene() {
return this.scene;
}
}, {
key: "getViewport",
value: function getViewport() {
return this.viewport;
}
}, {
key: "getClearColor",
value: function getClearColor() {
return this.clearColor;
}
}, {
key: "setCamera",
value: function setCamera(camera) {
this.camera = camera;
return this;
}
}, {
key: "setScene",
value: function setScene(scene) {
this.scene = scene;
return this;
}
}, {
key: "setViewport",
value: function setViewport(viewport) {
this.viewport = viewport;
return this;
}
}, {
key: "setClearColor",
value: function setClearColor(clearColor) {
this.clearColor = clearColor;
return this;
}
}, {
key: "pick",
value: function pick2(position2) {
return this.rendererSystem.pick(position2, this);
}
}]);
return View3;
}(), _temp28), _descriptor47 = _applyDecoratedDescriptor(_class223.prototype, "rendererSystem", [_dec222, _dec318], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class223)) || _class49);
// node_modules/@antv/g-webgpu/es/World.js
var _dec75;
var _dec223;
var _class50;
var _class224;
var _descriptor48;
var _temp29;
function ownKeys11(object, enumerableOnly) {
var keys2 = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys2.push.apply(keys2, symbols);
}
return keys2;
}
function _objectSpread11(target) {
for (var i4 = 1; i4 < arguments.length; i4++) {
var source = arguments[i4] != null ? arguments[i4] : {};
if (i4 % 2) {
ownKeys11(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys11(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
var World = (_dec75 = (0, import_inversify36.injectable)(), _dec223 = (0, import_inversify36.inject)(IDENTIFIER.ConfigService), _dec75(_class50 = (_class224 = (_temp29 = /* @__PURE__ */ function() {
function World2() {
_classCallCheck(this, World2);
_initializerDefineProperty(this, "configService", _descriptor48, this);
this.container = void 0;
}
_createClass(World2, [{
key: "getEngine",
value: function() {
var _getEngine = _asyncToGenerator(/* @__PURE__ */ import_regenerator20.default.mark(function _callee() {
var engine, _this$configService$g, canvas, engineOptions;
return import_regenerator20.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
engine = this.container.get(IDENTIFIER.RenderEngine);
_this$configService$g = this.configService.get(), canvas = _this$configService$g.canvas, engineOptions = _this$configService$g.engineOptions;
_context.next = 4;
return engine.init(_objectSpread11({
canvas: canvas || createCanvas(),
swapChainFormat: WebGPUConstants10.TextureFormat.BGRA8Unorm,
antialiasing: false
}, engineOptions));
case 4:
return _context.abrupt("return", engine);
case 5:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
function getEngine2() {
return _getEngine.apply(this, arguments);
}
return getEngine2;
}()
}, {
key: "getTransformComponent",
value: function getTransformComponent(entity) {
var manager = this.container.get(IDENTIFIER.TransformComponentManager);
return manager.getComponentByEntity(entity);
}
}, {
key: "getMeshComponent",
value: function getMeshComponent(entity) {
var manager = this.container.get(IDENTIFIER.MeshComponentManager);
return manager.getComponentByEntity(entity);
}
}, {
key: "setConfig",
value: function setConfig(config) {
this.configService.set(config);
}
}, {
key: "setContainer",
value: function setContainer(container2) {
this.container = container2;
}
}, {
key: "getContainer",
value: function getContainer() {
return this.container;
}
}, {
key: "createEntity",
value: function createEntity2() {
return createEntity();
}
}, {
key: "createScene",
value: function createScene() {
return this.container.get(Scene);
}
}, {
key: "createCamera",
value: function createCamera() {
return this.container.get(Camera);
}
}, {
key: "createView",
value: function createView() {
return this.container.get(View2);
}
}, {
key: "createRenderable",
value: function createRenderable(type2, config) {
var renderable = type2 ? this.container.getNamed(IDENTIFIER.Renderable, type2) : this.container.get(Renderable);
var entity = createEntity();
renderable.setConfig(config || {});
renderable.setEntity(entity);
return renderable;
}
}, {
key: "createGeometry",
value: function createGeometry(type2, config) {
var geometry35 = this.container.getNamed(IDENTIFIER.Geometry, type2);
var entity = createEntity();
geometry35.setConfig(config || {});
geometry35.setEntity(entity);
return geometry35.getComponent();
}
}, {
key: "createMaterial",
value: function createMaterial(type2, config) {
var material = this.container.getNamed(IDENTIFIER.Material, type2);
var entity = createEntity();
material.setConfig(config || {});
material.setEntity(entity, type2);
return material.getComponent();
}
}, {
key: "createTexture2D",
value: function createTexture2D(config) {
var texture = this.container.get(Texture2D);
texture.setConfig(config);
return texture;
}
}, {
key: "createBufferGeometry",
value: function createBufferGeometry(params) {
var geometrySystem = this.container.getNamed(IDENTIFIER.Systems, IDENTIFIER.GeometrySystem);
return geometrySystem.createBufferGeometry(params);
}
}, {
key: "createInstancedBufferGeometry",
value: function createInstancedBufferGeometry(params) {
var geometrySystem = this.container.getNamed(IDENTIFIER.Systems, IDENTIFIER.GeometrySystem);
return geometrySystem.createInstancedBufferGeometry(params);
}
}, {
key: "createShaderMaterial",
value: function createShaderMaterial(params) {
var materialSystem = this.container.getNamed(IDENTIFIER.Systems, IDENTIFIER.MaterialSystem);
return materialSystem.createShaderMaterial(params);
}
}, {
key: "createKernel",
value: function createKernel(precompiledBundle) {
var kernel = this.container.get(Kernel);
if (typeof precompiledBundle === "string") {
kernel.setBundle(JSON.parse(precompiledBundle));
} else {
kernel.setBundle(precompiledBundle);
}
kernel.init();
return kernel;
}
}, {
key: "createRenderer",
value: function createRenderer() {
var renderer = this.container.get(Renderer);
renderer.container = this.container;
renderer.init();
return renderer;
}
}, {
key: "destroy",
value: function destroy() {
var systems = this.container.getAll(IDENTIFIER.Systems);
systems.forEach(function(system) {
if (system.tearDown) {
system.tearDown();
}
});
var engine = this.container.get(IDENTIFIER.RenderEngine);
engine.destroy();
var interactor = this.container.get(IDENTIFIER.InteractorService);
interactor.destroy();
}
}], [{
key: "create",
value: function create8() {
var config = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
var worldContainer = createWorldContainer();
var engineClazz = !navigator.gpu ? WebGLEngine : WebGPUEngine;
if (!worldContainer.isBound(IDENTIFIER.RenderEngine)) {
worldContainer.bind(IDENTIFIER.RenderEngine).to(engineClazz).inSingletonScope();
}
worldContainer.bind(Renderer).toSelf();
worldContainer.bind(Kernel).toSelf();
worldContainer.bind(Renderable).toSelf();
worldContainer.bind(View2).toSelf();
worldContainer.bind(Camera).toSelf();
worldContainer.bind(Scene).toSelf();
worldContainer.bind(World2).toSelf();
worldContainer.bind(TextureCache).toSelf();
worldContainer.bind(Texture2D).toSelf();
worldContainer.bind(IDENTIFIER.Geometry).to(Box2).whenTargetNamed(Geometry2.BOX);
worldContainer.bind(IDENTIFIER.Geometry).to(Sphere).whenTargetNamed(Geometry2.SPHERE);
worldContainer.bind(IDENTIFIER.Geometry).to(Plane2).whenTargetNamed(Geometry2.PLANE);
worldContainer.bind(IDENTIFIER.Geometry).to(Merged).whenTargetNamed(Geometry2.MERGED);
worldContainer.bind(IDENTIFIER.Material).to(Basic).whenTargetNamed(Material.BASIC);
worldContainer.bind(IDENTIFIER.Renderable).to(Point2).whenTargetNamed(Renderable.POINT);
worldContainer.bind(IDENTIFIER.Renderable).to(Line8).whenTargetNamed(Renderable.LINE);
worldContainer.bind(IDENTIFIER.Renderable).to(Grid).whenTargetNamed(Renderable.GRID);
var world = worldContainer.get(World2);
world.setContainer(worldContainer);
world.setConfig(config);
return world;
}
}]);
return World2;
}(), _temp29), _descriptor48 = _applyDecoratedDescriptor(_class224.prototype, "configService", [_dec223], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _class224)) || _class50);
// node_modules/@antv/layout/es/util/gpu.js
var proccessToFunc2 = (value2, defaultV) => {
let func;
if (!value2) {
func = () => {
return defaultV || 1;
};
} else if (isNumber3(value2)) {
func = () => {
return value2;
};
} else {
func = value2;
}
return func;
};
var buildTextureData = (nodes, edges) => {
const dataArray = [];
const nodeDict = [];
const mapIdPos = {};
let i4 = 0;
for (i4 = 0; i4 < nodes.length; i4++) {
const n3 = nodes[i4];
mapIdPos[n3.id] = i4;
dataArray.push(n3.x);
dataArray.push(n3.y);
dataArray.push(0);
dataArray.push(0);
nodeDict.push([]);
}
for (i4 = 0; i4 < edges.length; i4++) {
const e4 = edges[i4];
const source = getEdgeTerminal(e4, "source");
const target = getEdgeTerminal(e4, "target");
nodeDict[mapIdPos[source]].push(mapIdPos[target]);
nodeDict[mapIdPos[target]].push(mapIdPos[source]);
}
let maxEdgePerVetex = 0;
for (i4 = 0; i4 < nodes.length; i4++) {
const offset = dataArray.length;
const dests = nodeDict[i4];
const len5 = dests.length;
dataArray[i4 * 4 + 2] = offset;
dataArray[i4 * 4 + 3] = dests.length;
maxEdgePerVetex = Math.max(maxEdgePerVetex, dests.length);
for (let j4 = 0; j4 < len5; ++j4) {
const dest = dests[j4];
dataArray.push(+dest);
}
}
while (dataArray.length % 4 !== 0) {
dataArray.push(0);
}
return {
maxEdgePerVetex,
array: new Float32Array(dataArray)
};
};
var buildTextureDataWithTwoEdgeAttr = (nodes, edges, attrs1, attrs2) => {
const dataArray = [];
const nodeDict = [];
const mapIdPos = {};
let i4 = 0;
for (i4 = 0; i4 < nodes.length; i4++) {
const n3 = nodes[i4];
mapIdPos[n3.id] = i4;
dataArray.push(n3.x);
dataArray.push(n3.y);
dataArray.push(0);
dataArray.push(0);
nodeDict.push([]);
}
for (i4 = 0; i4 < edges.length; i4++) {
const e4 = edges[i4];
const source = getEdgeTerminal(e4, "source");
const target = getEdgeTerminal(e4, "target");
nodeDict[mapIdPos[source]].push(mapIdPos[target]);
nodeDict[mapIdPos[source]].push(attrs1(e4));
nodeDict[mapIdPos[source]].push(attrs2(e4));
nodeDict[mapIdPos[source]].push(0);
nodeDict[mapIdPos[target]].push(mapIdPos[source]);
nodeDict[mapIdPos[target]].push(attrs1(e4));
nodeDict[mapIdPos[target]].push(attrs2(e4));
nodeDict[mapIdPos[target]].push(0);
}
let maxEdgePerVetex = 0;
for (i4 = 0; i4 < nodes.length; i4++) {
const offset = dataArray.length;
const dests = nodeDict[i4];
const len5 = dests.length;
dataArray[i4 * 4 + 2] = offset + 1048576 * len5 / 4;
dataArray[i4 * 4 + 3] = 0;
maxEdgePerVetex = Math.max(maxEdgePerVetex, len5 / 4);
for (let j4 = 0; j4 < len5; ++j4) {
const dest = dests[j4];
dataArray.push(+dest);
}
}
while (dataArray.length % 4 !== 0) {
dataArray.push(0);
}
return {
maxEdgePerVetex,
array: new Float32Array(dataArray)
};
};
var attributesToTextureData = (attributeNames, items) => {
const dataArray = [];
const attributeNum = attributeNames.length;
const attributteStringMap = {};
items.forEach((item) => {
attributeNames.forEach((name, i4) => {
if (attributteStringMap[item[name]] === void 0) {
attributteStringMap[item[name]] = Object.keys(attributteStringMap).length;
}
dataArray.push(attributteStringMap[item[name]]);
if (i4 === attributeNum - 1) {
while (dataArray.length % 4 !== 0) {
dataArray.push(0);
}
}
});
});
return {
array: new Float32Array(dataArray),
count: Object.keys(attributteStringMap).length
};
};
var arrayToTextureData = (valueArrays) => {
const dataArray = [];
const attributeNum = valueArrays.length;
const itemNum = valueArrays[0].length;
for (let j4 = 0; j4 < itemNum; j4++) {
valueArrays.forEach((valueArray, i4) => {
dataArray.push(valueArray[j4]);
if (i4 === attributeNum - 1) {
while (dataArray.length % 4 !== 0) {
dataArray.push(0);
}
}
});
}
return new Float32Array(dataArray);
};
// node_modules/@antv/layout/es/layout/gpu/fruchtermanShader.js
var fruchtermanBundle = `{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4 = vec4(0.0);\\n\\n[[builtin global_invocation_id]] var globalInvocationID : vec3;\\n# [[builtin work_group_size]] var workGroupSize : vec3;\\n# [[builtin work_group_id]] var workGroupID : vec3;\\n[[builtin local_invocation_id]] var localInvocationID : vec3;\\n# [[builtin num_work_groups]] var numWorkGroups : vec3;\\n[[builtin local_invocation_idx]] var localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n [[offset 0]] u_K : f32;\\n [[offset 4]] u_K2 : f32;\\n [[offset 8]] u_Center : vec2;\\n [[offset 16]] u_Gravity : f32;\\n [[offset 20]] u_ClusterGravity : f32;\\n [[offset 24]] u_Speed : f32;\\n [[offset 28]] u_MaxDisplace : f32;\\n [[offset 32]] u_Clustering : f32;\\n};\\n[[binding 0, set 0]] var gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array>;\\n};\\n[[binding 1, set 0]] var gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_AttributeArray : [[stride 16]] array>;\\n};\\n[[binding 2, set 0]] var gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n [[offset 0]] u_ClusterCenters : [[stride 16]] array>;\\n};\\n[[binding 3, set 0]] var gWebGPUBuffer2 : GWebGPUBuffer2;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn calcRepulsive(i : i32, currentNode : vec4) -> vec2 {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {if (i != j) {var nextNode : vec4 = gWebGPUBuffer0.u_Data[j];\\nvar xDist : f32 = currentNode.x - nextNode.x;\\nvar yDist : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nvar param : f32 = gWebGPUUniformParams.u_K2 / dist;\\nif (dist > 0.0) {dx = dx + param * xDist;\\ndy = dy + param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {var sign : f32 = select(1.0, -1.0, i < j);\\ndx = dx + param * std::sign;\\ndy = dy + param * std::sign;}}}}\\nreturn vec2(dx, dy);}\\nfn calcGravity(currentNode : vec4, nodeAttributes : vec4) -> vec2 {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nvar vx : f32 = currentNode.x - gWebGPUUniformParams.u_Center.x;\\nvar vy : f32 = currentNode.y - gWebGPUUniformParams.u_Center.y;\\nvar gf : f32 = (0.01 * gWebGPUUniformParams.u_K) * gWebGPUUniformParams.u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (gWebGPUUniformParams.u_Clustering == 1.0) {var clusterIdx : i32 = i32(nodeAttributes.x);\\nvar center : vec4 = gWebGPUBuffer2.u_ClusterCenters[clusterIdx];\\nvar cvx : f32 = currentNode.x - center.x;\\nvar cvy : f32 = currentNode.y - center.y;\\nvar dist : f32 = std::sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nvar parma : f32 = (gWebGPUUniformParams.u_K * gWebGPUUniformParams.u_ClusterGravity) / dist;\\ndx = dx + parma * cvx;\\ndy = dy + parma * cvy;}\\nreturn vec2(dx, dy);}\\nfn calcAttractive(i : i32, currentNode : vec4) -> vec2 {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nvar arr_offset : i32 = i32(std::floor(currentNode.z + 0.5));\\nvar length : i32 = i32(std::floor(currentNode.w + 0.5));\\nvar node_buffer : vec4;\\nfor (var p : i32 = 0; p < __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX; p = p + 1) {if (p >= length) {break;}\\nvar arr_idx : i32 = arr_offset + i32(p);\\nvar buf_offset : i32 = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[i32(arr_idx / 4)];}\\nvar float_j : f32 = select(node_buffer.x, select(node_buffer.y, select(node_buffer.z, node_buffer.w, buf_offset == 2), buf_offset == 1), buf_offset == 0);\\nvar nextNode : vec4 = gWebGPUBuffer0.u_Data[i32(float_j)];\\nvar xDist : f32 = currentNode.x - nextNode.x;\\nvar yDist : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = std::sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nvar attractiveF : f32 = dist / gWebGPUUniformParams.u_K;\\nif (dist > 0.0) {dx = dx - xDist * attractiveF;\\ndy = dy - yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {var sign : f32 = select(1.0, -1.0, i < i32(float_j));\\ndx = dx - std::sign * attractiveF;\\ndy = dy - std::sign * attractiveF;}}}\\nreturn vec2(dx, dy);}\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar currentNode : vec4 = gWebGPUBuffer0.u_Data[i];\\nvar dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nif (i >= __DefineValuePlaceholder__VERTEX_COUNT) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvar nodeAttributes : vec4 = gWebGPUBuffer1.u_AttributeArray[i];\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w);\\nreturn ;}\\nvar repulsive : vec2 = calcRepulsive(i, currentNode);\\ndx = dx + repulsive.x;\\ndy = dy + repulsive.y;\\nvar attractive : vec2 = calcAttractive(i, currentNode);\\ndx = dx + attractive.x;\\ndy = dy + attractive.y;\\nvar gravity : vec2 = calcGravity(currentNode, nodeAttributes);\\ndx = dx - gravity.x;\\ndy = dy - gravity.y;\\ndx = dx * gWebGPUUniformParams.u_Speed;\\ndy = dy * gWebGPUUniformParams.u_Speed;\\nvar distLength : f32 = std::sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {var limitedDist : f32 = std::min(gWebGPUUniformParams.u_MaxDisplace * gWebGPUUniformParams.u_Speed, distLength);\\ngWebGPUBuffer0.u_Data[i] = vec4(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w);}\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n float u_K;\\n float u_K2;\\n vec2 u_Center;\\n float u_Gravity;\\n float u_ClusterGravity;\\n float u_Speed;\\n float u_MaxDisplace;\\n float u_Clustering;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer readonly GWebGPUBuffer1 {\\n vec4 u_AttributeArray[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 3) buffer readonly GWebGPUBuffer2 {\\n vec4 u_ClusterCenters[];\\n} gWebGPUBuffer2;\\n\\n\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nvec2 calcRepulsive(int i, vec4 currentNode) {float dx = 0.0;\\nfloat dy = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = gWebGPUBuffer0.u_Data[j];\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat param = gWebGPUUniformParams.u_K2 / dist;\\nif (dist > 0.0) {dx += param * xDist;\\ndy += param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < j) ? (1.0) : (-1.0);\\ndx += param * sign;\\ndy += param * sign;}}}}\\nreturn vec2(dx, dy);}\\nvec2 calcGravity(vec4 currentNode, vec4 nodeAttributes) {float dx = 0.0;\\nfloat dy = 0.0;\\nfloat vx = currentNode.x - gWebGPUUniformParams.u_Center.x;\\nfloat vy = currentNode.y - gWebGPUUniformParams.u_Center.y;\\nfloat gf = (0.01 * gWebGPUUniformParams.u_K) * gWebGPUUniformParams.u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (gWebGPUUniformParams.u_Clustering == 1.0) {int clusterIdx = int(nodeAttributes.x);\\nvec4 center = gWebGPUBuffer2.u_ClusterCenters[clusterIdx];\\nfloat cvx = currentNode.x - center.x;\\nfloat cvy = currentNode.y - center.y;\\nfloat dist = sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nfloat parma = (gWebGPUUniformParams.u_K * gWebGPUUniformParams.u_ClusterGravity) / dist;\\ndx += parma * cvx;\\ndy += parma * cvy;}\\nreturn vec2(dx, dy);}\\nvec2 calcAttractive(int i, vec4 currentNode) {float dx = 0.0;\\nfloat dy = 0.0;\\nint arr_offset = int(floor(currentNode.z + 0.5));\\nint length = int(floor(currentNode.w + 0.5));\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + int(p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[int(arr_idx / 4)];}\\nfloat float_j = (buf_offset == 0) ? (node_buffer.x) : ((buf_offset == 1) ? (node_buffer.y) : ((buf_offset == 2) ? (node_buffer.z) : (node_buffer.w)));\\nvec4 nextNode = gWebGPUBuffer0.u_Data[int(float_j)];\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat attractiveF = dist / gWebGPUUniformParams.u_K;\\nif (dist > 0.0) {dx -= xDist * attractiveF;\\ndy -= yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < int(float_j)) ? (1.0) : (-1.0);\\ndx -= sign * attractiveF;\\ndy -= sign * attractiveF;}}}\\nreturn vec2(dx, dy);}\\nvoid main() {int i = globalInvocationID.x;\\nvec4 currentNode = gWebGPUBuffer0.u_Data[i];\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nif (i >= VERTEX_COUNT) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvec4 nodeAttributes = gWebGPUBuffer1.u_AttributeArray[i];\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w);\\nreturn ;}\\nvec2 repulsive = calcRepulsive(i, currentNode);\\ndx += repulsive.x;\\ndy += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode);\\ndx += attractive.x;\\ndy += attractive.y;\\nvec2 gravity = calcGravity(currentNode, nodeAttributes);\\ndx -= gravity.x;\\ndy -= gravity.y;\\ndx *= gWebGPUUniformParams.u_Speed;\\ndy *= gWebGPUUniformParams.u_Speed;\\nfloat distLength = sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {float limitedDist = min(gWebGPUUniformParams.u_MaxDisplace * gWebGPUUniformParams.u_Speed, distLength);\\ngWebGPUBuffer0.u_Data[i] = vec4(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w);}}\\n","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_K;\\nuniform float u_K2;\\nuniform vec2 u_Center;\\nuniform float u_Gravity;\\nuniform float u_ClusterGravity;\\nuniform float u_Speed;\\nuniform float u_MaxDisplace;\\nuniform float u_Clustering;\\nuniform sampler2D u_AttributeArray;\\nuniform vec2 u_AttributeArraySize;\\nvec4 getDatau_AttributeArray(vec2 address2D) {\\n return vec4(texture2D(u_AttributeArray, address2D).rgba);\\n}\\nvec4 getDatau_AttributeArray(float address1D) {\\n return getDatau_AttributeArray(addrTranslation_1Dto2D(address1D, u_AttributeArraySize));\\n}\\nvec4 getDatau_AttributeArray(int address1D) {\\n return getDatau_AttributeArray(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n return getDatau_ClusterCenters(float(address1D));\\n}\\nvec2 calcRepulsive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = getDatau_Data(j);\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat param = u_K2 / dist;\\nif (dist > 0.0) {dx += param * xDist;\\ndy += param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < j) ? (1.0) : (-1.0);\\ndx += param * sign;\\ndy += param * sign;}}}}\\nreturn vec2(dx, dy);}\\nvec2 calcGravity(vec4 currentNode, vec4 nodeAttributes) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nfloat vx = currentNode.x - u_Center.x;\\nfloat vy = currentNode.y - u_Center.y;\\nfloat gf = (0.01 * u_K) * u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (u_Clustering == 1.0) {int clusterIdx = int(nodeAttributes.x);\\nvec4 center = getDatau_ClusterCenters(clusterIdx);\\nfloat cvx = currentNode.x - center.x;\\nfloat cvy = currentNode.y - center.y;\\nfloat dist = sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nfloat parma = (u_K * u_ClusterGravity) / dist;\\ndx += parma * cvx;\\ndy += parma * cvy;}\\nreturn vec2(dx, dy);}\\nvec2 calcAttractive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nint arr_offset = int(floor(currentNode.z + 0.5));\\nint length = int(floor(currentNode.w + 0.5));\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + int(p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = getDatau_Data(int(arr_idx / 4));}\\nfloat float_j = (buf_offset == 0) ? (node_buffer.x) : ((buf_offset == 1) ? (node_buffer.y) : ((buf_offset == 2) ? (node_buffer.z) : (node_buffer.w)));\\nvec4 nextNode = getDatau_Data(int(float_j));\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat attractiveF = dist / u_K;\\nif (dist > 0.0) {dx -= xDist * attractiveF;\\ndy -= yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < int(float_j)) ? (1.0) : (-1.0);\\ndx -= sign * attractiveF;\\ndy -= sign * attractiveF;}}}\\nreturn vec2(dx, dy);}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 currentNode = getDatau_Data(i);\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nif (i >= VERTEX_COUNT) {gl_FragColor = vec4(currentNode);\\nreturn ;}\\nvec4 nodeAttributes = getDatau_AttributeArray(i);\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w));\\nreturn ;}\\nvec2 repulsive = calcRepulsive(i, currentNode);\\ndx += repulsive.x;\\ndy += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode);\\ndx += attractive.x;\\ndy += attractive.y;\\nvec2 gravity = calcGravity(currentNode, nodeAttributes);\\ndx -= gravity.x;\\ndy -= gravity.y;\\ndx *= u_Speed;\\ndy *= u_Speed;\\nfloat distLength = sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {float limitedDist = min(u_MaxDisplace * u_Speed, distLength);\\ngl_FragColor = vec4(vec4(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w));}if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"MAX_EDGE_PER_VERTEX","type":"Float","runtime":true},{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]},{"name":"u_K","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_K2","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Center","type":"vec2","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Gravity","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterGravity","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Speed","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_MaxDisplace","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Clustering","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AttributeArray","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}`;
var clusterBundle = `{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4 = vec4(0.0);\\n\\n[[builtin global_invocation_id]] var globalInvocationID : vec3;\\n# [[builtin work_group_size]] var workGroupSize : vec3;\\n# [[builtin work_group_id]] var workGroupID : vec3;\\n[[builtin local_invocation_id]] var localInvocationID : vec3;\\n# [[builtin num_work_groups]] var numWorkGroups : vec3;\\n[[builtin local_invocation_idx]] var localInvocationIndex : u32;\\n\\n\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array>;\\n};\\n[[binding 0, set 0]] var gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_NodeAttributes : [[stride 16]] array>;\\n};\\n[[binding 1, set 0]] var gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n [[offset 0]] u_ClusterCenters : [[stride 16]] array>;\\n};\\n[[binding 2, set 0]] var gWebGPUBuffer2 : GWebGPUBuffer2;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar center : vec4 = gWebGPUBuffer2.u_ClusterCenters[i];\\nvar sumx : f32 = 0.0;\\nvar sumy : f32 = 0.0;\\nvar count : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {var attributes : vec4 = gWebGPUBuffer1.u_NodeAttributes[j];\\nvar clusterIdx : i32 = i32(attributes.x);\\nvar vertex : vec4 = gWebGPUBuffer0.u_Data[j];\\nif (clusterIdx == i) {sumx = sumx + vertex.x;\\nsumy = sumy + vertex.y;\\ncount = count + 1.0;}}\\ngWebGPUBuffer2.u_ClusterCenters[i] = vec4(sumx / count, sumy / count, count, i);\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\n\\nlayout(std430, set = 0, binding = 0) buffer readonly GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 1) buffer readonly GWebGPUBuffer1 {\\n vec4 u_NodeAttributes[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 2) buffer GWebGPUBuffer2 {\\n vec4 u_ClusterCenters[];\\n} gWebGPUBuffer2;\\n\\n\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define CLUSTER_COUNT __DefineValuePlaceholder__CLUSTER_COUNT\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\nvoid main() {int i = globalInvocationID.x;\\nvec4 center = gWebGPUBuffer2.u_ClusterCenters[i];\\nfloat sumx = 0.0;\\nfloat sumy = 0.0;\\nfloat count = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 attributes = gWebGPUBuffer1.u_NodeAttributes[j];\\nint clusterIdx = int(attributes.x);\\nvec4 vertex = gWebGPUBuffer0.u_Data[j];\\nif (clusterIdx == i) {sumx += vertex.x;\\nsumy += vertex.y;\\ncount += 1.0;}}\\ngWebGPUBuffer2.u_ClusterCenters[i] = vec4(sumx / count, sumy / count, count, i);}\\n","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define CLUSTER_COUNT __DefineValuePlaceholder__CLUSTER_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributes;\\nuniform vec2 u_NodeAttributesSize;\\nvec4 getDatau_NodeAttributes(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributes, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributes(float address1D) {\\n return getDatau_NodeAttributes(addrTranslation_1Dto2D(address1D, u_NodeAttributesSize));\\n}\\nvec4 getDatau_NodeAttributes(int address1D) {\\n return getDatau_NodeAttributes(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n return getDatau_ClusterCenters(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 center = getDatau_ClusterCenters(i);\\nfloat sumx = 0.0;\\nfloat sumy = 0.0;\\nfloat count = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 attributes = getDatau_NodeAttributes(j);\\nint clusterIdx = int(attributes.x);\\nvec4 vertex = getDatau_Data(j);\\nif (clusterIdx == i) {sumx += vertex.x;\\nsumy += vertex.y;\\ncount += 1.0;}}\\ngl_FragColor = vec4(vec4(sumx / count, sumy / count, count, i));if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"CLUSTER_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributes","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_ClusterCenters","size":[1,1],"length":1},"needPingpong":true}}`;
// node_modules/@antv/layout/es/layout/gpu/fruchterman.js
var __awaiter4 = function(thisArg, _arguments, P4, generator) {
function adopt(value2) {
return value2 instanceof P4 ? value2 : new P4(function(resolve) {
resolve(value2);
});
}
return new (P4 || (P4 = Promise))(function(resolve, reject) {
function fulfilled(value2) {
try {
step(generator.next(value2));
} catch (e4) {
reject(e4);
}
}
function rejected(value2) {
try {
step(generator["throw"](value2));
} catch (e4) {
reject(e4);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var FruchtermanGPULayout = class extends Base3 {
constructor(options) {
super();
this.maxIteration = 1e3;
this.gravity = 10;
this.speed = 1;
this.clustering = false;
this.clusterField = "cluster";
this.clusterGravity = 10;
this.workerEnabled = false;
this.nodes = [];
this.edges = [];
this.width = 300;
this.height = 300;
this.nodeMap = {};
this.nodeIdxMap = {};
this.updateCfg(options);
}
getDefaultCfg() {
return {
maxIteration: 1e3,
gravity: 10,
speed: 1,
clustering: false,
clusterGravity: 10
};
}
execute() {
return __awaiter4(this, void 0, void 0, function* () {
const self2 = this;
const nodes = self2.nodes;
if (!nodes || nodes.length === 0) {
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return;
}
if (!self2.width && typeof window !== "undefined") {
self2.width = window.innerWidth;
}
if (!self2.height && typeof window !== "undefined") {
self2.height = window.innerHeight;
}
if (!self2.center) {
self2.center = [self2.width / 2, self2.height / 2];
}
const center2 = self2.center;
if (nodes.length === 1) {
nodes[0].x = center2[0];
nodes[0].y = center2[1];
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return;
}
const nodeMap = {};
const nodeIdxMap = {};
nodes.forEach((node, i4) => {
if (!isNumber3(node.x))
node.x = Math.random() * this.width;
if (!isNumber3(node.y))
node.y = Math.random() * this.height;
nodeMap[node.id] = node;
nodeIdxMap[node.id] = i4;
});
self2.nodeMap = nodeMap;
self2.nodeIdxMap = nodeIdxMap;
yield self2.run();
});
}
executeWithWorker(canvas, ctx4) {
return __awaiter4(this, void 0, void 0, function* () {
const self2 = this;
const nodes = self2.nodes;
const center2 = self2.center;
if (!nodes || nodes.length === 0) {
return;
}
if (nodes.length === 1) {
nodes[0].x = center2[0];
nodes[0].y = center2[1];
return;
}
const nodeMap = {};
const nodeIdxMap = {};
nodes.forEach((node, i4) => {
if (!isNumber3(node.x))
node.x = Math.random() * this.width;
if (!isNumber3(node.y))
node.y = Math.random() * this.height;
nodeMap[node.id] = node;
nodeIdxMap[node.id] = i4;
});
self2.nodeMap = nodeMap;
self2.nodeIdxMap = nodeIdxMap;
yield self2.run(canvas, ctx4);
});
}
run(canvas, ctx4) {
return __awaiter4(this, void 0, void 0, function* () {
const self2 = this;
const nodes = self2.nodes;
const edges = self2.edges;
const maxIteration = self2.maxIteration;
const center2 = self2.center;
const area2 = self2.height * self2.width;
let maxDisplace = Math.sqrt(area2) / 10;
const k22 = area2 / (nodes.length + 1);
const k4 = Math.sqrt(k22);
const speed = self2.speed;
const clustering = self2.clustering;
const { array: attributeArray, count: clusterCount } = attributesToTextureData([self2.clusterField], nodes);
nodes.forEach((node, i4) => {
let fx = 0;
let fy = 0;
if (isNumber3(node.fx) && isNumber3(node.fy)) {
fx = node.fx || 1e-3;
fy = node.fy || 1e-3;
}
attributeArray[4 * i4 + 1] = fx;
attributeArray[4 * i4 + 2] = fy;
});
const numParticles = nodes.length;
const { maxEdgePerVetex, array: nodesEdgesArray } = buildTextureData(nodes, edges);
const workerEnabled = self2.workerEnabled;
let world;
if (workerEnabled) {
world = World.create({
canvas,
engineOptions: {
supportCompute: true
}
});
} else {
world = World.create({
engineOptions: {
supportCompute: true
}
});
}
const onLayoutEnd = self2.onLayoutEnd;
const clusterCenters = [];
for (let i4 = 0; i4 < clusterCount; i4++) {
clusterCenters.push(0, 0, 0, 0);
}
const kernelFruchterman = world.createKernel(fruchtermanBundle).setDispatch([numParticles, 1, 1]).setBinding({
u_Data: nodesEdgesArray,
u_K: k4,
u_K2: k22,
u_Gravity: self2.gravity,
u_ClusterGravity: self2.clusterGravity || self2.gravity || 1,
u_Speed: speed,
u_MaxDisplace: maxDisplace,
u_Clustering: clustering ? 1 : 0,
u_Center: center2,
u_AttributeArray: attributeArray,
u_ClusterCenters: clusterCenters,
MAX_EDGE_PER_VERTEX: maxEdgePerVetex,
VERTEX_COUNT: numParticles
});
let kernelCluster;
if (clustering) {
kernelCluster = world.createKernel(clusterBundle).setDispatch([clusterCount, 1, 1]).setBinding({
u_Data: nodesEdgesArray,
u_NodeAttributes: attributeArray,
u_ClusterCenters: clusterCenters,
VERTEX_COUNT: numParticles,
CLUSTER_COUNT: clusterCount
});
}
const execute = () => __awaiter4(this, void 0, void 0, function* () {
for (let i4 = 0; i4 < maxIteration; i4++) {
yield kernelFruchterman.execute();
if (clustering) {
kernelCluster.setBinding({
u_Data: kernelFruchterman
});
yield kernelCluster.execute();
kernelFruchterman.setBinding({
u_ClusterCenters: kernelCluster
});
}
kernelFruchterman.setBinding({
u_MaxDisplace: maxDisplace *= 0.99
});
}
const finalParticleData = yield kernelFruchterman.getOutput();
if (canvas) {
ctx4.postMessage({
type: LAYOUT_MESSAGE.GPUEND,
vertexEdgeData: finalParticleData
});
} else {
nodes.forEach((node, i4) => {
const x6 = finalParticleData[4 * i4];
const y5 = finalParticleData[4 * i4 + 1];
node.x = x6;
node.y = y5;
});
}
if (onLayoutEnd)
onLayoutEnd();
});
yield execute();
});
}
getType() {
return "fruchterman-gpu";
}
};
// node_modules/@antv/layout/es/layout/gpu/gForceShader.js
var gForceBundle = `{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4 = vec4(0.0);\\n\\n[[builtin global_invocation_id]] var globalInvocationID : vec3;\\n# [[builtin work_group_size]] var workGroupSize : vec3;\\n# [[builtin work_group_id]] var workGroupID : vec3;\\n[[builtin local_invocation_id]] var localInvocationID : vec3;\\n# [[builtin num_work_groups]] var numWorkGroups : vec3;\\n[[builtin local_invocation_idx]] var localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n [[offset 0]] u_damping : f32;\\n [[offset 4]] u_maxSpeed : f32;\\n [[offset 8]] u_minMovement : f32;\\n \\n [[offset 12]] u_coulombDisScale : f32;\\n [[offset 16]] u_factor : f32;\\n \\n \\n [[offset 20]] u_interval : f32;\\n};\\n[[binding 0, set 0]] var gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array>;\\n};\\n[[binding 1, set 0]] var gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_AveMovement : [[stride 16]] array>;\\n};\\n[[binding 2, set 0]] var gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n [[offset 0]] u_NodeAttributeArray1 : [[stride 16]] array>;\\n};\\n[[binding 3, set 0]] var gWebGPUBuffer2 : GWebGPUBuffer2;\\ntype GWebGPUBuffer3 = [[block]] struct {\\n [[offset 0]] u_NodeAttributeArray2 : [[stride 16]] array>;\\n};\\n[[binding 4, set 0]] var gWebGPUBuffer3 : GWebGPUBuffer3;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn unpack_float(packedValue : f32) -> vec2 {var packedIntValue : i32 = i32(packedValue);\\nvar v0 : i32 = packedIntValue / 1048576;\\nreturn vec2(v0, packedIntValue - (v0 * 1048576));}\\nfn calcRepulsive(i : i32, currentNode : vec4) -> vec2 {var ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {if (i != j) {var nextNode : vec4 = gWebGPUBuffer0.u_Data[j];\\nvar vx : f32 = currentNode.x - nextNode.x;\\nvar vy : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.01;\\nvar n_dist : f32 = (dist + 0.1) * gWebGPUUniformParams.u_coulombDisScale;\\nvar direx : f32 = vx / dist;\\nvar direy : f32 = vy / dist;\\nvar attributesi : vec4 = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvar attributesj : vec4 = gWebGPUBuffer2.u_NodeAttributeArray1[j];\\nvar massi : f32 = attributesi.x;\\nvar nodeStrengthi : f32 = attributesi.z;\\nvar nodeStrengthj : f32 = attributesj.z;\\nvar nodeStrength : f32 = (nodeStrengthi + nodeStrengthj) / 2.0;\\nvar param : f32 = (nodeStrength * gWebGPUUniformParams.u_factor) / (n_dist * n_dist);\\nax = ax + direx * param;\\nay = ay + direy * param;}}\\nreturn vec2(ax, ay);}\\nfn calcGravity(i : i32, currentNode : vec4, attributes2 : vec4) -> vec2 {var vx : f32 = currentNode.x - attributes2.x;\\nvar vy : f32 = currentNode.y - attributes2.y;\\nvar ax : f32 = vx * attributes2.z;\\nvar ay : f32 = vy * attributes2.z;\\nreturn vec2(ax, ay);}\\nfn calcAttractive(i : i32, currentNode : vec4, attributes1 : vec4) -> vec2 {var mass : f32 = attributes1.x;\\nvar ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nvar compressed : vec2 = unpack_float(currentNode.z);\\nvar length : i32 = compressed.x;\\nvar arr_offset : i32 = compressed.y;\\nvar node_buffer : vec4;\\nfor (var p : i32 = 0; p < __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX; p = p + 1) {if (p >= length) {break;}\\nvar arr_idx : i32 = arr_offset + (4 * p);\\nvar buf_offset : i32 = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[i32(arr_idx / 4)];}\\nvar float_j : f32 = node_buffer.x;\\nvar nextNode : vec4 = gWebGPUBuffer0.u_Data[i32(float_j)];\\nvar vx : f32 = nextNode.x - currentNode.x;\\nvar vy : f32 = nextNode.y - currentNode.y;\\nvar dist : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.01;\\nvar direx : f32 = vx / dist;\\nvar direy : f32 = vy / dist;\\nvar edgeLength : f32 = node_buffer.y;\\nvar edgeStrength : f32 = node_buffer.z;\\nvar diff : f32 = edgeLength - dist;\\nvar param : f32 = (diff * edgeStrength) / mass;\\nax = ax - direx * param;\\nay = ay - direy * param;}\\nreturn vec2(ax, ay);}\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar currentNode : vec4 = gWebGPUBuffer0.u_Data[i];\\nvar movement : vec4 = gWebGPUBuffer1.u_AveMovement[0];\\nvar ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nif ((i >= __DefineValuePlaceholder__VERTEX_COUNT) || (movement.x < gWebGPUUniformParams.u_minMovement)) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvar nodeAttributes1 : vec4 = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvar nodeAttributes2 : vec4 = gWebGPUBuffer3.u_NodeAttributeArray2[i];\\nvar repulsive : vec2 = calcRepulsive(i, currentNode);\\nax = ax + repulsive.x;\\nay = ay + repulsive.y;\\nvar attractive : vec2 = calcAttractive(i, currentNode, nodeAttributes1);\\nax = ax + attractive.x;\\nay = ay + attractive.y;\\nvar gravity : vec2 = calcGravity(i, currentNode, nodeAttributes2);\\nax = ax - gravity.x;\\nay = ay - gravity.y;\\nvar param : f32 = gWebGPUUniformParams.u_interval * gWebGPUUniformParams.u_damping;\\nvar vx : f32 = ax * param;\\nvar vy : f32 = ay * param;\\nvar vlength : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > gWebGPUUniformParams.u_maxSpeed) {var param2 : f32 = gWebGPUUniformParams.u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nvar distx : f32 = vx * gWebGPUUniformParams.u_interval;\\nvar disty : f32 = vy * gWebGPUUniformParams.u_interval;\\nvar distLength : f32 = std::sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0);}else {gWebGPUBuffer0.u_Data[i] = vec4(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength);}\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n float u_damping;\\n float u_maxSpeed;\\n float u_minMovement;\\n \\n float u_coulombDisScale;\\n float u_factor;\\n \\n \\n float u_interval;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer readonly GWebGPUBuffer1 {\\n vec4 u_AveMovement[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 3) buffer readonly GWebGPUBuffer2 {\\n vec4 u_NodeAttributeArray1[];\\n} gWebGPUBuffer2;\\n\\nlayout(std430, set = 0, binding = 4) buffer readonly GWebGPUBuffer3 {\\n vec4 u_NodeAttributeArray2[];\\n} gWebGPUBuffer3;\\n\\n\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define SHIFT_20 1048576.0\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nivec2 unpack_float(float packedValue) {int packedIntValue = int(packedValue);\\nint v0 = packedIntValue / int(SHIFT_20);\\nreturn ivec2(v0, packedIntValue - (v0 * int(SHIFT_20)));}\\nvec2 calcRepulsive(int i, vec4 currentNode) {float ax = 0.0;\\nfloat ay = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = gWebGPUBuffer0.u_Data[j];\\nfloat vx = currentNode.x - nextNode.x;\\nfloat vy = currentNode.y - nextNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat n_dist = (dist + 0.1) * gWebGPUUniformParams.u_coulombDisScale;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nvec4 attributesi = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvec4 attributesj = gWebGPUBuffer2.u_NodeAttributeArray1[j];\\nfloat massi = attributesi.x;\\nfloat nodeStrengthi = attributesi.z;\\nfloat nodeStrengthj = attributesj.z;\\nfloat nodeStrength = (nodeStrengthi + nodeStrengthj) / 2.0;\\nfloat param = (nodeStrength * gWebGPUUniformParams.u_factor) / (n_dist * n_dist);\\nax += direx * param;\\nay += direy * param;}}\\nreturn vec2(ax, ay);}\\nvec2 calcGravity(int i, vec4 currentNode, vec4 attributes2) {float vx = currentNode.x - attributes2.x;\\nfloat vy = currentNode.y - attributes2.y;\\nfloat ax = vx * attributes2.z;\\nfloat ay = vy * attributes2.z;\\nreturn vec2(ax, ay);}\\nvec2 calcAttractive(int i, vec4 currentNode, vec4 attributes1) {float mass = attributes1.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nivec2 compressed = unpack_float(currentNode.z);\\nint length = compressed.x;\\nint arr_offset = compressed.y;\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + (4 * p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[int(arr_idx / 4)];}\\nfloat float_j = node_buffer.x;\\nvec4 nextNode = gWebGPUBuffer0.u_Data[int(float_j)];\\nfloat vx = nextNode.x - currentNode.x;\\nfloat vy = nextNode.y - currentNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nfloat edgeLength = node_buffer.y;\\nfloat edgeStrength = node_buffer.z;\\nfloat diff = edgeLength - dist;\\nfloat param = (diff * edgeStrength) / mass;\\nax -= direx * param;\\nay -= direy * param;}\\nreturn vec2(ax, ay);}\\nvoid main() {int i = globalInvocationID.x;\\nvec4 currentNode = gWebGPUBuffer0.u_Data[i];\\nvec4 movement = gWebGPUBuffer1.u_AveMovement[0];\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nif ((i >= VERTEX_COUNT) || (movement.x < gWebGPUUniformParams.u_minMovement)) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvec4 nodeAttributes1 = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvec4 nodeAttributes2 = gWebGPUBuffer3.u_NodeAttributeArray2[i];\\nvec2 repulsive = calcRepulsive(i, currentNode);\\nax += repulsive.x;\\nay += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode, nodeAttributes1);\\nax += attractive.x;\\nay += attractive.y;\\nvec2 gravity = calcGravity(i, currentNode, nodeAttributes2);\\nax -= gravity.x;\\nay -= gravity.y;\\nfloat param = gWebGPUUniformParams.u_interval * gWebGPUUniformParams.u_damping;\\nfloat vx = ax * param;\\nfloat vy = ay * param;\\nfloat vlength = sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > gWebGPUUniformParams.u_maxSpeed) {float param2 = gWebGPUUniformParams.u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nfloat distx = vx * gWebGPUUniformParams.u_interval;\\nfloat disty = vy * gWebGPUUniformParams.u_interval;\\nfloat distLength = sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0);}else {gWebGPUBuffer0.u_Data[i] = vec4(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength);}}\\n","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define SHIFT_20 1048576.0\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_damping;\\nuniform float u_maxSpeed;\\nuniform float u_minMovement;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n return getDatau_AveMovement(float(address1D));\\n}\\nuniform float u_coulombDisScale;\\nuniform float u_factor;\\nuniform sampler2D u_NodeAttributeArray1;\\nuniform vec2 u_NodeAttributeArray1Size;\\nvec4 getDatau_NodeAttributeArray1(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributeArray1, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributeArray1(float address1D) {\\n return getDatau_NodeAttributeArray1(addrTranslation_1Dto2D(address1D, u_NodeAttributeArray1Size));\\n}\\nvec4 getDatau_NodeAttributeArray1(int address1D) {\\n return getDatau_NodeAttributeArray1(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributeArray2;\\nuniform vec2 u_NodeAttributeArray2Size;\\nvec4 getDatau_NodeAttributeArray2(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributeArray2, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributeArray2(float address1D) {\\n return getDatau_NodeAttributeArray2(addrTranslation_1Dto2D(address1D, u_NodeAttributeArray2Size));\\n}\\nvec4 getDatau_NodeAttributeArray2(int address1D) {\\n return getDatau_NodeAttributeArray2(float(address1D));\\n}\\nuniform float u_interval;\\nivec2 unpack_float(float packedValue) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint packedIntValue = int(packedValue);\\nint v0 = packedIntValue / int(SHIFT_20);\\nreturn ivec2(v0, packedIntValue - (v0 * int(SHIFT_20)));}\\nvec2 calcRepulsive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = getDatau_Data(j);\\nfloat vx = currentNode.x - nextNode.x;\\nfloat vy = currentNode.y - nextNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat n_dist = (dist + 0.1) * u_coulombDisScale;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nvec4 attributesi = getDatau_NodeAttributeArray1(i);\\nvec4 attributesj = getDatau_NodeAttributeArray1(j);\\nfloat massi = attributesi.x;\\nfloat nodeStrengthi = attributesi.z;\\nfloat nodeStrengthj = attributesj.z;\\nfloat nodeStrength = (nodeStrengthi + nodeStrengthj) / 2.0;\\nfloat param = (nodeStrength * u_factor) / (n_dist * n_dist);\\nax += direx * param;\\nay += direy * param;}}\\nreturn vec2(ax, ay);}\\nvec2 calcGravity(int i, vec4 currentNode, vec4 attributes2) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat vx = currentNode.x - attributes2.x;\\nfloat vy = currentNode.y - attributes2.y;\\nfloat ax = vx * attributes2.z;\\nfloat ay = vy * attributes2.z;\\nreturn vec2(ax, ay);}\\nvec2 calcAttractive(int i, vec4 currentNode, vec4 attributes1) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat mass = attributes1.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nivec2 compressed = unpack_float(currentNode.z);\\nint length = compressed.x;\\nint arr_offset = compressed.y;\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + (4 * p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = getDatau_Data(int(arr_idx / 4));}\\nfloat float_j = node_buffer.x;\\nvec4 nextNode = getDatau_Data(int(float_j));\\nfloat vx = nextNode.x - currentNode.x;\\nfloat vy = nextNode.y - currentNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nfloat edgeLength = node_buffer.y;\\nfloat edgeStrength = node_buffer.z;\\nfloat diff = edgeLength - dist;\\nfloat param = (diff * edgeStrength) / mass;\\nax -= direx * param;\\nay -= direy * param;}\\nreturn vec2(ax, ay);}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 currentNode = getDatau_Data(i);\\nvec4 movement = getDatau_AveMovement(0.0);\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nif ((i >= VERTEX_COUNT) || (movement.x < u_minMovement)) {gl_FragColor = vec4(currentNode);\\nreturn ;}\\nvec4 nodeAttributes1 = getDatau_NodeAttributeArray1(i);\\nvec4 nodeAttributes2 = getDatau_NodeAttributeArray2(i);\\nvec2 repulsive = calcRepulsive(i, currentNode);\\nax += repulsive.x;\\nay += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode, nodeAttributes1);\\nax += attractive.x;\\nay += attractive.y;\\nvec2 gravity = calcGravity(i, currentNode, nodeAttributes2);\\nax -= gravity.x;\\nay -= gravity.y;\\nfloat param = u_interval * u_damping;\\nfloat vx = ax * param;\\nfloat vy = ay * param;\\nfloat vlength = sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > u_maxSpeed) {float param2 = u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nfloat distx = vx * u_interval;\\nfloat disty = vy * u_interval;\\nfloat distLength = sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0));}else {gl_FragColor = vec4(vec4(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength));}if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"MAX_EDGE_PER_VERTEX","type":"Float","runtime":true},{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"SHIFT_20","type":"Float","value":1048576,"runtime":false}],"uniforms":[{"name":"u_Data","type":"vec4[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]},{"name":"u_damping","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_maxSpeed","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_minMovement","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_coulombDisScale","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_factor","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray1","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray2","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_interval","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}`;
var aveMovementBundle = `{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4 = vec4(0.0);\\n\\n[[builtin global_invocation_id]] var globalInvocationID : vec3;\\n# [[builtin work_group_size]] var workGroupSize : vec3;\\n# [[builtin work_group_id]] var workGroupID : vec3;\\n[[builtin local_invocation_id]] var localInvocationID : vec3;\\n# [[builtin num_work_groups]] var numWorkGroups : vec3;\\n[[builtin local_invocation_idx]] var localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n [[offset 0]] u_iter : f32;\\n};\\n[[binding 0, set 0]] var gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array>;\\n};\\n[[binding 1, set 0]] var gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_AveMovement : [[stride 16]] array>;\\n};\\n[[binding 2, set 0]] var gWebGPUBuffer1 : GWebGPUBuffer1;\\n\\n\\n\\n\\n\\n\\n\\n\\nfn main() -> void {var movement : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {var vertex : vec4 = gWebGPUBuffer0.u_Data[j];\\nmovement = movement + vertex.w;}\\nmovement = movement / f32(__DefineValuePlaceholder__VERTEX_COUNT);\\ngWebGPUBuffer1.u_AveMovement[0] = vec4(movement, 0.0, 0.0, 0.0);\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n float u_iter;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer readonly GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer GWebGPUBuffer1 {\\n vec4 u_AveMovement[];\\n} gWebGPUBuffer1;\\n\\n\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\nvoid main() {float movement = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 vertex = gWebGPUBuffer0.u_Data[j];\\nmovement += vertex.w;}\\nmovement = movement / float(VERTEX_COUNT);\\ngWebGPUBuffer1.u_AveMovement[0] = vec4(movement, 0.0, 0.0, 0.0);}\\n","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_iter;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n return getDatau_AveMovement(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat movement = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 vertex = getDatau_Data(j);\\nmovement += vertex.w;}\\nmovement = movement / float(VERTEX_COUNT);\\ngl_FragColor = vec4(vec4(movement, 0.0, 0.0, 0.0));if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_iter","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_AveMovement","size":[1,1],"length":1},"needPingpong":true}}`;
// node_modules/@antv/layout/es/layout/gpu/gForce.js
var __awaiter5 = function(thisArg, _arguments, P4, generator) {
function adopt(value2) {
return value2 instanceof P4 ? value2 : new P4(function(resolve) {
resolve(value2);
});
}
return new (P4 || (P4 = Promise))(function(resolve, reject) {
function fulfilled(value2) {
try {
step(generator.next(value2));
} catch (e4) {
reject(e4);
}
}
function rejected(value2) {
try {
step(generator["throw"](value2));
} catch (e4) {
reject(e4);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var GForceGPULayout = class extends Base3 {
constructor(options) {
super();
this.maxIteration = 1e3;
this.edgeStrength = 200;
this.nodeStrength = 1e3;
this.coulombDisScale = 5e-3;
this.damping = 0.9;
this.maxSpeed = 1e3;
this.minMovement = 0.5;
this.interval = 0.02;
this.factor = 1;
this.linkDistance = 1;
this.gravity = 10;
this.workerEnabled = false;
this.nodes = [];
this.edges = [];
this.width = 300;
this.height = 300;
this.nodeMap = {};
this.nodeIdxMap = {};
this.updateCfg(options);
}
getDefaultCfg() {
return {
maxIteration: 2e3,
gravity: 10,
clustering: false,
clusterGravity: 10
};
}
execute() {
return __awaiter5(this, void 0, void 0, function* () {
const self2 = this;
const nodes = self2.nodes;
if (!nodes || nodes.length === 0) {
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return;
}
if (!self2.width && typeof window !== "undefined") {
self2.width = window.innerWidth;
}
if (!self2.height && typeof window !== "undefined") {
self2.height = window.innerHeight;
}
if (!self2.center) {
self2.center = [self2.width / 2, self2.height / 2];
}
const center2 = self2.center;
if (nodes.length === 1) {
nodes[0].x = center2[0];
nodes[0].y = center2[1];
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return;
}
const nodeMap = {};
const nodeIdxMap = {};
nodes.forEach((node, i4) => {
if (!isNumber3(node.x))
node.x = Math.random() * self2.width;
if (!isNumber3(node.y))
node.y = Math.random() * self2.height;
nodeMap[node.id] = node;
nodeIdxMap[node.id] = i4;
});
self2.nodeMap = nodeMap;
self2.nodeIdxMap = nodeIdxMap;
self2.nodeStrength = proccessToFunc2(self2.nodeStrength, 1);
self2.edgeStrength = proccessToFunc2(self2.edgeStrength, 1);
yield self2.run();
});
}
executeWithWorker(canvas, ctx4) {
const self2 = this;
const nodes = self2.nodes;
const center2 = self2.center;
if (!nodes || nodes.length === 0) {
return;
}
if (nodes.length === 1) {
nodes[0].x = center2[0];
nodes[0].y = center2[1];
return;
}
const nodeMap = {};
const nodeIdxMap = {};
nodes.forEach((node, i4) => {
if (!isNumber3(node.x))
node.x = Math.random() * self2.width;
if (!isNumber3(node.y))
node.y = Math.random() * self2.height;
nodeMap[node.id] = node;
nodeIdxMap[node.id] = i4;
});
self2.nodeMap = nodeMap;
self2.nodeIdxMap = nodeIdxMap;
self2.nodeStrength = proccessToFunc2(self2.nodeStrength, 1);
self2.edgeStrength = proccessToFunc2(self2.edgeStrength, 1);
self2.run(canvas, ctx4);
}
run(canvas, ctx4) {
return __awaiter5(this, void 0, void 0, function* () {
const self2 = this;
const nodes = self2.nodes;
const edges = self2.edges;
const maxIteration = self2.maxIteration;
if (!self2.width && typeof window !== "undefined") {
self2.width = window.innerWidth;
}
if (!self2.height && typeof window !== "undefined") {
self2.height = window.innerHeight;
}
const numParticles = nodes.length;
self2.linkDistance = proccessToFunc2(self2.linkDistance);
self2.edgeStrength = proccessToFunc2(self2.edgeStrength);
const { maxEdgePerVetex, array: nodesEdgesArray } = buildTextureDataWithTwoEdgeAttr(nodes, edges, self2.linkDistance, self2.edgeStrength);
self2.degrees = getDegree3(nodes.length, self2.nodeIdxMap, edges);
const masses = [];
const nodeStrengths = [];
const centerXs = [];
const centerYs = [];
const centerGravities = [];
const fxs = [];
const fys = [];
if (!self2.getMass) {
self2.getMass = (d3) => {
return self2.degrees[self2.nodeIdxMap[d3.id]] || 1;
};
}
const gravity = self2.gravity;
const center2 = self2.center;
nodes.forEach((node, i4) => {
masses.push(self2.getMass(node));
nodeStrengths.push(self2.nodeStrength(node));
if (!self2.degrees[i4])
self2.degrees[i4] = 0;
let nodeGravity = [center2[0], center2[1], gravity];
if (self2.getCenter) {
const customCenter = self2.getCenter(node, self2.degrees[i4]);
if (customCenter && isNumber3(customCenter[0]) && isNumber3(customCenter[1]) && isNumber3(customCenter[2])) {
nodeGravity = customCenter;
}
}
centerXs.push(nodeGravity[0]);
centerYs.push(nodeGravity[1]);
centerGravities.push(nodeGravity[2]);
if (isNumber3(node.fx) && isNumber3(node.fy)) {
fxs.push(node.fx || 1e-3);
fys.push(node.fy || 1e-3);
} else {
fxs.push(0);
fys.push(0);
}
});
const nodeAttributeArray1 = arrayToTextureData([
masses,
self2.degrees,
nodeStrengths,
fxs
]);
const nodeAttributeArray2 = arrayToTextureData([
centerXs,
centerYs,
centerGravities,
fys
]);
const workerEnabled = self2.workerEnabled;
let world;
if (workerEnabled) {
world = World.create({
canvas,
engineOptions: {
supportCompute: true
}
});
} else {
world = World.create({
engineOptions: {
supportCompute: true
}
});
}
const onLayoutEnd = self2.onLayoutEnd;
const initPreviousData = [];
nodesEdgesArray.forEach((value2) => {
initPreviousData.push(value2);
});
for (let i4 = 0; i4 < 4; i4++) {
initPreviousData.push(0);
}
const kernelGForce = world.createKernel(gForceBundle).setDispatch([numParticles, 1, 1]).setBinding({
u_Data: nodesEdgesArray,
u_damping: self2.damping,
u_maxSpeed: self2.maxSpeed,
u_minMovement: self2.minMovement,
u_coulombDisScale: self2.coulombDisScale,
u_factor: self2.factor,
u_NodeAttributeArray1: nodeAttributeArray1,
u_NodeAttributeArray2: nodeAttributeArray2,
MAX_EDGE_PER_VERTEX: maxEdgePerVetex,
VERTEX_COUNT: numParticles,
u_AveMovement: initPreviousData,
u_interval: self2.interval
});
const kernelAveMovement = world.createKernel(aveMovementBundle).setDispatch([1, 1, 1]).setBinding({
u_Data: nodesEdgesArray,
VERTEX_COUNT: numParticles,
u_AveMovement: [0, 0, 0, 0]
});
const execute = () => __awaiter5(this, void 0, void 0, function* () {
for (let i4 = 0; i4 < maxIteration; i4++) {
yield kernelGForce.execute();
kernelAveMovement.setBinding({
u_Data: kernelGForce
});
yield kernelAveMovement.execute();
const stepInterval = Math.max(0.02, self2.interval - i4 * 2e-3);
kernelGForce.setBinding({
u_interval: stepInterval,
u_AveMovement: kernelAveMovement
});
}
const finalParticleData = yield kernelGForce.getOutput();
if (canvas) {
ctx4.postMessage({
type: LAYOUT_MESSAGE.GPUEND,
vertexEdgeData: finalParticleData
});
} else {
nodes.forEach((node, i4) => {
const x6 = finalParticleData[4 * i4];
const y5 = finalParticleData[4 * i4 + 1];
node.x = x6;
node.y = y5;
});
}
if (onLayoutEnd)
onLayoutEnd();
});
yield execute();
});
}
getType() {
return "gForce-gpu";
}
};
// node_modules/@antv/layout/es/layout/comboForce.js
var ComboForceLayout = class extends Base3 {
constructor(options) {
super();
this.center = [0, 0];
this.maxIteration = 100;
this.gravity = 10;
this.comboGravity = 10;
this.linkDistance = 10;
this.alpha = 1;
this.alphaMin = 1e-3;
this.alphaDecay = 1 - Math.pow(this.alphaMin, 1 / 300);
this.alphaTarget = 0;
this.velocityDecay = 0.6;
this.edgeStrength = 0.6;
this.nodeStrength = 30;
this.preventOverlap = false;
this.preventNodeOverlap = false;
this.preventComboOverlap = false;
this.collideStrength = void 0;
this.nodeCollideStrength = 0.5;
this.comboCollideStrength = 0.5;
this.comboSpacing = 20;
this.comboPadding = 10;
this.optimizeRangeFactor = 1;
this.onTick = () => {
};
this.onLayoutEnd = () => {
};
this.depthAttractiveForceScale = 1;
this.depthRepulsiveForceScale = 2;
this.nodes = [];
this.edges = [];
this.combos = [];
this.comboTrees = [];
this.width = 300;
this.height = 300;
this.bias = [];
this.nodeMap = {};
this.oriComboMap = {};
this.indexMap = {};
this.comboMap = {};
this.previousLayouted = false;
this.updateCfg(options);
}
getDefaultCfg() {
return {
maxIteration: 100,
center: [0, 0],
gravity: 10,
speed: 1,
comboGravity: 30,
preventOverlap: false,
preventComboOverlap: true,
preventNodeOverlap: true,
nodeSpacing: void 0,
collideStrength: void 0,
nodeCollideStrength: 0.5,
comboCollideStrength: 0.5,
comboSpacing: 20,
comboPadding: 10,
edgeStrength: 0.6,
nodeStrength: 30,
linkDistance: 10
};
}
execute() {
const self2 = this;
const nodes = self2.nodes;
const center2 = self2.center;
self2.comboTree = {
id: "comboTreeRoot",
depth: -1,
children: self2.comboTrees
};
if (!nodes || nodes.length === 0) {
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return;
}
if (nodes.length === 1) {
nodes[0].x = center2[0];
nodes[0].y = center2[1];
if (self2.onLayoutEnd)
self2.onLayoutEnd();
return;
}
self2.initVals();
self2.run();
if (self2.onLayoutEnd)
self2.onLayoutEnd();
}
run() {
const self2 = this;
const nodes = self2.nodes;
const maxIteration = self2.previousLayouted ? self2.maxIteration / 5 : self2.maxIteration;
if (!self2.width && typeof window !== "undefined") {
self2.width = window.innerWidth;
}
if (!self2.height && typeof window !== "undefined") {
self2.height = window.innerHeight;
}
const center2 = self2.center;
const velocityDecay = self2.velocityDecay;
const comboMap = self2.comboMap;
if (!self2.previousLayouted)
self2.initPos(comboMap);
for (let i4 = 0; i4 < maxIteration; i4++) {
const displacements = [];
nodes.forEach((_8, j4) => {
displacements[j4] = { x: 0, y: 0 };
});
self2.applyCalculate(displacements);
self2.applyComboCenterForce(displacements);
nodes.forEach((n3, j4) => {
if (!isNumber3(n3.x) || !isNumber3(n3.y))
return;
n3.x += displacements[j4].x * velocityDecay;
n3.y += displacements[j4].y * velocityDecay;
});
self2.alpha += (self2.alphaTarget - self2.alpha) * self2.alphaDecay;
self2.onTick();
}
const meanCenter = [0, 0];
nodes.forEach((n3) => {
if (!isNumber3(n3.x) || !isNumber3(n3.y))
return;
meanCenter[0] += n3.x;
meanCenter[1] += n3.y;
});
meanCenter[0] /= nodes.length;
meanCenter[1] /= nodes.length;
const centerOffset = [center2[0] - meanCenter[0], center2[1] - meanCenter[1]];
nodes.forEach((n3, j4) => {
if (!isNumber3(n3.x) || !isNumber3(n3.y))
return;
n3.x += centerOffset[0];
n3.y += centerOffset[1];
});
self2.combos.forEach((combo) => {
const mapped = comboMap[combo.id];
if (mapped && mapped.empty) {
combo.x = mapped.cx || combo.x;
combo.y = mapped.cy || combo.y;
}
});
self2.previousLayouted = true;
}
initVals() {
const self2 = this;
const edges = self2.edges;
const nodes = self2.nodes;
const combos = self2.combos;
const count2 = {};
const nodeMap = {};
const indexMap = {};
nodes.forEach((node, i4) => {
nodeMap[node.id] = node;
indexMap[node.id] = i4;
});
self2.nodeMap = nodeMap;
self2.indexMap = indexMap;
const oriComboMap = {};
combos.forEach((combo) => {
oriComboMap[combo.id] = combo;
});
self2.oriComboMap = oriComboMap;
self2.comboMap = self2.getComboMap();
const preventOverlap = self2.preventOverlap;
self2.preventComboOverlap = self2.preventComboOverlap || preventOverlap;
self2.preventNodeOverlap = self2.preventNodeOverlap || preventOverlap;
const collideStrength = self2.collideStrength;
if (collideStrength) {
self2.comboCollideStrength = collideStrength;
self2.nodeCollideStrength = collideStrength;
}
self2.comboCollideStrength = self2.comboCollideStrength ? self2.comboCollideStrength : 0;
self2.nodeCollideStrength = self2.nodeCollideStrength ? self2.nodeCollideStrength : 0;
for (let i4 = 0; i4 < edges.length; ++i4) {
const source = getEdgeTerminal(edges[i4], "source");
const target = getEdgeTerminal(edges[i4], "target");
if (count2[source])
count2[source]++;
else
count2[source] = 1;
if (count2[target])
count2[target]++;
else
count2[target] = 1;
}
const bias = [];
for (let i4 = 0; i4 < edges.length; ++i4) {
const source = getEdgeTerminal(edges[i4], "source");
const target = getEdgeTerminal(edges[i4], "target");
bias[i4] = count2[source] / (count2[source] + count2[target]);
}
this.bias = bias;
const nodeSize = self2.nodeSize;
const nodeSpacing = self2.nodeSpacing;
let nodeSizeFunc;
let nodeSpacingFunc;
if (isNumber3(nodeSpacing)) {
nodeSpacingFunc = () => nodeSpacing;
} else if (isFunction(nodeSpacing)) {
nodeSpacingFunc = nodeSpacing;
} else {
nodeSpacingFunc = () => 0;
}
this.nodeSpacing = nodeSpacingFunc;
if (!nodeSize) {
nodeSizeFunc = (d3) => {
if (d3.size) {
if (isArray2(d3.size)) {
const res = d3.size[0] > d3.size[1] ? d3.size[0] : d3.size[1];
return res / 2;
}
if (isObject2(d3.size)) {
const res = d3.size.width > d3.size.height ? d3.size.width : d3.size.height;
return res / 2;
}
return d3.size / 2;
}
return 10;
};
} else if (isFunction(nodeSize)) {
nodeSizeFunc = (d3) => {
return nodeSize(d3);
};
} else if (isArray2(nodeSize)) {
const larger = nodeSize[0] > nodeSize[1] ? nodeSize[0] : nodeSize[1];
const radius = larger / 2;
nodeSizeFunc = (d3) => radius;
} else {
const radius = nodeSize / 2;
nodeSizeFunc = (d3) => radius;
}
this.nodeSize = nodeSizeFunc;
const comboSpacing = self2.comboSpacing;
let comboSpacingFunc;
if (isNumber3(comboSpacing)) {
comboSpacingFunc = () => comboSpacing;
} else if (isFunction(comboSpacing)) {
comboSpacingFunc = comboSpacing;
} else {
comboSpacingFunc = () => 0;
}
this.comboSpacing = comboSpacingFunc;
const comboPadding = self2.comboPadding;
let comboPaddingFunc;
if (isNumber3(comboPadding)) {
comboPaddingFunc = () => comboPadding;
} else if (isArray2(comboPadding)) {
comboPaddingFunc = () => Math.max.apply(null, comboPadding);
} else if (isFunction(comboPadding)) {
comboPaddingFunc = comboPadding;
} else {
comboPaddingFunc = () => 0;
}
this.comboPadding = comboPaddingFunc;
let linkDistance = this.linkDistance;
let linkDistanceFunc;
if (!linkDistance) {
linkDistance = 10;
}
if (isNumber3(linkDistance)) {
linkDistanceFunc = (d3) => {
return linkDistance;
};
} else {
linkDistanceFunc = linkDistance;
}
this.linkDistance = linkDistanceFunc;
let edgeStrength = this.edgeStrength;
let edgeStrengthFunc;
if (!edgeStrength) {
edgeStrength = 1;
}
if (isNumber3(edgeStrength)) {
edgeStrengthFunc = (d3) => {
return edgeStrength;
};
} else {
edgeStrengthFunc = edgeStrength;
}
this.edgeStrength = edgeStrengthFunc;
let nodeStrength = this.nodeStrength;
let nodeStrengthFunc;
if (!nodeStrength) {
nodeStrength = 30;
}
if (isNumber3(nodeStrength)) {
nodeStrengthFunc = (d3) => {
return nodeStrength;
};
} else {
nodeStrengthFunc = nodeStrength;
}
this.nodeStrength = nodeStrengthFunc;
}
initPos(comboMap) {
const self2 = this;
const nodes = self2.nodes;
nodes.forEach((node, i4) => {
const comboId = node.comboId;
const combo = comboMap[comboId];
if (comboId && combo) {
node.x = combo.cx + 100 / (i4 + 1);
node.y = combo.cy + 100 / (i4 + 1);
} else {
node.x = 100 / (i4 + 1);
node.y = 100 / (i4 + 1);
}
});
}
getComboMap() {
const self2 = this;
const nodeMap = self2.nodeMap;
const comboTrees = self2.comboTrees;
const oriComboMap = self2.oriComboMap;
const comboMap = {};
(comboTrees || []).forEach((ctree) => {
const treeChildren = [];
traverseTreeUp3(ctree, (treeNode) => {
if (treeNode.itemType === "node")
return true;
if (!oriComboMap[treeNode.id])
return true;
if (comboMap[treeNode.id] === void 0) {
const combo = {
id: treeNode.id,
name: treeNode.id,
cx: 0,
cy: 0,
count: 0,
depth: self2.oriComboMap[treeNode.id].depth || 0,
children: []
};
comboMap[treeNode.id] = combo;
}
const children = treeNode.children;
if (children) {
children.forEach((child) => {
if (!comboMap[child.id] && !nodeMap[child.id])
return true;
treeChildren.push(child);
});
}
const c5 = comboMap[treeNode.id];
c5.cx = 0;
c5.cy = 0;
if (treeChildren.length === 0) {
c5.empty = true;
const oriCombo = oriComboMap[treeNode.id];
c5.cx = oriCombo.x;
c5.cy = oriCombo.y;
}
treeChildren.forEach((child) => {
c5.count++;
if (child.itemType !== "node") {
const childCombo = comboMap[child.id];
if (isNumber3(childCombo.cx))
c5.cx += childCombo.cx;
if (isNumber3(childCombo.cy))
c5.cy += childCombo.cy;
return;
}
const node = nodeMap[child.id];
if (!node)
return;
if (isNumber3(node.x)) {
c5.cx += node.x;
}
if (isNumber3(node.y)) {
c5.cy += node.y;
}
});
c5.cx /= c5.count || 1;
c5.cy /= c5.count || 1;
c5.children = treeChildren;
return true;
});
});
return comboMap;
}
applyComboCenterForce(displacements) {
const self2 = this;
const gravity = self2.gravity;
const comboGravity = self2.comboGravity || gravity;
const alpha = this.alpha;
const comboTrees = self2.comboTrees;
const indexMap = self2.indexMap;
const nodeMap = self2.nodeMap;
const comboMap = self2.comboMap;
(comboTrees || []).forEach((ctree) => {
traverseTreeUp3(ctree, (treeNode) => {
if (treeNode.itemType === "node")
return true;
const combo = comboMap[treeNode.id];
if (!combo)
return true;
const c5 = comboMap[treeNode.id];
const gravityScale = (c5.depth + 1) / 10 * 0.5;
const comboX = c5.cx;
const comboY = c5.cy;
c5.cx = 0;
c5.cy = 0;
c5.children.forEach((child) => {
if (child.itemType !== "node") {
const childCombo = comboMap[child.id];
if (childCombo && isNumber3(childCombo.cx))
c5.cx += childCombo.cx;
if (childCombo && isNumber3(childCombo.cy))
c5.cy += childCombo.cy;
return;
}
const node = nodeMap[child.id];
const vecX = node.x - comboX || 5e-3;
const vecY = node.y - comboY || 5e-3;
const l4 = Math.sqrt(vecX * vecX + vecY * vecY);
const childIdx = indexMap[node.id];
const params = comboGravity * alpha / l4 * gravityScale;
displacements[childIdx].x -= vecX * params;
displacements[childIdx].y -= vecY * params;
if (isNumber3(node.x))
c5.cx += node.x;
if (isNumber3(node.y))
c5.cy += node.y;
});
c5.cx /= c5.count || 1;
c5.cy /= c5.count || 1;
return true;
});
});
}
applyCalculate(displacements) {
const self2 = this;
const comboMap = self2.comboMap;
const nodes = self2.nodes;
const vecMap = {};
nodes.forEach((v3, i4) => {
nodes.forEach((u3, j4) => {
if (i4 < j4)
return;
const vx = v3.x - u3.x || 5e-3;
const vy = v3.y - u3.y || 5e-3;
let vl2 = vx * vx + vy * vy;
const vl = Math.sqrt(vl2);
if (vl2 < 1)
vl2 = vl;
vecMap[`${v3.id}-${u3.id}`] = { vx, vy, vl2, vl };
vecMap[`${u3.id}-${v3.id}`] = { vl2, vl, vx: -vx, vy: -vy };
});
});
self2.updateComboSizes(comboMap);
self2.calRepulsive(displacements, vecMap);
self2.calAttractive(displacements, vecMap);
const preventComboOverlap = self2.preventComboOverlap;
if (preventComboOverlap)
self2.comboNonOverlapping(displacements, comboMap);
}
updateComboSizes(comboMap) {
const self2 = this;
const comboTrees = self2.comboTrees;
const nodeMap = self2.nodeMap;
const nodeSize = self2.nodeSize;
const comboSpacing = self2.comboSpacing;
const comboPadding = self2.comboPadding;
(comboTrees || []).forEach((ctree) => {
const treeChildren = [];
traverseTreeUp3(ctree, (treeNode) => {
if (treeNode.itemType === "node")
return true;
const c5 = comboMap[treeNode.id];
if (!c5)
return false;
const children = treeNode.children;
if (children) {
children.forEach((child) => {
if (!comboMap[child.id] && !nodeMap[child.id])
return;
treeChildren.push(child);
});
}
c5.minX = Infinity;
c5.minY = Infinity;
c5.maxX = -Infinity;
c5.maxY = -Infinity;
treeChildren.forEach((child) => {
if (child.itemType !== "node")
return true;
const node = nodeMap[child.id];
if (!node)
return true;
const r4 = nodeSize(node);
const nodeMinX = node.x - r4;
const nodeMinY = node.y - r4;
const nodeMaxX = node.x + r4;
const nodeMaxY = node.y + r4;
if (c5.minX > nodeMinX)
c5.minX = nodeMinX;
if (c5.minY > nodeMinY)
c5.minY = nodeMinY;
if (c5.maxX < nodeMaxX)
c5.maxX = nodeMaxX;
if (c5.maxY < nodeMaxY)
c5.maxY = nodeMaxY;
});
let minSize = self2.oriComboMap[treeNode.id].size || 10;
if (isArray2(minSize))
minSize = minSize[0];
const maxLength = Math.max(c5.maxX - c5.minX, c5.maxY - c5.minY, minSize);
c5.r = maxLength / 2 + comboSpacing(c5) / 2 + comboPadding(c5);
return true;
});
});
}
comboNonOverlapping(displacements, comboMap) {
const self2 = this;
const comboTree = self2.comboTree;
const comboCollideStrength = self2.comboCollideStrength;
const indexMap = self2.indexMap;
const nodeMap = self2.nodeMap;
traverseTreeUp3(comboTree, (treeNode) => {
if (!comboMap[treeNode.id] && !nodeMap[treeNode.id] && treeNode.id !== "comboTreeRoot") {
return false;
}
const children = treeNode.children;
if (children && children.length > 1) {
children.forEach((v3, i4) => {
if (v3.itemType === "node")
return false;
const cv = comboMap[v3.id];
if (!cv)
return;
children.forEach((u3, j4) => {
if (i4 <= j4)
return false;
if (u3.itemType === "node")
return false;
const cu = comboMap[u3.id];
if (!cu)
return false;
const vx = cv.cx - cu.cx || 5e-3;
const vy = cv.cy - cu.cy || 5e-3;
const l4 = vx * vx + vy * vy;
const rv = cv.r || 1;
const ru = cu.r || 1;
const r4 = rv + ru;
const ru2 = ru * ru;
const rv2 = rv * rv;
if (l4 < r4 * r4) {
const vnodes = v3.children;
if (!vnodes || vnodes.length === 0)
return false;
const unodes = u3.children;
if (!unodes || unodes.length === 0)
return false;
const sqrtl = Math.sqrt(l4);
const ll = (r4 - sqrtl) / sqrtl * comboCollideStrength;
const xl = vx * ll;
const yl = vy * ll;
const rratio = ru2 / (rv2 + ru2);
const irratio = 1 - rratio;
vnodes.forEach((vn) => {
if (vn.itemType !== "node")
return false;
if (!nodeMap[vn.id])
return;
const vindex = indexMap[vn.id];
unodes.forEach((un2) => {
if (un2.itemType !== "node")
return false;
if (!nodeMap[un2.id])
return false;
const uindex = indexMap[un2.id];
displacements[vindex].x += xl * rratio;
displacements[vindex].y += yl * rratio;
displacements[uindex].x -= xl * irratio;
displacements[uindex].y -= yl * irratio;
});
});
}
});
});
}
return true;
});
}
calRepulsive(displacements, vecMap) {
const self2 = this;
const nodes = self2.nodes;
const max8 = self2.width * self2.optimizeRangeFactor;
const nodeStrength = self2.nodeStrength;
const alpha = self2.alpha;
const nodeCollideStrength = self2.nodeCollideStrength;
const preventNodeOverlap = self2.preventNodeOverlap;
const nodeSizeFunc = self2.nodeSize;
const nodeSpacingFunc = self2.nodeSpacing;
const scale12 = self2.depthRepulsiveForceScale;
const center2 = self2.center;
nodes.forEach((v3, i4) => {
if (!v3.x || !v3.y)
return;
if (center2) {
const gravity = self2.gravity;
const vecX = v3.x - center2[0] || 5e-3;
const vecY = v3.y - center2[1] || 5e-3;
const l4 = Math.sqrt(vecX * vecX + vecY * vecY);
displacements[i4].x -= vecX * gravity * alpha / l4;
displacements[i4].y -= vecY * gravity * alpha / l4;
}
nodes.forEach((u3, j4) => {
if (i4 === j4) {
return;
}
if (!u3.x || !u3.y)
return;
const { vl2, vl } = vecMap[`${v3.id}-${u3.id}`];
if (vl > max8)
return;
const { vx, vy } = vecMap[`${v3.id}-${u3.id}`];
let depthDiff = Math.log(Math.abs(u3.depth - v3.depth) / 10) + 1 || 1;
depthDiff = depthDiff < 1 ? 1 : depthDiff;
if (u3.comboId !== v3.comboId)
depthDiff += 1;
const depthParam = depthDiff ? Math.pow(scale12, depthDiff) : 1;
const params = nodeStrength(u3) * alpha / vl2 * depthParam;
displacements[i4].x += vx * params;
displacements[i4].y += vy * params;
if (i4 < j4 && preventNodeOverlap) {
const ri = nodeSizeFunc(v3) + nodeSpacingFunc(v3) || 1;
const rj = nodeSizeFunc(u3) + nodeSpacingFunc(u3) || 1;
const r4 = ri + rj;
if (vl2 < r4 * r4) {
const ll = (r4 - vl) / vl * nodeCollideStrength;
const rj2 = rj * rj;
let rratio = rj2 / (ri * ri + rj2);
const xl = vx * ll;
const yl = vy * ll;
displacements[i4].x += xl * rratio;
displacements[i4].y += yl * rratio;
rratio = 1 - rratio;
displacements[j4].x -= xl * rratio;
displacements[j4].y -= yl * rratio;
}
}
});
});
}
calAttractive(displacements, vecMap) {
const self2 = this;
const edges = self2.edges;
const linkDistance = self2.linkDistance;
const alpha = self2.alpha;
const edgeStrength = self2.edgeStrength;
const bias = self2.bias;
const scale12 = self2.depthAttractiveForceScale;
edges.forEach((e4, i4) => {
const source = getEdgeTerminal(e4, "source");
const target = getEdgeTerminal(e4, "target");
if (!source || !target || source === target)
return;
const uIndex = self2.indexMap[source];
const vIndex = self2.indexMap[target];
const u3 = self2.nodeMap[source];
const v3 = self2.nodeMap[target];
if (!u3 || !v3)
return;
let depthDiff = u3.depth === v3.depth ? 0 : Math.log(Math.abs(u3.depth - v3.depth) / 10);
if (u3.comboId === v3.comboId) {
depthDiff = depthDiff / 2;
}
let depthParam = depthDiff ? Math.pow(scale12, depthDiff) : 1;
if (u3.comboId !== v3.comboId && depthParam === 1) {
depthParam = scale12 / 2;
} else if (u3.comboId === v3.comboId) {
depthParam = 2;
}
if (!isNumber3(v3.x) || !isNumber3(u3.x) || !isNumber3(v3.y) || !isNumber3(u3.y)) {
return;
}
const { vl, vx, vy } = vecMap[`${target}-${source}`];
const l4 = (vl - linkDistance(e4)) / vl * alpha * edgeStrength(e4) * depthParam;
const vecX = vx * l4;
const vecY = vy * l4;
const b10 = bias[i4];
displacements[vIndex].x -= vecX * b10;
displacements[vIndex].y -= vecY * b10;
displacements[uIndex].x += vecX * (1 - b10);
displacements[uIndex].y += vecY * (1 - b10);
});
}
getType() {
return "comboForce";
}
};
// node_modules/@antv/layout/es/layout/forceAtlas2/body.js
var Body = class {
constructor(params) {
this.id = params.id || 0;
this.rx = params.rx;
this.ry = params.ry;
this.fx = 0;
this.fy = 0;
this.mass = params.mass;
this.degree = params.degree;
this.g = params.g || 0;
}
distanceTo(bo) {
const dx = this.rx - bo.rx;
const dy = this.ry - bo.ry;
return Math.hypot(dx, dy);
}
setPos(x6, y5) {
this.rx = x6;
this.ry = y5;
}
resetForce() {
this.fx = 0;
this.fy = 0;
}
addForce(b10) {
const dx = b10.rx - this.rx;
const dy = b10.ry - this.ry;
let dist4 = Math.hypot(dx, dy);
dist4 = dist4 < 1e-4 ? 1e-4 : dist4;
const F3 = this.g * (this.degree + 1) * (b10.degree + 1) / dist4;
this.fx += F3 * dx / dist4;
this.fy += F3 * dy / dist4;
}
in(quad) {
return quad.contains(this.rx, this.ry);
}
add(bo) {
const nenwMass = this.mass + bo.mass;
const x6 = (this.rx * this.mass + bo.rx * bo.mass) / nenwMass;
const y5 = (this.ry * this.mass + bo.ry * bo.mass) / nenwMass;
const dg = this.degree + bo.degree;
const params = {
rx: x6,
ry: y5,
mass: nenwMass,
degree: dg
};
return new Body(params);
}
};
// node_modules/@antv/layout/es/layout/forceAtlas2/quad.js
var Quad = class {
constructor(params) {
this.xmid = params.xmid;
this.ymid = params.ymid;
this.length = params.length;
this.massCenter = params.massCenter || [0, 0];
this.mass = params.mass || 1;
}
getLength() {
return this.length;
}
contains(x6, y5) {
const halfLen = this.length / 2;
return x6 <= this.xmid + halfLen && x6 >= this.xmid - halfLen && y5 <= this.ymid + halfLen && y5 >= this.ymid - halfLen;
}
NW() {
const x6 = this.xmid - this.length / 4;
const y5 = this.ymid + this.length / 4;
const len5 = this.length / 2;
const params = {
xmid: x6,
ymid: y5,
length: len5
};
const NW = new Quad(params);
return NW;
}
NE() {
const x6 = this.xmid + this.length / 4;
const y5 = this.ymid + this.length / 4;
const len5 = this.length / 2;
const params = {
xmid: x6,
ymid: y5,
length: len5
};
const NE = new Quad(params);
return NE;
}
SW() {
const x6 = this.xmid - this.length / 4;
const y5 = this.ymid - this.length / 4;
const len5 = this.length / 2;
const params = {
xmid: x6,
ymid: y5,
length: len5
};
const SW = new Quad(params);
return SW;
}
SE() {
const x6 = this.xmid + this.length / 4;
const y5 = this.ymid - this.length / 4;
const len5 = this.length / 2;
const params = {
xmid: x6,
ymid: y5,
length: len5
};
const SE = new Quad(params);
return SE;
}
};
// node_modules/@antv/layout/es/layout/forceAtlas2/quadTree.js
var QuadTree = class {
constructor(param) {
this.body = null;
this.quad = null;
this.NW = null;
this.NE = null;
this.SW = null;
this.SE = null;
this.theta = 0.5;
if (param != null)
this.quad = param;
}
insert(bo) {
if (this.body == null) {
this.body = bo;
return;
}
if (!this._isExternal()) {
this.body = this.body.add(bo);
this._putBody(bo);
} else {
if (this.quad) {
this.NW = new QuadTree(this.quad.NW());
this.NE = new QuadTree(this.quad.NE());
this.SW = new QuadTree(this.quad.SW());
this.SE = new QuadTree(this.quad.SE());
}
this._putBody(this.body);
this._putBody(bo);
this.body = this.body.add(bo);
}
}
_putBody(bo) {
if (!this.quad)
return;
if (bo.in(this.quad.NW()) && this.NW)
this.NW.insert(bo);
else if (bo.in(this.quad.NE()) && this.NE)
this.NE.insert(bo);
else if (bo.in(this.quad.SW()) && this.SW)
this.SW.insert(bo);
else if (bo.in(this.quad.SE()) && this.SE)
this.SE.insert(bo);
}
_isExternal() {
return this.NW == null && this.NE == null && this.SW == null && this.SE == null;
}
updateForce(bo) {
if (this.body == null || bo === this.body) {
return;
}
if (this._isExternal())
bo.addForce(this.body);
else {
const s4 = this.quad ? this.quad.getLength() : 0;
const d3 = this.body.distanceTo(bo);
if (s4 / d3 < this.theta)
bo.addForce(this.body);
else {
this.NW && this.NW.updateForce(bo);
this.NE && this.NE.updateForce(bo);
this.SW && this.SW.updateForce(bo);
this.SE && this.SE.updateForce(bo);
}
}
}
};
// node_modules/@antv/layout/es/layout/forceAtlas2/index.js
var ForceAtlas2Layout = class extends Base3 {
constructor(options) {
super();
this.center = [0, 0];
this.width = 300;
this.height = 300;
this.nodes = [];
this.edges = [];
this.kr = 5;
this.kg = 1;
this.mode = "normal";
this.preventOverlap = false;
this.dissuadeHubs = false;
this.barnesHut = void 0;
this.maxIteration = 0;
this.ks = 0.1;
this.ksmax = 10;
this.tao = 0.1;
this.onLayoutEnd = () => {
};
this.prune = void 0;
this.updateCfg(options);
}
getDefaultCfg() {
return {};
}
execute() {
const self2 = this;
const { nodes, onLayoutEnd, prune } = self2;
let maxIteration = self2.maxIteration;
if (!self2.width && typeof window !== "undefined") {
self2.width = window.innerWidth;
}
if (!self2.height && typeof window !== "undefined") {
self2.height = window.innerHeight;
}
const sizes = [];
const nodeNum = nodes.length;
for (let i4 = 0; i4 < nodeNum; i4 += 1) {
const node = nodes[i4];
let nodeWidth = 10;
let nodeHeight = 10;
if (isNumber3(node.size)) {
nodeWidth = node.size;
nodeHeight = node.size;
}
if (isArray2(node.size)) {
if (!isNaN(node.size[0]))
nodeWidth = node.size[0];
if (!isNaN(node.size[1]))
nodeHeight = node.size[1];
} else if (isObject2(node.size)) {
nodeWidth = node.size.width;
nodeHeight = node.size.height;
}
if (self2.getWidth && !isNaN(self2.getWidth(node)))
nodeHeight = self2.getWidth(node);
if (self2.getHeight && !isNaN(self2.getHeight(node)))
nodeWidth = self2.getHeight(node);
const maxSize = Math.max(nodeWidth, nodeHeight);
sizes.push(maxSize);
}
if (self2.barnesHut === void 0 && nodeNum > 250)
self2.barnesHut = true;
if (self2.prune === void 0 && nodeNum > 100)
self2.prune = true;
if (this.maxIteration === 0 && !self2.prune) {
maxIteration = 250;
if (nodeNum <= 200 && nodeNum > 100)
maxIteration = 1e3;
else if (nodeNum > 200)
maxIteration = 1200;
this.maxIteration = maxIteration;
} else if (this.maxIteration === 0 && prune) {
maxIteration = 100;
if (nodeNum <= 200 && nodeNum > 100)
maxIteration = 500;
else if (nodeNum > 200)
maxIteration = 950;
this.maxIteration = maxIteration;
}
if (!self2.kr) {
self2.kr = 50;
if (nodeNum > 100 && nodeNum <= 500)
self2.kr = 20;
else if (nodeNum > 500)
self2.kr = 1;
}
if (!self2.kg) {
self2.kg = 20;
if (nodeNum > 100 && nodeNum <= 500)
self2.kg = 10;
else if (nodeNum > 500)
self2.kg = 1;
}
this.nodes = self2.updateNodesByForces(sizes);
onLayoutEnd();
}
updateNodesByForces(sizes) {
const self2 = this;
const { edges, maxIteration } = self2;
let nodes = self2.nodes;
const nonLoopEdges = edges.filter((edge2) => {
const source = getEdgeTerminal(edge2, "source");
const target = getEdgeTerminal(edge2, "target");
return source !== target;
});
const size2 = nodes.length;
const esize = nonLoopEdges.length;
const degrees = [];
const idMap = {};
const edgeEndsIdMap = {};
const Es = [];
for (let i4 = 0; i4 < size2; i4 += 1) {
idMap[nodes[i4].id] = i4;
degrees[i4] = 0;
if (nodes[i4].x === void 0 || isNaN(nodes[i4].x)) {
nodes[i4].x = Math.random() * 1e3;
}
if (nodes[i4].y === void 0 || isNaN(nodes[i4].y)) {
nodes[i4].y = Math.random() * 1e3;
}
Es.push({ x: nodes[i4].x, y: nodes[i4].y });
}
for (let i4 = 0; i4 < esize; i4 += 1) {
let node1;
let node2;
let sIdx = 0;
let tIdx = 0;
for (let j4 = 0; j4 < size2; j4 += 1) {
const source = getEdgeTerminal(nonLoopEdges[i4], "source");
const target = getEdgeTerminal(nonLoopEdges[i4], "target");
if (nodes[j4].id === source) {
node1 = nodes[j4];
sIdx = j4;
} else if (nodes[j4].id === target) {
node2 = nodes[j4];
tIdx = j4;
}
edgeEndsIdMap[i4] = { sourceIdx: sIdx, targetIdx: tIdx };
}
if (node1)
degrees[idMap[node1.id]] += 1;
if (node2)
degrees[idMap[node2.id]] += 1;
}
let iteration = maxIteration;
nodes = this.iterate(iteration, idMap, edgeEndsIdMap, esize, degrees, sizes);
if (self2.prune) {
for (let j4 = 0; j4 < esize; j4 += 1) {
if (degrees[edgeEndsIdMap[j4].sourceIdx] <= 1) {
nodes[edgeEndsIdMap[j4].sourceIdx].x = nodes[edgeEndsIdMap[j4].targetIdx].x;
nodes[edgeEndsIdMap[j4].sourceIdx].y = nodes[edgeEndsIdMap[j4].targetIdx].y;
} else if (degrees[edgeEndsIdMap[j4].targetIdx] <= 1) {
nodes[edgeEndsIdMap[j4].targetIdx].x = nodes[edgeEndsIdMap[j4].sourceIdx].x;
nodes[edgeEndsIdMap[j4].targetIdx].y = nodes[edgeEndsIdMap[j4].sourceIdx].y;
}
}
self2.prune = false;
self2.barnesHut = false;
iteration = 100;
nodes = this.iterate(iteration, idMap, edgeEndsIdMap, esize, degrees, sizes);
}
return nodes;
}
iterate(iteration, idMap, edgeEndsIdMap, esize, degrees, sizes) {
const self2 = this;
let { nodes } = self2;
const { kr, preventOverlap } = self2;
const { barnesHut } = self2;
const nodeNum = nodes.length;
let sg = 0;
const krPrime = 100;
let iter = iteration;
const prevoIter = 50;
let forces = [];
const preForces = [];
const bodies = [];
for (let i4 = 0; i4 < nodeNum; i4 += 1) {
forces[2 * i4] = 0;
forces[2 * i4 + 1] = 0;
if (barnesHut) {
const params = {
id: i4,
rx: nodes[i4].x,
ry: nodes[i4].y,
mass: 1,
g: kr,
degree: degrees[i4]
};
bodies[i4] = new Body(params);
}
}
while (iter > 0) {
for (let i4 = 0; i4 < nodeNum; i4 += 1) {
preForces[2 * i4] = forces[2 * i4];
preForces[2 * i4 + 1] = forces[2 * i4 + 1];
forces[2 * i4] = 0;
forces[2 * i4 + 1] = 0;
}
forces = this.getAttrForces(iter, prevoIter, esize, idMap, edgeEndsIdMap, degrees, sizes, forces);
if (barnesHut && (preventOverlap && iter > prevoIter || !preventOverlap)) {
forces = this.getOptRepGraForces(forces, bodies, degrees);
} else {
forces = this.getRepGraForces(iter, prevoIter, forces, krPrime, sizes, degrees);
}
const res = this.updatePos(forces, preForces, sg, degrees);
nodes = res.nodes;
sg = res.sg;
iter--;
if (self2.tick)
self2.tick();
}
return nodes;
}
getAttrForces(iter, prevoIter, esize, idMap, edgeEndsIdMap, degrees, sizes, forces) {
const self2 = this;
const { nodes, preventOverlap, dissuadeHubs, mode, prune } = self2;
for (let i4 = 0; i4 < esize; i4 += 1) {
const sourceNode = nodes[edgeEndsIdMap[i4].sourceIdx];
const sourceIdx = edgeEndsIdMap[i4].sourceIdx;
const targetNode = nodes[edgeEndsIdMap[i4].targetIdx];
const targetIdx = edgeEndsIdMap[i4].targetIdx;
if (prune && (degrees[sourceIdx] <= 1 || degrees[targetIdx] <= 1))
continue;
const dir = [targetNode.x - sourceNode.x, targetNode.y - sourceNode.y];
let eucliDis = Math.hypot(dir[0], dir[1]);
eucliDis = eucliDis < 1e-4 ? 1e-4 : eucliDis;
dir[0] = dir[0] / eucliDis;
dir[1] = dir[1] / eucliDis;
if (preventOverlap && iter < prevoIter)
eucliDis = eucliDis - sizes[sourceIdx] - sizes[targetIdx];
let Fa1 = eucliDis;
let Fa2 = Fa1;
if (mode === "linlog") {
Fa1 = Math.log(1 + eucliDis);
Fa2 = Fa1;
}
if (dissuadeHubs) {
Fa1 = eucliDis / degrees[sourceIdx];
Fa2 = eucliDis / degrees[targetIdx];
}
if (preventOverlap && iter < prevoIter && eucliDis <= 0) {
Fa1 = 0;
Fa2 = 0;
} else if (preventOverlap && iter < prevoIter && eucliDis > 0) {
Fa1 = eucliDis;
Fa2 = eucliDis;
}
forces[2 * idMap[sourceNode.id]] += Fa1 * dir[0];
forces[2 * idMap[targetNode.id]] -= Fa2 * dir[0];
forces[2 * idMap[sourceNode.id] + 1] += Fa1 * dir[1];
forces[2 * idMap[targetNode.id] + 1] -= Fa2 * dir[1];
}
return forces;
}
getRepGraForces(iter, prevoIter, forces, krPrime, sizes, degrees) {
const self2 = this;
const { nodes, preventOverlap, kr, kg, center: center2, prune } = self2;
const nodeNum = nodes.length;
for (let i4 = 0; i4 < nodeNum; i4 += 1) {
for (let j4 = i4 + 1; j4 < nodeNum; j4 += 1) {
if (prune && (degrees[i4] <= 1 || degrees[j4] <= 1))
continue;
const dir2 = [nodes[j4].x - nodes[i4].x, nodes[j4].y - nodes[i4].y];
let eucliDis2 = Math.hypot(dir2[0], dir2[1]);
eucliDis2 = eucliDis2 < 1e-4 ? 1e-4 : eucliDis2;
dir2[0] = dir2[0] / eucliDis2;
dir2[1] = dir2[1] / eucliDis2;
if (preventOverlap && iter < prevoIter)
eucliDis2 = eucliDis2 - sizes[i4] - sizes[j4];
let Fr = kr * (degrees[i4] + 1) * (degrees[j4] + 1) / eucliDis2;
if (preventOverlap && iter < prevoIter && eucliDis2 < 0) {
Fr = krPrime * (degrees[i4] + 1) * (degrees[j4] + 1);
} else if (preventOverlap && iter < prevoIter && eucliDis2 === 0) {
Fr = 0;
} else if (preventOverlap && iter < prevoIter && eucliDis2 > 0) {
Fr = kr * (degrees[i4] + 1) * (degrees[j4] + 1) / eucliDis2;
}
forces[2 * i4] -= Fr * dir2[0];
forces[2 * j4] += Fr * dir2[0];
forces[2 * i4 + 1] -= Fr * dir2[1];
forces[2 * j4 + 1] += Fr * dir2[1];
}
const dir = [nodes[i4].x - center2[0], nodes[i4].y - center2[1]];
const eucliDis = Math.hypot(dir[0], dir[1]);
dir[0] = dir[0] / eucliDis;
dir[1] = dir[1] / eucliDis;
const Fg = kg * (degrees[i4] + 1);
forces[2 * i4] -= Fg * dir[0];
forces[2 * i4 + 1] -= Fg * dir[1];
}
return forces;
}
getOptRepGraForces(forces, bodies, degrees) {
const self2 = this;
const { nodes, kg, center: center2, prune } = self2;
const nodeNum = nodes.length;
let minx = 9e10;
let maxx = -9e10;
let miny = 9e10;
let maxy = -9e10;
for (let i4 = 0; i4 < nodeNum; i4 += 1) {
if (prune && degrees[i4] <= 1)
continue;
bodies[i4].setPos(nodes[i4].x, nodes[i4].y);
if (nodes[i4].x >= maxx)
maxx = nodes[i4].x;
if (nodes[i4].x <= minx)
minx = nodes[i4].x;
if (nodes[i4].y >= maxy)
maxy = nodes[i4].y;
if (nodes[i4].y <= miny)
miny = nodes[i4].y;
}
const width2 = Math.max(maxx - minx, maxy - miny);
const quadParams = {
xmid: (maxx + minx) / 2,
ymid: (maxy + miny) / 2,
length: width2,
massCenter: center2,
mass: nodeNum
};
const quad = new Quad(quadParams);
const quadTree = new QuadTree(quad);
for (let i4 = 0; i4 < nodeNum; i4 += 1) {
if (prune && degrees[i4] <= 1)
continue;
if (bodies[i4].in(quad))
quadTree.insert(bodies[i4]);
}
for (let i4 = 0; i4 < nodeNum; i4 += 1) {
if (prune && degrees[i4] <= 1)
continue;
bodies[i4].resetForce();
quadTree.updateForce(bodies[i4]);
forces[2 * i4] -= bodies[i4].fx;
forces[2 * i4 + 1] -= bodies[i4].fy;
const dir = [nodes[i4].x - center2[0], nodes[i4].y - center2[1]];
let eucliDis = Math.hypot(dir[0], dir[1]);
eucliDis = eucliDis < 1e-4 ? 1e-4 : eucliDis;
dir[0] = dir[0] / eucliDis;
dir[1] = dir[1] / eucliDis;
const Fg = kg * (degrees[i4] + 1);
forces[2 * i4] -= Fg * dir[0];
forces[2 * i4 + 1] -= Fg * dir[1];
}
return forces;
}
updatePos(forces, preForces, sg, degrees) {
const self2 = this;
const { nodes, ks, tao, prune, ksmax } = self2;
const nodeNum = nodes.length;
const swgns = [];
const trans = [];
let swgG = 0;
let traG = 0;
for (let i4 = 0; i4 < nodeNum; i4 += 1) {
if (prune && degrees[i4] <= 1)
continue;
const minus = [
forces[2 * i4] - preForces[2 * i4],
forces[2 * i4 + 1] - preForces[2 * i4 + 1]
];
const minusNorm = Math.hypot(minus[0], minus[1]);
const add8 = [
forces[2 * i4] + preForces[2 * i4],
forces[2 * i4 + 1] + preForces[2 * i4 + 1]
];
const addNorm = Math.hypot(add8[0], add8[1]);
swgns[i4] = minusNorm;
trans[i4] = addNorm / 2;
swgG += (degrees[i4] + 1) * swgns[i4];
traG += (degrees[i4] + 1) * trans[i4];
}
const preSG = sg;
sg = tao * traG / swgG;
if (preSG !== 0) {
sg = sg > 1.5 * preSG ? 1.5 * preSG : sg;
}
for (let i4 = 0; i4 < nodeNum; i4 += 1) {
if (prune && degrees[i4] <= 1)
continue;
let sn = ks * sg / (1 + sg * Math.sqrt(swgns[i4]));
let absForce = Math.hypot(forces[2 * i4], forces[2 * i4 + 1]);
absForce = absForce < 1e-4 ? 1e-4 : absForce;
const max8 = ksmax / absForce;
sn = sn > max8 ? max8 : sn;
const dnx = sn * forces[2 * i4];
const dny = sn * forces[2 * i4 + 1];
nodes[i4].x += dnx;
nodes[i4].y += dny;
}
return { nodes, sg };
}
};
// node_modules/@antv/layout/es/layout/er/grid.js
var Grid2 = class {
constructor() {
this.cells = [];
this.columnNum = 0;
this.rowNum = 0;
this.additionColumn = [];
this.additionRow = [];
}
init(width2, height, gridSize) {
this.cells = [];
this.CELL_W = gridSize.CELL_W || Grid2.DEFAULT_CELL_W;
this.CELL_H = gridSize.CELL_H || Grid2.DEFAULT_CELL_H;
this.columnNum = Math.ceil(width2 / this.CELL_W);
this.rowNum = Math.ceil(height / this.CELL_H);
Grid2.MIN_DIST = Math.pow(width2, 2) + Math.pow(height, 2);
for (let i4 = 0; i4 < this.columnNum; i4++) {
const tmp = [];
for (let j4 = 0; j4 < this.rowNum; j4++) {
const cell = {
dx: i4,
dy: j4,
x: i4 * this.CELL_W,
y: j4 * this.CELL_H,
occupied: false
};
tmp.push(cell);
}
this.cells.push(tmp);
}
}
findGridByNodeId(nodeId) {
var _a6, _b;
for (let i4 = 0; i4 < this.columnNum; i4++) {
for (let j4 = 0; j4 < this.rowNum; j4++) {
if (this.cells[i4][j4].node) {
if (((_b = (_a6 = this.cells[i4][j4]) === null || _a6 === void 0 ? void 0 : _a6.node) === null || _b === void 0 ? void 0 : _b.id) === nodeId) {
return { column: i4, row: j4 };
}
}
}
}
return null;
}
sqdist(a4, b10) {
return Math.pow(a4.x - b10.x, 2) + Math.pow(a4.y - b10.y, 2);
}
occupyNearest(p4) {
let minDist = Grid2.MIN_DIST;
let d3;
let candidate = null;
for (let i4 = 0; i4 < this.columnNum; i4++) {
for (let j4 = 0; j4 < this.rowNum; j4++) {
if (!this.cells[i4][j4].occupied && (d3 = this.sqdist(p4, this.cells[i4][j4])) < minDist) {
minDist = d3;
candidate = this.cells[i4][j4];
}
}
}
if (candidate) {
candidate.occupied = true;
}
return candidate;
}
insertColumn(columnIndex, length5) {
if (length5 <= 0)
return;
for (let i4 = 0; i4 < length5; i4++) {
this.cells[i4 + this.columnNum] = [];
for (let j4 = 0; j4 < this.rowNum; j4++) {
this.cells[i4 + this.columnNum][j4] = {
dx: i4,
dy: j4,
x: i4 * this.CELL_W,
y: j4 * this.CELL_H,
occupied: false,
node: null
};
}
}
for (let i4 = this.columnNum - 1; i4 > columnIndex; i4--) {
for (let j4 = 0; j4 < this.rowNum; j4++) {
this.cells[i4 + length5][j4] = Object.assign(Object.assign({}, this.cells[i4][j4]), { x: (i4 + length5) * this.CELL_W, y: j4 * this.CELL_H });
this.cells[i4][j4] = {
x: i4 * this.CELL_W,
y: j4 * this.CELL_H,
occupied: true,
node: null
};
}
}
for (let j4 = 0; j4 < this.additionColumn.length; j4++) {
if (this.additionColumn[j4] >= columnIndex) {
this.additionColumn[j4] += length5;
}
}
for (let i4 = 0; i4 < length5; i4++) {
this.additionColumn.push(columnIndex + i4 + 1);
}
this.columnNum += length5;
}
insertRow(rowIndex, length5) {
if (length5 <= 0)
return;
for (let j4 = 0; j4 < length5; j4++) {
for (let i4 = 0; i4 < this.columnNum; i4++) {
this.cells[i4][j4 + this.rowNum] = {
dx: i4,
dy: j4,
x: i4 * this.CELL_W,
y: j4 * this.CELL_H,
occupied: false,
node: null
};
}
}
for (let i4 = 0; i4 < this.columnNum; i4++) {
for (let j4 = this.rowNum - 1; j4 > rowIndex; j4--) {
this.cells[i4][j4 + length5] = Object.assign(Object.assign({}, this.cells[i4][j4]), { dx: i4, dy: j4 + length5, x: i4 * this.CELL_W, y: (j4 + length5) * this.CELL_H });
this.cells[i4][j4] = {
dx: i4,
dy: j4,
x: i4 * this.CELL_W,
y: j4 * this.CELL_H,
occupied: false,
node: null
};
}
}
for (let j4 = 0; j4 < this.additionRow.length; j4++) {
if (this.additionRow[j4] >= rowIndex) {
this.additionRow[j4] += length5;
}
}
for (let i4 = 0; i4 < length5; i4++) {
this.additionRow.push(rowIndex + i4 + 1);
}
this.rowNum += length5;
}
getNodes() {
const nodes = [];
for (let i4 = 0; i4 < this.columnNum; i4++) {
for (let j4 = 0; j4 < this.rowNum; j4++) {
if (this.cells[i4][j4].node) {
nodes.push(this.cells[i4][j4]);
}
}
}
return nodes;
}
};
Grid2.MIN_DIST = 50;
Grid2.DEFAULT_CELL_W = 80;
Grid2.DEFAULT_CELL_H = 80;
// node_modules/@antv/layout/es/layout/er/forceGrid.js
function layout3(data3, options) {
if (!data3.nodes || data3.nodes.length === 0)
return data3;
const width2 = options.width;
const height = options.height;
const nodeMinGap = options.nodeMinGap;
let CELL_W2 = 1e4;
let CELL_H2 = 1e4;
data3.nodes.forEach((node) => {
const nodeWidth = node.size[0] || 50;
const nodeHeight = node.size[1] || 50;
CELL_W2 = Math.min(nodeWidth, CELL_W2);
CELL_H2 = Math.min(nodeHeight, CELL_H2);
});
const grid = new Grid2();
grid.init(width2, height, {
CELL_H: CELL_H2,
CELL_W: CELL_W2
});
data3.nodes.forEach((d3) => {
const gridpoint = grid.occupyNearest(d3);
if (gridpoint) {
gridpoint.node = {
id: d3.id,
size: d3.size
};
d3.x = gridpoint.x;
d3.y = gridpoint.y;
d3.dx = gridpoint.dx;
d3.dy = gridpoint.dy;
}
});
for (let i4 = 0; i4 < data3.nodes.length; i4++) {
const node = data3.nodes[i4];
const result = grid.findGridByNodeId(node.id);
if (!result)
throw new Error("can not find node cell");
const { column, row } = result;
if (node.size[0] + nodeMinGap > CELL_W2) {
const addGridSize = Math.ceil((node.size[0] + nodeMinGap) / CELL_W2) - 1;
let realAdd = addGridSize;
for (let j4 = 0; j4 < addGridSize; j4++) {
const hasColumn = grid.additionColumn.indexOf(column + j4 + 1) > -1;
if (hasColumn && !grid.cells[column + j4 + 1][row].node) {
realAdd--;
} else {
break;
}
}
grid.insertColumn(column, realAdd);
}
if (node.size[1] + nodeMinGap > CELL_H2) {
const addGridSize = Math.ceil((node.size[1] + nodeMinGap) / CELL_H2) - 1;
let realAdd = addGridSize;
for (let j4 = 0; j4 < addGridSize; j4++) {
const hasColumn = grid.additionRow.indexOf(row + j4 + 1) > -1;
if (hasColumn && !grid.cells[column][row + j4 + 1].node) {
realAdd--;
} else {
break;
}
}
grid.insertRow(row, realAdd);
}
}
for (let i4 = 0; i4 < grid.columnNum; i4++) {
for (let j4 = 0; j4 < grid.rowNum; j4++) {
const cell = grid.cells[i4][j4];
if (cell.node) {
const node = data3.nodes.find((node2) => {
var _a6;
return node2.id === ((_a6 = cell === null || cell === void 0 ? void 0 : cell.node) === null || _a6 === void 0 ? void 0 : _a6.id);
});
if (node) {
node.x = cell.x + node.size[0] / 2;
node.y = cell.y + node.size[1] / 2;
}
}
}
}
}
// node_modules/@antv/layout/es/layout/er/mysqlWorkbench.js
var graphWidth = 1200;
var graphHeight = 800;
var OVERLAP_QUOT = 1e7;
var MIN_DIST = 10;
var M_PI = 3.141592653589793;
var M_PI_2 = 1.5707963267948966;
var PI_38 = M_PI * 0.375;
var PI_58 = M_PI * 0.625;
var nodeEdgeMap = new Map();
var CELL_W = 10;
var CELL_H = 10;
var T4 = 0.8;
var T_MIN = 0.1;
var R2 = 0.5;
function distanceToNode(node1, node2, isHoriz) {
const x11 = node1.x - node1.size[0] / 2;
const y11 = node1.y - node1.size[1] / 2;
const x12 = node1.x + node1.size[0] / 2;
const y12 = node1.y + node1.size[1] / 2;
const x21 = node2.x - node2.size[0] / 2;
const y21 = node2.y - node2.size[1] / 2;
const x22 = node2.x + node2.size[0] / 2;
const y22 = node2.y + node2.size[1] / 2;
const cx1 = node1.x;
const cy1 = node1.y;
const cx2 = node2.x;
const cy2 = node2.y;
const dcx = cx2 - cx1;
const qr = Math.atan2(dcx, cy2 - cy1);
let dx = 0;
let dy = 0;
let l1 = 0;
let l22 = 0;
if (qr > M_PI_2) {
dy = y11 - y22;
dx = x21 - x12;
l1 = parseFloat(dy ? (dy / Math.cos(qr)).toFixed(2) : dx.toFixed(2));
l22 = parseFloat(dx ? (dx / Math.sin(qr)).toFixed(2) : dy.toFixed(2));
} else if (0 < qr && qr <= M_PI_2) {
dy = y21 - y12;
dx = x21 - x12;
if (dy > dx) {
l1 = l22 = parseFloat(dy ? (dy / Math.cos(qr)).toFixed(2) : dx.toFixed(2));
} else {
l1 = l22 = parseFloat(dx ? (dx / Math.sin(qr)).toFixed(2) : dy.toFixed(2));
}
} else if (qr < -M_PI_2) {
dy = y11 - y22;
dx = -(x22 - x11);
if (dy > dx) {
l1 = l22 = parseFloat(dy ? (dy / Math.cos(qr)).toFixed(2) : dx.toFixed(2));
} else {
l1 = l22 = parseFloat(dx ? (dx / Math.sin(qr)).toFixed(2) : dy.toFixed(2));
}
} else {
dy = y21 - y12;
if (Math.abs(dcx) > (x12 - x11) / 2) {
dx = x11 - x22;
} else {
dx = dcx;
}
if (dy > dx) {
l1 = l22 = parseFloat(dy ? (dy / Math.cos(qr)).toFixed(2) : dx.toFixed(2));
} else {
l1 = l22 = parseFloat(dx && qr !== 0 ? (dx / Math.sin(qr)).toFixed(2) : dy.toFixed(2));
}
}
const aqr = parseFloat(qr.toFixed(2));
let newHoriz = isHoriz;
if (isHoriz) {
newHoriz = PI_38 < aqr && aqr < PI_58;
}
return {
distance: Math.abs(l1 < l22 ? l1 : l22),
isHoriz: newHoriz
};
}
function calcNodePair(nodeA, nodeB) {
const edges = nodeEdgeMap.get(nodeA.id) || [];
const isLinked = edges.find((edge2) => {
return edge2.source === nodeB.id || edge2.target === nodeB.id;
});
const areaA = nodeA.size[0] * nodeA.size[1];
const areaB = nodeB.size[0] * nodeB.size[1];
const node1 = areaA > areaB ? nodeB : nodeA;
const node2 = areaA > areaB ? nodeA : nodeB;
const x11 = node1.x - node1.size[0] / 2;
const y11 = node1.y - node1.size[1] / 2;
const x12 = node1.x + node1.size[0] / 2;
const y12 = node1.y + node1.size[1] / 2;
const x21 = node2.x - node2.size[0] / 2;
const y21 = node2.y - node2.size[1] / 2;
const x22 = node2.x + node2.size[0] / 2;
const y22 = node2.y + node2.size[1] / 2;
const cx1 = node1.x;
const cy1 = node1.y;
const cx2 = node2.x;
const cy2 = node2.y;
const isoverlap = x12 >= x21 && x22 >= x11 && y12 >= y21 && y22 >= y11;
let e4 = 0;
let distance15 = 0;
if (isoverlap) {
distance15 = Math.sqrt(Math.pow(cx2 - cx1, 2) + Math.pow(cy2 - cy1, 2));
const sx1 = x11 > x21 ? x11 : x21;
const sy1 = y11 > y21 ? y11 : y21;
const sx2 = x12 < x22 ? x12 : x22;
const sy2 = y12 < y22 ? y12 : y22;
const dsx = sx2 - sx1;
const dsy = sy2 - sy1;
const sov = dsx * dsy;
if (distance15 === 0) {
distance15 = 1e-7;
}
e4 = MIN_DIST * 1 / distance15 * 100 + sov;
e4 *= OVERLAP_QUOT;
} else {
let isHoriz = false;
const res = distanceToNode(node1, node2, isHoriz);
distance15 = res.distance;
isHoriz = res.isHoriz;
if (distance15 <= MIN_DIST) {
if (distance15 !== 0) {
if (isLinked) {
e4 += MIN_DIST + OVERLAP_QUOT * 1 / distance15;
} else {
e4 += MIN_DIST + OVERLAP_QUOT * MIN_DIST / distance15;
}
} else {
e4 += OVERLAP_QUOT;
}
} else {
e4 += distance15;
if (isLinked) {
e4 += distance15 * distance15;
}
}
}
return e4;
}
function calcEnergy(nodes) {
let energy = 0;
for (let i4 = 0; i4 < nodes.length; i4++) {
const node = nodes[i4];
if (node.x < 0 || node.y < 0 || node.x > graphWidth || node.y > graphHeight) {
energy += 1e12;
}
for (let j4 = i4 + 1; j4 < nodes.length; j4++) {
energy += calcNodePair(node, nodes[j4]);
}
}
return energy;
}
function isCorrectPosition(node, newPosition, nodes, edges) {
const nodeIdxMap = new Map();
nodes.forEach((o3, i4) => {
nodeIdxMap.set(o3.id, o3);
});
const relateEdges = edges.filter((edge2) => edge2.source === node.id || edge2.target === node.id) || [];
const relateNodes = [];
relateEdges.forEach((edge2) => {
const otherNodeId = edge2.source === node.id ? edge2.target : edge2.source;
const otherNode = nodeIdxMap.get(otherNodeId);
if (otherNode) {
relateNodes.push(otherNode);
}
});
let flag = true;
for (let i4 = 0; i4 < relateNodes.length; i4++) {
const item = relateNodes[i4];
const delta = Math.atan((node.y - item.y) / (item.x - node.y)) * 180;
const newDelta = Math.atan((newPosition.y - item.y) / (item.x - newPosition.y)) * 180;
const isHor = delta < 30 || delta > 150;
const newIsHor = newDelta < 30 || newDelta > 150;
const isVer = delta > 70 && delta < 110;
const newIsVer = newDelta > 70 && newDelta < 110;
if (isHor && !newIsHor || delta * newDelta < 0) {
flag = false;
break;
} else if (isVer && !newIsVer || delta * newDelta < 0) {
flag = false;
break;
} else if ((item.x - node.x) * (item.x - newPosition.x) < 0) {
flag = false;
break;
} else if ((item.y - node.y) * (item.y - newPosition.y) < 0) {
flag = false;
break;
}
}
return flag;
}
function shuffle2(nodes, edges) {
let foundSmallerEnergy = false;
const step = 1;
const wstep = CELL_W * step;
const hstep = CELL_H * step;
const wsteps = [wstep, -wstep, 0, 0];
const hsteps = [0, 0, hstep, -hstep];
for (let i4 = 0; i4 < nodes.length; ++i4) {
const node = nodes[i4];
let nodeEnergy = calcNodeEnergy(node, nodes);
for (let ns = 0; ns < wsteps.length; ns++) {
const flag = isCorrectPosition(node, { x: node.x + wsteps[ns], y: node.y + hsteps[ns] }, nodes, edges);
if (flag) {
node.x += wsteps[ns];
node.y += hsteps[ns];
const energy = calcNodeEnergy(node, nodes);
const rdm = Math.random();
if (energy < nodeEnergy) {
nodeEnergy = energy;
foundSmallerEnergy = true;
} else if (rdm < T4 && rdm > T_MIN) {
nodeEnergy = energy;
foundSmallerEnergy = true;
} else {
node.x -= wsteps[ns];
node.y -= hsteps[ns];
}
}
}
}
if (T4 > T_MIN) {
T4 *= R2;
}
if (foundSmallerEnergy) {
return calcEnergy(nodes);
}
return 0;
}
function calcNodeEnergy(node, nodes) {
let e4 = 0;
if (node.x < 0 || node.y < 0 || node.x + node.size[0] + 20 > graphWidth || node.y + node.size[1] + 20 > graphHeight) {
e4 += 1e12;
}
for (let i4 = 0; i4 < nodes.length; ++i4) {
if (node.id !== nodes[i4].id) {
e4 += calcNodePair(node, nodes[i4]);
}
}
return e4;
}
function layout4(nodes, edges) {
if (nodes.length === 0) {
return { nodes, edges };
}
nodes.forEach((node) => {
const relateEdge = edges.filter((edge2) => edge2.source === node.id || edge2.target === node.id);
nodeEdgeMap.set(node, relateEdge);
});
nodes.sort((node1, node2) => {
var _a6, _b;
return ((_a6 = nodeEdgeMap.get(node1.id)) === null || _a6 === void 0 ? void 0 : _a6.length) - ((_b = nodeEdgeMap.get(node2.id)) === null || _b === void 0 ? void 0 : _b.length);
});
let minEnergy = calcEnergy(nodes);
let deSameCount = 20;
let de = 1;
let prevEnergy = 0;
const MAX_COUNT = 50;
let count2 = 0;
while (deSameCount > 0) {
count2++;
if (count2 >= MAX_COUNT) {
break;
}
const ea = shuffle2(nodes, edges);
if (ea !== 0) {
prevEnergy = ea;
}
de = prevEnergy - minEnergy;
minEnergy = prevEnergy;
if (de === 0) {
--deSameCount;
} else {
deSameCount = 20;
}
}
nodes.forEach((node) => {
node.x = node.x - node.size[0] / 2;
node.y = node.y - node.size[1] / 2;
});
return {
nodes,
edges
};
}
var mysqlWorkbench_default = layout4;
// node_modules/@antv/layout/es/layout/er/core.js
function layout5(data3, options) {
const { nodes, edges } = data3;
const width2 = options.width;
const height = options.height;
if (!(nodes === null || nodes === void 0 ? void 0 : nodes.length))
return Promise.resolve();
const noLeafNodes = [];
nodes.forEach((node) => {
const relateEdges = edges.filter((edge2) => {
return edge2.source === node.id || edge2.target === node.id;
});
if (relateEdges.length > 1) {
const temp = Object.assign({}, node);
delete temp.size;
noLeafNodes.push(temp);
}
});
const noLeafEdge = [];
edges.forEach((edge2) => {
const sourceNode = noLeafNodes.find((node) => node.id === edge2.source);
const targetNode = noLeafNodes.find((node) => node.id === edge2.target);
if (sourceNode && targetNode) {
noLeafEdge.push(edge2);
}
});
const graphLayout = new DagreLayout({
type: "dagre",
ranksep: options.nodeMinGap,
nodesep: options.nodeMinGap
});
const { nodes: nodesTmp } = graphLayout.layout({
nodes: noLeafNodes,
edges: noLeafEdge
});
nodes.forEach((n3) => {
const found = (nodesTmp || []).find((temp) => temp.id === n3.id);
n3.x = (found === null || found === void 0 ? void 0 : found.x) || width2 / 2;
n3.y = (found === null || found === void 0 ? void 0 : found.y) || height / 2;
});
const copyNodes = JSON.parse(JSON.stringify(nodes));
const copyEdges = JSON.parse(JSON.stringify(edges));
const simulation = simulation_default().nodes(copyNodes).force("link", link_default(copyEdges).id((d3) => d3.id).distance((d3) => {
const edgeInfo = noLeafEdge.find((edge2) => edge2.source === d3.source && edge2.target === d3.target);
if (edgeInfo) {
return 30;
}
return 20;
})).force("charge", manyBody_default()).force("center", center_default(width2 / 2, height / 2)).force("x", x_default2(width2 / 2)).force("y", y_default2(height / 2)).alpha(0.3).alphaDecay(0.08).alphaMin(1e-3);
const layoutPromise = new Promise((resolve) => {
simulation.on("end", () => {
nodes.forEach((node) => {
const nodeInfo = copyNodes.find((item) => item.id === node.id);
if (nodeInfo) {
node.x = nodeInfo.x;
node.y = nodeInfo.y;
}
});
const minX = Math.min(...nodes.map((node) => node.x));
const maxX = Math.max(...nodes.map((node) => node.x));
const minY = Math.min(...nodes.map((node) => node.y));
const maxY2 = Math.max(...nodes.map((node) => node.y));
const scalex = width2 / (maxX - minX);
const scaley = height / (maxY2 - minY);
nodes.forEach((node) => {
if (node.x !== void 0 && scalex < 1) {
node.x = (node.x - minX) * scalex;
}
if (node.y !== void 0 && scaley < 1) {
node.y = (node.y - minY) * scaley;
}
});
nodes.forEach((node) => {
node.sizeTemp = node.size;
node.size = [10, 10];
});
mysqlWorkbench_default(nodes, edges);
nodes.forEach((node) => {
node.size = node.sizeTemp || [];
delete node.sizeTemp;
});
layout3({
nodes,
edges
}, options);
resolve();
});
});
return layoutPromise;
}
// node_modules/@antv/layout/es/layout/er/index.js
var ERLayout = class extends Base3 {
constructor(options) {
super();
this.width = 300;
this.height = 300;
this.nodeMinGap = 50;
this.onLayoutEnd = () => {
};
if (options) {
this.updateCfg(options);
}
}
getDefaultCfg() {
return {
width: 300,
height: 300,
nodeMinGap: 50
};
}
execute() {
const self2 = this;
const nodes = self2.nodes;
const edges = self2.edges;
nodes === null || nodes === void 0 ? void 0 : nodes.forEach((node) => {
if (!node.size) {
node.size = [50, 50];
}
});
return layout5({
nodes,
edges
}, {
width: this.width,
height: this.height,
nodeMinGap: this.nodeMinGap
}).then(() => {
if (self2.onLayoutEnd)
self2.onLayoutEnd();
});
}
getType() {
return "er";
}
};
// node_modules/@antv/layout/es/layout/layout.js
var Layouts = {
force: ForceLayout,
fruchterman: FruchtermanLayout,
forceAtlas2: ForceAtlas2Layout,
gForce: GForceLayout,
dagre: DagreLayout,
circular: CircularLayout,
radial: RadialLayout,
concentric: ConcentricLayout,
grid: GridLayout,
mds: MDSLayout,
comboForce: ComboForceLayout,
random: RandomLayout,
"gForce-gpu": GForceGPULayout,
"fruchterman-gpu": FruchtermanGPULayout,
er: ERLayout
};
// node_modules/@antv/g6-pc/es/layout/index.js
registerLayout("grid", GridLayout);
registerLayout("random", RandomLayout);
registerLayout("force", ForceLayout);
registerLayout("circular", CircularLayout);
registerLayout("dagre", DagreLayout);
registerLayout("radial", RadialLayout);
registerLayout("concentric", ConcentricLayout);
registerLayout("mds", MDSLayout);
registerLayout("fruchterman", FruchtermanLayout);
registerLayout("fruchterman-gpu", FruchtermanGPULayout);
registerLayout("gForce", GForceLayout);
registerLayout("gForce-gpu", GForceGPULayout);
registerLayout("comboForce", ComboForceLayout);
registerLayout("forceAtlas2", ForceAtlas2Layout);
var registerLayout2 = function registerLayout3(name, layoutOverride) {
layoutOverride.isCustomLayout = true;
registerLayout(name, layoutOverride);
};
// node_modules/@antv/g6-pc/es/layout/worker/work.js
var WebWorker = function() {
function WebWorker2(worker, workerScirptURL) {
var code = worker.toString();
var blob = new Blob(["importScripts('" + workerScirptURL + "');(" + code + ")()"], {
type: "text/javascript"
});
return new Worker(URL.createObjectURL(blob));
}
return WebWorker2;
}();
var work_default = WebWorker;
// node_modules/@antv/g6-pc/es/layout/worker/layout.worker.js
var LayoutWorker = function LayoutWorker2(workerScriptURL) {
if (workerScriptURL === void 0) {
workerScriptURL = "https://unpkg.com/@antv/layout@latest/dist/layout.min.js";
}
function workerCode() {
var LAYOUT_MESSAGE3 = {
RUN: "LAYOUT_RUN",
END: "LAYOUT_END",
ERROR: "LAYOUT_ERROR",
TICK: "LAYOUT_TICK",
GPURUN: "GPU_LAYOUT_RUN",
GPUEND: "GPU_LAYOUT_END"
};
layout.registerLayout("grid", layout.GridLayout);
layout.registerLayout("random", layout.RandomLayout);
layout.registerLayout("force", layout.ForceLayout);
layout.registerLayout("circular", layout.CircularLayout);
layout.registerLayout("dagre", layout.DagreLayout);
layout.registerLayout("radial", layout.RadialLayout);
layout.registerLayout("concentric", layout.ConcentricLayout);
layout.registerLayout("mds", layout.MDSLayout);
layout.registerLayout("fruchterman", layout.FruchtermanLayout);
layout.registerLayout("fruchterman-gpu", layout.FruchtermanGPULayout);
layout.registerLayout("gForce", layout.GForceLayout);
layout.registerLayout("gForce-gpu", layout.GForceGPULayout);
layout.registerLayout("comboForce", layout.ComboForceLayout);
layout.registerLayout("forceAtlas2", layout.ForceAtlas2Layout);
function isLayoutMessage(event) {
var type2 = event.data.type;
return type2 === LAYOUT_MESSAGE3.RUN || type2 === LAYOUT_MESSAGE3.GPURUN;
}
function handleLayoutMessage(event) {
var _this = this;
var type2 = event.data.type;
switch (type2) {
case LAYOUT_MESSAGE3.RUN: {
var _a6 = event.data, nodes_1 = _a6.nodes, edges = _a6.edges, _b = _a6.layoutCfg, layoutCfg = _b === void 0 ? {} : _b;
var layoutType = layoutCfg.type;
var LayoutClass = layout.getLayoutByName(layoutType);
if (!LayoutClass) {
this.postMessage({
type: LAYOUT_MESSAGE3.ERROR,
message: "layout " + layoutType + " not found"
});
break;
}
var layoutMethod_1;
layoutCfg.onLayoutEnd = function() {
_this.postMessage({
type: LAYOUT_MESSAGE3.END,
nodes: nodes_1
});
layoutMethod_1 === null || layoutMethod_1 === void 0 ? void 0 : layoutMethod_1.destroy();
};
layoutMethod_1 = new LayoutClass(layoutCfg);
layoutMethod_1.init({
nodes: nodes_1,
edges
});
layoutMethod_1.execute();
break;
}
case LAYOUT_MESSAGE3.GPURUN: {
var _c = event.data, nodes = _c.nodes, edges = _c.edges, _d = _c.layoutCfg, layoutCfg = _d === void 0 ? {} : _d, canvas = _c.canvas;
var layoutType = layoutCfg.type;
var LayoutClass = layout.getLayoutByName(layoutType);
if (!LayoutClass) {
this.postMessage({
type: LAYOUT_MESSAGE3.ERROR,
message: "layout " + layoutType + " not found"
});
break;
}
if (layoutType.split("-")[1] !== "gpu") {
this.postMessage({
type: LAYOUT_MESSAGE3.ERROR,
message: "layout " + layoutType + " does not support GPU"
});
break;
}
var layoutMethod = new LayoutClass(layoutCfg);
layoutMethod.init({
nodes,
edges
});
layoutMethod.executeWithWorker(canvas, this);
break;
}
default:
break;
}
}
onmessage = function onmessage2(event) {
if (isLayoutMessage(event)) {
handleLayoutMessage(event);
}
};
}
var layoutWorker = new work_default(workerCode, workerScriptURL);
return layoutWorker;
};
// node_modules/@antv/g6-pc/es/layout/worker/layoutConst.js
var LAYOUT_MESSAGE2 = {
RUN: "LAYOUT_RUN",
END: "LAYOUT_END",
ERROR: "LAYOUT_ERROR",
TICK: "LAYOUT_TICK",
GPURUN: "GPU_LAYOUT_RUN",
GPUEND: "GPU_LAYOUT_END"
};
// node_modules/@antv/g6-pc/es/util/gpu.js
var gpu_exports = {};
__export(gpu_exports, {
gpuDetector: () => gpuDetector
});
var gpuDetector = function gpuDetector2() {
if (typeof window === "undefined" || typeof document === "undefined")
return {};
return {
canvas: !!window.CanvasRenderingContext2D,
webgl: function() {
try {
var canvas = document.createElement("canvas");
return !!(window.WebGLRenderingContext && (canvas.getContext("webgl") || canvas.getContext("experimental-webgl")));
} catch (e4) {
return false;
}
}(),
workers: !!window.Worker,
fileapi: window.File && window.FileReader && window.FileList && window.Blob,
getWebGLErrorMessage: function getWebGLErrorMessage() {
var element = document.createElement("div");
element.id = "webgl-error-message";
element.style.fontFamily = "monospace";
element.style.fontSize = "13px";
element.style.fontWeight = "normal";
element.style.textAlign = "center";
element.style.background = "#fff";
element.style.color = "#000";
element.style.padding = "1.5em";
element.style.width = "400px";
element.style.margin = "5em auto 0";
if (!this.webgl) {
element.innerHTML = window.WebGLRenderingContext ? ['Your graphics card does not seem to support WebGL.
', 'Find out how to get it here.'].join("\n") : ['Your browser does not seem to support WebGL.
', 'Find out how to get it here.'].join("\n");
}
return element;
},
addGetWebGLMessage: function addGetWebGLMessage(parameters) {
parameters = parameters || {};
var parent = parameters.parent !== void 0 ? parameters.parent : document.body;
var id = parameters.id !== void 0 ? parameters.id : "oldie";
var element = gpuDetector2().getWebGLErrorMessage();
element.id = id;
parent.appendChild(element);
}
};
};
// node_modules/@antv/g6-pc/es/graph/controller/layout.js
function _typeof4(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof4 = function _typeof5(obj2) {
return typeof obj2;
};
} else {
_typeof4 = function _typeof5(obj2) {
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
};
}
return _typeof4(obj);
}
var mockRaf = function mockRaf2(cb) {
return setTimeout(cb, 16);
};
var mockCaf = function mockCaf2(reqId) {
return clearTimeout(reqId);
};
var helper = {
requestAnimationFrame: function requestAnimationFrame3(callback) {
var fn2 = typeof window !== "undefined" ? window.requestAnimationFrame || window.webkitRequestAnimationFrame || mockRaf : mockRaf;
return fn2(callback);
},
cancelAnimationFrame: function cancelAnimationFrame3(requestId) {
var fn2 = typeof window !== "undefined" ? window.cancelAnimationFrame || window.webkitCancelAnimationFrame || mockCaf : mockCaf;
return fn2(requestId);
}
};
var GPULayoutNames = ["fruchterman", "gForce"];
var LayoutPipesAdjustNames = ["force", "grid", "circular"];
var LayoutController2 = function(_super) {
__extends(LayoutController3, _super);
function LayoutController3(graph) {
var _this = _super.call(this, graph) || this;
_this.graph = graph;
_this.layoutCfg = graph.get("layout") || {};
_this.layoutType = _this.getLayoutType();
_this.worker = null;
_this.workerData = {};
_this.initLayout();
return _this;
}
LayoutController3.prototype.initLayout = function() {
};
LayoutController3.prototype.getWorker = function() {
if (this.worker) {
return this.worker;
}
if (typeof Worker === "undefined") {
console.warn("Web worker is not supported in current browser.");
this.worker = null;
} else {
this.worker = LayoutWorker(this.layoutCfg.workerScriptURL);
}
return this.worker;
};
LayoutController3.prototype.stopWorker = function() {
var workerData = this.workerData;
if (!this.worker) {
return;
}
this.worker.terminate();
this.worker = null;
if (workerData.requestId) {
helper.cancelAnimationFrame(workerData.requestId);
workerData.requestId = null;
}
if (workerData.requestId2) {
helper.cancelAnimationFrame(workerData.requestId2);
workerData.requestId2 = null;
}
};
LayoutController3.prototype.execLayoutMethod = function(layoutCfg, order2) {
var _this = this;
return new Promise(function(reslove, reject) {
var graph = _this.graph;
var layoutType = layoutCfg.type;
layoutCfg.onLayoutEnd = function() {
graph.emit("aftersublayout", {
type: layoutType
});
reslove();
};
if (layoutType && _this.isGPU) {
if (!_this.hasGPUVersion(layoutType)) {
console.warn("The '" + layoutType + "' layout does not support GPU calculation for now, it will run in CPU.");
} else {
layoutType = layoutType + "-gpu";
}
}
var isForce = layoutType === "force" || layoutType === "g6force" || layoutType === "gForce";
if (isForce) {
var onTick_1 = layoutCfg.onTick;
var tick = function tick2() {
if (onTick_1) {
onTick_1();
}
graph.refreshPositions();
};
layoutCfg.tick = tick;
} else if (layoutCfg.type === "comboForce") {
layoutCfg.comboTrees = graph.get("comboTrees");
}
var enableTick = false;
var layoutMethod;
try {
layoutMethod = new Layouts[layoutType](layoutCfg);
} catch (e4) {
console.warn("The layout method: '" + layoutType + "' does not exist! Please specify it first.");
reject();
}
enableTick = layoutMethod.enableTick;
if (enableTick) {
var onTick_2 = layoutCfg.onTick;
var tick = function tick2() {
if (onTick_2) {
onTick_2();
}
graph.refreshPositions();
};
layoutMethod.tick = tick;
}
var layoutData = _this.filterLayoutData(_this.data, layoutCfg);
addLayoutOrder(layoutData, order2);
layoutMethod.init(layoutData);
graph.emit("beforesublayout", {
type: layoutType
});
layoutMethod.execute();
if (layoutMethod.isCustomLayout && layoutCfg.onLayoutEnd)
layoutCfg.onLayoutEnd();
_this.layoutMethods.push(layoutMethod);
});
};
LayoutController3.prototype.updateLayoutMethod = function(layoutMethod, layoutCfg) {
var _this = this;
return new Promise(function(reslove, reject) {
var graph = _this.graph;
var layoutType = layoutCfg === null || layoutCfg === void 0 ? void 0 : layoutCfg.type;
layoutCfg.onLayoutEnd = function() {
graph.emit("aftersublayout", {
type: layoutType
});
reslove();
};
var layoutData = _this.filterLayoutData(_this.data, layoutCfg);
layoutMethod.init(layoutData);
layoutMethod.updateCfg(layoutCfg);
graph.emit("beforesublayout", {
type: layoutType
});
layoutMethod.execute();
if (layoutMethod.isCustomLayout && layoutCfg.onLayoutEnd)
layoutCfg.onLayoutEnd();
});
};
LayoutController3.prototype.layout = function(success) {
var _this = this;
var graph = this.graph;
this.data = this.setDataFromGraph();
var _a6 = this.data, nodes = _a6.nodes, hiddenNodes = _a6.hiddenNodes;
if (!nodes) {
return false;
}
var width2 = graph.get("width");
var height = graph.get("height");
var layoutCfg = {};
Object.assign(layoutCfg, {
width: width2,
height,
center: [width2 / 2, height / 2]
}, this.layoutCfg);
this.layoutCfg = layoutCfg;
this.destoryLayoutMethods();
graph.emit("beforelayout");
this.initPositions(layoutCfg.center, nodes);
this.initPositions(layoutCfg.center, hiddenNodes);
var layoutType = layoutCfg.type;
if (layoutType && layoutType.split("-")[1] === "gpu") {
layoutType = layoutType.split("-")[0];
layoutCfg.gpuEnabled = true;
}
var enableGPU = false;
if (layoutCfg.gpuEnabled) {
enableGPU = true;
if (!gpuDetector().webgl) {
console.warn("Your browser does not support webGL or GPGPU. The layout will run in CPU.");
enableGPU = false;
}
}
this.isGPU = enableGPU;
var onLayoutEnd = layoutCfg.onLayoutEnd, layoutEndFormatted = layoutCfg.layoutEndFormatted, adjust4 = layoutCfg.adjust;
if (!layoutEndFormatted) {
layoutCfg.layoutEndFormatted = true;
layoutCfg.onAllLayoutEnd = function() {
return __awaiter(_this, void 0, void 0, function() {
return __generator(this, function(_a7) {
switch (_a7.label) {
case 0:
if (onLayoutEnd) {
onLayoutEnd();
}
this.refreshLayout();
if (!(adjust4 && layoutCfg.pipes))
return [
3,
2
];
return [
4,
this.adjustPipesBox(this.data, adjust4)
];
case 1:
_a7.sent();
this.refreshLayout();
_a7.label = 2;
case 2:
graph.emit("afterlayout");
return [
2
];
}
});
});
};
}
this.stopWorker();
if (layoutCfg.workerEnabled && this.layoutWithWorker(this.data)) {
return true;
}
var start = Promise.resolve();
if (layoutCfg.type) {
start = start.then(function() {
return _this.execLayoutMethod(layoutCfg, 0);
});
} else if (layoutCfg.pipes) {
layoutCfg.pipes.forEach(function(cfg, index2) {
start = start.then(function() {
return _this.execLayoutMethod(cfg, index2);
});
});
}
start.then(function() {
if (layoutCfg.onAllLayoutEnd)
layoutCfg.onAllLayoutEnd();
if (success)
success();
}).catch(function(error) {
console.warn("graph layout failed,", error);
});
return false;
};
LayoutController3.prototype.layoutWithWorker = function(data3) {
var _this = this;
var _a6 = this, layoutCfg = _a6.layoutCfg, graph = _a6.graph;
var worker = this.getWorker();
var workerData = this.workerData;
if (!worker) {
return false;
}
workerData.requestId = null;
workerData.requestId2 = null;
workerData.currentTick = null;
workerData.currentTickData = null;
graph.emit("beforelayout");
var start = Promise.resolve();
if (layoutCfg.type) {
start = start.then(function() {
return _this.runWebworker(worker, data3, layoutCfg);
});
} else if (layoutCfg.pipes) {
var _loop_1 = function _loop_12(cfg2) {
start = start.then(function() {
return _this.runWebworker(worker, data3, cfg2);
});
};
for (var _i = 0, _b = layoutCfg.pipes; _i < _b.length; _i++) {
var cfg = _b[_i];
_loop_1(cfg);
}
}
start.then(function() {
if (layoutCfg.onAllLayoutEnd)
layoutCfg.onAllLayoutEnd();
}).catch(function(error) {
console.error("layout failed", error);
});
return true;
};
LayoutController3.prototype.runWebworker = function(worker, allData, layoutCfg) {
var _this = this;
var isGPU = this.isGPU;
var data3 = this.filterLayoutData(allData, layoutCfg);
var nodes = data3.nodes, edges = data3.edges;
var offScreenCanvas = document.createElement("canvas");
var gpuWorkerAbility = isGPU && typeof window !== "undefined" && window.navigator && !navigator["gpu"] && "OffscreenCanvas" in window && "transferControlToOffscreen" in offScreenCanvas;
var filteredLayoutCfg = filterObject(layoutCfg, function(value2) {
return typeof value2 !== "function";
});
if (!gpuWorkerAbility) {
worker.postMessage({
type: LAYOUT_MESSAGE2.RUN,
nodes,
edges,
layoutCfg: filteredLayoutCfg
});
} else {
var offscreen = offScreenCanvas.transferControlToOffscreen();
filteredLayoutCfg.type = filteredLayoutCfg.type + "-gpu";
worker.postMessage({
type: LAYOUT_MESSAGE2.GPURUN,
nodes,
edges,
layoutCfg: filteredLayoutCfg,
canvas: offscreen
}, [offscreen]);
}
return new Promise(function(reslove, reject) {
worker.onmessage = function(event) {
_this.handleWorkerMessage(reslove, reject, event, data3, layoutCfg);
};
});
};
LayoutController3.prototype.handleWorkerMessage = function(reslove, reject, event, data3, layoutCfg) {
var _a6 = this, graph = _a6.graph, workerData = _a6.workerData;
var eventData = event.data;
var type2 = eventData.type;
var onTick = function onTick2() {
if (layoutCfg.onTick) {
layoutCfg.onTick();
}
};
switch (type2) {
case LAYOUT_MESSAGE2.TICK:
workerData.currentTick = eventData.currentTick;
workerData.currentTickData = eventData;
if (!workerData.requestId) {
workerData.requestId = helper.requestAnimationFrame(function requestId() {
updateLayoutPosition(data3, eventData);
graph.refreshPositions();
onTick();
if (eventData.currentTick === eventData.totalTicks) {
reslove();
} else if (workerData.currentTick === eventData.totalTicks) {
workerData.requestId2 = helper.requestAnimationFrame(function requestId2() {
updateLayoutPosition(data3, workerData.currentTickData);
graph.refreshPositions();
workerData.requestId2 = null;
onTick();
reslove();
});
}
workerData.requestId = null;
});
}
break;
case LAYOUT_MESSAGE2.END:
if (workerData.currentTick == null) {
updateLayoutPosition(data3, eventData);
reslove();
}
break;
case LAYOUT_MESSAGE2.GPUEND:
if (workerData.currentTick == null) {
updateGPUWorkerLayoutPosition(data3, eventData);
reslove();
}
break;
case LAYOUT_MESSAGE2.ERROR:
console.warn("Web-Worker layout error!", eventData.message);
reject();
break;
default:
reject();
break;
}
};
LayoutController3.prototype.updateLayoutCfg = function(cfg) {
var _this = this;
var _a6 = this, graph = _a6.graph, layoutMethods = _a6.layoutMethods;
var layoutCfg = mix({}, this.layoutCfg, cfg);
this.layoutCfg = layoutCfg;
if (!(layoutMethods === null || layoutMethods === void 0 ? void 0 : layoutMethods.length)) {
this.layout();
return;
}
this.data = this.setDataFromGraph();
this.stopWorker();
if (cfg.workerEnabled && this.layoutWithWorker(this.data)) {
return;
}
graph.emit("beforelayout");
var start = Promise.resolve();
if (layoutMethods.length === 1) {
start = start.then(function() {
return _this.updateLayoutMethod(layoutMethods[0], layoutCfg);
});
} else {
layoutMethods === null || layoutMethods === void 0 ? void 0 : layoutMethods.forEach(function(layoutMethod, index2) {
var currentCfg = layoutCfg.pipes[index2];
start = start.then(function() {
return _this.updateLayoutMethod(layoutMethod, currentCfg);
});
});
}
start.then(function() {
if (layoutCfg.onAllLayoutEnd)
layoutCfg.onAllLayoutEnd();
}).catch(function(error) {
console.warn("layout failed", error);
});
};
LayoutController3.prototype.adjustPipesBox = function(data3, adjust4) {
var _this = this;
return new Promise(function(resolve) {
var nodes = data3.nodes;
if (!(nodes === null || nodes === void 0 ? void 0 : nodes.length)) {
resolve();
}
if (!LayoutPipesAdjustNames.includes(adjust4)) {
console.warn("The adjust type " + adjust4 + " is not supported yet, please assign it with 'force', 'grid', or 'circular'.");
resolve();
}
var layoutCfg = {
center: _this.layoutCfg.center,
nodeSize: function nodeSize(d3) {
return Math.max(d3.height, d3.width);
},
preventOverlap: true,
onLayoutEnd: function onLayoutEnd() {
}
};
var _a6 = _this.getLayoutBBox(nodes), groupNodes = _a6.groupNodes, layoutNodes2 = _a6.layoutNodes;
var preNodes = clone_default(layoutNodes2);
layoutCfg.onLayoutEnd = function() {
layoutNodes2 === null || layoutNodes2 === void 0 ? void 0 : layoutNodes2.forEach(function(ele, index2) {
var _a7, _b, _c;
var dx = ele.x - ((_a7 = preNodes[index2]) === null || _a7 === void 0 ? void 0 : _a7.x);
var dy = ele.y - ((_b = preNodes[index2]) === null || _b === void 0 ? void 0 : _b.y);
(_c = groupNodes[index2]) === null || _c === void 0 ? void 0 : _c.forEach(function(n3) {
n3.x += dx;
n3.y += dy;
});
});
resolve();
};
var layoutMethod = new Layouts[adjust4](layoutCfg);
layoutMethod.layout({
nodes: layoutNodes2
});
});
};
LayoutController3.prototype.hasGPUVersion = function(layoutName) {
var length5 = GPULayoutNames.length;
for (var i4 = 0; i4 < length5; i4++) {
if (GPULayoutNames[i4] === layoutName)
return true;
}
return false;
};
LayoutController3.prototype.destroy = function() {
this.destoryLayoutMethods();
var worker = this.worker;
if (worker) {
worker.terminate();
this.worker = null;
}
this.destroyed = true;
this.graph.set("layout", void 0);
this.layoutCfg = void 0;
this.layoutType = void 0;
this.layoutMethods = void 0;
this.graph = null;
};
return LayoutController3;
}(layout_default);
var layout_default3 = LayoutController2;
function updateLayoutPosition(data3, layoutData) {
var nodes = data3.nodes;
var layoutNodes2 = layoutData.nodes;
var nodeLength = nodes.length;
for (var i4 = 0; i4 < nodeLength; i4++) {
var node = nodes[i4];
node.x = layoutNodes2[i4].x;
node.y = layoutNodes2[i4].y;
}
}
function filterObject(collection, callback) {
var result = {};
if (collection && _typeof4(collection) === "object") {
Object.keys(collection).forEach(function(key) {
if (collection.hasOwnProperty(key) && callback(collection[key])) {
result[key] = collection[key];
}
});
return result;
}
return collection;
}
function updateGPUWorkerLayoutPosition(data3, layoutData) {
var nodes = data3.nodes;
var vertexEdgeData = layoutData.vertexEdgeData;
var nodeLength = nodes.length;
for (var i4 = 0; i4 < nodeLength; i4++) {
var node = nodes[i4];
var x6 = vertexEdgeData[4 * i4];
var y5 = vertexEdgeData[4 * i4 + 1];
node.x = x6;
node.y = y5;
}
}
function addLayoutOrder(data3, order2) {
var _a6;
if (!((_a6 = data3 === null || data3 === void 0 ? void 0 : data3.nodes) === null || _a6 === void 0 ? void 0 : _a6.length)) {
return;
}
var nodes = data3.nodes;
nodes.forEach(function(node) {
node.layoutOrder = order2;
});
}
// node_modules/@antv/g6-pc/es/graph/graph.js
var transform13 = ext_exports3.transform;
var SVG2 = "svg";
var Graph9 = function(_super) {
__extends(Graph10, _super);
function Graph10(cfg) {
var _this = _super.call(this, cfg) || this;
var defaultNode = _this.get("defaultNode");
if (!defaultNode) {
_this.set("defaultNode", {
type: "circle"
});
}
if (!defaultNode.type) {
defaultNode.type = "circle";
_this.set("defaultNode", defaultNode);
}
_this.destroyed = false;
return _this;
}
Graph10.prototype.initLayoutController = function() {
var layoutController = new layout_default3(this);
this.set({
layoutController
});
};
Graph10.prototype.initEventController = function() {
var eventController = new event_default3(this);
this.set({
eventController
});
};
Graph10.prototype.initCanvas = function() {
var container2 = this.get("container");
if (typeof container2 === "string") {
container2 = document.getElementById(container2);
this.set("container", container2);
}
if (!container2) {
throw new Error("invalid container");
}
var width2 = this.get("width");
var height = this.get("height");
var renderer = this.get("renderer");
var canvas;
if (renderer === SVG2) {
canvas = new canvas_default3({
container: container2,
width: width2,
height
});
} else {
var canvasCfg = {
container: container2,
width: width2,
height
};
var pixelRatio = this.get("pixelRatio");
if (pixelRatio) {
canvasCfg.pixelRatio = pixelRatio;
}
canvas = new canvas_default2(canvasCfg);
}
this.set("canvas", canvas);
};
Graph10.prototype.initPlugins = function() {
var self2 = this;
each_default(self2.get("plugins"), function(plugin) {
if (!plugin.destroyed && plugin.initPlugin) {
plugin.initPlugin(self2);
}
});
};
Graph10.prototype.toDataURL = function(type2, backgroundColor) {
var canvas = this.get("canvas");
var renderer = canvas.getRenderer();
var canvasDom = canvas.get("el");
if (!type2)
type2 = "image/png";
var dataURL = "";
if (renderer === "svg") {
var cloneNode = canvasDom.cloneNode(true);
var svgDocType = document.implementation.createDocumentType("svg", "-//W3C//DTD SVG 1.1//EN", "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd");
var svgDoc = document.implementation.createDocument("http://www.w3.org/2000/svg", "svg", svgDocType);
svgDoc.replaceChild(cloneNode, svgDoc.documentElement);
var svgData = new XMLSerializer().serializeToString(svgDoc);
dataURL = "data:image/svg+xml;charset=utf8," + encodeURIComponent(svgData);
} else {
var imageData = void 0;
var context = canvasDom.getContext("2d");
var width2 = this.get("width");
var height = this.get("height");
var compositeOperation = void 0;
if (backgroundColor) {
var pixelRatio = typeof window !== "undefined" ? window.devicePixelRatio : 1;
imageData = context.getImageData(0, 0, width2 * pixelRatio, height * pixelRatio);
compositeOperation = context.globalCompositeOperation;
context.globalCompositeOperation = "destination-over";
context.fillStyle = backgroundColor;
context.fillRect(0, 0, width2, height);
}
dataURL = canvasDom.toDataURL(type2);
if (backgroundColor) {
context.clearRect(0, 0, width2, height);
context.putImageData(imageData, 0, 0);
context.globalCompositeOperation = compositeOperation;
}
}
return dataURL;
};
Graph10.prototype.toFullDataURL = function(callback, type2, imageConfig) {
var bbox = this.get("group").getCanvasBBox();
var height = bbox.height;
var width2 = bbox.width;
var renderer = this.get("renderer");
var vContainerDOM = createDom('');
var backgroundColor = imageConfig ? imageConfig.backgroundColor : void 0;
var padding3 = imageConfig ? imageConfig.padding : void 0;
if (!padding3)
padding3 = [0, 0, 0, 0];
else if (is_number_default(padding3))
padding3 = [padding3, padding3, padding3, padding3];
var vHeight = height + padding3[0] + padding3[2];
var vWidth = width2 + padding3[1] + padding3[3];
var canvasOptions = {
container: vContainerDOM,
height: vHeight,
width: vWidth,
quickHit: true
};
var vCanvas = renderer === "svg" ? new canvas_default3(canvasOptions) : new canvas_default2(canvasOptions);
var group2 = this.get("group");
var vGroup = group2.clone();
var matrix = clone_default(vGroup.getMatrix());
if (!matrix)
matrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
var centerX = (bbox.maxX + bbox.minX) / 2;
var centerY = (bbox.maxY + bbox.minY) / 2;
matrix = transform13(matrix, [["t", -centerX, -centerY], ["t", width2 / 2 + padding3[3], height / 2 + padding3[0]]]);
vGroup.resetMatrix();
vGroup.setMatrix(matrix);
vCanvas.add(vGroup);
var vCanvasEl = vCanvas.get("el");
var dataURL = "";
if (!type2)
type2 = "image/png";
setTimeout(function() {
if (renderer === "svg") {
var cloneNode = vCanvasEl.cloneNode(true);
var svgDocType = document.implementation.createDocumentType("svg", "-//W3C//DTD SVG 1.1//EN", "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd");
var svgDoc = document.implementation.createDocument("http://www.w3.org/2000/svg", "svg", svgDocType);
svgDoc.replaceChild(cloneNode, svgDoc.documentElement);
var svgData = new XMLSerializer().serializeToString(svgDoc);
dataURL = "data:image/svg+xml;charset=utf8," + encodeURIComponent(svgData);
} else {
var imageData = void 0;
var context = vCanvasEl.getContext("2d");
var compositeOperation = void 0;
if (backgroundColor) {
var pixelRatio = typeof window !== "undefined" ? window.devicePixelRatio : 1;
imageData = context.getImageData(0, 0, vWidth * pixelRatio, vHeight * pixelRatio);
compositeOperation = context.globalCompositeOperation;
context.globalCompositeOperation = "destination-over";
context.fillStyle = backgroundColor;
context.fillRect(0, 0, vWidth, vHeight);
}
dataURL = vCanvasEl.toDataURL(type2);
if (backgroundColor) {
context.clearRect(0, 0, vWidth, vHeight);
context.putImageData(imageData, 0, 0);
context.globalCompositeOperation = compositeOperation;
}
}
if (callback)
callback(dataURL);
}, 16);
};
Graph10.prototype.downloadFullImage = function(name, type2, imageConfig) {
var _this = this;
var bbox = this.get("group").getCanvasBBox();
var height = bbox.height;
var width2 = bbox.width;
var renderer = this.get("renderer");
var vContainerDOM = createDom('');
var backgroundColor = imageConfig ? imageConfig.backgroundColor : void 0;
var padding3 = imageConfig ? imageConfig.padding : void 0;
if (!padding3)
padding3 = [0, 0, 0, 0];
else if (is_number_default(padding3))
padding3 = [padding3, padding3, padding3, padding3];
var vHeight = height + padding3[0] + padding3[2];
var vWidth = width2 + padding3[1] + padding3[3];
var canvasOptions = {
container: vContainerDOM,
height: vHeight,
width: vWidth
};
var vCanvas = renderer === "svg" ? new canvas_default3(canvasOptions) : new canvas_default2(canvasOptions);
var group2 = this.get("group");
var vGroup = group2.clone();
var matrix = clone_default(vGroup.getMatrix());
if (!matrix)
matrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
var centerX = (bbox.maxX + bbox.minX) / 2;
var centerY = (bbox.maxY + bbox.minY) / 2;
matrix = transform13(matrix, [["t", -centerX, -centerY], ["t", width2 / 2 + padding3[3], height / 2 + padding3[0]]]);
vGroup.resetMatrix();
vGroup.setMatrix(matrix);
vCanvas.add(vGroup);
var vCanvasEl = vCanvas.get("el");
if (!type2)
type2 = "image/png";
setTimeout(function() {
var dataURL = "";
if (renderer === "svg") {
var cloneNode = vCanvasEl.cloneNode(true);
var svgDocType = document.implementation.createDocumentType("svg", "-//W3C//DTD SVG 1.1//EN", "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd");
var svgDoc = document.implementation.createDocument("http://www.w3.org/2000/svg", "svg", svgDocType);
svgDoc.replaceChild(cloneNode, svgDoc.documentElement);
var svgData = new XMLSerializer().serializeToString(svgDoc);
dataURL = "data:image/svg+xml;charset=utf8," + encodeURIComponent(svgData);
} else {
var imageData = void 0;
var context = vCanvasEl.getContext("2d");
var compositeOperation = void 0;
if (backgroundColor) {
var pixelRatio = typeof window !== "undefined" ? window.devicePixelRatio : 1;
imageData = context.getImageData(0, 0, vWidth * pixelRatio, vHeight * pixelRatio);
compositeOperation = context.globalCompositeOperation;
context.globalCompositeOperation = "destination-over";
context.fillStyle = backgroundColor;
context.fillRect(0, 0, vWidth, vHeight);
}
dataURL = vCanvasEl.toDataURL(type2);
if (backgroundColor) {
context.clearRect(0, 0, vWidth, vHeight);
context.putImageData(imageData, 0, 0);
context.globalCompositeOperation = compositeOperation;
}
}
var link = document.createElement("a");
var fileName = (name || "graph") + (renderer === "svg" ? ".svg" : "." + type2.split("/")[1]);
_this.dataURLToImage(dataURL, renderer, link, fileName);
var e4 = document.createEvent("MouseEvents");
e4.initEvent("click", false, false);
link.dispatchEvent(e4);
}, 16);
};
Graph10.prototype.downloadImage = function(name, type2, backgroundColor) {
var _this = this;
var self2 = this;
if (self2.isAnimating()) {
self2.stopAnimate();
}
var canvas = self2.get("canvas");
var renderer = canvas.getRenderer();
if (!type2)
type2 = "image/png";
var fileName = (name || "graph") + (renderer === "svg" ? ".svg" : type2.split("/")[1]);
var link = document.createElement("a");
setTimeout(function() {
var dataURL = self2.toDataURL(type2, backgroundColor);
_this.dataURLToImage(dataURL, renderer, link, fileName);
var e4 = document.createEvent("MouseEvents");
e4.initEvent("click", false, false);
link.dispatchEvent(e4);
}, 16);
};
Graph10.prototype.dataURLToImage = function(dataURL, renderer, link, fileName) {
if (typeof window !== "undefined") {
if (window.Blob && window.URL && renderer !== "svg") {
var arr = dataURL.split(",");
var mime = "";
if (arr && arr.length > 0) {
var match = arr[0].match(/:(.*?);/);
if (match && match.length >= 2)
mime = match[1];
}
var bstr = atob(arr[1]);
var n3 = bstr.length;
var u8arr = new Uint8Array(n3);
while (n3--) {
u8arr[n3] = bstr.charCodeAt(n3);
}
var blobObj_1 = new Blob([u8arr], {
type: mime
});
if (window.navigator.msSaveBlob) {
window.navigator.msSaveBlob(blobObj_1, fileName);
} else {
link.addEventListener("click", function() {
link.download = fileName;
link.href = window.URL.createObjectURL(blobObj_1);
});
}
} else {
link.addEventListener("click", function() {
link.download = fileName;
link.href = dataURL;
});
}
}
};
Graph10.prototype.addPlugin = function(plugin) {
var self2 = this;
if (plugin.destroyed) {
return;
}
self2.get("plugins").push(plugin);
plugin.initPlugin(self2);
};
Graph10.prototype.removePlugin = function(plugin) {
var plugins = this.get("plugins");
var index2 = plugins.indexOf(plugin);
if (index2 >= 0) {
plugin.destroyPlugin();
plugins.splice(index2, 1);
}
};
Graph10.prototype.setImageWaterMarker = function(imgURL, config) {
if (imgURL === void 0) {
imgURL = global_default2.waterMarkerImage;
}
var container2 = this.get("container");
if (is_string_default(container2)) {
container2 = document.getElementById(container2);
}
if (!container2.style.position) {
container2.style.position = "relative";
}
var canvas = this.get("graphWaterMarker");
var waterMarkerConfig = deep_mix_default({}, global_default2.imageWaterMarkerConfig, config);
var width2 = waterMarkerConfig.width, height = waterMarkerConfig.height, compatible = waterMarkerConfig.compatible, image = waterMarkerConfig.image;
if (!canvas) {
var canvasCfg = {
container: container2,
width: width2,
height,
capture: false
};
var pixelRatio = this.get("pixelRatio");
if (pixelRatio) {
canvasCfg.pixelRatio = pixelRatio;
}
canvas = new canvas_default2(canvasCfg);
this.set("graphWaterMarker", canvas);
}
canvas.get("el").style.display = "none";
var ctx4 = canvas.get("context");
var rotate8 = image.rotate, x6 = image.x, y5 = image.y;
ctx4.rotate(-rotate8 * Math.PI / 180);
var img = new Image();
img.crossOrigin = "anonymous";
img.src = imgURL;
img.onload = function() {
ctx4.drawImage(img, x6, y5, image.width, image.height);
ctx4.rotate(rotate8 * Math.PI / 180);
if (!compatible) {
var box2 = document.querySelector(".g6-graph-watermarker");
if (!box2) {
box2 = document.createElement("div");
box2.className = "g6-graph-watermarker";
}
box2.className = "g6-graph-watermarker";
if (!canvas.destroyed) {
box2.style.cssText = "background-image: url(" + canvas.get("el").toDataURL("image/png") + ");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:-1;";
container2.appendChild(box2);
}
} else {
container2.style.cssText = "background-image: url(" + canvas.get("el").toDataURL("image/png") + ");background-repeat:repeat;";
}
};
};
Graph10.prototype.setTextWaterMarker = function(texts, config) {
var container2 = this.get("container");
if (is_string_default(container2)) {
container2 = document.getElementById(container2);
}
if (!container2.style.position) {
container2.style.position = "relative";
}
var canvas = this.get("graphWaterMarker");
var waterMarkerConfig = deep_mix_default({}, global_default2.textWaterMarkerConfig, config);
var width2 = waterMarkerConfig.width, height = waterMarkerConfig.height, compatible = waterMarkerConfig.compatible, text = waterMarkerConfig.text;
if (!canvas) {
var canvasCfg = {
container: container2,
width: width2,
height,
capture: false
};
var pixelRatio = this.get("pixelRatio");
if (pixelRatio) {
canvasCfg.pixelRatio = pixelRatio;
}
canvas = new canvas_default2(canvasCfg);
this.set("graphWaterMarker", canvas);
}
canvas.get("el").style.display = "none";
var ctx4 = canvas.get("context");
var rotate8 = text.rotate, fill = text.fill, fontFamily = text.fontFamily, fontSize = text.fontSize, baseline = text.baseline, x6 = text.x, y5 = text.y, lineHeight = text.lineHeight;
ctx4.rotate(-rotate8 * Math.PI / 180);
ctx4.font = fontSize + "px " + fontFamily;
ctx4.fillStyle = fill;
ctx4.textBaseline = baseline;
for (var i4 = texts.length - 1; i4 >= 0; i4--) {
ctx4.fillText(texts[i4], x6, y5 + i4 * lineHeight);
}
ctx4.rotate(rotate8 * Math.PI / 180);
if (!compatible) {
var box2 = document.querySelector(".g6-graph-watermarker");
if (!box2) {
box2 = document.createElement("div");
box2.className = "g6-graph-watermarker";
}
box2.style.cssText = "background-image: url(" + canvas.get("el").toDataURL("image/png") + ");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:99;";
container2.appendChild(box2);
} else {
container2.style.cssText = "background-image: url(" + canvas.get("el").toDataURL("image/png") + ");background-repeat:repeat;";
}
};
Graph10.prototype.destroy = function() {
each_default(this.get("plugins"), function(plugin) {
plugin.destroyPlugin();
});
var tooltipDOMs = this.get("tooltips");
if (tooltipDOMs) {
for (var i4 = 0; i4 < tooltipDOMs.length; i4++) {
var container2 = tooltipDOMs[i4];
if (!container2)
continue;
var parent_1 = container2.parentElement;
if (!parent_1)
continue;
parent_1.removeChild(container2);
}
}
this.get("eventController").destroy();
this.get("layoutController").destroy();
if (this.get("graphWaterMarker")) {
this.get("graphWaterMarker").destroy();
}
if (document.querySelector(".g6-graph-watermarker")) {
document.querySelector(".g6-graph-watermarker").remove();
}
_super.prototype.destroy.call(this);
};
return Graph10;
}(graph_default);
var graph_default2 = Graph9;
// node_modules/@antv/g6-pc/es/graph/tree-graph.js
var import_hierarchy4 = __toModule(require_hierarchy());
// node_modules/@antv/g6-pc/es/util/layout.js
var layout_exports = {};
__export(layout_exports, {
arrayToTextureData: () => arrayToTextureData2,
attributesToTextureData: () => attributesToTextureData2,
buildTextureData: () => buildTextureData2,
buildTextureDataWithOneEdgeAttr: () => buildTextureDataWithOneEdgeAttr,
buildTextureDataWithTwoEdgeAttr: () => buildTextureDataWithTwoEdgeAttr2,
proccessToFunc: () => proccessToFunc3,
radialLayout: () => radialLayout
});
var traverseTree3 = util_default.traverseTree;
var proccessToFunc3 = function proccessToFunc4(value2, defaultV) {
var func;
if (!value2) {
func = function func2(d3) {
return defaultV || 1;
};
} else if (is_number_default(value2)) {
func = function func2(d3) {
return value2;
};
} else {
func = value2;
}
return func;
};
var buildTextureData2 = function buildTextureData3(nodes, edges) {
var dataArray = [];
var nodeDict = [];
var mapIdPos = {};
var i4 = 0;
for (i4 = 0; i4 < nodes.length; i4++) {
var n3 = nodes[i4];
mapIdPos[n3.id] = i4;
dataArray.push(n3.x);
dataArray.push(n3.y);
dataArray.push(0);
dataArray.push(0);
nodeDict.push([]);
}
for (i4 = 0; i4 < edges.length; i4++) {
var e4 = edges[i4];
nodeDict[mapIdPos[e4.source]].push(mapIdPos[e4.target]);
nodeDict[mapIdPos[e4.target]].push(mapIdPos[e4.source]);
}
var maxEdgePerVetex = 0;
for (i4 = 0; i4 < nodes.length; i4++) {
var offset = dataArray.length;
var dests = nodeDict[i4];
var len5 = dests.length;
dataArray[i4 * 4 + 2] = offset;
dataArray[i4 * 4 + 3] = dests.length;
maxEdgePerVetex = Math.max(maxEdgePerVetex, dests.length);
for (var j4 = 0; j4 < len5; ++j4) {
var dest = dests[j4];
dataArray.push(+dest);
}
}
while (dataArray.length % 4 !== 0) {
dataArray.push(0);
}
return {
array: new Float32Array(dataArray),
maxEdgePerVetex
};
};
var buildTextureDataWithOneEdgeAttr = function buildTextureDataWithOneEdgeAttr2(nodes, edges, attrs) {
var dataArray = [];
var nodeDict = [];
var mapIdPos = {};
var i4 = 0;
for (i4 = 0; i4 < nodes.length; i4++) {
var n3 = nodes[i4];
mapIdPos[n3.id] = i4;
dataArray.push(n3.x);
dataArray.push(n3.y);
dataArray.push(0);
dataArray.push(0);
nodeDict.push([]);
}
for (i4 = 0; i4 < edges.length; i4++) {
var e4 = edges[i4];
nodeDict[mapIdPos[e4.source]].push(mapIdPos[e4.target]);
nodeDict[mapIdPos[e4.source]].push(attrs(e4));
nodeDict[mapIdPos[e4.target]].push(mapIdPos[e4.source]);
nodeDict[mapIdPos[e4.target]].push(attrs(e4));
}
var maxEdgePerVetex = 0;
for (i4 = 0; i4 < nodes.length; i4++) {
var offset = dataArray.length;
var dests = nodeDict[i4];
var len5 = dests.length;
dataArray[i4 * 4 + 2] = offset;
dataArray[i4 * 4 + 3] = len5 / 2;
maxEdgePerVetex = Math.max(maxEdgePerVetex, len5 / 2);
for (var j4 = 0; j4 < len5; ++j4) {
var dest = dests[j4];
dataArray.push(+dest);
}
}
while (dataArray.length % 4 !== 0) {
dataArray.push(0);
}
return {
array: new Float32Array(dataArray),
maxEdgePerVetex
};
};
var buildTextureDataWithTwoEdgeAttr2 = function buildTextureDataWithTwoEdgeAttr3(nodes, edges, attrs1, attrs2) {
var dataArray = [];
var nodeDict = [];
var mapIdPos = {};
var i4 = 0;
for (i4 = 0; i4 < nodes.length; i4++) {
var n3 = nodes[i4];
mapIdPos[n3.id] = i4;
dataArray.push(n3.x);
dataArray.push(n3.y);
dataArray.push(0);
dataArray.push(0);
nodeDict.push([]);
}
for (i4 = 0; i4 < edges.length; i4++) {
var e4 = edges[i4];
nodeDict[mapIdPos[e4.source]].push(mapIdPos[e4.target]);
nodeDict[mapIdPos[e4.source]].push(attrs1(e4));
nodeDict[mapIdPos[e4.source]].push(attrs2(e4));
nodeDict[mapIdPos[e4.source]].push(0);
nodeDict[mapIdPos[e4.target]].push(mapIdPos[e4.source]);
nodeDict[mapIdPos[e4.target]].push(attrs1(e4));
nodeDict[mapIdPos[e4.target]].push(attrs2(e4));
nodeDict[mapIdPos[e4.target]].push(0);
}
var maxEdgePerVetex = 0;
for (i4 = 0; i4 < nodes.length; i4++) {
var offset = dataArray.length;
var dests = nodeDict[i4];
var len5 = dests.length;
dataArray[i4 * 4 + 2] = offset + 1048576 * len5 / 4;
dataArray[i4 * 4 + 3] = 0;
maxEdgePerVetex = Math.max(maxEdgePerVetex, len5 / 4);
for (var j4 = 0; j4 < len5; ++j4) {
var dest = dests[j4];
dataArray.push(+dest);
}
}
while (dataArray.length % 4 !== 0) {
dataArray.push(0);
}
return {
array: new Float32Array(dataArray),
maxEdgePerVetex
};
};
var attributesToTextureData2 = function attributesToTextureData3(attributeNames, items) {
var dataArray = [];
var attributeNum = attributeNames.length;
var attributteStringMap = {};
items.forEach(function(item) {
attributeNames.forEach(function(name, i4) {
if (attributteStringMap[item[name]] === void 0) {
attributteStringMap[item[name]] = Object.keys(attributteStringMap).length;
}
dataArray.push(attributteStringMap[item[name]]);
if (i4 === attributeNum - 1) {
while (dataArray.length % 4 !== 0) {
dataArray.push(0);
}
}
});
});
return {
array: new Float32Array(dataArray),
count: Object.keys(attributteStringMap).length
};
};
var arrayToTextureData2 = function arrayToTextureData3(valueArrays) {
var dataArray = [];
var attributeNum = valueArrays.length;
var itemNum = valueArrays[0].length;
var _loop_1 = function _loop_12(j5) {
valueArrays.forEach(function(valueArray, i4) {
dataArray.push(valueArray[j5]);
if (i4 === attributeNum - 1) {
while (dataArray.length % 4 !== 0) {
dataArray.push(0);
}
}
});
};
for (var j4 = 0; j4 < itemNum; j4++) {
_loop_1(j4);
}
return new Float32Array(dataArray);
};
var radialLayout = function radialLayout2(data3, layout6) {
var VERTICAL_LAYOUTS = ["V", "TB", "BT"];
var min7 = {
x: Infinity,
y: Infinity
};
var max8 = {
x: -Infinity,
y: -Infinity
};
var rScale = "x";
var radScale = "y";
if (layout6 && VERTICAL_LAYOUTS.indexOf(layout6) >= 0) {
radScale = "x";
rScale = "y";
}
var count2 = 0;
traverseTree3(data3, function(node) {
count2++;
if (node.x > max8.x) {
max8.x = node.x;
}
if (node.x < min7.x) {
min7.x = node.x;
}
if (node.y > max8.y) {
max8.y = node.y;
}
if (node.y < min7.y) {
min7.y = node.y;
}
return true;
});
var avgRad = Math.PI * 2 / count2;
var radDiff = max8[radScale] - min7[radScale];
if (radDiff === 0) {
return data3;
}
traverseTree3(data3, function(node) {
var radial = (node[radScale] - min7[radScale]) / radDiff * (Math.PI * 2 - avgRad) + avgRad;
var r4 = Math.abs(rScale === "x" ? node.x - data3.x : node.y - data3.y);
node.x = r4 * Math.cos(radial);
node.y = r4 * Math.sin(radial);
return true;
});
return data3;
};
// node_modules/@antv/g6-pc/es/util/index.js
var G6Util = __assign(__assign(__assign(__assign({}, util_default), color_exports), layout_exports), gpu_exports);
var util_default3 = G6Util;
// node_modules/@antv/g6-pc/es/graph/tree-graph.js
var radialLayout3 = util_default3.radialLayout;
var traverseTree4 = util_default3.traverseTree;
var TreeGraph = function(_super) {
__extends(TreeGraph2, _super);
function TreeGraph2(cfg) {
var _this = _super.call(this, cfg) || this;
_this.layoutAnimating = false;
_this.set("removeList", []);
_this.set("layoutMethod", _this.getLayout());
return _this;
}
TreeGraph2.prototype.getLayout = function() {
var layout6 = this.get("layout");
if (!layout6) {
return null;
}
if (typeof layout6 === "function") {
return layout6;
}
if (!layout6.type) {
layout6.type = "dendrogram";
}
if (!layout6.direction) {
layout6.direction = "TB";
}
if (layout6.radial) {
return function(data3) {
var layoutData = import_hierarchy4.default[layout6.type](data3, layout6);
radialLayout3(layoutData);
return layoutData;
};
}
return function(data3) {
return import_hierarchy4.default[layout6.type](data3, layout6);
};
};
TreeGraph2.indexOfChild = function(children, id) {
var index2 = -1;
each_default(children, function(former, i4) {
if (id === former.id) {
index2 = i4;
return false;
}
});
return index2;
};
TreeGraph2.prototype.getDefaultCfg = function() {
var cfg = _super.prototype.getDefaultCfg.call(this);
cfg.animate = true;
return cfg;
};
TreeGraph2.prototype.innerAddChild = function(treeData, parent, animate) {
var self2 = this;
var model = treeData.data;
if (model) {
model.x = treeData.x;
model.y = treeData.y;
model.depth = treeData.depth;
}
var node = self2.addItem("node", model, false);
if (parent) {
node.set("parent", parent);
if (animate) {
var origin_1 = parent.get("originAttrs");
if (origin_1) {
node.set("originAttrs", origin_1);
} else {
var parentModel = parent.getModel();
node.set("originAttrs", {
x: parentModel.x,
y: parentModel.y
});
}
}
var childrenList = parent.get("children");
if (!childrenList) {
parent.set("children", [node]);
} else {
childrenList.push(node);
}
self2.addItem("edge", {
source: parent,
target: node,
id: parent.get("id") + ":" + node.get("id")
}, false);
}
each_default(treeData.children || [], function(child) {
self2.innerAddChild(child, node, animate);
});
self2.emit("afteraddchild", {
item: node,
parent
});
return node;
};
TreeGraph2.prototype.innerUpdateChild = function(data3, parent, animate) {
var self2 = this;
var current = self2.findById(data3.id);
if (!current) {
self2.innerAddChild(data3, parent, animate);
return;
}
each_default(data3.children || [], function(child2) {
self2.innerUpdateChild(child2, current, animate);
});
var children = current.get("children");
if (children) {
var len5 = children.length;
if (len5 > 0) {
for (var i4 = children.length - 1; i4 >= 0; i4--) {
var child = children[i4].getModel();
if (TreeGraph2.indexOfChild(data3.children || [], child.id) === -1) {
self2.innerRemoveChild(child.id, {
x: data3.x,
y: data3.y
}, animate);
children.splice(i4, 1);
}
}
}
}
var oriX;
var oriY;
if (current.get("originAttrs")) {
oriX = current.get("originAttrs").x;
oriY = current.get("originAttrs").y;
}
var model = current.getModel();
if (animate) {
current.set("originAttrs", {
x: model.x,
y: model.y
});
}
current.set("model", data3.data);
if (oriX !== data3.x || oriY !== data3.y) {
current.updatePosition({
x: data3.x,
y: data3.y
});
}
};
TreeGraph2.prototype.innerRemoveChild = function(id, to, animate) {
var self2 = this;
var node = self2.findById(id);
if (!node) {
return;
}
each_default(node.get("children"), function(child) {
self2.innerRemoveChild(child.getModel().id, to, animate);
});
if (animate) {
var model = node.getModel();
node.set("to", to);
node.set("originAttrs", {
x: model.x,
y: model.y
});
self2.get("removeList").push(node);
} else {
self2.removeItem(node);
}
};
TreeGraph2.prototype.changeData = function(data3) {
var self2 = this;
this.getNodes().map(function(node) {
return self2.clearItemStates(node);
});
this.getEdges().map(function(edge2) {
return self2.clearItemStates(edge2);
});
if (data3) {
self2.data(data3);
self2.render();
} else {
self2.layout(this.get("fitView"));
}
};
TreeGraph2.prototype.changeLayout = function(layout6) {
console.warn("Please call updateLayout instead of changeLayout. changeLayout will be discarded soon");
var self2 = this;
self2.updateLayout(layout6);
};
TreeGraph2.prototype.updateLayout = function(layout6) {
var self2 = this;
if (!layout6) {
console.warn("layout cannot be null");
return;
}
self2.set("layout", layout6);
self2.set("layoutMethod", self2.getLayout());
self2.layout();
};
TreeGraph2.prototype.refreshLayout = function(fitView) {
console.warn("Please call layout instead of refreshLayout. refreshLayout will be discarded soon");
var self2 = this;
self2.layout(fitView);
};
TreeGraph2.prototype.layout = function(fitView) {
var self2 = this;
var data3 = self2.get("data");
var layoutMethod = self2.get("layoutMethod");
var layoutData = layoutMethod(data3, self2.get("layout"));
var animate = self2.get("animate");
self2.emit("beforerefreshlayout", {
data: data3,
layoutData
});
self2.emit("beforelayout");
self2.innerUpdateChild(layoutData, void 0, animate);
if (fitView) {
var viewController = self2.get("viewController");
viewController.fitView();
}
if (!animate) {
self2.refresh();
self2.paint();
} else {
self2.layoutAnimate(layoutData);
}
self2.emit("afterrefreshlayout", {
data: data3,
layoutData
});
self2.emit("afterlayout");
};
TreeGraph2.prototype.addChild = function(data3, parent) {
var self2 = this;
self2.emit("beforeaddchild", {
model: data3,
parent
});
if (!is_string_default(parent)) {
parent = parent.get("id");
}
var parentData = self2.findDataById(parent);
if (parentData) {
if (!parentData.children) {
parentData.children = [];
}
parentData.children.push(data3);
self2.changeData();
}
};
TreeGraph2.prototype.updateChildren = function(data3, parentId) {
var self2 = this;
if (!parentId || !self2.findById(parentId)) {
console.warn("Update children failed! There is no node with id '" + parentId + "'");
return;
}
var parentModel = self2.findDataById(parentId);
parentModel.children = data3;
self2.changeData();
};
TreeGraph2.prototype.updateChild = function(data3, parentId) {
var self2 = this;
if (!parentId || !self2.findById(parentId)) {
self2.changeData(data3);
return;
}
var parentModel = self2.findDataById(parentId);
var current = self2.findById(data3.id);
if (!parentModel.children) {
parentModel.children = [];
}
if (!current) {
parentModel.children.push(data3);
} else {
var index2 = TreeGraph2.indexOfChild(parentModel.children, data3.id);
parentModel.children[index2] = data3;
}
self2.changeData();
};
TreeGraph2.prototype.removeChild = function(id) {
var self2 = this;
var node = self2.findById(id);
if (!node) {
return;
}
var parent = node.get("parent");
if (parent && !parent.destroyed) {
var parentNode = self2.findDataById(parent.get("id"));
var siblings = parentNode && parentNode.children || [];
var model = node.getModel();
var index2 = TreeGraph2.indexOfChild(siblings, model.id);
siblings.splice(index2, 1);
}
self2.changeData();
};
TreeGraph2.prototype.findDataById = function(id, parent) {
var self2 = this;
if (!parent) {
parent = self2.get("data");
}
if (id === parent.id) {
return parent;
}
var result = null;
each_default(parent.children || [], function(child) {
if (child.id === id) {
result = child;
return false;
}
result = self2.findDataById(id, child);
if (result) {
return false;
}
});
return result;
};
TreeGraph2.prototype.layoutAnimate = function(data3, onFrame) {
var self2 = this;
var animateCfg = this.get("animateCfg");
self2.emit("beforeanimate", {
data: data3
});
self2.getEdges().forEach(function(edge2) {
var model = edge2.get("model");
if (!model.sourceAnchor) {
model.sourceAnchor = edge2.get("sourceAnchorIndex");
}
});
this.get("canvas").animate(function(ratio) {
traverseTree4(data3, function(child) {
var node = self2.findById(child.id);
if (node) {
var origin_2 = node.get("originAttrs");
var model = node.get("model");
if (!origin_2) {
origin_2 = {
x: model.x,
y: model.y
};
node.set("originAttrs", origin_2);
}
if (onFrame) {
var attrs = onFrame(node, ratio, origin_2, data3);
node.set("model", Object.assign(model, attrs));
} else {
model.x = origin_2.x + (child.x - origin_2.x) * ratio;
model.y = origin_2.y + (child.y - origin_2.y) * ratio;
}
}
return true;
});
each_default(self2.get("removeList"), function(node) {
var model = node.getModel();
var from = node.get("originAttrs");
var to = node.get("to");
model.x = from.x + (to.x - from.x) * ratio;
model.y = from.y + (to.y - from.y) * ratio;
});
self2.refreshPositions();
}, {
duration: animateCfg.duration,
easing: animateCfg.ease,
callback: function callback() {
each_default(self2.getNodes(), function(node) {
node.set("originAttrs", null);
});
each_default(self2.get("removeList"), function(node) {
self2.removeItem(node);
});
self2.set("removeList", []);
if (animateCfg.callback) {
animateCfg.callback();
}
self2.emit("afteranimate", {
data: data3
});
},
delay: animateCfg.delay
});
};
TreeGraph2.prototype.stopLayoutAnimate = function() {
this.get("canvas").stopAnimate();
this.emit("layoutanimateend", {
data: this.get("data")
});
this.layoutAnimating = false;
};
TreeGraph2.prototype.isLayoutAnimating = function() {
return this.layoutAnimating;
};
TreeGraph2.prototype.render = function() {
var self2 = this;
var data3 = self2.get("data");
if (!data3) {
throw new Error("data must be defined first");
}
self2.clear();
self2.emit("beforerender");
self2.layout(this.get("fitView"));
self2.emit("afterrender");
};
TreeGraph2.prototype.save = function() {
return this.get("data");
};
return TreeGraph2;
}(graph_default2);
var tree_graph_default = TreeGraph;
// node_modules/@antv/g6-plugin/es/base.js
var PluginBase = function() {
function PluginBase2(cfgs) {
this._cfgs = deep_mix_default(this.getDefaultCfgs(), cfgs);
this._events = {};
this.destroyed = false;
}
PluginBase2.prototype.getDefaultCfgs = function() {
return {};
};
PluginBase2.prototype.initPlugin = function(graph) {
var self2 = this;
self2.set("graph", graph);
var events = self2.getEvents();
var bindEvents2 = {};
each_default(events, function(v3, k4) {
var event = wrap_behavior_default(self2, v3);
bindEvents2[k4] = event;
graph.on(k4, event);
});
this._events = bindEvents2;
this.init();
};
PluginBase2.prototype.getEvents = function() {
return {};
};
PluginBase2.prototype.get = function(key) {
return this._cfgs[key];
};
PluginBase2.prototype.set = function(key, val) {
this._cfgs[key] = val;
};
PluginBase2.prototype.destroy = function() {
};
PluginBase2.prototype.destroyPlugin = function() {
this.destroy();
var graph = this.get("graph");
var events = this._events;
each_default(events, function(v3, k4) {
graph.off(k4, v3);
});
this._events = null;
this._cfgs = null;
this.destroyed = true;
};
return PluginBase2;
}();
var base_default18 = PluginBase;
// node_modules/@antv/g6-plugin/es/grid/index.js
var __extends5 = function() {
var _extendStatics = function extendStatics(d3, b10) {
_extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(d4, b11) {
d4.__proto__ = b11;
} || function(d4, b11) {
for (var p4 in b11) {
if (Object.prototype.hasOwnProperty.call(b11, p4))
d4[p4] = b11[p4];
}
};
return _extendStatics(d3, b10);
};
return function(d3, b10) {
if (typeof b10 !== "function" && b10 !== null)
throw new TypeError("Class extends value " + String(b10) + " is not a constructor or null");
_extendStatics(d3, b10);
function __() {
this.constructor = d3;
}
d3.prototype = b10 === null ? Object.create(b10) : (__.prototype = b10.prototype, new __());
};
}();
var GRID_PNG = "url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAwIDEwIEwgNDAgMTAgTSAxMCAwIEwgMTAgNDAgTSAwIDIwIEwgNDAgMjAgTSAyMCAwIEwgMjAgNDAgTSAwIDMwIEwgNDAgMzAgTSAzMCAwIEwgMzAgNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2UwZTBlMCIgb3BhY2l0eT0iMC4yIiBzdHJva2Utd2lkdGg9IjEiLz48cGF0aCBkPSJNIDQwIDAgTCAwIDAgMCA0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZTBlMGUwIiBzdHJva2Utd2lkdGg9IjEiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JpZCkiLz48L3N2Zz4=)";
var Grid3 = function(_super) {
__extends5(Grid5, _super);
function Grid5() {
return _super !== null && _super.apply(this, arguments) || this;
}
Grid5.prototype.getDefaultCfgs = function() {
return {
img: GRID_PNG
};
};
Grid5.prototype.init = function() {
var graph = this.get("graph");
var minZoom = graph.get("minZoom");
var graphContainer = graph.get("container");
var canvas = graph.get("canvas").get("el");
var width2 = graph.get("width");
var height = graph.get("height");
var img = this.get("img") || GRID_PNG;
var container2 = createDom(``);
var gridContainer = createDom("");
container2.appendChild(gridContainer);
modifyCSS(container2, {
width: width2 + "px",
height: height + "px",
left: graphContainer.offsetLeft + "px",
top: graphContainer.offsetTop + "px"
});
modifyCSS(gridContainer, {
width: width2 / minZoom + "px",
height: height / minZoom + "px",
left: "0px",
top: "0px"
});
graphContainer.insertBefore(container2, canvas);
this.set("container", container2);
this.set("gridContainer", gridContainer);
};
Grid5.prototype.getEvents = function() {
return {
viewportchange: "updateGrid"
};
};
Grid5.prototype.updateGrid = function(param) {
var gridContainer = this.get("gridContainer");
var matrix = param.matrix;
if (!matrix)
matrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
var transform18 = "matrix(" + matrix[0] + ", " + matrix[1] + ", " + matrix[3] + ", " + matrix[4] + ", 0, 0)";
modifyCSS(gridContainer, {
transform: transform18
});
};
Grid5.prototype.getContainer = function() {
return this.get("container");
};
Grid5.prototype.destroy = function() {
var graph = this.get("graph");
var graphContainer = graph.get("container");
var container2 = this.get("container");
graphContainer.removeChild(container2);
};
return Grid5;
}(base_default18);
var grid_default = Grid3;
// node_modules/@antv/g6-plugin/es/menu/index.js
var import_insert_css = __toModule(require_insert_css());
var __extends6 = function() {
var _extendStatics = function extendStatics(d3, b10) {
_extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(d4, b11) {
d4.__proto__ = b11;
} || function(d4, b11) {
for (var p4 in b11) {
if (Object.prototype.hasOwnProperty.call(b11, p4))
d4[p4] = b11[p4];
}
};
return _extendStatics(d3, b10);
};
return function(d3, b10) {
if (typeof b10 !== "function" && b10 !== null)
throw new TypeError("Class extends value " + String(b10) + " is not a constructor or null");
_extendStatics(d3, b10);
function __() {
this.constructor = d3;
}
d3.prototype = b10 === null ? Object.create(b10) : (__.prototype = b10.prototype, new __());
};
}();
(0, import_insert_css.default)("\n .g6-component-contextmenu {\n border: 1px solid #e2e2e2;\n border-radius: 4px;\n font-size: 12px;\n color: #545454;\n background-color: rgba(255, 255, 255, 0.9);\n padding: 10px 8px;\n box-shadow: rgb(174, 174, 174) 0px 0px 10px;\n }\n .g6-contextmenu-ul {\n padding: 0;\n margin: 0;\n list-style: none;\n }\n\n");
var Menu = function(_super) {
__extends6(Menu3, _super);
function Menu3() {
return _super !== null && _super.apply(this, arguments) || this;
}
Menu3.prototype.getDefaultCfgs = function() {
return {
offsetX: 6,
offsetY: 6,
handleMenuClick: void 0,
getContent: function getContent(e4) {
return "\n \n ";
},
shouldBegin: function shouldBegin2(e4) {
return true;
},
onHide: function onHide() {
return true;
},
itemTypes: ["node", "edge", "combo"]
};
};
Menu3.prototype.getEvents = function() {
return {
contextmenu: "onMenuShow"
};
};
Menu3.prototype.init = function() {
var className = this.get("className");
var menu = createDom("");
modifyCSS(menu, {
top: "0px",
position: "absolute",
visibility: "hidden"
});
var container2 = this.get("container");
if (!container2) {
container2 = this.get("graph").get("container");
}
if (is_string_default(container2)) {
container2 = document.getElementById(container2);
}
container2.appendChild(menu);
this.set("menu", menu);
};
Menu3.prototype.onMenuShow = function(e4) {
var self2 = this;
e4.preventDefault();
e4.stopPropagation();
var itemTypes = this.get("itemTypes");
if (!e4.item) {
if (itemTypes.indexOf("canvas") === -1)
return;
} else {
if (e4.item && e4.item.getType && itemTypes.indexOf(e4.item.getType()) === -1) {
self2.onMenuHide();
return;
}
}
var shouldBegin2 = this.get("shouldBegin");
if (!shouldBegin2(e4))
return;
var menuDom = this.get("menu");
var getContent = this.get("getContent");
var graph = this.get("graph");
var menu = getContent(e4, graph);
if (is_string_default(menu)) {
menuDom.innerHTML = menu;
} else {
menuDom.innerHTML = menu.outerHTML;
}
this.removeMenuEventListener();
var handleMenuClick = this.get("handleMenuClick");
if (handleMenuClick) {
var handleMenuClickWrapper = function handleMenuClickWrapper2(evt) {
handleMenuClick(evt.target, e4.item, graph);
};
this.set("handleMenuClickWrapper", handleMenuClickWrapper);
menuDom.addEventListener("click", handleMenuClickWrapper);
}
var width2 = graph.get("width");
var height = graph.get("height");
var bbox = menuDom.getBoundingClientRect();
var offsetX = this.get("offsetX") || 0;
var offsetY = this.get("offsetY") || 0;
var graphTop = graph.getContainer().offsetTop;
var graphLeft = graph.getContainer().offsetLeft;
var x6 = e4.canvasX + graphLeft + offsetX;
var y5 = e4.canvasY + graphTop + offsetY;
if (x6 + bbox.width > width2) {
x6 = e4.canvasX - bbox.width - offsetX + graphLeft;
}
if (y5 + bbox.height > height) {
y5 = e4.canvasY - bbox.height - offsetY + graphTop;
}
modifyCSS(menuDom, {
top: y5 + "px",
left: x6 + "px",
visibility: "visible"
});
var handler = function handler2(evt) {
self2.onMenuHide();
};
document.body.addEventListener("click", handler);
this.set("handler", handler);
};
Menu3.prototype.removeMenuEventListener = function() {
var handleMenuClickWrapper = this.get("handleMenuClickWrapper");
var handler = this.get("handler");
if (handleMenuClickWrapper) {
var menuDom = this.get("menu");
menuDom.removeEventListener("click", handleMenuClickWrapper);
this.set("handleMenuClickWrapper", null);
}
if (handler) {
document.body.removeEventListener("click", handler);
}
};
Menu3.prototype.onMenuHide = function() {
var menuDom = this.get("menu");
if (menuDom) {
modifyCSS(menuDom, {
visibility: "hidden"
});
}
this.removeMenuEventListener();
};
Menu3.prototype.destroy = function() {
var menu = this.get("menu");
this.removeMenuEventListener();
if (menu) {
var container2 = this.get("container");
if (!container2) {
container2 = this.get("graph").get("container");
}
if (is_string_default(container2)) {
container2 = document.getElementById(container2);
}
container2.removeChild(menu);
}
};
return Menu3;
}(base_default18);
var menu_default = Menu;
// node_modules/@antv/g6-plugin/node_modules/@antv/matrix-util/esm/ext.js
var ext_exports4 = {};
__export(ext_exports4, {
angleTo: () => angleTo3,
direction: () => direction4,
leftRotate: () => leftRotate3,
leftScale: () => leftScale3,
leftTranslate: () => leftTranslate3,
transform: () => transform14,
vertical: () => vertical3
});
function leftTranslate3(out, a4, v3) {
var transMat = [0, 0, 0, 0, 0, 0, 0, 0, 0];
mat3_exports.fromTranslation(transMat, v3);
return mat3_exports.multiply(out, transMat, a4);
}
function leftRotate3(out, a4, rad) {
var rotateMat = [0, 0, 0, 0, 0, 0, 0, 0, 0];
mat3_exports.fromRotation(rotateMat, rad);
return mat3_exports.multiply(out, rotateMat, a4);
}
function leftScale3(out, a4, v3) {
var scaleMat = [0, 0, 0, 0, 0, 0, 0, 0, 0];
mat3_exports.fromScaling(scaleMat, v3);
return mat3_exports.multiply(out, scaleMat, a4);
}
function leftMultiply3(out, a4, a1) {
return mat3_exports.multiply(out, a1, a4);
}
function transform14(m4, actions) {
var matrix = m4 ? [].concat(m4) : [1, 0, 0, 0, 1, 0, 0, 0, 1];
for (var i4 = 0, len5 = actions.length; i4 < len5; i4++) {
var action = actions[i4];
switch (action[0]) {
case "t":
leftTranslate3(matrix, matrix, [action[1], action[2]]);
break;
case "s":
leftScale3(matrix, matrix, [action[1], action[2]]);
break;
case "r":
leftRotate3(matrix, matrix, action[1]);
break;
case "m":
leftMultiply3(matrix, matrix, action[1]);
break;
default:
break;
}
}
return matrix;
}
function direction4(v1, v22) {
return v1[0] * v22[1] - v22[0] * v1[1];
}
function angleTo3(v1, v22, direct) {
var ang = vec2_exports.angle(v1, v22);
var angleLargeThanPI = direction4(v1, v22) >= 0;
if (direct) {
if (angleLargeThanPI) {
return Math.PI * 2 - ang;
}
return ang;
}
if (angleLargeThanPI) {
return ang;
}
return Math.PI * 2 - ang;
}
function vertical3(out, v3, flag) {
if (flag) {
out[0] = v3[1];
out[1] = -1 * v3[0];
} else {
out[0] = -1 * v3[1];
out[1] = v3[0];
}
return out;
}
// node_modules/@antv/g6-plugin/es/minimap/index.js
var __extends7 = function() {
var _extendStatics = function extendStatics(d3, b10) {
_extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(d4, b11) {
d4.__proto__ = b11;
} || function(d4, b11) {
for (var p4 in b11) {
if (Object.prototype.hasOwnProperty.call(b11, p4))
d4[p4] = b11[p4];
}
};
return _extendStatics(d3, b10);
};
return function(d3, b10) {
if (typeof b10 !== "function" && b10 !== null)
throw new TypeError("Class extends value " + String(b10) + " is not a constructor or null");
_extendStatics(d3, b10);
function __() {
this.constructor = d3;
}
d3.prototype = b10 === null ? Object.create(b10) : (__.prototype = b10.prototype, new __());
};
}();
var __assign6 = function() {
__assign6 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4) {
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
}
return t4;
};
return __assign6.apply(this, arguments);
};
var max6 = Math.max;
var transform15 = ext_exports4.transform;
var DEFAULT_MODE = "default";
var KEYSHAPE_MODE = "keyShape";
var DELEGATE_MODE = "delegate";
var SVG3 = "svg";
var MiniMap = function(_super) {
__extends7(MiniMap2, _super);
function MiniMap2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.handleUpdateCanvas = debounce_default(function(event) {
var self2 = _this;
if (self2.destroyed)
return;
self2.updateCanvas();
}, 100, false);
return _this;
}
MiniMap2.prototype.getDefaultCfgs = function() {
return {
container: null,
className: "g6-minimap",
viewportClassName: "g6-minimap-viewport",
type: "default",
padding: 50,
size: [200, 120],
delegateStyle: {
fill: "#40a9ff",
stroke: "#096dd9"
},
refresh: true
};
};
MiniMap2.prototype.getEvents = function() {
return {
beforepaint: "updateViewport",
beforeanimate: "disableRefresh",
afteranimate: "enableRefresh",
viewportchange: "disableOneRefresh"
};
};
MiniMap2.prototype.disableRefresh = function() {
this.set("refresh", false);
};
MiniMap2.prototype.enableRefresh = function() {
this.set("refresh", true);
this.updateCanvas();
};
MiniMap2.prototype.disableOneRefresh = function() {
this.set("viewportChange", true);
};
MiniMap2.prototype.initViewport = function() {
var _this = this;
var cfgs = this._cfgs;
var size2 = cfgs.size, graph = cfgs.graph;
if (this.destroyed)
return;
var canvas = this.get("canvas");
var containerDOM = canvas.get("container");
var viewport = createDom("\n \n
");
var isFireFox = navigator.userAgent.toLowerCase().indexOf("firefox") > -1;
var x6 = 0;
var y5 = 0;
var dragging = false;
var left2 = 0;
var top = 0;
var width2 = 0;
var height = 0;
var ratio = 0;
var zoom2 = 0;
viewport.addEventListener("dragstart", function(e4) {
var _a6, _b;
if (e4.dataTransfer) {
var img = new Image();
img.src = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' %3E%3Cpath /%3E%3C/svg%3E";
(_b = (_a6 = e4.dataTransfer).setDragImage) === null || _b === void 0 ? void 0 : _b.call(_a6, img, 0, 0);
try {
e4.dataTransfer.setData("text/html", "view-port-minimap");
} catch (_c) {
e4.dataTransfer.setData("text", "view-port-minimap");
}
}
cfgs.refresh = false;
if (e4.target !== viewport) {
return;
}
var style = viewport.style;
left2 = parseInt(style.left, 10);
top = parseInt(style.top, 10);
width2 = parseInt(style.width, 10);
height = parseInt(style.height, 10);
if (width2 > size2[0] || height > size2[1]) {
return;
}
zoom2 = graph.getZoom();
ratio = _this.get("ratio");
dragging = true;
x6 = e4.clientX;
y5 = e4.clientY;
}, false);
viewport.addEventListener(isFireFox ? "dragover" : "drag", function(e4) {
if (!dragging || is_nil_default(e4.clientX) || is_nil_default(e4.clientY)) {
return;
}
var dx = x6 - e4.clientX;
var dy = y5 - e4.clientY;
if (left2 - dx < 0 || left2 - dx + width2 >= size2[0]) {
dx = 0;
}
if (top - dy < 0 || top - dy + height >= size2[1]) {
dy = 0;
}
left2 -= dx;
top -= dy;
modifyCSS(viewport, {
left: left2 + "px",
top: top + "px"
});
graph.translate(dx * zoom2 / ratio, dy * zoom2 / ratio);
x6 = e4.clientX;
y5 = e4.clientY;
}, false);
viewport.addEventListener("dragend", function() {
dragging = false;
cfgs.refresh = true;
}, false);
this.set("viewport", viewport);
containerDOM.appendChild(viewport);
};
MiniMap2.prototype.updateViewport = function() {
if (this.destroyed)
return;
var ratio = this.get("ratio");
var dx = this.get("dx");
var dy = this.get("dy");
var totaldx = this.get("totaldx");
var totaldy = this.get("totaldy");
var graph = this.get("graph");
var size2 = this.get("size");
var graphWidth2 = graph.get("width");
var graphHeight2 = graph.get("height");
var topLeft = graph.getPointByCanvas(0, 0);
var bottomRight = graph.getPointByCanvas(graphWidth2, graphHeight2);
var viewport = this.get("viewport");
if (!viewport) {
this.initViewport();
}
var zoom2 = graph.getZoom();
var width2 = (bottomRight.x - topLeft.x) * ratio;
var height = (bottomRight.y - topLeft.y) * ratio;
var left2 = topLeft.x * ratio + totaldx;
var top = topLeft.y * ratio + totaldy;
var right2 = left2 + width2;
var bottom = top + height;
if (left2 < 0) {
width2 += left2;
left2 = 0;
}
if (right2 > size2[0]) {
width2 = width2 - (right2 - size2[0]);
}
if (top < 0) {
height += top;
top = 0;
}
if (bottom > size2[1]) {
height = height - (bottom - size2[1]);
}
this.set("ratio", ratio);
var correctLeft = left2 + "px";
var correctTop = top + "px";
modifyCSS(viewport, {
left: correctLeft,
top: correctTop,
width: width2 + "px",
height: height + "px"
});
};
MiniMap2.prototype.updateGraphShapes = function() {
var graph = this._cfgs.graph;
var canvas = this.get("canvas");
var graphGroup = graph.get("group");
if (graphGroup.destroyed)
return;
var clonedGroup = graphGroup.clone();
clonedGroup.resetMatrix();
canvas.clear();
canvas.add(clonedGroup);
var renderer = graph.get("renderer");
if (renderer === SVG3) {
this.updateVisible(clonedGroup);
}
};
MiniMap2.prototype.updateVisible = function(ele) {
var _this = this;
if (!ele.isGroup() && !ele.get("visible")) {
ele.hide();
} else {
var children = ele.get("children");
if (!children || !children.length)
return;
children.forEach(function(child) {
if (!child.get("visible"))
child.hide();
_this.updateVisible(child);
});
}
};
MiniMap2.prototype.updateKeyShapes = function() {
var _this = this;
var graph = this._cfgs.graph;
each_default(graph.getEdges(), function(edge2) {
_this.updateOneEdgeKeyShape(edge2);
});
each_default(graph.getNodes(), function(node) {
_this.updateOneNodeKeyShape(node);
});
this.clearDestroyedShapes();
};
MiniMap2.prototype.updateOneNodeKeyShape = function(item) {
var canvas = this.get("canvas");
var group2 = canvas.get("children")[0] || canvas.addGroup();
var itemMap = this.get("itemMap") || {};
var mappedItem = itemMap[item.get("id")];
var bbox = item.getBBox();
var cKeyShape = item.get("keyShape").clone();
var keyShapeStyle = cKeyShape.attr();
var attrs = {
x: bbox.centerX,
y: bbox.centerY
};
if (!mappedItem) {
mappedItem = cKeyShape;
group2.add(mappedItem);
} else {
attrs = Object.assign(keyShapeStyle, attrs);
}
var shapeType = mappedItem.get("type");
if (shapeType === "rect" || shapeType === "image") {
attrs.x = bbox.minX;
attrs.y = bbox.minY;
}
mappedItem.attr(attrs);
if (!item.isVisible()) {
mappedItem.hide();
}
mappedItem.exist = true;
itemMap[item.get("id")] = mappedItem;
this.set("itemMap", itemMap);
};
MiniMap2.prototype.updateDelegateShapes = function() {
var _this = this;
var graph = this._cfgs.graph;
each_default(graph.getEdges(), function(edge2) {
_this.updateOneEdgeKeyShape(edge2);
});
each_default(graph.getNodes(), function(node) {
_this.updateOneNodeDelegateShape(node);
});
this.clearDestroyedShapes();
};
MiniMap2.prototype.clearDestroyedShapes = function() {
var itemMap = this.get("itemMap") || {};
var keys2 = Object.keys(itemMap);
if (!keys2 || keys2.length === 0)
return;
for (var i4 = keys2.length - 1; i4 >= 0; i4--) {
var shape = itemMap[keys2[i4]];
var exist = shape.exist;
shape.exist = false;
if (!exist) {
shape.remove();
delete itemMap[keys2[i4]];
}
}
};
MiniMap2.prototype.updateOneEdgeKeyShape = function(item) {
var canvas = this.get("canvas");
var group2 = canvas.get("children")[0] || canvas.addGroup();
var itemMap = this.get("itemMap") || {};
var mappedItem = itemMap[item.get("id")];
if (mappedItem) {
var path = item.get("keyShape").attr("path");
mappedItem.attr("path", path);
} else {
mappedItem = item.get("keyShape").clone();
group2.add(mappedItem);
mappedItem.toBack();
}
if (!item.isVisible()) {
mappedItem.hide();
}
mappedItem.exist = true;
itemMap[item.get("id")] = mappedItem;
this.set("itemMap", itemMap);
};
MiniMap2.prototype.updateOneNodeDelegateShape = function(item) {
var canvas = this.get("canvas");
var group2 = canvas.get("children")[0] || canvas.addGroup();
var delegateStyle = this.get("delegateStyle");
var itemMap = this.get("itemMap") || {};
var mappedItem = itemMap[item.get("id")];
var bbox = item.getBBox();
if (mappedItem) {
var attrs = {
x: bbox.minX,
y: bbox.minY,
width: bbox.width,
height: bbox.height
};
mappedItem.attr(attrs);
} else {
mappedItem = group2.addShape("rect", {
attrs: __assign6({
x: bbox.minX,
y: bbox.minY,
width: bbox.width,
height: bbox.height
}, delegateStyle),
name: "minimap-node-shape"
});
}
if (!item.isVisible()) {
mappedItem.hide();
}
mappedItem.exist = true;
itemMap[item.get("id")] = mappedItem;
this.set("itemMap", itemMap);
};
MiniMap2.prototype.init = function() {
this.initContainer();
this.get("graph").on("afterupdateitem", this.handleUpdateCanvas);
this.get("graph").on("afteritemstatechange", this.handleUpdateCanvas);
this.get("graph").on("afteradditem", this.handleUpdateCanvas);
this.get("graph").on("afterremoveitem", this.handleUpdateCanvas);
this.get("graph").on("afterrender", this.handleUpdateCanvas);
this.get("graph").on("afterlayout", this.handleUpdateCanvas);
};
MiniMap2.prototype.initContainer = function() {
var self2 = this;
var graph = self2.get("graph");
var size2 = self2.get("size");
var className = self2.get("className");
var parentNode = self2.get("container");
var container2 = createDom("");
if (is_string_default(parentNode)) {
parentNode = document.getElementById(parentNode);
}
if (parentNode) {
parentNode.appendChild(container2);
} else {
graph.get("container").appendChild(container2);
}
self2.set("container", container2);
var containerDOM = createDom('');
container2.appendChild(containerDOM);
containerDOM.addEventListener("dragenter", function(e4) {
e4.preventDefault();
});
containerDOM.addEventListener("dragover", function(e4) {
e4.preventDefault();
});
var canvas;
var renderer = graph.get("renderer");
if (renderer === SVG3) {
canvas = new canvas_default3({
container: containerDOM,
width: size2[0],
height: size2[1]
});
} else {
canvas = new canvas_default2({
container: containerDOM,
width: size2[0],
height: size2[1]
});
}
self2.set("canvas", canvas);
self2.updateCanvas();
};
MiniMap2.prototype.updateCanvas = function() {
var isRefresh = this.get("refresh");
if (!isRefresh) {
return;
}
var graph = this.get("graph");
if (graph.get("destroyed")) {
return;
}
if (this.get("viewportChange")) {
this.set("viewportChange", false);
this.updateViewport();
}
var size2 = this.get("size");
var canvas = this.get("canvas");
var type2 = this.get("type");
var padding3 = this.get("padding");
if (canvas.destroyed) {
return;
}
switch (type2) {
case DEFAULT_MODE:
this.updateGraphShapes();
break;
case KEYSHAPE_MODE:
this.updateKeyShapes();
break;
case DELEGATE_MODE:
this.updateDelegateShapes();
break;
default:
break;
}
var group2 = canvas.get("children")[0];
if (!group2)
return;
group2.resetMatrix();
var bbox = group2.getCanvasBBox();
var graphBBox = graph.get("canvas").getCanvasBBox();
var width2 = graphBBox.width;
var height = graphBBox.height;
if (Number.isFinite(bbox.width)) {
width2 = max6(bbox.width, width2);
height = max6(bbox.height, height);
}
width2 += 2 * padding3;
height += 2 * padding3;
var ratio = Math.min(size2[0] / width2, size2[1] / height);
var matrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
var minX = 0;
var minY = 0;
if (Number.isFinite(bbox.minX)) {
minX = -bbox.minX;
}
if (Number.isFinite(bbox.minY)) {
minY = -bbox.minY;
}
var dx = (size2[0] - (width2 - 2 * padding3) * ratio) / 2;
var dy = (size2[1] - (height - 2 * padding3) * ratio) / 2;
matrix = transform15(matrix, [
["t", minX, minY],
["s", ratio, ratio],
["t", dx, dy]
]);
group2.setMatrix(matrix);
this.set("ratio", ratio);
this.set("totaldx", dx + minX * ratio);
this.set("totaldy", dy + minY * ratio);
this.set("dx", dx);
this.set("dy", dy);
this.updateViewport();
};
MiniMap2.prototype.getCanvas = function() {
return this.get("canvas");
};
MiniMap2.prototype.getViewport = function() {
return this.get("viewport");
};
MiniMap2.prototype.getContainer = function() {
return this.get("container");
};
MiniMap2.prototype.destroy = function() {
this.get("canvas").destroy();
var container2 = this.get("container");
container2.parentNode.removeChild(container2);
};
return MiniMap2;
}(base_default18);
var minimap_default = MiniMap;
// node_modules/@antv/g6-plugin/es/bundling/index.js
var __extends8 = function() {
var _extendStatics = function extendStatics(d3, b10) {
_extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(d4, b11) {
d4.__proto__ = b11;
} || function(d4, b11) {
for (var p4 in b11) {
if (Object.prototype.hasOwnProperty.call(b11, p4))
d4[p4] = b11[p4];
}
};
return _extendStatics(d3, b10);
};
return function(d3, b10) {
if (typeof b10 !== "function" && b10 !== null)
throw new TypeError("Class extends value " + String(b10) + " is not a constructor or null");
_extendStatics(d3, b10);
function __() {
this.constructor = d3;
}
d3.prototype = b10 === null ? Object.create(b10) : (__.prototype = b10.prototype, new __());
};
}();
function getEucliDis(pointA, pointB, eps2) {
var vx = pointA.x - pointB.x;
var vy = pointA.y - pointB.y;
if (!eps2 || Math.abs(vx) > eps2 || Math.abs(vy) > eps2) {
return Math.sqrt(vx * vx + vy * vy);
}
return eps2;
}
function getDotProduct(ei, ej) {
return ei.x * ej.x + ei.y * ej.y;
}
function projectPointToEdge(p4, e4) {
var k4 = (e4.source.y - e4.target.y) / (e4.source.x - e4.target.x);
var x6 = (k4 * k4 * e4.source.x + k4 * (p4.y - e4.source.y) + p4.x) / (k4 * k4 + 1);
var y5 = k4 * (x6 - e4.source.x) + e4.source.y;
return {
x: x6,
y: y5
};
}
var Bundling = function(_super) {
__extends8(Bundling3, _super);
function Bundling3() {
return _super !== null && _super.apply(this, arguments) || this;
}
Bundling3.prototype.getDefaultCfgs = function() {
return {
edgeBundles: [],
edgePoints: [],
K: 0.1,
lambda: 0.1,
divisions: 1,
divRate: 2,
cycles: 6,
iterations: 90,
iterRate: 0.6666667,
bundleThreshold: 0.6,
eps: 1e-6,
onLayoutEnd: function onLayoutEnd() {
},
onTick: function onTick() {
}
};
};
Bundling3.prototype.init = function() {
var graph = this.get("graph");
var onTick = this.get("onTick");
var tick = function tick2() {
if (onTick) {
onTick();
}
graph.refreshPositions();
};
this.set("tick", tick);
};
Bundling3.prototype.bundling = function(data3) {
var self2 = this;
self2.set("data", data3);
if (self2.isTicking()) {
return;
}
var edges = data3.edges || [];
var nodes = data3.nodes || [];
var nodeIdMap = {};
var error = false;
nodes.forEach(function(node) {
if (node.x === null || !node.y === null || node.x === void 0 || !node.y === void 0) {
error = true;
}
nodeIdMap[node.id] = node;
});
if (error)
throw new Error("please layout the graph or assign x and y for nodes first");
self2.set("nodeIdMap", nodeIdMap);
var divisions = self2.get("divisions");
var divRate = self2.get("divRate");
var edgePoints = self2.divideEdges(divisions);
self2.set("edgePoints", edgePoints);
var edgeBundles = self2.getEdgeBundles();
self2.set("edgeBundles", edgeBundles);
var C3 = self2.get("cycles");
var iterations = self2.get("iterations");
var iterRate = self2.get("iterRate");
var lambda = self2.get("lambda");
for (var i4 = 0; i4 < C3; i4++) {
var _loop_1 = function _loop_12(j5) {
var forces = [];
edges.forEach(function(e4, k4) {
if (e4.source === e4.target)
return;
var source = nodeIdMap[e4.source];
var target = nodeIdMap[e4.target];
forces[k4] = self2.getEdgeForces({
source,
target
}, k4, divisions, lambda);
for (var p4 = 0; p4 < divisions + 1; p4++) {
edgePoints[k4][p4].x += forces[k4][p4].x;
edgePoints[k4][p4].y += forces[k4][p4].y;
}
});
};
for (var j4 = 0; j4 < iterations; j4++) {
_loop_1(j4);
}
lambda = lambda / 2;
divisions *= divRate;
iterations *= iterRate;
edgePoints = self2.divideEdges(divisions);
self2.set("edgePoints", edgePoints);
}
edges.forEach(function(e4, i5) {
if (e4.source === e4.target)
return;
e4.type = "polyline";
e4.controlPoints = edgePoints[i5].slice(1, edgePoints[i5].length - 1);
});
var graph = self2.get("graph");
graph.refresh();
};
Bundling3.prototype.updateBundling = function(cfg) {
var self2 = this;
var data3 = cfg.data;
if (data3) {
self2.set("data", data3);
}
if (self2.get("ticking")) {
self2.set("ticking", false);
}
Object.keys(cfg).forEach(function(key) {
self2.set(key, cfg[key]);
});
if (cfg.onTick) {
var graph_1 = this.get("graph");
self2.set("tick", function() {
cfg.onTick();
graph_1.refresh();
});
}
self2.bundling(data3);
};
Bundling3.prototype.divideEdges = function(divisions) {
var self2 = this;
var edges = self2.get("data").edges;
var nodeIdMap = self2.get("nodeIdMap");
var edgePoints = self2.get("edgePoints");
if (!edgePoints || edgePoints === void 0)
edgePoints = [];
edges.forEach(function(edge2, i4) {
if (!edgePoints[i4] || edgePoints[i4] === void 0) {
edgePoints[i4] = [];
}
var source = nodeIdMap[edge2.source];
var target = nodeIdMap[edge2.target];
if (divisions === 1) {
edgePoints[i4].push({
x: source.x,
y: source.y
});
edgePoints[i4].push({
x: 0.5 * (source.x + target.x),
y: 0.5 * (source.y + target.y)
});
edgePoints[i4].push({
x: target.x,
y: target.y
});
} else {
var edgeLength = 0;
if (!edgePoints[i4] || edgePoints[i4] === []) {
edgeLength = getEucliDis({
x: source.x,
y: source.y
}, {
x: target.x,
y: target.y
});
} else {
edgeLength = self2.getEdgeLength(edgePoints[i4]);
}
var divisionLength_1 = edgeLength / (divisions + 1);
var currentDivisonLength_1 = divisionLength_1;
var newEdgePoints_1 = [{
x: source.x,
y: source.y
}];
edgePoints[i4].forEach(function(ep, j4) {
if (j4 === 0)
return;
var oriDivisionLength = getEucliDis(ep, edgePoints[i4][j4 - 1]);
while (oriDivisionLength > currentDivisonLength_1) {
var ratio = currentDivisonLength_1 / oriDivisionLength;
var edgePoint = {
x: edgePoints[i4][j4 - 1].x,
y: edgePoints[i4][j4 - 1].y
};
edgePoint.x += ratio * (ep.x - edgePoints[i4][j4 - 1].x);
edgePoint.y += ratio * (ep.y - edgePoints[i4][j4 - 1].y);
newEdgePoints_1.push(edgePoint);
oriDivisionLength -= currentDivisonLength_1;
currentDivisonLength_1 = divisionLength_1;
}
currentDivisonLength_1 -= oriDivisionLength;
});
newEdgePoints_1.push({
x: target.x,
y: target.y
});
edgePoints[i4] = newEdgePoints_1;
}
});
return edgePoints;
};
Bundling3.prototype.getEdgeLength = function(points) {
var length5 = 0;
points.forEach(function(p4, i4) {
if (i4 === 0)
return;
length5 += getEucliDis(p4, points[i4 - 1]);
});
return length5;
};
Bundling3.prototype.getEdgeBundles = function() {
var self2 = this;
var data3 = self2.get("data");
var edges = data3.edges || [];
var bundleThreshold = self2.get("bundleThreshold");
var nodeIdMap = self2.get("nodeIdMap");
var edgeBundles = self2.get("edgeBundles");
if (!edgeBundles)
edgeBundles = [];
edges.forEach(function(e4, i4) {
if (!edgeBundles[i4] || edgeBundles[i4] === void 0) {
edgeBundles[i4] = [];
}
});
edges.forEach(function(ei, i4) {
var iSource = nodeIdMap[ei.source];
var iTarget = nodeIdMap[ei.target];
edges.forEach(function(ej, j4) {
if (j4 <= i4)
return;
var jSource = nodeIdMap[ej.source];
var jTarget = nodeIdMap[ej.target];
var score2 = self2.getBundleScore({
source: iSource,
target: iTarget
}, {
source: jSource,
target: jTarget
});
if (score2 >= bundleThreshold) {
edgeBundles[i4].push(j4);
edgeBundles[j4].push(i4);
}
});
});
return edgeBundles;
};
Bundling3.prototype.getBundleScore = function(ei, ej) {
var self2 = this;
ei.vx = ei.target.x - ei.source.x;
ei.vy = ei.target.y - ei.source.y;
ej.vx = ej.target.x - ej.source.x;
ej.vy = ej.target.y - ej.source.y;
ei.length = getEucliDis({
x: ei.source.x,
y: ei.source.y
}, {
x: ei.target.x,
y: ei.target.y
});
ej.length = getEucliDis({
x: ej.source.x,
y: ej.source.y
}, {
x: ej.target.x,
y: ej.target.y
});
var aScore = self2.getAngleScore(ei, ej);
var sScore = self2.getScaleScore(ei, ej);
var pScore = self2.getPositionScore(ei, ej);
var vScore = self2.getVisibilityScore(ei, ej);
return aScore * sScore * pScore * vScore;
};
Bundling3.prototype.getAngleScore = function(ei, ej) {
var dotProduct = getDotProduct({
x: ei.vx,
y: ei.vy
}, {
x: ej.vx,
y: ej.vy
});
return dotProduct / (ei.length * ej.length);
};
Bundling3.prototype.getScaleScore = function(ei, ej) {
var aLength = (ei.length + ej.length) / 2;
var score2 = 2 / (aLength / Math.min(ei.length, ej.length) + Math.max(ei.length, ej.length) / aLength);
return score2;
};
Bundling3.prototype.getPositionScore = function(ei, ej) {
var aLength = (ei.length + ej.length) / 2;
var iMid = {
x: (ei.source.x + ei.target.x) / 2,
y: (ei.source.y + ei.target.y) / 2
};
var jMid = {
x: (ej.source.x + ej.target.x) / 2,
y: (ej.source.y + ej.target.y) / 2
};
var distance15 = getEucliDis(iMid, jMid);
return aLength / (aLength + distance15);
};
Bundling3.prototype.getVisibilityScore = function(ei, ej) {
var vij = this.getEdgeVisibility(ei, ej);
var vji = this.getEdgeVisibility(ej, ei);
return vij < vji ? vij : vji;
};
Bundling3.prototype.getEdgeVisibility = function(ei, ej) {
var ps = projectPointToEdge(ej.source, ei);
var pt = projectPointToEdge(ej.target, ei);
var pMid = {
x: (ps.x + pt.x) / 2,
y: (ps.y + pt.y) / 2
};
var iMid = {
x: (ei.source.x + ei.target.x) / 2,
y: (ei.source.y + ei.target.y) / 2
};
return Math.max(0, 1 - 2 * getEucliDis(pMid, iMid) / getEucliDis(ps, pt));
};
Bundling3.prototype.getEdgeForces = function(e4, eidx, divisions, lambda) {
var self2 = this;
var edgePoints = self2.get("edgePoints");
var K2 = self2.get("K");
var kp = K2 / (getEucliDis(e4.source, e4.target) * (divisions + 1));
var edgePointForces = [{
x: 0,
y: 0
}];
for (var i4 = 1; i4 < divisions; i4++) {
var force = {
x: 0,
y: 0
};
var spring = self2.getSpringForce({
pre: edgePoints[eidx][i4 - 1],
cur: edgePoints[eidx][i4],
next: edgePoints[eidx][i4 + 1]
}, kp);
var electrostatic = self2.getElectrostaticForce(i4, eidx);
force.x = lambda * (spring.x + electrostatic.x);
force.y = lambda * (spring.y + electrostatic.y);
edgePointForces.push(force);
}
edgePointForces.push({
x: 0,
y: 0
});
return edgePointForces;
};
Bundling3.prototype.getSpringForce = function(divisions, kp) {
var x6 = divisions.pre.x + divisions.next.x - 2 * divisions.cur.x;
var y5 = divisions.pre.y + divisions.next.y - 2 * divisions.cur.y;
x6 *= kp;
y5 *= kp;
return {
x: x6,
y: y5
};
};
Bundling3.prototype.getElectrostaticForce = function(pidx, eidx) {
var self2 = this;
var eps2 = self2.get("eps");
var edgeBundles = self2.get("edgeBundles");
var edgePoints = self2.get("edgePoints");
var edgeBundle = edgeBundles[eidx];
var resForce = {
x: 0,
y: 0
};
edgeBundle.forEach(function(eb) {
var force = {
x: edgePoints[eb][pidx].x - edgePoints[eidx][pidx].x,
y: edgePoints[eb][pidx].y - edgePoints[eidx][pidx].y
};
if (Math.abs(force.x) > eps2 || Math.abs(force.y) > eps2) {
var length_1 = getEucliDis(edgePoints[eb][pidx], edgePoints[eidx][pidx]);
var diff2 = 1 / length_1;
resForce.x += force.x * diff2;
resForce.y += force.y * diff2;
}
});
return resForce;
};
Bundling3.prototype.isTicking = function() {
return this.get("ticking");
};
Bundling3.prototype.getSimulation = function() {
return this.get("forceSimulation");
};
Bundling3.prototype.destroy = function() {
if (this.get("ticking")) {
this.getSimulation().stop();
}
_super.prototype.destroy.call(this);
};
return Bundling3;
}(base_default18);
var bundling_default = Bundling;
// node_modules/@antv/g6-plugin/es/fisheye/index.js
var __extends9 = function() {
var _extendStatics = function extendStatics(d3, b10) {
_extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(d4, b11) {
d4.__proto__ = b11;
} || function(d4, b11) {
for (var p4 in b11) {
if (Object.prototype.hasOwnProperty.call(b11, p4))
d4[p4] = b11[p4];
}
};
return _extendStatics(d3, b10);
};
return function(d3, b10) {
if (typeof b10 !== "function" && b10 !== null)
throw new TypeError("Class extends value " + String(b10) + " is not a constructor or null");
_extendStatics(d3, b10);
function __() {
this.constructor = d3;
}
d3.prototype = b10 === null ? Object.create(b10) : (__.prototype = b10.prototype, new __());
};
}();
var __assign7 = function() {
__assign7 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4) {
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
}
return t4;
};
return __assign7.apply(this, arguments);
};
var DELTA = 0.05;
var lensDelegateStyle = {
stroke: "#000",
strokeOpacity: 0.8,
lineWidth: 2,
fillOpacity: 0.1,
fill: "#ccc"
};
var Fisheye = function(_super) {
__extends9(Fisheye3, _super);
function Fisheye3() {
return _super !== null && _super.apply(this, arguments) || this;
}
Fisheye3.prototype.getDefaultCfgs = function() {
return {
trigger: "mousemove",
d: 1.5,
r: 300,
delegateStyle: clone_default(lensDelegateStyle),
showLabel: false,
maxD: 5,
minD: 0,
scaleRBy: "unset",
scaleDBy: "unset",
showDPercent: true
};
};
Fisheye3.prototype.getEvents = function() {
var events;
switch (this.get("trigger")) {
case "click":
events = {
click: "magnify"
};
break;
case "drag":
events = {
click: "createDelegate"
};
break;
default:
events = {
mousemove: "magnify"
};
break;
}
return events;
};
Fisheye3.prototype.init = function() {
var self2 = this;
var r4 = self2.get("r");
self2.set("cachedMagnifiedModels", []);
self2.set("cachedOriginPositions", {});
self2.set("r2", r4 * r4);
var d3 = self2.get("d");
self2.set("molecularParam", (d3 + 1) * r4);
};
Fisheye3.prototype.createDelegate = function(e4) {
var _this = this;
var self2 = this;
var lensDelegate = self2.get("delegate");
if (!lensDelegate || lensDelegate.destroyed) {
self2.magnify(e4);
lensDelegate = self2.get("delegate");
lensDelegate.on("dragstart", function(evt) {
self2.set("delegateCenterDiff", {
x: lensDelegate.attr("x") - evt.x,
y: lensDelegate.attr("y") - evt.y
});
});
lensDelegate.on("drag", function(evt) {
self2.magnify(evt);
});
if (this.get("scaleDBy") === "wheel") {
lensDelegate.on("mousewheel", function(evt) {
_this.scaleDByWheel(evt);
});
}
if (this.get("scaleRBy") === "wheel") {
lensDelegate.on("mousewheel", function(evt) {
self2.scaleRByWheel(evt);
});
}
}
};
Fisheye3.prototype.scaleRByWheel = function(e4) {
var self2 = this;
if (!e4 || !e4.originalEvent)
return;
if (e4.preventDefault)
e4.preventDefault();
var graph = self2.get("graph");
var ratio;
var lensDelegate = self2.get("delegate");
var lensCenter = lensDelegate ? {
x: lensDelegate.attr("x"),
y: lensDelegate.attr("y")
} : void 0;
var mousePos = lensCenter || graph.getPointByClient(e4.clientX, e4.clientY);
if (e4.originalEvent.wheelDelta < 0) {
ratio = 1 - DELTA;
} else {
ratio = 1 / (1 - DELTA);
}
var maxR = self2.get("maxR");
var minR = self2.get("minR");
var r4 = self2.get("r");
if (r4 > (maxR || graph.get("height")) && ratio > 1 || r4 < (minR || graph.get("height") * 0.05) && ratio < 1) {
ratio = 1;
}
r4 *= ratio;
self2.set("r", r4);
self2.set("r2", r4 * r4);
var d3 = self2.get("d");
self2.set("molecularParam", (d3 + 1) * r4);
self2.set("delegateCenterDiff", void 0);
self2.magnify(e4, mousePos);
};
Fisheye3.prototype.scaleRByDrag = function(e4) {
var self2 = this;
if (!e4)
return;
var dragPrePos = self2.get("dragPrePos");
var graph = self2.get("graph");
var ratio;
var mousePos = graph.getPointByClient(e4.clientX, e4.clientY);
if (e4.x - dragPrePos.x < 0) {
ratio = 1 - DELTA;
} else {
ratio = 1 / (1 - DELTA);
}
var maxR = self2.get("maxR");
var minR = self2.get("minR");
var r4 = self2.get("r");
if (r4 > (maxR || graph.get("height")) && ratio > 1 || r4 < (minR || graph.get("height") * 0.05) && ratio < 1) {
ratio = 1;
}
r4 *= ratio;
self2.set("r", r4);
self2.set("r2", r4 * r4);
var d3 = self2.get("d");
self2.set("molecularParam", (d3 + 1) * r4);
self2.magnify(e4, mousePos);
self2.set("dragPrePos", {
x: e4.x,
y: e4.y
});
};
Fisheye3.prototype.scaleDByWheel = function(evt) {
var self2 = this;
if (!evt && !evt.originalEvent)
return;
if (evt.preventDefault)
evt.preventDefault();
var delta = 0;
if (evt.originalEvent.wheelDelta < 0) {
delta = -0.1;
} else {
delta = 0.1;
}
var d3 = self2.get("d");
var newD = d3 + delta;
var maxD = self2.get("maxD");
var minD = self2.get("minD");
if (newD < maxD && newD > minD) {
self2.set("d", newD);
var r4 = self2.get("r");
self2.set("molecularParam", (newD + 1) * r4);
var lensDelegate = self2.get("delegate");
var lensCenter = lensDelegate ? {
x: lensDelegate.attr("x"),
y: lensDelegate.attr("y")
} : void 0;
self2.set("delegateCenterDiff", void 0);
self2.magnify(evt, lensCenter);
}
};
Fisheye3.prototype.scaleDByDrag = function(e4) {
var self2 = this;
var dragPrePos = self2.get("dragPrePos");
var delta = e4.x - dragPrePos.x > 0 ? 0.1 : -0.1;
var d3 = self2.get("d");
var newD = d3 + delta;
var maxD = self2.get("maxD");
var minD = self2.get("minD");
if (newD < maxD && newD > minD) {
self2.set("d", newD);
var r4 = self2.get("r");
self2.set("molecularParam", (newD + 1) * r4);
self2.magnify(e4);
}
self2.set("dragPrePos", {
x: e4.x,
y: e4.y
});
};
Fisheye3.prototype.magnify = function(e4, mousePos) {
var self2 = this;
self2.restoreCache();
var graph = self2.get("graph");
var cachedMagnifiedModels = self2.get("cachedMagnifiedModels");
var cachedOriginPositions = self2.get("cachedOriginPositions");
var showLabel = self2.get("showLabel");
var r4 = self2.get("r");
var r22 = self2.get("r2");
var d3 = self2.get("d");
var molecularParam = self2.get("molecularParam");
var nodes = graph.getNodes();
var nodeLength = nodes.length;
var mCenter = mousePos ? {
x: mousePos.x,
y: mousePos.y
} : {
x: e4.x,
y: e4.y
};
if (self2.get("dragging") && (self2.get("trigger") === "mousemove" || self2.get("trigger") === "click")) {
mCenter = self2.get("cacheCenter");
}
var delegateCenterDiff = self2.get("delegateCenterDiff");
if (delegateCenterDiff) {
mCenter.x += delegateCenterDiff.x;
mCenter.y += delegateCenterDiff.y;
}
self2.updateDelegate(mCenter, r4);
for (var i4 = 0; i4 < nodeLength; i4++) {
var model = nodes[i4].getModel();
var x6 = model.x, y5 = model.y;
if (isNaN(x6) || isNaN(y5))
continue;
var dist22 = (x6 - mCenter.x) * (x6 - mCenter.x) + (y5 - mCenter.y) * (y5 - mCenter.y);
if (!isNaN(dist22) && dist22 < r22 && dist22 !== 0) {
var dist4 = Math.sqrt(dist22);
var magnifiedDist = molecularParam * dist4 / (d3 * dist4 + r4);
var cos3 = (x6 - mCenter.x) / dist4;
var sin3 = (y5 - mCenter.y) / dist4;
model.x = cos3 * magnifiedDist + mCenter.x;
model.y = sin3 * magnifiedDist + mCenter.y;
if (!cachedOriginPositions[model.id]) {
cachedOriginPositions[model.id] = {
x: x6,
y: y5,
texts: []
};
}
cachedMagnifiedModels.push(model);
if (showLabel && 2 * dist4 < r4) {
var node = nodes[i4];
var nodeGroup = node.getContainer();
var shapes = nodeGroup.getChildren();
var shapeLength = shapes.length;
for (var j4 = 0; j4 < shapeLength; j4++) {
var shape = shapes[j4];
if (shape.get("type") === "text") {
cachedOriginPositions[model.id].texts.push({
visible: shape.get("visible"),
shape
});
shape.set("visible", true);
}
}
}
}
}
graph.refreshPositions();
};
Fisheye3.prototype.restoreCache = function() {
var self2 = this;
var cachedMagnifiedModels = self2.get("cachedMagnifiedModels");
var cachedOriginPositions = self2.get("cachedOriginPositions");
var cacheLength = cachedMagnifiedModels.length;
for (var i4 = 0; i4 < cacheLength; i4++) {
var node = cachedMagnifiedModels[i4];
var id = node.id;
var ori = cachedOriginPositions[id];
node.x = ori.x;
node.y = ori.y;
var textLength = ori.texts.length;
for (var j4 = 0; j4 < textLength; j4++) {
var text = ori.texts[j4];
text.shape.set("visible", text.visible);
}
}
self2.set("cachedMagnifiedModels", []);
self2.set("cachedOriginPositions", {});
};
Fisheye3.prototype.updateParams = function(cfg) {
var self2 = this;
var r4 = cfg.r, d3 = cfg.d, trigger = cfg.trigger, minD = cfg.minD, maxD = cfg.maxD, minR = cfg.minR, maxR = cfg.maxR, scaleDBy = cfg.scaleDBy, scaleRBy = cfg.scaleRBy;
if (!isNaN(cfg.r)) {
self2.set("r", r4);
self2.set("r2", r4 * r4);
}
if (!isNaN(d3)) {
self2.set("d", d3);
}
if (!isNaN(maxD)) {
self2.set("maxD", maxD);
}
if (!isNaN(minD)) {
self2.set("minD", minD);
}
if (!isNaN(maxR)) {
self2.set("maxR", maxR);
}
if (!isNaN(minR)) {
self2.set("minR", minR);
}
var nd = self2.get("d");
var nr = self2.get("r");
self2.set("molecularParam", (nd + 1) * nr);
if (trigger === "mousemove" || trigger === "click" || trigger === "drag") {
self2.set("trigger", trigger);
}
if (scaleDBy === "drag" || scaleDBy === "wheel" || scaleDBy === "unset") {
self2.set("scaleDBy", scaleDBy);
self2.get("delegate").remove();
self2.get("delegate").destroy();
var dPercentText = self2.get("dPercentText");
if (dPercentText) {
dPercentText.remove();
dPercentText.destroy();
}
}
if (scaleRBy === "drag" || scaleRBy === "wheel" || scaleRBy === "unset") {
self2.set("scaleRBy", scaleRBy);
self2.get("delegate").remove();
self2.get("delegate").destroy();
var dPercentText = self2.get("dPercentText");
if (dPercentText) {
dPercentText.remove();
dPercentText.destroy();
}
}
};
Fisheye3.prototype.updateDelegate = function(mCenter, r4) {
var _this = this;
var self2 = this;
var graph = self2.get("graph");
var lensDelegate = self2.get("delegate");
if (!lensDelegate || lensDelegate.destroyed) {
var parent_1 = graph.get("group");
var attrs = self2.get("delegateStyle") || lensDelegateStyle;
lensDelegate = parent_1.addShape("circle", {
attrs: __assign7({
r: r4 / 1.5,
x: mCenter.x,
y: mCenter.y
}, attrs),
name: "lens-shape",
draggable: true
});
if (this.get("trigger") !== "drag") {
if (this.get("scaleRBy") === "wheel") {
lensDelegate.on("mousewheel", function(evt) {
self2.scaleRByWheel(evt);
});
} else if (this.get("scaleRBy") === "drag") {
lensDelegate.on("dragstart", function(e4) {
self2.set("dragging", true);
self2.set("cacheCenter", {
x: e4.x,
y: e4.y
});
self2.set("dragPrePos", {
x: e4.x,
y: e4.y
});
});
lensDelegate.on("drag", function(evt) {
self2.scaleRByDrag(evt);
});
lensDelegate.on("dragend", function(e4) {
self2.set("dragging", false);
});
}
if (this.get("scaleDBy") === "wheel") {
lensDelegate.on("mousewheel", function(evt) {
_this.scaleDByWheel(evt);
});
} else if (this.get("scaleDBy") === "drag") {
lensDelegate.on("dragstart", function(evt) {
self2.set("dragging", true);
self2.set("cacheCenter", {
x: evt.x,
y: evt.y
});
self2.set("dragPrePos", {
x: evt.x,
y: evt.y
});
});
lensDelegate.on("drag", function(evt) {
_this.scaleDByDrag(evt);
});
lensDelegate.on("dragend", function(evt) {
self2.set("dragging", false);
});
}
}
} else {
lensDelegate.attr({
x: mCenter.x,
y: mCenter.y,
r: r4 / 1.5
});
}
if (self2.get("showDPercent")) {
var percent2 = Math.round((self2.get("d") - self2.get("minD")) / (self2.get("maxD") - self2.get("minD")) * 100);
var dPercentText = self2.get("dPercentText");
var textY = mCenter.y + r4 / 1.5 + 16;
if (!dPercentText || dPercentText.destroyed) {
var parent_2 = graph.get("group");
dPercentText = parent_2.addShape("text", {
attrs: {
text: percent2 + "%",
x: mCenter.x,
y: textY,
fill: "#aaa",
stroke: "#fff",
lineWidth: 1,
fontSize: 12
}
});
self2.set("dPercentText", dPercentText);
} else {
dPercentText.attr({
text: percent2 + "%",
x: mCenter.x,
y: textY
});
}
}
self2.set("delegate", lensDelegate);
};
Fisheye3.prototype.clear = function() {
var graph = this.get("graph");
this.restoreCache();
graph.refreshPositions();
var lensDelegate = this.get("delegate");
if (lensDelegate && !lensDelegate.destroyed) {
lensDelegate.remove();
lensDelegate.destroy();
}
var dPercentText = this.get("dPercentText");
if (dPercentText && !dPercentText.destroyed) {
dPercentText.remove();
dPercentText.destroy();
}
};
Fisheye3.prototype.destroy = function() {
this.clear();
};
return Fisheye3;
}(base_default18);
var fisheye_default = Fisheye;
// node_modules/@antv/g6-plugin/es/toolBar/index.js
var import_insert_css2 = __toModule(require_insert_css());
var __extends10 = function() {
var _extendStatics = function extendStatics(d3, b10) {
_extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(d4, b11) {
d4.__proto__ = b11;
} || function(d4, b11) {
for (var p4 in b11) {
if (Object.prototype.hasOwnProperty.call(b11, p4))
d4[p4] = b11[p4];
}
};
return _extendStatics(d3, b10);
};
return function(d3, b10) {
if (typeof b10 !== "function" && b10 !== null)
throw new TypeError("Class extends value " + String(b10) + " is not a constructor or null");
_extendStatics(d3, b10);
function __() {
this.constructor = d3;
}
d3.prototype = b10 === null ? Object.create(b10) : (__.prototype = b10.prototype, new __());
};
}();
var DELTA2 = 0.05;
(0, import_insert_css2.default)("\n .g6-component-toolbar {\n position: absolute;\n list-style-type: none;\n padding: 6px;\n left: 0px;\n top: 0px;\n background-color: rgba(255, 255, 255, 0.9);\n border: 1px solid #e2e2e2;\n border-radius: 4px;\n font-size: 12px;\n color: #545454;\n margin: 0;\n }\n .g6-component-toolbar li {\n float: left;\n text-align: center;\n width: 35px;\n height: 24px;\n cursor: pointer;\n list-style-type:none;\n list-style: none;\n margin-left: 0px;\n }\n .g6-component-toolbar li .icon {\n opacity: 0.7;\n }\n .g6-component-toolbar li .icon:hover {\n opacity: 1;\n }\n");
var getEventPath = function getEventPath2(evt) {
if (!evt) {
return [];
}
if (evt.composedPath) {
return evt.composedPath();
}
var path = [];
var el = evt.target;
while (el) {
path.push(el);
if (el.tagName === "HTML") {
path.push(document, window);
return path;
}
el = el.parentElement;
}
return path;
};
var ToolBar = function(_super) {
__extends10(ToolBar3, _super);
function ToolBar3() {
return _super !== null && _super.apply(this, arguments) || this;
}
ToolBar3.prototype.getDefaultCfgs = function() {
return {
handleClick: void 0,
getContent: function getContent(graph) {
return `
`;
},
zoomSensitivity: 2
};
};
ToolBar3.prototype.init = function() {
var _this = this;
var graph = this.get("graph");
var getContent = this.get("getContent");
var toolBar = getContent(graph);
var toolBarDOM = toolBar;
if (is_string_default(toolBar)) {
toolBarDOM = createDom(toolBar);
}
var className = this.get("className");
toolBarDOM.setAttribute("class", className || "g6-component-toolbar");
var container2 = this.get("container");
if (!container2) {
container2 = this.get("graph").get("container");
}
if (is_string_default(container2)) {
container2 = document.getElementById(container2);
}
container2.appendChild(toolBarDOM);
this.set("toolBar", toolBarDOM);
var handleClick = this.get("handleClick");
toolBarDOM.addEventListener("click", function(evt) {
var current = getEventPath(evt).filter(function(p4) {
return p4.nodeName === "LI";
});
if (current.length === 0) {
return;
}
var code = current[0].getAttribute("code");
if (!code) {
return;
}
if (handleClick) {
handleClick(code, graph);
} else {
_this.handleDefaultOperator(code, graph);
}
});
var pos = this.get("position");
if (pos) {
modifyCSS(toolBarDOM, {
top: pos.y + "px",
left: pos.x + "px"
});
}
this.bindUndoRedo();
};
ToolBar3.prototype.bindUndoRedo = function() {
var graph = this.get("graph");
var undoDom = document.querySelector('.g6-component-toolbar li[code="undo"]');
var undoDomIcon = document.querySelector('.g6-component-toolbar li[code="undo"] svg');
var redoDom = document.querySelector('.g6-component-toolbar li[code="redo"]');
var redoDomIcon = document.querySelector('.g6-component-toolbar li[code="redo"] svg');
if (!undoDom || !undoDomIcon || !redoDom || !redoDomIcon) {
return;
}
graph.on("stackchange", function(evt) {
var undoStack = evt.undoStack, redoStack = evt.redoStack;
var undoStackLen = undoStack.length;
var redoStackLen = redoStack.length;
if (undoStackLen === 1) {
undoDom.setAttribute("style", "cursor: not-allowed");
undoDomIcon.setAttribute("style", "opacity: 0.4");
} else {
undoDom.removeAttribute("style");
undoDomIcon.removeAttribute("style");
}
if (redoStackLen === 0) {
redoDom.setAttribute("style", "cursor: not-allowed");
redoDomIcon.setAttribute("style", "opacity: 0.4");
} else {
redoDom.removeAttribute("style");
redoDomIcon.removeAttribute("style");
}
});
};
ToolBar3.prototype.undo = function() {
var graph = this.get("graph");
var undoStack = graph.getUndoStack();
if (!undoStack || undoStack.length === 1) {
return;
}
var currentData = undoStack.pop();
if (currentData) {
var action = currentData.action;
graph.pushStack(action, clone_default(currentData.data), "redo");
var data_1 = currentData.data.before;
if (action === "add") {
data_1 = currentData.data.after;
}
if (!data_1)
return;
switch (action) {
case "visible": {
Object.keys(data_1).forEach(function(key) {
var array = data_1[key];
if (!array)
return;
array.forEach(function(model) {
var item = graph.findById(model.id);
if (model.visible) {
graph.showItem(item, false);
} else {
graph.hideItem(item, false);
}
});
});
break;
}
case "render":
case "update":
Object.keys(data_1).forEach(function(key) {
var array = data_1[key];
if (!array)
return;
array.forEach(function(model) {
graph.updateItem(model.id, model, false);
});
});
break;
case "changedata":
graph.changeData(data_1, false);
break;
case "delete": {
Object.keys(data_1).forEach(function(key) {
var array = data_1[key];
if (!array)
return;
array.forEach(function(model) {
var itemType = model.itemType;
delete model.itemType;
graph.addItem(itemType, model, false);
});
});
break;
}
case "add":
Object.keys(data_1).forEach(function(key) {
var array = data_1[key];
if (!array)
return;
array.forEach(function(model) {
graph.removeItem(model.id, false);
});
});
break;
case "updateComboTree":
Object.keys(data_1).forEach(function(key) {
var array = data_1[key];
if (!array)
return;
array.forEach(function(model) {
graph.updateComboTree(model.id, model.parentId, false);
});
});
break;
default:
}
}
};
ToolBar3.prototype.redo = function() {
var graph = this.get("graph");
var redoStack = graph.getRedoStack();
if (!redoStack || redoStack.length === 0) {
return;
}
var currentData = redoStack.pop();
if (currentData) {
var action = currentData.action;
var data_2 = currentData.data.after;
graph.pushStack(action, clone_default(currentData.data));
if (action === "delete") {
data_2 = currentData.data.before;
}
if (!data_2)
return;
switch (action) {
case "visible": {
Object.keys(data_2).forEach(function(key) {
var array = data_2[key];
if (!array)
return;
array.forEach(function(model) {
var item = graph.findById(model.id);
if (model.visible) {
graph.showItem(item, false);
} else {
graph.hideItem(item, false);
}
});
});
break;
}
case "render":
case "update":
Object.keys(data_2).forEach(function(key) {
var array = data_2[key];
if (!array)
return;
array.forEach(function(model) {
graph.updateItem(model.id, model, false);
});
});
break;
case "changedata":
graph.changeData(data_2, false);
break;
case "delete":
if (data_2.edges) {
data_2.edges.forEach(function(model) {
graph.removeItem(model.id, false);
});
}
if (data_2.nodes) {
data_2.nodes.forEach(function(model) {
graph.removeItem(model.id, false);
});
}
if (data_2.combos) {
data_2.combos.forEach(function(model) {
graph.removeItem(model.id, false);
});
}
break;
case "add": {
Object.keys(data_2).forEach(function(key) {
var array = data_2[key];
if (!array)
return;
array.forEach(function(model) {
var itemType = model.itemType;
delete model.itemType;
graph.addItem(itemType, model, false);
});
});
break;
}
case "updateComboTree":
Object.keys(data_2).forEach(function(key) {
var array = data_2[key];
if (!array)
return;
array.forEach(function(model) {
graph.updateComboTree(model.id, model.parentId, false);
});
});
break;
default:
}
}
};
ToolBar3.prototype.handleDefaultOperator = function(code, graph) {
var currentZoom = graph.getZoom();
switch (code) {
case "redo":
this.redo();
break;
case "undo":
this.undo();
break;
case "zoomOut": {
var ratioOut = 1 / (1 - DELTA2 * this.get("zoomSensitivity"));
var maxZoom = this.get("maxZoom") || graph.get("maxZoom");
if (ratioOut * currentZoom > maxZoom) {
return;
}
graph.zoomTo(currentZoom * ratioOut);
break;
}
case "zoomIn": {
var ratioIn = 1 - DELTA2 * this.get("zoomSensitivity");
var minZoom = this.get("minZoom") || graph.get("minZoom");
if (ratioIn * currentZoom < minZoom) {
return;
}
graph.zoomTo(currentZoom * ratioIn);
break;
}
case "realZoom":
graph.zoomTo(1);
break;
case "autoZoom":
graph.fitView([20, 20]);
break;
default:
}
};
ToolBar3.prototype.destroy = function() {
var toolBar = this.get("toolBar");
if (toolBar) {
var container2 = this.get("container");
if (!container2) {
container2 = this.get("graph").get("container");
}
if (is_string_default(container2)) {
container2 = document.getElementById(container2);
}
container2.removeChild(toolBar);
}
var handleClick = this.get("handleClick");
if (handleClick) {
toolBar.removeEventListener("click", handleClick);
}
};
return ToolBar3;
}(base_default18);
var toolBar_default = ToolBar;
// node_modules/@antv/g6-plugin/es/tooltip/index.js
var import_insert_css3 = __toModule(require_insert_css());
var __extends11 = function() {
var _extendStatics = function extendStatics(d3, b10) {
_extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(d4, b11) {
d4.__proto__ = b11;
} || function(d4, b11) {
for (var p4 in b11) {
if (Object.prototype.hasOwnProperty.call(b11, p4))
d4[p4] = b11[p4];
}
};
return _extendStatics(d3, b10);
};
return function(d3, b10) {
if (typeof b10 !== "function" && b10 !== null)
throw new TypeError("Class extends value " + String(b10) + " is not a constructor or null");
_extendStatics(d3, b10);
function __() {
this.constructor = d3;
}
d3.prototype = b10 === null ? Object.create(b10) : (__.prototype = b10.prototype, new __());
};
}();
(0, import_insert_css3.default)("\n .g6-component-tooltip {\n border: 1px solid #e2e2e2;\n border-radius: 4px;\n font-size: 12px;\n color: #545454;\n background-color: rgba(255, 255, 255, 0.9);\n padding: 10px 8px;\n box-shadow: rgb(174, 174, 174) 0px 0px 10px;\n }\n .tooltip-type {\n padding: 0;\n margin: 0;\n }\n .tooltip-id {\n color: #531dab;\n }\n");
var Tooltip3 = function(_super) {
__extends11(Tooltip5, _super);
function Tooltip5() {
return _super !== null && _super.apply(this, arguments) || this;
}
Tooltip5.prototype.getDefaultCfgs = function() {
return {
offsetX: 6,
offsetY: 6,
getContent: function getContent(e4) {
return "\n \n ID\uFF1A" + e4.item.getID() + "\n ";
},
shouldBegin: function shouldBegin2(e4) {
return true;
},
itemTypes: ["node", "edge", "combo"],
trigger: "mouseenter",
fixToNode: void 0
};
};
Tooltip5.prototype.getEvents = function() {
if (this.get("trigger") === "click") {
return {
"node:click": "onClick",
"edge:click": "onClick",
"combo:click": "onClick",
"canvas:click": "onMouseLeave",
afterremoveitem: "onMouseLeave",
contextmenu: "onMouseLeave",
"drag": "onMouseLeave"
};
}
return {
"node:mouseenter": "onMouseEnter",
"node:mouseleave": "onMouseLeave",
"node:mousemove": "onMouseMove",
"edge:mouseenter": "onMouseEnter",
"edge:mouseleave": "onMouseLeave",
"edge:mousemove": "onMouseMove",
"combo:mouseenter": "onMouseEnter",
"combo:mouseleave": "onMouseLeave",
"combo:mousemove": "onMouseMove",
afterremoveitem: "onMouseLeave",
contextmenu: "onMouseLeave",
"node:drag": "onMouseLeave"
};
};
Tooltip5.prototype.init = function() {
var className = this.get("className") || "g6-component-tooltip";
var tooltip10 = createDom("");
var container2 = this.get("container");
if (!container2) {
container2 = this.get("graph").get("container");
}
if (is_string_default(container2)) {
container2 = document.getElementById(container2);
}
modifyCSS(tooltip10, {
position: "absolute",
visibility: "hidden",
display: "none"
});
container2.appendChild(tooltip10);
this.set("tooltip", tooltip10);
};
Tooltip5.prototype.onClick = function(e4) {
var itemTypes = this.get("itemTypes");
if (e4.item && e4.item.getType && itemTypes.indexOf(e4.item.getType()) === -1)
return;
var item = e4.item;
var graph = this.get("graph");
if (this.currentTarget === item) {
this.currentTarget = null;
this.hideTooltip();
graph.emit("tooltipchange", {
item: e4.item,
action: "hide"
});
} else {
this.currentTarget = item;
this.showTooltip(e4);
graph.emit("tooltipchange", {
item: e4.item,
action: "show"
});
}
};
Tooltip5.prototype.onMouseEnter = function(e4) {
var itemTypes = this.get("itemTypes");
if (e4.item && e4.item.getType && itemTypes.indexOf(e4.item.getType()) === -1)
return;
var item = e4.item;
var graph = this.get("graph");
this.currentTarget = item;
this.showTooltip(e4);
graph.emit("tooltipchange", {
item: e4.item,
action: "show"
});
};
Tooltip5.prototype.onMouseMove = function(e4) {
var itemTypes = this.get("itemTypes");
if (e4.item && e4.item.getType && itemTypes.indexOf(e4.item.getType()) === -1)
return;
if (!this.currentTarget || e4.item !== this.currentTarget) {
return;
}
this.showTooltip(e4);
};
Tooltip5.prototype.onMouseLeave = function() {
this.hideTooltip();
var graph = this.get("graph");
graph.emit("tooltipchange", {
item: this.currentTarget,
action: "hide"
});
this.currentTarget = null;
};
Tooltip5.prototype.showTooltip = function(e4) {
if (!e4.item) {
return;
}
var itemTypes = this.get("itemTypes");
if (e4.item.getType && itemTypes.indexOf(e4.item.getType()) === -1)
return;
var container2 = this.get("tooltip");
var getContent = this.get("getContent");
var tooltip10 = getContent(e4);
if (is_string_default(tooltip10)) {
container2.innerHTML = tooltip10;
} else {
container2.innerHTML = tooltip10.outerHTML;
}
this.updatePosition(e4);
};
Tooltip5.prototype.hideTooltip = function() {
var tooltip10 = this.get("tooltip");
if (tooltip10) {
modifyCSS(tooltip10, {
visibility: "hidden",
display: "none"
});
}
};
Tooltip5.prototype.updatePosition = function(e4) {
var shouldBegin2 = this.get("shouldBegin");
var tooltip10 = this.get("tooltip");
if (!shouldBegin2(e4)) {
modifyCSS(tooltip10, {
visibility: "hidden",
display: "none"
});
return;
}
var graph = this.get("graph");
var width2 = graph.get("width");
var height = graph.get("height");
var offsetX = this.get("offsetX") || 0;
var offsetY = this.get("offsetY") || 0;
var point2 = graph.getPointByClient(e4.clientX, e4.clientY);
var fixToNode = this.get("fixToNode");
var item = e4.item;
if (item.getType && item.getType() === "node" && fixToNode && is_array_default(fixToNode) && fixToNode.length >= 2) {
var itemBBox = item.getBBox();
point2 = {
x: itemBBox.minX + itemBBox.width * fixToNode[0],
y: itemBBox.minY + itemBBox.height * fixToNode[1]
};
}
var _a6 = graph.getCanvasByPoint(point2.x, point2.y), x6 = _a6.x, y5 = _a6.y;
var graphContainer = graph.getContainer();
var res = {
x: x6 + graphContainer.offsetLeft + offsetX,
y: y5 + graphContainer.offsetTop + offsetY
};
modifyCSS(tooltip10, {
visibility: "visible",
display: "unset"
});
var bbox = tooltip10.getBoundingClientRect();
if (x6 + bbox.width + offsetX > width2) {
res.x -= bbox.width + offsetX;
}
if (y5 + bbox.height + offsetY > height) {
res.y -= bbox.height + offsetY;
}
modifyCSS(tooltip10, {
left: res.x + "px",
top: res.y + "px"
});
};
Tooltip5.prototype.hide = function() {
this.onMouseLeave();
};
Tooltip5.prototype.destroy = function() {
var tooltip10 = this.get("tooltip");
if (tooltip10) {
var container2 = this.get("container");
if (!container2) {
container2 = this.get("graph").get("container");
}
if (is_string_default(container2)) {
container2 = document.getElementById(container2);
}
container2.removeChild(tooltip10);
}
};
return Tooltip5;
}(base_default18);
var tooltip_default2 = Tooltip3;
// node_modules/@antv/g6-plugin/es/timeBar/path.js
var __spreadArray3 = function(to, from) {
for (var i4 = 0, il = from.length, j4 = to.length; i4 < il; i4++, j4++) {
to[j4] = from[i4];
}
return to;
};
function pointsToPath2(points) {
return map_default(points, function(p4, idx) {
var command = idx === 0 ? "M" : "L";
var x6 = p4[0], y5 = p4[1];
return [command, x6, y5];
});
}
function getLinePath3(points) {
return pointsToPath2(points);
}
function getSmoothLinePath2(points) {
if (points.length <= 2) {
return getLinePath3(points);
}
var data3 = [];
each_default(points, function(p4) {
if (!is_equal_default(p4, data3.slice(data3.length - 2))) {
data3.push(p4[0], p4[1]);
}
});
var path = catmull_rom_2_bezier_default(data3, false);
var _a6 = head(points), x6 = _a6[0], y5 = _a6[1];
path.unshift(["M", x6, y5]);
return path;
}
function dataToPath2(data3, width2, height, smooth) {
if (smooth === void 0) {
smooth = true;
}
var y5 = new linear_default({
values: data3
});
var x6 = new base_default5({
values: map_default(data3, function(v3, idx) {
return idx;
})
});
var points = map_default(data3, function(v3, idx) {
return [x6.scale(idx) * width2, height - y5.scale(v3) * height];
});
return smooth ? getSmoothLinePath2(points) : getLinePath3(points);
}
function dataToRectPath(data3, width2, height) {
var y5 = new linear_default({
values: data3
});
var x6 = new base_default5({
values: map_default(data3, function(v3, idx) {
return idx;
})
});
var points = map_default(data3, function(v3, idx) {
return [x6.scale(idx) * width2, height - y5.scale(v3) * height];
});
var rectPoints = [];
for (var i4 = 0; i4 < points.length; i4++) {
var point2 = points[i4];
var param = {
x: point2[0],
y: point2[1],
y0: height,
size: 5
};
var rectPoint = getRectPoints3(param);
rectPoints.push.apply(rectPoints, rectPoint);
}
return getRectPath3(rectPoints);
}
function getAreaLineY2(data3, height) {
var y5 = new linear_default({
values: data3
});
var lineY = Math.max(0, y5.min);
return height - y5.scale(lineY) * height;
}
function linePathToAreaPath2(path, width2, height, data3) {
var areaPath = __spreadArray3([], path);
var lineYPx = getAreaLineY2(data3, height);
areaPath.push(["L", width2, lineYPx]);
areaPath.push(["L", 0, lineYPx]);
areaPath.push(["Z"]);
return areaPath;
}
function getRectPoints3(pointInfo) {
var x6 = pointInfo.x, y5 = pointInfo.y, y0 = pointInfo.y0, size2 = pointInfo.size;
var yMin;
var yMax;
if (is_array_default(y5)) {
yMin = y5[0], yMax = y5[1];
} else {
yMin = y0;
yMax = y5;
}
var xMin;
var xMax;
if (is_array_default(x6)) {
xMin = x6[0], xMax = x6[1];
} else {
xMin = x6 - size2 / 2;
xMax = x6 + size2 / 2;
}
var points = [{
x: xMin,
y: yMin
}, {
x: xMin,
y: yMax
}];
points.push({
x: xMax,
y: yMax
}, {
x: xMax,
y: yMin
});
return points;
}
function getRectPath3(points, isClosed) {
if (isClosed === void 0) {
isClosed = true;
}
var path = [];
var firstPoint = points[0];
path.push(["M", firstPoint.x, firstPoint.y]);
for (var i4 = 1, len5 = points.length; i4 < len5; i4++) {
path.push(["L", points[i4].x, points[i4].y]);
}
if (isClosed) {
path.push(["L", firstPoint.x, firstPoint.y]);
path.push(["z"]);
}
return path;
}
// node_modules/@antv/g6-plugin/es/timeBar/trend.js
var __assign8 = function() {
__assign8 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4) {
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
}
return t4;
};
return __assign8.apply(this, arguments);
};
var LINE_STYLE2 = {
stroke: "#C5C5C5",
strokeOpacity: 0.85
};
var AREA_STYLE2 = {
fill: "#CACED4",
opacity: 0.85
};
var Trend2 = function() {
function Trend3(cfg) {
var _a6 = cfg.x, x6 = _a6 === void 0 ? 0 : _a6, _b = cfg.y, y5 = _b === void 0 ? 0 : _b, _c = cfg.width, width2 = _c === void 0 ? 200 : _c, _d = cfg.height, height = _d === void 0 ? 26 : _d, _e = cfg.smooth, smooth = _e === void 0 ? true : _e, _f = cfg.isArea, isArea = _f === void 0 ? false : _f, _g = cfg.data, data3 = _g === void 0 ? [] : _g, lineStyle = cfg.lineStyle, areaStyle = cfg.areaStyle, group2 = cfg.group, _h = cfg.interval, interval3 = _h === void 0 ? null : _h;
this.group = group2;
this.x = x6;
this.y = y5;
this.width = width2;
this.height = height;
this.data = data3;
this.smooth = smooth;
this.isArea = isArea;
this.lineStyle = Object.assign({}, LINE_STYLE2, lineStyle);
this.areaStyle = Object.assign({}, AREA_STYLE2, areaStyle);
this.intervalConfig = interval3;
this.renderLine();
}
Trend3.prototype.renderLine = function() {
var _a6 = this, x6 = _a6.x, y5 = _a6.y, width2 = _a6.width, height = _a6.height, data3 = _a6.data, smooth = _a6.smooth, isArea = _a6.isArea, lineStyle = _a6.lineStyle, areaStyle = _a6.areaStyle;
var trendGroup = this.group.addGroup({
name: "trend-group"
});
if (data3) {
var path = dataToPath2(data3, width2, height, smooth);
trendGroup.addShape("path", {
attrs: __assign8({
path
}, lineStyle)
});
if (isArea) {
var areaPath = linePathToAreaPath2(path, width2, height, data3);
trendGroup.addShape("path", {
attrs: __assign8({
path: areaPath
}, areaStyle)
});
}
}
if (this.intervalConfig) {
trendGroup.addShape("path", {
attrs: __assign8({
path: dataToRectPath(this.intervalConfig.data, width2, height)
}, this.intervalConfig.style)
});
}
trendGroup.move(x6, y5);
};
Trend3.prototype.destory = function() {
this.group.destroy();
};
return Trend3;
}();
var trend_default = Trend2;
// node_modules/@antv/g6-plugin/es/timeBar/handler.js
var __assign9 = function() {
__assign9 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4) {
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
}
return t4;
};
return __assign9.apply(this, arguments);
};
var DEFAULT_STYLE2 = {
fill: "#1890ff",
stroke: "#1890ff",
type: "trend",
radius: 2,
opacity: 1,
cursor: "ew-resize",
highLightFill: "#0050b3"
};
var SIMPLE_DEFAULT_STYLE = {
fill: "#fff",
stroke: "#1890ff",
radius: 2,
opacity: 1,
cursor: "ew-resize"
};
var Handler2 = function() {
function Handler3(cfg) {
var group2 = cfg.group, name = cfg.name, type2 = cfg.type, _a6 = cfg.x, x6 = _a6 === void 0 ? 0 : _a6, _b = cfg.y, y5 = _b === void 0 ? 0 : _b, _c = cfg.width, width2 = _c === void 0 ? 2 : _c, _d = cfg.height, height = _d === void 0 ? 24 : _d, _e = cfg.style, style = _e === void 0 ? {} : _e;
this.group = group2;
this.name = name;
this.handleType = type2;
this.x = x6;
this.y = y5;
this.width = width2;
this.height = height;
if (type2 === "trend") {
this.style = __assign9(__assign9({}, DEFAULT_STYLE2), style);
} else if (type2 === "simple") {
this.style = __assign9(__assign9({}, SIMPLE_DEFAULT_STYLE), style);
}
this.renderHandle();
}
Handler3.prototype.setX = function(x6) {
this.setXY(x6, void 0);
};
Handler3.prototype.setY = function(y5) {
this.setXY(void 0, y5);
};
Handler3.prototype.setXY = function(x6, y5) {
if (is_number_default(x6)) {
this.x = x6;
}
if (is_number_default(y5)) {
this.y = y5;
}
this.updateXY();
};
Handler3.prototype.renderHandle = function() {
var _a6 = this, width2 = _a6.width, height = _a6.height, style = _a6.style, name = _a6.name;
var fill = style.fill, stroke = style.stroke, radius = style.radius, opacity = style.opacity, cursor = style.cursor;
this.handleGroup = this.group.addGroup();
if (this.handleType === "trend") {
this.verticalLine = this.handleGroup.addShape("rect", {
attrs: {
x: 0,
y: 0,
width: width2,
height,
fill,
stroke,
radius,
opacity,
cursor
},
name: name + "-handler"
});
this.topCircle = this.handleGroup.addShape("circle", {
attrs: {
x: width2 / 2,
y: 0,
r: 2 * width2,
fill,
stroke,
radius,
opacity,
cursor
},
name: name + "-handler"
});
this.bottomCircle = this.handleGroup.addShape("circle", {
attrs: {
x: width2 / 2,
y: height,
r: 2 * width2,
fill,
stroke,
radius,
opacity,
cursor
},
name: name + "-handler"
});
} else if (this.handleType === "simple") {
this.topCircle = this.handleGroup.addShape("circle", {
attrs: {
x: width2 / 2,
y: height / 2,
r: 2 * width2,
fill,
stroke,
radius,
opacity,
cursor,
lineWidth: 2
},
name: name + "-handler"
});
}
this.updateXY();
if (this.handleType === "trend") {
this.bindTrendEvents();
} else if (this.handleType === "simple") {
this.bindSimpleEvents();
}
};
Handler3.prototype.bindSimpleEvents = function() {
var _this = this;
var name = this.name;
this.handleGroup.on(name + "-handler:mouseenter", function() {
var highLightFill = _this.style.highLightFill;
_this.topCircle.attr("fill", highLightFill);
});
this.handleGroup.on(name + "-handler:mouseleave", function() {
var fill = _this.style.fill;
_this.topCircle.attr("fill", fill);
});
};
Handler3.prototype.bindTrendEvents = function() {
var _this = this;
var name = this.name;
this.handleGroup.on(name + "-handler:mouseenter", function() {
var highLightFill = _this.style.highLightFill;
_this.verticalLine.attr("fill", highLightFill);
_this.topCircle.attr("fill", highLightFill);
_this.bottomCircle.attr("fill", highLightFill);
});
this.handleGroup.on(name + "-handler:mouseleave", function() {
var fill = _this.style.fill;
_this.verticalLine.attr("fill", fill);
_this.topCircle.attr("fill", fill);
_this.bottomCircle.attr("fill", fill);
});
};
Handler3.prototype.show = function() {
this.handleGroup.show();
};
Handler3.prototype.hide = function() {
this.handleGroup.hide();
};
Handler3.prototype.updateXY = function() {
this.handleGroup.setMatrix([1, 0, 0, 0, 1, 0, this.x, this.y, 1]);
};
return Handler3;
}();
var handler_default = Handler2;
// node_modules/@antv/g6-plugin/es/timeBar/constant.js
var TIMELINE_START = "timelinestart";
var TIMELINE_END = "timelineend";
var VALUE_CHANGE = "valueChange";
var TIMEBAR_CONFIG_CHANGE = "timebarConfigChanged";
var PLAY_PAUSE_BTN = "playPauseBtn";
var NEXT_STEP_BTN = "nextStepBtn";
var PRE_STEP_BTN = "preStepBtn";
// node_modules/@antv/g6-plugin/es/timeBar/timeButton.js
var __assign10 = function() {
__assign10 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4) {
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
}
return t4;
};
return __assign10.apply(this, arguments);
};
var Button = function() {
function Button2(cfg) {
this.config = deep_mix_default({}, cfg);
this.init();
}
Button2.prototype.update = function(cfg) {
this.config = deep_mix_default({}, this.config, cfg);
this.updateElement();
this.renderMarker();
};
Button2.prototype.init = function() {
this.initElement();
this.renderMarker();
};
Button2.prototype.initElement = function() {
var _a6 = this.config, group2 = _a6.group, style = _a6.style;
var _b = style.scale, scale12 = _b === void 0 ? 1 : _b, _c = style.offsetX, offsetX = _c === void 0 ? 0 : _c, _d = style.offsetY, offsetY = _d === void 0 ? 0 : _d;
var x6 = this.config.x + offsetX;
var y5 = this.config.y + offsetY;
var buttonGroup = group2.addGroup({
name: PLAY_PAUSE_BTN
});
this.startMarkerGroup = buttonGroup.addGroup({
name: PLAY_PAUSE_BTN
});
this.circle = group2.addShape("circle", {
attrs: __assign10({
x: x6,
y: y5,
r: this.config.r * scale12
}, style),
name: PLAY_PAUSE_BTN
});
this.startMarker = this.startMarkerGroup.addShape("path", {
attrs: {
path: this.getStartMarkerPath(x6, y5, scale12),
fill: style.stroke || "#aaa"
}
});
this.pauseMarkerGroup = buttonGroup.addGroup({
name: PLAY_PAUSE_BTN
});
var width2 = 0.25 * this.config.r * scale12;
var height = 0.5 * this.config.r * Math.sqrt(3) * scale12;
this.pauseLeftMarker = this.pauseMarkerGroup.addShape("rect", {
attrs: {
x: x6 - 0.375 * this.config.r * scale12,
y: y5 - height / 2,
width: width2,
height,
fill: style.stroke || "#aaa",
lineWidth: 0
}
});
this.pauseRightMarker = this.pauseMarkerGroup.addShape("rect", {
attrs: {
x: x6 + 1 / 8 * this.config.r * scale12,
y: y5 - height / 2,
width: width2,
height,
fill: style.stroke || "#aaa",
lineWidth: 0
}
});
};
Button2.prototype.updateElement = function() {
var _a6 = this.config.style, _b = _a6.scale, scale12 = _b === void 0 ? 1 : _b, _c = _a6.offsetX, offsetX = _c === void 0 ? 0 : _c, _d = _a6.offsetY, offsetY = _d === void 0 ? 0 : _d;
var x6 = this.config.x + offsetX;
var y5 = this.config.y + offsetY;
this.circle.attr("x", x6);
this.circle.attr("y", y5);
this.circle.attr("r", this.config.r * scale12);
this.startMarker.attr("path", this.getStartMarkerPath(x6, y5, scale12));
var width2 = 0.25 * this.config.r * scale12;
var height = 0.5 * this.config.r * Math.sqrt(3) * scale12;
this.pauseLeftMarker.attr("x", x6 - (1 / 4 + 1 / 8) * this.config.r * scale12);
this.pauseLeftMarker.attr("y", y5 - height / 2);
this.pauseLeftMarker.attr("width", width2);
this.pauseLeftMarker.attr("height", height);
this.pauseRightMarker.attr("x", x6 + 1 / 8 * this.config.r * scale12);
this.pauseRightMarker.attr("y", y5 - height / 2);
this.pauseRightMarker.attr("width", width2);
this.pauseRightMarker.attr("height", height);
};
Button2.prototype.renderMarker = function() {
if (this.config.isPlay) {
this.startMarkerGroup.hide();
this.pauseMarkerGroup.show();
} else {
this.startMarkerGroup.show();
this.pauseMarkerGroup.hide();
}
};
Button2.prototype.getStartMarkerPath = function(x6, y5, scale12) {
var sideLength = 0.5 * this.config.r * Math.sqrt(3) * scale12;
return [["M", x6 - sideLength / Math.sqrt(3) / 2, y5 - sideLength / 2], ["L", x6 + sideLength / Math.sqrt(3), y5], ["L", x6 - sideLength / Math.sqrt(3) / 2, y5 + sideLength / 2]];
};
return Button2;
}();
var timeButton_default = Button;
// node_modules/@antv/g6-plugin/es/timeBar/controllerBtn.js
var __assign11 = function() {
__assign11 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4) {
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
}
return t4;
};
return __assign11.apply(this, arguments);
};
var transform16 = ext_exports4.transform;
var DEFAULT_RECT_FILL = "#aaa";
var DEFAULT_RECT_STROKE = "green";
var DEFAULT_PLAYBTN_STYLE = {
fill: "#aaa",
fillOpacity: 0.35,
stroke: "#aaa"
};
var DEFAULT_PREBTN_STYLE = {
fill: "#fff"
};
var DEFAULT_NEXTBTN_STYLE = {
fill: "green"
};
var DEFAULT_SPEED_CONTROLLER_STYLE = {
pointer: {
fill: "#aaa",
lineWidth: 0
},
scroller: {
stroke: "#aaa",
fill: "#aaa",
lineWidth: 1,
lineAppendWidth: 5,
cursor: "pointer"
},
text: {
fill: "#aaa",
textBaseline: "top"
}
};
var DEFAULT_TIMETYPE_CONTROLLER_STYLE = {
check: {
stroke: "green",
lineWidth: 3
},
box: {
fill: "#fff",
stroke: "#aaa",
lineWidth: 2,
radius: 3,
width: 12,
height: 12
},
text: {
fill: "#aaa",
fontSize: 12,
textBaseline: "top"
}
};
var DEFAULT_CONTROLLER_CONFIG = {
speed: 1,
loop: false,
fill: "#fff",
stroke: "#fff",
hideTimeTypeController: false,
preBtnStyle: {
fill: "#aaa",
stroke: "#aaa"
},
nextBtnStyle: {
fill: "#aaa",
stroke: "#aaa"
},
playBtnStyle: {
fill: "#aaa",
stroke: "#aaa",
fillOpacity: 0.05
},
speedControllerStyle: DEFAULT_SPEED_CONTROLLER_STYLE,
timeTypeControllerStyle: DEFAULT_TIMETYPE_CONTROLLER_STYLE
};
var SPEED_CONTROLLER_OFFSET = 110;
var TOGGLE_MODEL_OFFSET = 50;
var ControllerBtn = function() {
function ControllerBtn2(cfg) {
this.controllerCfg = deep_mix_default({}, DEFAULT_CONTROLLER_CONFIG, cfg);
this.group = cfg.group;
this.controllerGroup = this.group.addGroup({
name: "controller-group"
});
this.speedAxisY = [];
this.currentSpeed = this.controllerCfg.speed;
this.currentType = "range";
this.fontFamily = cfg.fontFamily || "Arial, sans-serif";
this.init();
}
ControllerBtn2.prototype.init = function() {
this.renderPlayButton();
};
ControllerBtn2.prototype.getNextMarkerPath = function(x6, y5, len5) {
return [["M", x6, y5 - len5], ["L", x6 + len5, y5], ["L", x6, y5 + len5], ["Z", x6, y5 - len5], ["M", x6, y5], ["L", x6 - len5, y5 - len5], ["L", x6 - len5, y5 + len5], ["Z"]];
};
ControllerBtn2.prototype.getPreMarkerPath = function(x6, y5, len5) {
return [["M", x6, y5 - len5], ["L", x6 - len5, y5], ["L", x6, y5 + len5], ["L", x6, y5 - len5], ["M", x6, y5], ["L", x6 + len5, y5 - len5], ["L", x6 + len5, y5 + len5], ["Z"]];
};
ControllerBtn2.prototype.renderPlayButton = function() {
var controllerCfg = this.controllerCfg;
var width2 = controllerCfg.width, height = controllerCfg.height, x6 = controllerCfg.x, y5 = controllerCfg.y, hideTimeTypeController = controllerCfg.hideTimeTypeController, _a6 = controllerCfg.fill, fill = _a6 === void 0 ? DEFAULT_RECT_FILL : _a6, _b = controllerCfg.stroke, stroke = _b === void 0 ? DEFAULT_RECT_STROKE : _b;
var playBtnStyle = __assign11(__assign11({}, DEFAULT_PLAYBTN_STYLE), controllerCfg.playBtnStyle || {});
var preBtnStyle = __assign11(__assign11({}, DEFAULT_PREBTN_STYLE), controllerCfg.preBtnStyle || {});
var nextBtnStyle = __assign11(__assign11({}, DEFAULT_NEXTBTN_STYLE), controllerCfg.nextBtnStyle || {});
var r4 = height / 2 - 5;
var realY = y5 + 10;
var container2 = this.controllerGroup.addShape("rect", {
attrs: {
x: x6,
y: realY,
width: width2,
height,
stroke,
fill
},
name: "container-rect"
});
if (this.playButton) {
this.playButton.update({
x: width2 / 2,
y: realY,
r: r4
});
} else {
this.playButton = new timeButton_default({
group: this.controllerGroup,
x: width2 / 2,
y: realY + r4 + 5,
r: r4,
isPlay: this.isPlay,
style: playBtnStyle
});
}
var prePaddingX = preBtnStyle.offsetX || 0;
var prePaddingY = preBtnStyle.offsetY || 0;
var preR = (preBtnStyle.scale || 1) * r4;
this.controllerGroup.addShape("path", {
attrs: __assign11({
path: this.getPreMarkerPath(width2 / 2 - 5 * r4 + prePaddingX, realY + r4 + 5 + prePaddingY, preR * 0.5)
}, preBtnStyle),
name: PRE_STEP_BTN
});
var nxtPaddingX = nextBtnStyle.offsetX || 0;
var nxtPaddingY = nextBtnStyle.offsetY || 0;
var nxtR = (nextBtnStyle.scale || 1) * r4;
this.controllerGroup.addShape("path", {
attrs: __assign11({
path: this.getNextMarkerPath(width2 / 2 + 5 * r4 + nxtPaddingX, realY + r4 + 5 + nxtPaddingY, nxtR * 0.5)
}, nextBtnStyle),
name: NEXT_STEP_BTN
});
container2.toBack();
this.renderSpeedBtn();
if (!hideTimeTypeController) {
this.renderToggleTime();
}
this.bindEvent();
var _c = this.controllerCfg.scale, scale12 = _c === void 0 ? 1 : _c;
var currentBBox = this.controllerGroup.getCanvasBBox();
var centerX = (currentBBox.maxX + currentBBox.minX) / 2;
var centerY = (currentBBox.maxY + currentBBox.minY) / 2;
var matrix = transform16([1, 0, 0, 0, 1, 0, 0, 0, 1], [["t", -centerX, -centerY], ["s", scale12, scale12], ["t", centerX, centerY]]);
this.controllerGroup.setMatrix(matrix);
};
ControllerBtn2.prototype.renderSpeedBtn = function() {
var _a6 = this.controllerCfg, y5 = _a6.y, width2 = _a6.width, hideTimeTypeController = _a6.hideTimeTypeController;
var speedControllerStyle = __assign11(__assign11({}, DEFAULT_SPEED_CONTROLLER_STYLE), this.controllerCfg.speedControllerStyle || {});
var _b = speedControllerStyle.scroller, scroller = _b === void 0 ? {} : _b, _c = speedControllerStyle.text, text = _c === void 0 ? {} : _c, _d = speedControllerStyle.pointer, pointer = _d === void 0 ? {} : _d, _e = speedControllerStyle.scale, scale12 = _e === void 0 ? 1 : _e, _f = speedControllerStyle.offsetX, offsetX = _f === void 0 ? 0 : _f, _g = speedControllerStyle.offsetY, offsetY = _g === void 0 ? 0 : _g;
var speedGroup = this.controllerGroup.addGroup({
name: "speed-group"
});
this.speedGroup = speedGroup;
var speedNum = [];
var maxSpeed = 5;
this.speedAxisY = [19, 22, 26, 32, 39];
for (var i4 = 0; i4 < 5; i4++) {
var axisY = y5 + this.speedAxisY[i4];
var startX = width2 - (!hideTimeTypeController ? SPEED_CONTROLLER_OFFSET : TOGGLE_MODEL_OFFSET);
speedGroup.addShape("line", {
attrs: __assign11({
x1: startX,
x2: startX + 15,
y1: axisY,
y2: axisY
}, scroller),
speed: maxSpeed,
name: "speed-rect"
});
this.speedAxisY[i4] = axisY;
speedNum.push(maxSpeed);
maxSpeed = maxSpeed - 1;
}
this.speedText = speedGroup.addShape("text", {
attrs: __assign11({
x: width2 - (!hideTimeTypeController ? SPEED_CONTROLLER_OFFSET : TOGGLE_MODEL_OFFSET) + 20,
y: this.speedAxisY[0] + 4,
text: "1.0X",
fontFamily: this.fontFamily || "Arial, sans-serif"
}, text)
});
this.speedPoint = speedGroup.addShape("path", {
attrs: __assign11({
path: this.getPointerPath(width2 - (!hideTimeTypeController ? SPEED_CONTROLLER_OFFSET : TOGGLE_MODEL_OFFSET), 0),
matrix: [1, 0, 0, 0, 1, 0, 0, this.speedAxisY[4], 1]
}, pointer)
});
var currentBBox = this.speedGroup.getCanvasBBox();
var centerX = (currentBBox.maxX + currentBBox.minX) / 2;
var centerY = (currentBBox.maxY + currentBBox.minY) / 2;
var matrix = this.speedGroup.getMatrix() || [1, 0, 0, 0, 1, 0, 0, 0, 1];
matrix = transform16(matrix, [["t", -centerX, -centerY], ["s", scale12, scale12], ["t", centerX + offsetX * scale12, centerY + offsetY * scale12]]);
this.speedGroup.setMatrix(matrix);
};
ControllerBtn2.prototype.getPointerPath = function(x6, y5) {
return [["M", x6, y5], ["L", x6 - 10, y5 - 4], ["L", x6 - 10, y5 + 4], ["Z"]];
};
ControllerBtn2.prototype.renderToggleTime = function() {
var _a6;
var width2 = this.controllerCfg.width;
var timeTypeControllerStyle = __assign11(__assign11({}, DEFAULT_TIMETYPE_CONTROLLER_STYLE), this.controllerCfg.timeTypeControllerStyle || {});
var _b = timeTypeControllerStyle.scale, scale12 = _b === void 0 ? 1 : _b, _c = timeTypeControllerStyle.offsetX, offsetX = _c === void 0 ? 0 : _c, _d = timeTypeControllerStyle.offsetY, offsetY = _d === void 0 ? 0 : _d, _e = timeTypeControllerStyle.box, box2 = _e === void 0 ? {} : _e, _f = timeTypeControllerStyle.check, check = _f === void 0 ? {} : _f, _g = timeTypeControllerStyle.text, text = _g === void 0 ? {} : _g;
this.toggleGroup = this.controllerGroup.addGroup({
name: "toggle-group"
});
this.toggleGroup.addShape("rect", {
attrs: __assign11({
x: width2 - TOGGLE_MODEL_OFFSET,
y: this.speedAxisY[0] + 3.5
}, box2),
isChecked: false,
name: "toggle-model"
});
this.checkedIcon = this.toggleGroup.addShape("path", {
attrs: __assign11({
path: [["M", width2 - TOGGLE_MODEL_OFFSET + 3, this.speedAxisY[1] + 6], ["L", width2 - TOGGLE_MODEL_OFFSET + 7, this.speedAxisY[1] + 10], ["L", width2 - TOGGLE_MODEL_OFFSET + 12, this.speedAxisY[1] + 4]]
}, check),
capture: false
});
this.checkedIcon.hide();
this.checkedText = this.toggleGroup.addShape("text", {
attrs: __assign11({
text: ((_a6 = this.controllerCfg) === null || _a6 === void 0 ? void 0 : _a6.timePointControllerText) || "\u5355\u4E00\u65F6\u95F4",
x: width2 - TOGGLE_MODEL_OFFSET + 15,
y: this.speedAxisY[0] + 4,
fontFamily: typeof window !== "undefined" ? window.getComputedStyle(document.body, null).getPropertyValue("font-family") || "Arial, sans-serif" : "Arial, sans-serif"
}, text)
});
var currentBBox = this.toggleGroup.getCanvasBBox();
var centerX = (currentBBox.maxX + currentBBox.minX) / 2;
var centerY = (currentBBox.maxY + currentBBox.minY) / 2;
var matrix = this.toggleGroup.getMatrix() || [1, 0, 0, 0, 1, 0, 0, 0, 1];
matrix = transform16(matrix, [["t", -centerX, -centerY], ["s", scale12, scale12], ["t", centerX + offsetX * scale12, centerY + offsetY * scale12]]);
this.toggleGroup.setMatrix(matrix);
};
ControllerBtn2.prototype.bindEvent = function() {
var _this = this;
this.speedGroup.on("speed-rect:click", function(evt) {
var currentPointerY = evt.target.attr("y1");
var pointerMatrix = _this.speedPoint.attr("matrix");
var currentYIdx = _this.speedAxisY.indexOf(pointerMatrix[7] || 0);
var targetYIdx = _this.speedAxisY.indexOf(currentPointerY);
var yDiff = _this.speedAxisY[targetYIdx] - _this.speedAxisY[currentYIdx];
pointerMatrix = transform16(pointerMatrix, [["t", 0, yDiff]]);
_this.speedPoint.setMatrix(pointerMatrix);
_this.currentSpeed = _this.speedAxisY.length - targetYIdx;
_this.speedText.attr("text", _this.currentSpeed + ".0X");
_this.group.emit(TIMEBAR_CONFIG_CHANGE, {
speed: _this.currentSpeed,
type: _this.currentType
});
});
this.speedGroup.on("mousewheel", function(evt) {
evt.preventDefault();
var pointerMatrix = _this.speedPoint.attr("matrix") || [1, 0, 0, 0, 1, 0, 0, 0, 1];
var currentPointerY = pointerMatrix[7];
var currentYIdx = _this.speedAxisY.indexOf(currentPointerY);
if (currentYIdx === -1) {
var minDist_1 = Infinity;
_this.speedAxisY.forEach(function(y5, idx) {
var dist4 = Math.abs(y5 - currentPointerY);
if (minDist_1 > dist4) {
minDist_1 = dist4;
currentYIdx = idx;
}
});
}
if (evt.originalEvent.deltaY > 0)
currentYIdx = Math.max(0, currentYIdx - 1);
else
currentYIdx = Math.min(_this.speedAxisY.length - 1, currentYIdx + 1);
var yDiff = _this.speedAxisY[currentYIdx] - currentPointerY;
pointerMatrix = transform16(pointerMatrix, [["t", 0, yDiff]]);
_this.speedPoint.setMatrix(pointerMatrix);
_this.currentSpeed = _this.speedAxisY.length - currentYIdx;
_this.speedText.attr("text", _this.currentSpeed + ".0X");
_this.group.emit(TIMEBAR_CONFIG_CHANGE, {
speed: _this.currentSpeed,
type: _this.currentType
});
});
if (this.toggleGroup) {
this.toggleGroup.on("toggle-model:click", function(evt) {
var _a6, _b;
var isChecked = evt.target.get("isChecked");
if (!isChecked) {
_this.checkedIcon.show();
_this.checkedText.attr("text", ((_a6 = _this.controllerCfg) === null || _a6 === void 0 ? void 0 : _a6.timeRangeControllerText) || "\u65F6\u95F4\u8303\u56F4");
_this.currentType = "single";
} else {
_this.checkedIcon.hide();
_this.checkedText.attr("text", ((_b = _this.controllerCfg) === null || _b === void 0 ? void 0 : _b.timePointControllerText) || "\u5355\u4E00\u65F6\u95F4");
_this.currentType = "range";
}
evt.target.set("isChecked", !isChecked);
_this.group.emit(TIMEBAR_CONFIG_CHANGE, {
type: _this.currentType,
speed: _this.currentSpeed
});
});
}
};
ControllerBtn2.prototype.destroy = function() {
this.speedGroup.off("speed-rect:click");
if (this.toggleGroup) {
this.toggleGroup.off("toggle-model:click");
this.toggleGroup.destroy();
}
this.speedGroup.destroy();
};
return ControllerBtn2;
}();
var controllerBtn_default = ControllerBtn;
// node_modules/@antv/g6-plugin/es/timeBar/trendTimeBar.js
var __assign12 = function() {
__assign12 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4) {
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
}
return t4;
};
return __assign12.apply(this, arguments);
};
var BACKGROUND_STYLE3 = {
fill: "#416180",
opacity: 0.05
};
var SIMPLE_BACKGROUND_STYLE = {
fill: "#416180",
opacity: 0.15,
radius: 5
};
var FOREGROUND_STYLE2 = {
fill: "#5B8FF9",
opacity: 0.3,
cursor: "grab"
};
var DEFAULT_HANDLER_WIDTH2 = 2;
var HANDLER_STYLE2 = {
width: DEFAULT_HANDLER_WIDTH2,
height: 24
};
var TEXT_STYLE2 = {
textBaseline: "middle",
fill: "#000",
opacity: 0.45
};
var TICK_LABEL_STYLE = {
textAlign: "center",
textBaseline: "top",
fill: "#607889",
opacity: 0.35
};
var TICK_LINE_STYLE = {
lineWidth: 1,
stroke: "#ccc"
};
var TrendTimeBar = function() {
function TrendTimeBar2(cfg) {
var _this = this;
this.prevX = 0;
this.onMouseDown = function(handler) {
return function(e4) {
_this.currentHandler = handler;
var event = e4.originalEvent;
event.stopPropagation();
event.preventDefault();
_this.prevX = get_default(event, "touches.0.pageX", event.pageX);
var containerDOM = _this.canvas.get("container");
containerDOM.addEventListener("mousemove", _this.onMouseMove);
containerDOM.addEventListener("mouseup", _this.onMouseUp);
containerDOM.addEventListener("mouseleave", _this.onMouseUp);
containerDOM.addEventListener("touchmove", _this.onMouseMove);
containerDOM.addEventListener("touchend", _this.onMouseUp);
containerDOM.addEventListener("touchcancel", _this.onMouseUp);
};
};
this.onMouseMove = function(e4) {
e4.stopPropagation();
e4.preventDefault();
var x7 = get_default(e4, "touches.0.pageX", e4.pageX);
var offsetX = x7 - _this.prevX;
var offsetXRange = _this.adjustOffsetRange(offsetX / _this.width);
_this.updateStartEnd(offsetXRange);
_this.updateUI();
_this.prevX = x7;
};
this.onMouseUp = function() {
if (_this.currentHandler) {
_this.currentHandler = void 0;
}
var containerDOM = _this.canvas.get("container");
if (containerDOM) {
containerDOM.removeEventListener("mousemove", _this.onMouseMove);
containerDOM.removeEventListener("mouseup", _this.onMouseUp);
containerDOM.removeEventListener("mouseleave", _this.onMouseUp);
containerDOM.removeEventListener("touchmove", _this.onMouseMove);
containerDOM.removeEventListener("touchend", _this.onMouseUp);
containerDOM.removeEventListener("touchcancel", _this.onMouseUp);
}
};
var _a6 = cfg.x, x6 = _a6 === void 0 ? 0 : _a6, _b = cfg.y, y5 = _b === void 0 ? 0 : _b, _c = cfg.width, width2 = _c === void 0 ? 100 : _c, height = cfg.height, _d = cfg.padding, padding3 = _d === void 0 ? 10 : _d, trendCfg = cfg.trendCfg, _e = cfg.controllerCfg, controllerCfg = _e === void 0 ? {
speed: 1
} : _e, _f = cfg.backgroundStyle, backgroundStyle = _f === void 0 ? {} : _f, _g = cfg.foregroundStyle, foregroundStyle = _g === void 0 ? {} : _g, _h = cfg.handlerStyle, handlerStyle = _h === void 0 ? {} : _h, _j = cfg.textStyle, textStyle2 = _j === void 0 ? {} : _j, _k = cfg.start, start = _k === void 0 ? 0 : _k, _l = cfg.end, end2 = _l === void 0 ? 1 : _l, _m = cfg.minText, minText = _m === void 0 ? "" : _m, _o = cfg.maxText, maxText = _o === void 0 ? "" : _o, group2 = cfg.group, graph = cfg.graph, canvas = cfg.canvas, _p = cfg.tick, tick = _p === void 0 ? {
tickLabelStyle: {},
tickLineStyle: {},
tickLabelFormatter: function tickLabelFormatter(d3) {
return d3;
},
ticks: []
} : _p, type2 = cfg.type;
this.graph = graph;
this.canvas = canvas;
this.group = group2;
this.timeBarType = type2;
this.x = x6;
this.y = y5;
this.width = width2;
this.height = height;
this.padding = padding3;
this.ticks = tick.ticks;
this.trendCfg = trendCfg;
this.controllerCfg = controllerCfg;
this.currentSpeed = controllerCfg.speed || 1;
this.tickLabelFormatter = tick.tickLabelFormatter;
if (type2 === "trend") {
this.backgroundStyle = __assign12(__assign12({}, BACKGROUND_STYLE3), backgroundStyle);
} else if (type2 === "simple") {
this.backgroundStyle = __assign12(__assign12({}, SIMPLE_BACKGROUND_STYLE), backgroundStyle);
}
this.foregroundStyle = __assign12(__assign12({}, FOREGROUND_STYLE2), foregroundStyle);
this.handlerStyle = __assign12(__assign12({}, HANDLER_STYLE2), handlerStyle);
this.textStyle = __assign12(__assign12({}, TEXT_STYLE2), textStyle2);
this.tickLabelStyle = __assign12(__assign12({}, TICK_LABEL_STYLE), tick.tickLabelStyle);
this.tickLineStyle = __assign12(__assign12({}, TICK_LINE_STYLE), tick.tickLineStyle);
this.currentMode = "range";
this.start = start;
this.end = end2;
this.minText = minText;
this.maxText = maxText;
this.fontFamily = typeof window !== "undefined" ? window.getComputedStyle(document.body, null).getPropertyValue("font-family") || "Arial, sans-serif" : "Arial, sans-serif";
this.renderSlider();
}
TrendTimeBar2.prototype.update = function(cfg) {
var x6 = cfg.x, y5 = cfg.y, width2 = cfg.width, height = cfg.height, minText = cfg.minText, maxText = cfg.maxText, start = cfg.start, end2 = cfg.end;
this.start = Math.min(1, Math.max(start, 0));
this.end = Math.min(1, Math.max(end2, 0));
mix(this, {
x: x6,
y: y5,
width: width2,
height,
minText,
maxText
});
this.updateUI();
};
TrendTimeBar2.prototype.setText = function(minText, maxText) {
this.minTextShape.attr("text", minText);
this.maxTextShape.attr("text", maxText);
};
TrendTimeBar2.prototype.renderSlider = function() {
var _this = this;
var _a6 = this, width2 = _a6.width, height = _a6.height, timeBarType = _a6.timeBarType;
if (timeBarType === "trend" && size(get_default(this.trendCfg, "data"))) {
var trendComponent = new trend_default(__assign12(__assign12({
x: this.x,
y: this.y,
width: width2,
height
}, this.trendCfg), {
group: this.group
}));
this.trendComponent = trendComponent;
}
var sliderGroup = this.group.addGroup({
name: "slider-group"
});
sliderGroup.addShape("rect", {
attrs: __assign12({
x: 0,
y: 0,
width: width2,
height
}, this.backgroundStyle)
});
var textGroup = this.group.addGroup();
if (timeBarType === "trend") {
this.minTextShape = textGroup.addShape("text", {
attrs: __assign12({
x: 0,
y: height / 2 + this.y,
textAlign: "right",
text: this.minText,
silent: false,
fontFamily: this.fontFamily || "Arial, sans-serif"
}, this.textStyle),
capture: false
});
this.maxTextShape = textGroup.addShape("text", {
attrs: __assign12({
y: height / 2 + this.y,
textAlign: "left",
text: this.maxText,
silent: false,
fontFamily: this.fontFamily || "Arial, sans-serif"
}, this.textStyle),
capture: false
});
} else {
this.minTextShape = textGroup.addShape("text", {
attrs: __assign12({
x: 0,
y: this.y - 10,
textAlign: "center",
text: this.minText,
silent: false,
fontFamily: this.fontFamily || "Arial, sans-serif"
}, this.textStyle),
capture: false
});
this.maxTextShape = textGroup.addShape("text", {
attrs: __assign12({
y: this.y - 10,
textAlign: "center",
text: this.maxText,
silent: false,
fontFamily: this.fontFamily || "Arial, sans-serif"
}, this.textStyle),
capture: false
});
}
this.foregroundShape = this.group.addGroup().addShape("rect", {
attrs: __assign12({
x: 0,
y: this.y,
height
}, this.foregroundStyle)
});
this.foregroundShape.on("mousedown", function(e4) {
e4.target.attr("cursor", "grabbing");
});
this.foregroundShape.on("mouseup", function(e4) {
e4.target.attr("cursor", _this.foregroundStyle.cursor || "grab");
});
var handlerWidth = get_default(this.handlerStyle, "width", 2);
var handlerHeight = get_default(this.handlerStyle, "height", 24);
var minHandleGroup = this.group.addGroup({
name: "minHandlerShape"
});
this.minHandlerShape = new handler_default({
name: "minHandlerShape",
group: minHandleGroup,
type: timeBarType,
x: this.x,
y: this.y,
width: handlerWidth,
height: handlerHeight,
style: this.handlerStyle
});
var maxHandleGroup = this.group.addGroup({
name: "maxHandlerShape"
});
this.maxHandlerShape = new handler_default({
name: "maxHandlerShape",
group: maxHandleGroup,
type: timeBarType,
x: this.x,
y: this.y,
width: handlerWidth,
height: handlerHeight,
style: this.handlerStyle
});
var tickData = this.ticks;
var interval3 = width2 / (tickData.length - 1);
this.tickPosList = [];
if (this.textList && this.textList.length) {
this.textList.forEach(function(text) {
text.destroy();
});
}
var lastX = -Infinity;
this.textList = tickData.map(function(data3, index2) {
_this.tickPosList.push(_this.x + index2 * interval3);
var label17;
if (_this.tickLabelFormatter) {
label17 = _this.tickLabelFormatter(data3);
if (!is_string_default(label17) && label17) {
label17 = data3.date;
}
} else {
label17 = data3.date;
}
var text = _this.group.addShape("text", {
attrs: __assign12({
x: _this.x + index2 * interval3,
y: _this.y + height + 5,
text: label17,
fontFamily: _this.fontFamily || "Arial, sans-serif"
}, _this.tickLabelStyle)
});
var line2 = _this.group.addShape("line", {
attrs: __assign12({
x1: _this.x + index2 * interval3,
y1: _this.y + height + 2,
x2: _this.x + index2 * interval3,
y2: _this.y + height + 6
}, _this.tickLineStyle)
});
line2.toBack();
var bbox = text.getBBox();
if (bbox.minX > lastX) {
text.show();
line2.show();
lastX = bbox.minX + bbox.width + 10;
} else {
text.hide();
line2.hide();
}
return text;
});
this.controllerBtnGroup = new controllerBtn_default(__assign12({
group: this.group,
x: this.x,
y: this.y + height + 25,
width: width2,
height: 35
}, this.controllerCfg));
this.updateStartEnd(0);
this.updateUI();
sliderGroup.move(this.x, this.y);
this.bindEvents();
};
TrendTimeBar2.prototype.bindEvents = function() {
var _this = this;
var minHandleShapeGroup = this.group.find(function(group2) {
return group2.get("name") === "minHandlerShape";
});
if (minHandleShapeGroup) {
minHandleShapeGroup.on("minHandlerShape-handler:mousedown", this.onMouseDown(this.minHandlerShape));
minHandleShapeGroup.on("minHandlerShape-handler:touchstart", this.onMouseDown(this.minHandlerShape));
}
var maxHandleShapeGroup = this.group.find(function(group2) {
return group2.get("name") === "maxHandlerShape";
});
if (maxHandleShapeGroup) {
maxHandleShapeGroup.on("maxHandlerShape-handler:mousedown", this.onMouseDown(this.maxHandlerShape));
maxHandleShapeGroup.on("maxHandlerShape-handler:touchstart", this.onMouseDown(this.maxHandlerShape));
}
this.foregroundShape.on("mousedown", this.onMouseDown(this.foregroundShape));
this.foregroundShape.on("touchstart", this.onMouseDown(this.foregroundShape));
this.group.on(PLAY_PAUSE_BTN + ":click", function() {
_this.isPlay = !_this.isPlay;
_this.currentHandler = _this.maxHandlerShape;
_this.changePlayStatus();
});
this.group.on(NEXT_STEP_BTN + ":click", function() {
_this.currentHandler = _this.maxHandlerShape;
_this.updateStartEnd(0.01);
_this.updateUI();
});
this.group.on(PRE_STEP_BTN + ":click", function() {
_this.currentHandler = _this.maxHandlerShape;
_this.updateStartEnd(-0.01);
_this.updateUI();
});
this.group.on(TIMEBAR_CONFIG_CHANGE, function(_a6) {
var type2 = _a6.type, speed = _a6.speed;
_this.currentSpeed = speed;
_this.currentMode = type2;
if (type2 === "single") {
_this.minHandlerShape.hide();
_this.foregroundShape.hide();
_this.minTextShape.hide();
} else if (type2 === "range") {
_this.minHandlerShape.show();
_this.foregroundShape.show();
_this.minTextShape.show();
}
});
};
TrendTimeBar2.prototype.adjustTickIndex = function(timeSelectX) {
for (var i4 = 0; i4 < this.tickPosList.length - 1; i4++) {
if (this.tickPosList[i4] <= timeSelectX && timeSelectX <= this.tickPosList[i4 + 1]) {
return Math.abs(this.tickPosList[i4] - timeSelectX) < Math.abs(timeSelectX - this.tickPosList[i4 + 1]) ? i4 : i4 + 1;
}
}
return 0;
};
TrendTimeBar2.prototype.adjustOffsetRange = function(offsetRange) {
switch (this.currentHandler) {
case this.minHandlerShape: {
var min7 = 0 - this.start;
var max8 = 1 - this.start;
return Math.min(max8, Math.max(min7, offsetRange));
}
case this.maxHandlerShape: {
var min7 = 0 - this.end;
var max8 = 1 - this.end;
return Math.min(max8, Math.max(min7, offsetRange));
}
case this.foregroundShape: {
var min7 = 0 - this.start;
var max8 = 1 - this.end;
return Math.min(max8, Math.max(min7, offsetRange));
}
default:
return 0;
}
};
TrendTimeBar2.prototype.updateStartEnd = function(offsetRange) {
var minData = this.ticks[this.adjustTickIndex(this.start * this.width)];
var maxData = this.ticks[this.adjustTickIndex(this.end * this.width)];
if (!this.currentHandler) {
this.minText = this.tickLabelFormatter ? this.tickLabelFormatter(minData) : minData.date;
this.maxText = this.tickLabelFormatter ? this.tickLabelFormatter(maxData) : maxData.date;
return;
}
switch (this.currentHandler) {
case this.minHandlerShape:
this.maxText = this.maxTextShape.attr("text");
this.start += offsetRange;
this.minText = this.tickLabelFormatter ? this.tickLabelFormatter(minData) : minData.date;
break;
case this.maxHandlerShape:
this.minText = this.minTextShape.attr("text");
this.end += offsetRange;
this.maxText = this.tickLabelFormatter ? this.tickLabelFormatter(maxData) : maxData.date;
break;
case this.foregroundShape:
this.start += offsetRange;
this.end += offsetRange;
this.minText = this.tickLabelFormatter ? this.tickLabelFormatter(minData) : minData.date;
this.maxText = this.tickLabelFormatter ? this.tickLabelFormatter(maxData) : maxData.date;
break;
default:
break;
}
};
TrendTimeBar2.prototype.updateUI = function() {
var _this = this;
if (this.start < 0) {
this.start = 0;
}
if (this.end > 1) {
this.end = 1;
}
var min7 = this.x + this.start * this.width;
var max8 = this.x + this.end * this.width;
this.foregroundShape.attr("x", min7);
this.foregroundShape.attr("width", max8 - min7);
var handlerWidth = get_default(this.handlerStyle, "width", DEFAULT_HANDLER_WIDTH2);
this.setText(this.minText, this.maxText);
var _a6 = this.dodgeText([min7, max8]), minAttrs = _a6[0], maxAttrs = _a6[1];
this.minHandlerShape.setX(min7 - handlerWidth / 2);
each_default(minAttrs, function(v3, k4) {
return _this.minTextShape.attr(k4, v3);
});
this.maxHandlerShape.setX(max8 - handlerWidth / 2);
each_default(maxAttrs, function(v3, k4) {
return _this.maxTextShape.attr(k4, v3);
});
if (this.currentMode === "range") {
this.graph.emit(VALUE_CHANGE, {
value: [this.start, this.end].sort()
});
} else if (this.currentMode === "single") {
this.graph.emit(VALUE_CHANGE, {
value: [this.end, this.end]
});
}
};
TrendTimeBar2.prototype.dodgeText = function(range) {
var _a6, _b;
var TEXTPADDING = 2;
var handlerWidth = get_default(this.handlerStyle, "width", DEFAULT_HANDLER_WIDTH2);
var minTextShape = this.minTextShape;
var maxTextShape = this.maxTextShape;
var min7 = range[0], max8 = range[1];
var sorted = false;
if (min7 > max8) {
_a6 = [max8, min7], min7 = _a6[0], max8 = _a6[1];
_b = [maxTextShape, minTextShape], minTextShape = _b[0], maxTextShape = _b[1];
sorted = true;
}
var minBBox = minTextShape.getBBox();
var maxBBox = maxTextShape.getBBox();
var minAttrs = null;
var maxAttrs = null;
if (this.timeBarType === "trend") {
minAttrs = min7 - minBBox.width < this.x + TEXTPADDING ? {
x: min7 + handlerWidth / 2 + TEXTPADDING,
textAlign: "left"
} : {
x: min7 - handlerWidth / 2 - TEXTPADDING,
textAlign: "right"
};
maxAttrs = max8 + maxBBox.width > this.x + this.width ? {
x: max8 - handlerWidth / 2 - TEXTPADDING,
textAlign: "right"
} : {
x: max8 + handlerWidth / 2 + TEXTPADDING,
textAlign: "left"
};
} else if (this.timeBarType === "simple") {
minAttrs = minBBox.width > min7 - TEXTPADDING ? {
x: min7 + handlerWidth / 2 + TEXTPADDING,
textAlign: "center"
} : {
x: min7 - handlerWidth / 2 - TEXTPADDING,
textAlign: "center"
};
maxAttrs = maxBBox.width > this.width - max8 - TEXTPADDING ? {
x: max8 - handlerWidth / 2 - TEXTPADDING,
textAlign: "center"
} : {
x: max8 + handlerWidth / 2 + TEXTPADDING,
textAlign: "center"
};
}
return !sorted ? [minAttrs, maxAttrs] : [maxAttrs, minAttrs];
};
TrendTimeBar2.prototype.startPlay = function() {
var _this = this;
return typeof window !== "undefined" ? window.requestAnimationFrame(function() {
var _a6 = _this, ticks = _a6.ticks, width2 = _a6.width;
var speed = _this.currentSpeed;
var tickInterval = width2 / ticks.length;
var offsetX = tickInterval / ((10 - speed) * 1e3 / 60);
var offsetXRange = _this.adjustOffsetRange(offsetX / _this.width);
_this.updateStartEnd(offsetXRange);
_this.updateUI();
if (_this.isPlay) {
_this.playHandler = _this.startPlay();
}
}) : void 0;
};
TrendTimeBar2.prototype.changePlayStatus = function(isSync) {
if (isSync === void 0) {
isSync = true;
}
this.controllerBtnGroup.playButton.update({
isPlay: this.isPlay
});
if (this.isPlay) {
this.playHandler = this.startPlay();
this.graph.emit(TIMELINE_START, null);
} else {
if (this.playHandler) {
if (typeof window !== "undefined")
window.cancelAnimationFrame(this.playHandler);
if (isSync) {
this.graph.emit(TIMELINE_END, null);
}
}
}
};
TrendTimeBar2.prototype.destory = function() {
this.graph.off(VALUE_CHANGE);
var group2 = this.group;
var minHandleShapeGroup = group2.find(function(g4) {
return g4.get("name") === "minHandlerShape";
});
if (minHandleShapeGroup) {
minHandleShapeGroup.off("minHandlerShape-handler:mousedown");
minHandleShapeGroup.off("minHandlerShape-handler:touchstart");
minHandleShapeGroup.destroy();
}
var maxHandleShapeGroup = group2.find(function(g4) {
return g4.get("name") === "maxHandlerShape";
});
if (maxHandleShapeGroup) {
maxHandleShapeGroup.off("maxHandlerShape-handler:mousedown");
maxHandleShapeGroup.off("maxHandlerShape-handler:touchstart");
maxHandleShapeGroup.destroy();
}
this.foregroundShape.off("mousedown");
this.foregroundShape.off("touchstart");
this.foregroundShape.destroy();
group2.off(PLAY_PAUSE_BTN + ":click");
group2.off(NEXT_STEP_BTN + ":click");
group2.off(PRE_STEP_BTN + ":click");
group2.off(TIMEBAR_CONFIG_CHANGE);
group2.destroy();
if (this.trendComponent) {
this.trendComponent.destory();
}
};
return TrendTimeBar2;
}();
var trendTimeBar_default = TrendTimeBar;
// node_modules/@antv/g6-plugin/es/timeBar/timeBarTooltip.js
var TimeBarTooltip = function() {
function TimeBarTooltip2(cfg) {
var _a6 = cfg.x, x6 = _a6 === void 0 ? 0 : _a6, _b = cfg.y, y5 = _b === void 0 ? 0 : _b, container2 = cfg.container, text = cfg.text, _c = cfg.padding, padding3 = _c === void 0 ? [4, 4, 4, 4] : _c, _d = cfg.className, className = _d === void 0 ? "g6-component-timebar-tooltip" : _d, _e = cfg.backgroundColor, backgroundColor = _e === void 0 ? "#000" : _e, _f = cfg.textColor, textColor3 = _f === void 0 ? "#fff" : _f, _g = cfg.opacity, opacity = _g === void 0 ? 0.8 : _g, _h = cfg.fontSize, fontSize = _h === void 0 ? 12 : _h;
this.container = container2;
this.className = className;
this.backgroundColor = backgroundColor;
this.textColor = textColor3;
this.x = x6;
this.y = y5;
this.text = text;
this.padding = padding3;
this.opacity = opacity;
this.fontSize = fontSize;
this.render();
}
TimeBarTooltip2.prototype.render = function() {
var self2 = this;
var className = self2.className, x6 = self2.x, y5 = self2.y, backgroundColor = self2.backgroundColor, textColor3 = self2.textColor, text = self2.text, padding3 = self2.padding, opacity = self2.opacity, fontSize = self2.fontSize;
var parentNode = self2.container;
var container2 = createDom("');
if (is_string_default(parentNode)) {
parentNode = document.getElementById(parentNode);
}
parentNode.appendChild(container2);
self2.parentHeight = parentNode.offsetHeight;
self2.parentWidth = parentNode.offsetWidth;
modifyCSS(container2, {
visibility: "hidden",
top: 0,
left: 0
});
var background = createDom("\n ");
background.innerHTML = text;
container2.appendChild(background);
self2.backgroundDOM = background;
var arrow = createDom("");
container2.appendChild(arrow);
self2.arrowDOM = arrow;
self2.container = container2;
};
TimeBarTooltip2.prototype.show = function(cfg) {
var self2 = this;
var text = cfg.text, x6 = cfg.x, y5 = cfg.y, clientX = cfg.clientX, clientY = cfg.clientY;
self2.backgroundDOM.innerHTML = text;
var backgroundWidth = self2.backgroundDOM.offsetWidth;
var backgroundHeight = self2.backgroundDOM.offsetHeight;
var arrowWidth = self2.arrowDOM.offsetWidth;
var arrowHeight = self2.arrowDOM.offsetHeight;
modifyCSS(self2.container, {
top: -backgroundHeight - arrowHeight + "px",
left: x6 + "px",
visibility: "visible"
});
modifyCSS(self2.backgroundDOM, {
marginLeft: -backgroundWidth / 2 + "px"
});
modifyCSS(self2.arrowDOM, {
marginLeft: -arrowWidth / 2 + "px",
top: backgroundHeight + "px"
});
var left2 = x6 - backgroundWidth / 2;
var right2 = x6 + backgroundWidth / 2;
if (left2 < 0) {
modifyCSS(self2.backgroundDOM, {
marginLeft: -backgroundWidth / 2 - left2 + "px"
});
} else if (right2 > self2.parentWidth) {
modifyCSS(self2.backgroundDOM, {
marginLeft: -backgroundWidth / 2 - right2 + self2.parentWidth + 12 + "px"
});
}
};
TimeBarTooltip2.prototype.hide = function() {
modifyCSS(this.container, {
top: 0,
left: 0,
visibility: "hidden"
});
};
return TimeBarTooltip2;
}();
var timeBarTooltip_default = TimeBarTooltip;
// node_modules/@antv/g6-plugin/es/timeBar/timeBarSlice.js
var __assign13 = function() {
__assign13 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4) {
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
}
return t4;
};
return __assign13.apply(this, arguments);
};
var DEFAULT_SELECTEDTICK_STYLE = {
fill: "#5B8FF9"
};
var DEFAULT_UNSELECTEDTICK_STYLE = {
fill: "#e6e8e9"
};
var TimeBarSlice = function() {
function TimeBarSlice2(cfgs) {
this.frameCount = 0;
this.fontFamily = "Arial, sans-serif";
var graph = cfgs.graph, canvas = cfgs.canvas, group2 = cfgs.group, width2 = cfgs.width, height = cfgs.height, padding3 = cfgs.padding, data3 = cfgs.data, start = cfgs.start, end2 = cfgs.end, _a6 = cfgs.x, x6 = _a6 === void 0 ? 0 : _a6, _b = cfgs.y, y5 = _b === void 0 ? 0 : _b, tickLabelFormatter = cfgs.tickLabelFormatter, _c = cfgs.selectedTickStyle, selectedTickStyle = _c === void 0 ? DEFAULT_SELECTEDTICK_STYLE : _c, _d = cfgs.unselectedTickStyle, unselectedTickStyle = _d === void 0 ? DEFAULT_UNSELECTEDTICK_STYLE : _d, tooltipBackgroundColor = cfgs.tooltipBackgroundColor, tooltipFomatter = cfgs.tooltipFomatter;
this.graph = graph;
this.group = group2;
this.sliceGroup = group2.addGroup({
name: "slice-group"
});
this.canvas = canvas;
this.width = width2;
this.height = height;
this.padding = padding3;
this.data = data3;
this.start = start;
this.end = end2;
this.tickLabelFormatter = tickLabelFormatter;
this.selectedTickStyle = selectedTickStyle;
this.unselectedTickStyle = unselectedTickStyle;
this.x = x6;
this.y = y5;
this.tooltipBackgroundColor = tooltipBackgroundColor;
this.tooltipFomatter = tooltipFomatter;
this.fontFamily = typeof window !== "undefined" ? window.getComputedStyle(document.body, null).getPropertyValue("font-family") || "Arial, sans-serif" : "Arial, sans-serif";
this.renderSlices();
this.initEvent();
}
TimeBarSlice2.prototype.renderSlices = function() {
var _this = this;
var _a6 = this, width2 = _a6.width, height = _a6.height, padding3 = _a6.padding, data3 = _a6.data, start = _a6.start, end2 = _a6.end, tickLabelFormatter = _a6.tickLabelFormatter, selectedTickStyle = _a6.selectedTickStyle, unselectedTickStyle = _a6.unselectedTickStyle;
var realWidth = width2 - 2 * padding3;
var fontSize = 10;
var labelLineHeight = 4;
var labelAreaHeight = 3 * padding3 + labelLineHeight + fontSize;
var ticksAreaHeight = height - labelAreaHeight - 2 * padding3;
var gap = 2;
var ticksLength = data3.length;
var tickWidth = (realWidth - gap * (ticksLength - 1)) / ticksLength;
this.tickWidth = tickWidth;
var sliceGroup = this.sliceGroup;
var tickRects = [];
var labels = [];
var startTickId = Math.round(ticksLength * start);
var endTickId = Math.round(ticksLength * end2);
this.startTickRectId = startTickId;
this.endTickRectId = endTickId;
data3.forEach(function(d3, i4) {
var selected = i4 >= startTickId && i4 <= endTickId;
var tickStyle = selected ? selectedTickStyle : unselectedTickStyle;
var rect3 = sliceGroup.addShape("rect", {
attrs: __assign13({
x: padding3 + i4 * (tickWidth + gap),
y: padding3,
width: tickWidth,
height: ticksAreaHeight
}, tickStyle),
draggable: true,
name: "tick-rect-" + i4
});
var pickRect = sliceGroup.addShape("rect", {
attrs: {
x: padding3 + i4 * tickWidth + gap * (2 * i4 - 1) / 2,
y: padding3,
width: i4 === 0 || i4 === ticksLength - 1 ? tickWidth + gap / 2 : tickWidth + gap,
height: ticksAreaHeight,
fill: "#fff",
opacity: 0
},
draggable: true,
name: "pick-rect-" + i4
});
pickRect.toFront();
var rectBBox = rect3.getBBox();
var centerX = (rectBBox.minX + rectBBox.maxX) / 2;
tickRects.push({
rect: rect3,
pickRect,
value: d3.date,
x: centerX,
y: rectBBox.minY
});
var label17;
if (tickLabelFormatter) {
label17 = tickLabelFormatter(d3);
if (!is_string_default(label17) && label17) {
label17 = d3.date;
}
} else if (i4 % Math.round(ticksLength / 10) === 0) {
label17 = d3.date;
}
if (label17) {
labels.push(label17);
var lineStartY = rectBBox.maxY + padding3 * 2;
sliceGroup.addShape("line", {
attrs: {
stroke: "#BFBFBF",
x1: centerX,
y1: lineStartY,
x2: centerX,
y2: lineStartY + labelLineHeight
}
});
var labelStartY = lineStartY + labelLineHeight + padding3;
var text = sliceGroup.addShape("text", {
attrs: {
fill: "#8c8c8c",
stroke: "#fff",
lineWidth: 1,
x: centerX,
y: labelStartY,
textAlign: "center",
text: label17,
textBaseline: "top",
fontSize: 10,
fontFamily: _this.fontFamily || "Arial, sans-serif"
},
capture: false
});
var textBBox = text.getBBox();
if (textBBox.maxX > width2) {
text.attr("textAlign", "right");
} else if (textBBox.minX < 0) {
text.attr("textAlign", "left");
}
}
});
this.tickRects = tickRects;
var group2 = this.group;
this.currentSpeed = 1;
this.controllerBtnGroup = new controllerBtn_default({
group: group2,
x: this.x,
y: this.y + height + 5,
width: width2,
height: 40,
hideTimeTypeController: true,
speed: this.currentSpeed,
fontFamily: this.fontFamily || "Arial, sans-serif"
});
};
TimeBarSlice2.prototype.initEvent = function() {
var _this = this;
var sliceGroup = this.sliceGroup;
sliceGroup.on("click", function(e4) {
var targetRect = e4.target;
if (targetRect.get("type") !== "rect" || !targetRect.get("name"))
return;
var id = parseInt(targetRect.get("name").split("-")[2], 10);
if (!isNaN(id)) {
var tickRects_1 = _this.tickRects;
var unselectedTickStyle_1 = _this.unselectedTickStyle;
tickRects_1.forEach(function(tickRect) {
tickRect.rect.attr(unselectedTickStyle_1);
});
var selectedTickStyle = _this.selectedTickStyle;
tickRects_1[id].rect.attr(selectedTickStyle);
_this.startTickRectId = id;
_this.endTickRectId = id;
var ticksLength = tickRects_1.length;
var start = id / ticksLength;
_this.graph.emit(VALUE_CHANGE, {
value: [start, start]
});
}
});
sliceGroup.on("dragstart", function(e4) {
var tickRects2 = _this.tickRects;
var unselectedTickStyle = _this.unselectedTickStyle;
tickRects2.forEach(function(tickRect) {
tickRect.rect.attr(unselectedTickStyle);
});
var targetRect = e4.target;
var id = parseInt(targetRect.get("name").split("-")[2], 10);
var selectedTickStyle = _this.selectedTickStyle;
tickRects2[id].rect.attr(selectedTickStyle);
_this.startTickRectId = id;
var ticksLength = tickRects2.length;
var start = id / ticksLength;
_this.graph.emit(VALUE_CHANGE, {
value: [start, start]
});
_this.dragging = true;
});
sliceGroup.on("dragover", function(e4) {
if (!_this.dragging)
return;
if (e4.target.get("type") !== "rect")
return;
var id = parseInt(e4.target.get("name").split("-")[2], 10);
var startTickRectId = _this.startTickRectId;
var tickRects2 = _this.tickRects;
var selectedTickStyle = _this.selectedTickStyle;
var unselectedTickStyle = _this.unselectedTickStyle;
for (var i4 = 0; i4 < tickRects2.length; i4++) {
var style = i4 >= startTickRectId && i4 <= id ? selectedTickStyle : unselectedTickStyle;
tickRects2[i4].rect.attr(style);
}
var ticksLength = tickRects2.length;
_this.endTickRectId = id;
var start = startTickRectId / ticksLength;
var end2 = id / ticksLength;
_this.graph.emit(VALUE_CHANGE, {
value: [start, end2]
});
});
sliceGroup.on("drop", function(e4) {
if (!_this.dragging)
return;
_this.dragging = false;
if (e4.target.get("type") !== "rect")
return;
var startTickRectId = _this.startTickRectId;
var id = parseInt(e4.target.get("name").split("-")[2], 10);
if (id < startTickRectId)
return;
var selectedTickStyle = _this.selectedTickStyle;
var tickRects2 = _this.tickRects;
tickRects2[id].rect.attr(selectedTickStyle);
_this.endTickRectId = id;
var ticksLength = tickRects2.length;
var start = startTickRectId / ticksLength;
var end2 = id / ticksLength;
_this.graph.emit(VALUE_CHANGE, {
value: [start, end2]
});
});
var _a6 = this, tooltipBackgroundColor = _a6.tooltipBackgroundColor, tooltipFomatter = _a6.tooltipFomatter, canvas = _a6.canvas;
var tooltip10 = new timeBarTooltip_default({
container: canvas.get("container"),
backgroundColor: tooltipBackgroundColor
});
var tickRects = this.tickRects;
tickRects.forEach(function(tickRect) {
var pickRect = tickRect.pickRect;
pickRect.on("mouseenter", function(e4) {
var rect3 = e4.target;
if (rect3.get("type") !== "rect")
return;
var id = parseInt(rect3.get("name").split("-")[2], 10);
var clientPoint = canvas.getClientByPoint(tickRects[id].x, tickRects[id].y);
tooltip10.show({
x: tickRects[id].x,
y: tickRects[id].y,
clientX: clientPoint.x,
clientY: clientPoint.y,
text: tooltipFomatter ? tooltipFomatter(tickRects[id].value) : tickRects[id].value
});
});
pickRect.on("mouseleave", function(e4) {
tooltip10.hide();
});
});
var group2 = this.group;
group2.on(PLAY_PAUSE_BTN + ":click", function() {
_this.isPlay = !_this.isPlay;
_this.changePlayStatus();
});
group2.on(NEXT_STEP_BTN + ":click", function() {
_this.updateStartEnd(1);
});
group2.on(PRE_STEP_BTN + ":click", function() {
_this.updateStartEnd(-1);
});
group2.on(TIMEBAR_CONFIG_CHANGE, function(_a7) {
var type2 = _a7.type, speed = _a7.speed;
_this.currentSpeed = speed;
});
};
TimeBarSlice2.prototype.changePlayStatus = function(isSync) {
if (isSync === void 0) {
isSync = true;
}
this.controllerBtnGroup.playButton.update({
isPlay: this.isPlay
});
if (this.isPlay) {
this.playHandler = this.startPlay();
this.graph.emit(TIMELINE_START, null);
} else {
if (this.playHandler) {
if (typeof window !== "undefined")
window.cancelAnimationFrame(this.playHandler);
if (isSync) {
this.graph.emit(TIMELINE_END, null);
}
}
}
};
TimeBarSlice2.prototype.startPlay = function() {
var _this = this;
return typeof window !== "undefined" ? window.requestAnimationFrame(function() {
var speed = _this.currentSpeed;
if (_this.frameCount % (60 / speed) === 0) {
_this.frameCount = 0;
_this.updateStartEnd(1);
}
_this.frameCount++;
if (_this.isPlay) {
_this.playHandler = _this.startPlay();
}
}) : void 0;
};
TimeBarSlice2.prototype.updateStartEnd = function(sign) {
var self2 = this;
var tickRects = this.tickRects;
var ticksLength = tickRects.length;
var unselectedTickStyle = this.unselectedTickStyle;
var selectedTickStyle = this.selectedTickStyle;
var previousEndTickRectId = self2.endTickRectId;
if (sign > 0) {
self2.endTickRectId++;
} else {
tickRects[self2.endTickRectId].rect.attr(unselectedTickStyle);
self2.endTickRectId--;
}
if (previousEndTickRectId !== self2.startTickRectId) {
if (self2.endTickRectId < self2.startTickRectId) {
self2.startTickRectId = self2.endTickRectId;
}
} else {
for (var i4 = self2.startTickRectId; i4 <= self2.endTickRectId - 1; i4++) {
tickRects[i4].rect.attr(unselectedTickStyle);
}
self2.startTickRectId = self2.endTickRectId;
}
if (tickRects[self2.endTickRectId]) {
tickRects[self2.endTickRectId].rect.attr(selectedTickStyle);
var start = self2.startTickRectId / ticksLength;
var end2 = self2.endTickRectId / ticksLength;
this.graph.emit(VALUE_CHANGE, {
value: [start, end2]
});
}
};
TimeBarSlice2.prototype.destory = function() {
this.graph.off(VALUE_CHANGE);
var group2 = this.sliceGroup;
group2.off("click");
group2.off("dragstart");
group2.off("dragover");
group2.off("drop");
this.tickRects.forEach(function(tickRect) {
var pickRect = tickRect.pickRect;
pickRect.off("mouseenter");
pickRect.off("mouseleave");
});
this.tickRects.length = 0;
group2.off(PLAY_PAUSE_BTN + ":click");
group2.off(NEXT_STEP_BTN + ":click");
group2.off(PRE_STEP_BTN + ":click");
group2.off(TIMEBAR_CONFIG_CHANGE);
this.sliceGroup.destroy();
};
return TimeBarSlice2;
}();
var timeBarSlice_default = TimeBarSlice;
// node_modules/@antv/g6-plugin/es/timeBar/index.js
var __extends12 = function() {
var _extendStatics = function extendStatics(d3, b10) {
_extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(d4, b11) {
d4.__proto__ = b11;
} || function(d4, b11) {
for (var p4 in b11) {
if (Object.prototype.hasOwnProperty.call(b11, p4))
d4[p4] = b11[p4];
}
};
return _extendStatics(d3, b10);
};
return function(d3, b10) {
if (typeof b10 !== "function" && b10 !== null)
throw new TypeError("Class extends value " + String(b10) + " is not a constructor or null");
_extendStatics(d3, b10);
function __() {
this.constructor = d3;
}
d3.prototype = b10 === null ? Object.create(b10) : (__.prototype = b10.prototype, new __());
};
}();
var __assign14 = function() {
__assign14 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4) {
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
}
return t4;
};
return __assign14.apply(this, arguments);
};
var __rest40 = function(s4, e4) {
var t4 = {};
for (var p4 in s4) {
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
}
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var DEFAULT_SIMPLE_HEIGHT = 4;
var DEFAULT_TREND_HEIGHT = 26;
var TimeBar = function(_super) {
__extends12(TimeBar3, _super);
function TimeBar3() {
return _super !== null && _super.apply(this, arguments) || this;
}
TimeBar3.prototype.getDefaultCfgs = function() {
return {
container: null,
className: "g6-component-timebar",
padding: 10,
type: "trend",
trend: {
data: [],
isArea: false,
smooth: true
},
controllerCfg: {
speed: 1,
loop: false
},
slider: {
start: 0.1,
end: 0.9,
minText: "min",
maxText: "max"
},
tick: {
start: 0.1,
end: 0.9,
data: []
},
textStyle: {},
filterEdge: false
};
};
TimeBar3.prototype.initContainer = function() {
var graph = this.get("graph");
var _a6 = this._cfgs, width2 = _a6.width, height = _a6.height;
var className = this.get("className") || "g6-component-timebar";
var container2 = this.get("container");
var graphContainer = this.get("graph").get("container");
var timeBarContainer;
if (!container2) {
timeBarContainer = createDom("");
modifyCSS(timeBarContainer, {
position: "relative"
});
} else {
if (is_string_default(container2)) {
container2 = document.getElementById(container2);
}
timeBarContainer = container2;
}
graphContainer.appendChild(timeBarContainer);
this.set("timeBarContainer", timeBarContainer);
var canvas;
var renderer = graph.get("renderer");
if (renderer === "SVG") {
canvas = new canvas_default3({
container: timeBarContainer,
width: width2,
height
});
} else {
canvas = new canvas_default2({
container: timeBarContainer,
width: width2,
height
});
}
this.set("canvas", canvas);
};
TimeBar3.prototype.init = function() {
this.initContainer();
var canvas = this.get("canvas");
var timeBarGroup = canvas.addGroup({
name: "timebar-group"
});
this.set("timeBarGroup", timeBarGroup);
this.renderTrend();
this.initEvent();
var fontFamily = typeof window !== "undefined" ? window.getComputedStyle(document.body, null).getPropertyValue("font-family") || "Arial, sans-serif" : "Arial, sans-serif";
this.set("fontFamily", fontFamily);
};
TimeBar3.prototype.renderTrend = function() {
var _a6 = this._cfgs, width2 = _a6.width, x6 = _a6.x, y5 = _a6.y, padding3 = _a6.padding, type2 = _a6.type, trend = _a6.trend, slider3 = _a6.slider, controllerCfg = _a6.controllerCfg, textStyle2 = _a6.textStyle, tick = _a6.tick, backgroundStyle = _a6.backgroundStyle, foregroundStyle = _a6.foregroundStyle;
var data3 = trend.data, other2 = __rest40(trend, ["data"]);
var realWidth = width2 - 2 * padding3;
var defaultHeight = type2 === "trend" ? DEFAULT_TREND_HEIGHT : DEFAULT_SIMPLE_HEIGHT;
var graph = this.get("graph");
var group2 = this.get("timeBarGroup");
var canvas = this.get("canvas");
var timebar = null;
if (type2 === "trend" || type2 === "simple") {
timebar = new trendTimeBar_default(__assign14(__assign14({
graph,
canvas,
group: group2,
type: type2,
x: x6 + padding3,
y: type2 === "trend" ? y5 + padding3 : y5 + padding3 + 15,
width: realWidth,
height: defaultHeight,
padding: padding3,
backgroundStyle,
foregroundStyle,
trendCfg: __assign14(__assign14({}, other2), {
data: data3.map(function(d3) {
return d3.value;
})
})
}, slider3), {
tick: {
ticks: data3,
tickLabelFormatter: tick.tickLabelFormatter,
tickLabelStyle: tick.tickLabelStyle,
tickLineStyle: tick.tickLineStyle
},
handlerStyle: __assign14(__assign14({}, slider3.handlerStyle), {
height: slider3.height || defaultHeight
}),
controllerCfg,
textStyle: textStyle2
}));
} else if (type2 === "tick") {
timebar = new timeBarSlice_default(__assign14({
graph,
canvas,
group: group2,
x: x6 + padding3,
y: y5 + padding3
}, tick));
}
this.set("timebar", timebar);
};
TimeBar3.prototype.filterData = function(evt) {
var _a6;
var value2 = evt.value;
var trendData = null;
var type2 = this._cfgs.type;
if (type2 === "trend" || type2 === "simple") {
trendData = this._cfgs.trend.data;
} else if (type2 === "tick") {
trendData = this._cfgs.tick.data;
}
if (!trendData || trendData.length === 0) {
console.warn("\u8BF7\u914D\u7F6E TimeBar \u7EC4\u4EF6\u7684\u6570\u636E");
return;
}
var rangeChange = this.get("rangeChange");
var graph = this.get("graph");
var min7 = Math.round(trendData.length * value2[0]);
var max8 = Math.round(trendData.length * value2[1]);
max8 = max8 >= trendData.length ? trendData.length - 1 : max8;
min7 = min7 >= trendData.length ? trendData.length - 1 : min7;
var tickLabelFormatter = (_a6 = this._cfgs.tick) === null || _a6 === void 0 ? void 0 : _a6.tickLabelFormatter;
var minText = tickLabelFormatter ? tickLabelFormatter(trendData[min7]) : trendData[min7].date;
var maxText = tickLabelFormatter ? tickLabelFormatter(trendData[max8]) : trendData[max8].date;
if (type2 !== "tick") {
var timebar = this.get("timebar");
timebar.setText(minText, maxText);
}
if (rangeChange) {
rangeChange(graph, minText, maxText);
} else {
if (!this.cacheGraphData || this.cacheGraphData.nodes && this.cacheGraphData.nodes.length === 0) {
this.cacheGraphData = graph.get("data");
}
var filterData = this.cacheGraphData.nodes.filter(function(d3) {
return d3.date >= trendData[min7].date && d3.date <= trendData[max8].date;
});
var nodeIds_1 = filterData.map(function(node) {
return node.id;
});
var fileterEdges = [];
if (this.cacheGraphData.edges) {
fileterEdges = this.cacheGraphData.edges.filter(function(edge2) {
return nodeIds_1.includes(edge2.source) && nodeIds_1.includes(edge2.target);
});
if (this.get("filterEdge")) {
fileterEdges = fileterEdges.filter(function(edge2) {
return edge2.date >= trendData[min7].date && edge2.date <= trendData[max8].date;
});
}
}
graph.changeData({
nodes: filterData,
edges: fileterEdges
});
}
};
TimeBar3.prototype.initEvent = function() {
var _this = this;
var start = 0;
var end2 = 0;
var type2 = this._cfgs.type;
if (!type2 || type2 === "trend" || type2 === "simple") {
start = this._cfgs.slider.start;
end2 = this._cfgs.slider.end;
} else if (type2 === "tick") {
start = this._cfgs.tick.start;
end2 = this._cfgs.tick.end;
}
var graph = this.get("graph");
graph.on("afterrender", function(e4) {
_this.filterData({
value: [start, end2]
});
});
graph.on(VALUE_CHANGE, throttle_default(function(e4) {
_this.filterData(e4);
}, 200, {
trailing: true,
leading: true
}));
};
TimeBar3.prototype.destroy = function() {
var timebar = this.get("timebar");
if (timebar && timebar.destory) {
timebar.destory();
}
_super.prototype.destroy.call(this);
var timeBarContainer = this.get("timeBarContainer");
if (timeBarContainer) {
var container2 = this.get("container");
if (!container2) {
container2 = this.get("graph").get("container");
}
if (is_string_default(container2)) {
container2 = document.getElementById(container2);
}
container2.removeChild(timeBarContainer);
}
};
return TimeBar3;
}(base_default18);
var timeBar_default = TimeBar;
// node_modules/@antv/g6-plugin/es/imageMinimap/index.js
var __extends13 = function() {
var _extendStatics = function extendStatics(d3, b10) {
_extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(d4, b11) {
d4.__proto__ = b11;
} || function(d4, b11) {
for (var p4 in b11) {
if (Object.prototype.hasOwnProperty.call(b11, p4))
d4[p4] = b11[p4];
}
};
return _extendStatics(d3, b10);
};
return function(d3, b10) {
if (typeof b10 !== "function" && b10 !== null)
throw new TypeError("Class extends value " + String(b10) + " is not a constructor or null");
_extendStatics(d3, b10);
function __() {
this.constructor = d3;
}
d3.prototype = b10 === null ? Object.create(b10) : (__.prototype = b10.prototype, new __());
};
}();
var applyMatrix3 = util_default.applyMatrix;
function getImgNaturalDimension(img, callback) {
var nWidth, nHeight;
if (img.naturalWidth) {
nWidth = img.naturalWidth;
nHeight = img.naturalHeight;
} else {
var image_1 = new Image();
image_1.src = img.src;
image_1.onload = function() {
if (callback)
callback(image_1.width, image_1.height);
};
}
return [nWidth, nHeight];
}
var ImageMiniMap = function(_super) {
__extends13(ImageMiniMap2, _super);
function ImageMiniMap2() {
return _super !== null && _super.apply(this, arguments) || this;
}
ImageMiniMap2.prototype.getDefaultCfgs = function() {
return {
container: null,
className: "g6-minimap",
viewportClassName: "g6-minimap-viewport",
width: 200,
delegateStyle: {
fill: "#40a9ff",
stroke: "#096dd9"
},
refresh: true
};
};
ImageMiniMap2.prototype.getEvents = function() {
return {
beforepaint: "updateViewport",
beforeanimate: "disableRefresh",
afteranimate: "enableRefresh",
viewportchange: "disableOneRefresh"
};
};
ImageMiniMap2.prototype.disableRefresh = function() {
this.set("refresh", false);
};
ImageMiniMap2.prototype.enableRefresh = function() {
this.set("refresh", true);
this.updateCanvas();
};
ImageMiniMap2.prototype.disableOneRefresh = function() {
this.set("viewportChange", true);
};
ImageMiniMap2.prototype.initViewport = function() {
var _this = this;
var cfgs = this._cfgs;
var graph = cfgs.graph;
if (this.destroyed)
return;
var containerDOM = this.get("container");
if (is_string_default(containerDOM)) {
containerDOM = document.getElementById(containerDOM);
}
var viewport = createDom("\n
");
var x6 = 0;
var y5 = 0;
var dragging = false;
var left2 = 0;
var top = 0;
var width2 = 0;
var height = 0;
var ratio = 0;
var zoom2 = 0;
containerDOM.addEventListener("mousedown", function(e4) {
cfgs.refresh = false;
if (e4.target !== viewport) {
return;
}
var style = viewport.style;
width2 = parseInt(style.width, 10);
height = parseInt(style.height, 10);
var cWidth = _this.get("width");
var cHeight = _this.get("height");
if (width2 > cWidth || height > cHeight) {
return;
}
zoom2 = graph.getZoom();
ratio = _this.get("ratio");
dragging = true;
x6 = e4.clientX;
y5 = e4.clientY;
}, false);
containerDOM.addEventListener("mousemove", function(e4) {
if (!dragging || is_nil_default(e4.clientX) || is_nil_default(e4.clientY)) {
return;
}
var cWidth = _this.get("width");
var cHeight = _this.get("height");
var style = viewport.style;
left2 = parseInt(style.left, 10);
top = parseInt(style.top, 10);
width2 = parseInt(style.width, 10);
height = parseInt(style.height, 10);
var dx = x6 - e4.clientX;
var dy = y5 - e4.clientY;
if (left2 - dx < 0) {
dx = left2;
} else if (left2 - dx + width2 >= cWidth) {
dx = 0;
}
if (top - dy < 0) {
dy = top;
} else if (top - dy + height >= cHeight) {
dy = 0;
}
left2 -= dx;
top -= dy;
modifyCSS(viewport, {
left: left2 + "px",
top: top + "px"
});
graph.translate(dx * zoom2 / ratio, dy * zoom2 / ratio);
x6 = e4.clientX;
y5 = e4.clientY;
}, false);
containerDOM.addEventListener("mouseleave", function() {
dragging = false;
cfgs.refresh = true;
}, false);
containerDOM.addEventListener("mouseup", function() {
dragging = false;
cfgs.refresh = true;
}, false);
this.set("viewport", viewport);
containerDOM.appendChild(viewport);
};
ImageMiniMap2.prototype.updateViewport = function() {
if (this.destroyed)
return;
var ratio = this.get("ratio");
var cWidth = this.get("width");
var cHeight = this.get("height");
var graph = this.get("graph");
var graphWidth2 = graph.get("width");
var graphHeight2 = graph.get("height");
var aspectRatio = graphWidth2 / graphHeight2;
var graphGroup = graph.getGroup();
var graphCanvasBBox = graphGroup.getCanvasBBox();
var graphCanvasBBoxMean = [(graphCanvasBBox.minX + graphCanvasBBox.maxX) / 2, (graphCanvasBBox.minY + graphCanvasBBox.maxY) / 2];
var graphCanvasBBoxSize = [graphCanvasBBox.maxX - graphCanvasBBox.minX, graphCanvasBBox.maxY - graphCanvasBBox.minY];
var expandedGraphCanvasBBox = {
centerX: graphCanvasBBoxMean[0],
centerY: graphCanvasBBoxMean[1],
width: 0,
height: 0,
minX: 0,
minY: 0
};
if (graphCanvasBBox[0] / graphCanvasBBox[1] > aspectRatio) {
expandedGraphCanvasBBox.width = graphCanvasBBoxSize[0];
expandedGraphCanvasBBox.height = expandedGraphCanvasBBox.width / aspectRatio;
} else {
expandedGraphCanvasBBox.height = graphCanvasBBoxSize[1];
expandedGraphCanvasBBox.width = expandedGraphCanvasBBox.height * aspectRatio;
}
expandedGraphCanvasBBox.minX = graphCanvasBBoxMean[0] - expandedGraphCanvasBBox.width / 2;
expandedGraphCanvasBBox.minY = graphCanvasBBoxMean[1] - expandedGraphCanvasBBox.height / 2;
var graphMatrix = graphGroup.getMatrix();
if (!graphMatrix)
graphMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
var invertGraphMatrix = mat3_exports.invert([1, 0, 0, 0, 1, 0, 0, 0, 1], graphMatrix);
var minXY = applyMatrix3({
x: expandedGraphCanvasBBox.minX,
y: expandedGraphCanvasBBox.minY
}, invertGraphMatrix);
var topLeft = graph.getCanvasByPoint(minXY.x, minXY.y);
var viewport = this.get("viewport");
if (!viewport) {
this.initViewport();
}
var vpToMc = graphWidth2 / expandedGraphCanvasBBox.width;
var width2 = vpToMc * cWidth;
var height = vpToMc * cHeight;
var left2 = cWidth * -topLeft.x / expandedGraphCanvasBBox.width;
var top = cHeight * -topLeft.y / expandedGraphCanvasBBox.height;
var right2 = left2 + width2;
var bottom = top + height;
if (left2 < 0) {
width2 += left2;
left2 = 0;
}
if (right2 > cWidth) {
width2 = width2 - (right2 - cWidth);
}
if (top < 0) {
height += top;
top = 0;
}
if (bottom > cHeight) {
height = height - (bottom - cHeight);
}
this.set("ratio", ratio);
var correctLeft = left2 + "px";
var correctTop = top + "px";
modifyCSS(viewport, {
left: correctLeft,
top: correctTop,
width: width2 + "px",
height: height + "px"
});
};
ImageMiniMap2.prototype.init = function() {
this.initContainer();
};
ImageMiniMap2.prototype.initContainer = function() {
var self2 = this;
var graph = self2.get("graph");
var graphWidth2 = graph.get("width");
var graphHeight2 = graph.get("height");
var aspectRatio = graphHeight2 / graphWidth2;
var className = self2.get("className");
var parentNode = self2.get("container");
var cWidth = self2.get("width");
var cHeight = self2.get("height");
if (!cWidth && !cHeight) {
cWidth = 200;
}
if (cWidth) {
cHeight = aspectRatio * cWidth;
self2.set("height", cHeight);
} else {
cWidth = 1 / aspectRatio * cHeight;
self2.set("width", cWidth);
}
var container2 = createDom("");
if (is_string_default(parentNode)) {
parentNode = document.getElementById(parentNode);
}
if (parentNode) {
parentNode.appendChild(container2);
} else {
graph.get("container").appendChild(container2);
}
self2.set("container", container2);
var containerDOM = createDom('');
container2.appendChild(containerDOM);
var span = createDom('');
containerDOM.appendChild(span);
self2.set("containerDOM", containerDOM);
self2.set("containerSpan", span);
var img = createDom('');
self2.set("imgDOM", img);
self2.updateImgSize();
span.appendChild(img);
self2.updateCanvas();
};
ImageMiniMap2.prototype.updateImgSize = function() {
var self2 = this;
var imgDOM = self2.get("imgDOM");
var cWidth = self2.get("width");
var cHeight = self2.get("height");
imgDOM.onload = function() {
var naturalSize = getImgNaturalDimension(imgDOM);
if (naturalSize[0] > naturalSize[1]) {
imgDOM.width = cWidth;
} else {
imgDOM.height = cHeight;
}
};
};
ImageMiniMap2.prototype.updateCanvas = function() {
var isRefresh = this.get("refresh");
if (!isRefresh) {
return;
}
var graph = this.get("graph");
if (graph.get("destroyed")) {
return;
}
if (this.get("viewportChange")) {
this.set("viewportChange", false);
this.updateViewport();
}
var cWidth = this.get("width");
var graphBBox = graph.get("canvas").getCanvasBBox();
var width2 = graphBBox.width;
var ratio = cWidth / width2;
this.set("ratio", ratio);
this.updateViewport();
};
ImageMiniMap2.prototype.getViewport = function() {
return this.get("viewport");
};
ImageMiniMap2.prototype.getContainer = function() {
return this.get("container");
};
ImageMiniMap2.prototype.updateGraphImg = function(img) {
var self2 = this;
var oriImgDOM = self2.get("imgDOM");
oriImgDOM.remove();
self2.set("graphImg", img);
var imgDOM = createDom('');
self2.set("imgDOM", imgDOM);
imgDOM.src = img;
self2.updateImgSize();
var span = self2.get("containerSpan");
span.appendChild(imgDOM);
self2.updateCanvas();
};
ImageMiniMap2.prototype.destroy = function() {
var container2 = this.get("container");
container2.parentNode.removeChild(container2);
};
return ImageMiniMap2;
}(base_default18);
var imageMinimap_default = ImageMiniMap;
// node_modules/@antv/g6-plugin/es/edgeFilterLens/index.js
var __extends14 = function() {
var _extendStatics = function extendStatics(d3, b10) {
_extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(d4, b11) {
d4.__proto__ = b11;
} || function(d4, b11) {
for (var p4 in b11) {
if (Object.prototype.hasOwnProperty.call(b11, p4))
d4[p4] = b11[p4];
}
};
return _extendStatics(d3, b10);
};
return function(d3, b10) {
if (typeof b10 !== "function" && b10 !== null)
throw new TypeError("Class extends value " + String(b10) + " is not a constructor or null");
_extendStatics(d3, b10);
function __() {
this.constructor = d3;
}
d3.prototype = b10 === null ? Object.create(b10) : (__.prototype = b10.prototype, new __());
};
}();
var __assign15 = function() {
__assign15 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4) {
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
}
return t4;
};
return __assign15.apply(this, arguments);
};
var distance12 = util_default.distance;
var DELTA3 = 0.05;
var lensDelegateStyle2 = {
stroke: "#000",
strokeOpacity: 0.8,
lineWidth: 2,
fillOpacity: 1,
fill: "#fff"
};
var EdgeFilterLens = function(_super) {
__extends14(EdgeFilterLens3, _super);
function EdgeFilterLens3() {
return _super !== null && _super.apply(this, arguments) || this;
}
EdgeFilterLens3.prototype.getDefaultCfgs = function() {
return {
type: "both",
trigger: "mousemove",
r: 60,
delegateStyle: clone_default(lensDelegateStyle2),
showLabel: "edge",
scaleRBy: "wheel"
};
};
EdgeFilterLens3.prototype.getEvents = function() {
var events;
switch (this.get("trigger")) {
case "click":
events = {
click: "filter"
};
break;
case "drag":
events = {
click: "createDelegate"
};
break;
default:
events = {
mousemove: "filter"
};
break;
}
return events;
};
EdgeFilterLens3.prototype.init = function() {
var self2 = this;
var showLabel = self2.get("showLabel");
var showNodeLabel = showLabel === "node" || showLabel === "both";
var showEdgeLabel = showLabel === "edge" || showLabel === "both";
self2.set("showNodeLabel", showNodeLabel);
self2.set("showEdgeLabel", showEdgeLabel);
var shouldShow = self2.get("shouldShow");
if (!shouldShow)
self2.set("shouldShow", function() {
return true;
});
};
EdgeFilterLens3.prototype.createDelegate = function(e4) {
var self2 = this;
var lensDelegate = self2.get("delegate");
if (!lensDelegate || lensDelegate.destroyed) {
self2.filter(e4);
lensDelegate = self2.get("delegate");
lensDelegate.on("dragstart", function(evt) {
});
lensDelegate.on("drag", function(evt) {
self2.filter(evt);
});
if (this.get("scaleRBy") === "wheel") {
lensDelegate.on("mousewheel", function(evt) {
self2.scaleRByWheel(evt);
});
}
}
};
EdgeFilterLens3.prototype.scaleRByWheel = function(e4) {
var self2 = this;
if (!e4 || !e4.originalEvent)
return;
if (e4.preventDefault)
e4.preventDefault();
var graph = self2.get("graph");
var ratio;
var lensDelegate = self2.get("delegate");
var lensCenter = lensDelegate ? {
x: lensDelegate.attr("x"),
y: lensDelegate.attr("y")
} : void 0;
var mousePos = lensCenter || graph.getPointByClient(e4.clientX, e4.clientY);
if (e4.originalEvent.wheelDelta < 0) {
ratio = 1 - DELTA3;
} else {
ratio = 1 / (1 - DELTA3);
}
var maxR = self2.get("maxR");
var minR = self2.get("minR");
var r4 = self2.get("r");
if (r4 > (maxR || graph.get("height")) && ratio > 1 || r4 < (minR || graph.get("height") * 0.05) && ratio < 1) {
ratio = 1;
}
r4 *= ratio;
self2.set("r", r4);
self2.filter(e4);
};
EdgeFilterLens3.prototype.filter = function(e4) {
var self2 = this;
var graph = self2.get("graph");
var nodes = graph.getNodes();
var hitNodesMap = {};
var r4 = self2.get("r");
var type2 = self2.get("type");
var fCenter = {
x: e4.x,
y: e4.y
};
self2.updateDelegate(fCenter, r4);
var shouldShow = self2.get("shouldShow");
var vShapes = self2.get("vShapes");
if (vShapes) {
vShapes.forEach(function(shape) {
shape.remove();
shape.destroy();
});
}
vShapes = [];
nodes.forEach(function(node) {
var model = node.getModel();
var x6 = model.x, y5 = model.y;
if (distance12({
x: x6,
y: y5
}, fCenter) < r4) {
hitNodesMap[model.id] = node;
}
});
var edges = graph.getEdges();
var hitEdges = [];
edges.forEach(function(edge2) {
var model = edge2.getModel();
var sourceId = model.source;
var targetId = model.target;
if (shouldShow(model)) {
if (type2 === "only-source" || type2 === "one") {
if (hitNodesMap[sourceId] && !hitNodesMap[targetId])
hitEdges.push(edge2);
} else if (type2 === "only-target" || type2 === "one") {
if (hitNodesMap[targetId] && !hitNodesMap[sourceId])
hitEdges.push(edge2);
} else if (type2 === "both" && hitNodesMap[sourceId] && hitNodesMap[targetId]) {
hitEdges.push(edge2);
}
}
});
var showNodeLabel = self2.get("showNodeLabel");
var showEdgeLabel = self2.get("showEdgelabel");
var group2 = graph.get("group");
hitEdges.forEach(function(edge2) {
var shapes = edge2.get("group").get("children");
shapes.forEach(function(shape) {
var shapeType = shape.get("type");
var vShape = group2.addShape(shapeType, {
attrs: shape.attr()
});
vShapes.push(vShape);
if (showNodeLabel && shapeType === "text") {
vShape.set("visible", true);
}
});
});
Object.keys(hitNodesMap).forEach(function(key) {
var node = hitNodesMap[key];
var clonedGroup = node.get("group").clone();
group2.add(clonedGroup);
vShapes.push(clonedGroup);
if (showEdgeLabel) {
var shapes = clonedGroup.get("children");
for (var j4 = 0; j4 < shapes.length; j4++) {
var shape = shapes[j4];
if (shape.get("type") === "text") {
shape.set("visible", true);
}
}
}
});
self2.set("vShapes", vShapes);
};
EdgeFilterLens3.prototype.updateParams = function(cfg) {
var self2 = this;
var r4 = cfg.r, trigger = cfg.trigger, minR = cfg.minR, maxR = cfg.maxR, scaleRBy = cfg.scaleRBy, showLabel = cfg.showLabel, shouldShow = cfg.shouldShow;
if (!isNaN(cfg.r)) {
self2.set("r", r4);
}
if (!isNaN(maxR)) {
self2.set("maxR", maxR);
}
if (!isNaN(minR)) {
self2.set("minR", minR);
}
if (trigger === "mousemove" || trigger === "click") {
self2.set("trigger", trigger);
}
if (scaleRBy === "wheel" || scaleRBy === "unset") {
self2.set("scaleRBy", scaleRBy);
self2.get("delegate").remove();
self2.get("delegate").destroy();
var dPercentText = self2.get("dPercentText");
if (dPercentText) {
dPercentText.remove();
dPercentText.destroy();
}
}
if (showLabel === "node" || showLabel === "both") {
self2.set("showNodeLabel", true);
}
if (showLabel === "edge" || showLabel === "both") {
self2.set("showEdgeLabel", true);
}
if (shouldShow) {
self2.set("shouldShow", shouldShow);
}
};
EdgeFilterLens3.prototype.updateDelegate = function(mCenter, r4) {
var self2 = this;
var graph = self2.get("graph");
var lensDelegate = self2.get("delegate");
if (!lensDelegate || lensDelegate.destroyed) {
var parent_1 = graph.get("group");
var attrs = self2.get("delegateStyle") || lensDelegateStyle2;
lensDelegate = parent_1.addShape("circle", {
attrs: __assign15({
r: r4,
x: mCenter.x,
y: mCenter.y
}, attrs),
name: "lens-shape",
draggable: true
});
if (this.get("trigger") !== "drag") {
if (this.get("scaleRBy") === "wheel") {
lensDelegate.on("mousewheel", function(evt) {
self2.scaleRByWheel(evt);
});
}
}
} else {
lensDelegate.attr({
x: mCenter.x,
y: mCenter.y,
r: r4
});
}
self2.set("delegate", lensDelegate);
};
EdgeFilterLens3.prototype.clear = function() {
var self2 = this;
var vShapes = self2.get("vShapes");
if (vShapes) {
vShapes.forEach(function(shape) {
shape.remove();
shape.destroy();
});
}
vShapes = [];
self2.set("vShapes", vShapes);
var lensDelegate = self2.get("delegate");
if (lensDelegate && !lensDelegate.destroyed) {
lensDelegate.remove();
lensDelegate.destroy();
}
};
EdgeFilterLens3.prototype.destroy = function() {
this.clear();
};
return EdgeFilterLens3;
}(base_default18);
var edgeFilterLens_default = EdgeFilterLens;
// node_modules/@antv/g6-plugin/es/index.js
var Plugin = {
PluginBase: base_default18,
Menu: menu_default,
Grid: grid_default,
Minimap: minimap_default,
Bundling: bundling_default,
ToolBar: toolBar_default,
Tooltip: tooltip_default2,
Fisheye: fisheye_default,
TimeBar: timeBar_default,
ImageMinimap: imageMinimap_default,
EdgeFilterLens: edgeFilterLens_default
};
var es_default3 = Plugin;
// node_modules/@antv/g6-pc/es/plugin/index.js
var plugin_default = es_default3;
// node_modules/@antv/g6-element/es/nodes/circle.js
registerNode("circle", {
options: {
size: BaseGlobal.defaultNode.size,
style: {
x: 0,
y: 0,
stroke: BaseGlobal.defaultNode.style.stroke,
fill: BaseGlobal.defaultNode.style.fill,
lineWidth: BaseGlobal.defaultNode.style.lineWidth
},
labelCfg: {
style: {
fill: BaseGlobal.nodeLabel.style.fill,
fontSize: BaseGlobal.nodeLabel.style.fontSize
}
},
linkPoints: {
top: false,
right: false,
bottom: false,
left: false,
size: BaseGlobal.defaultNode.linkPoints.size,
lineWidth: BaseGlobal.defaultNode.linkPoints.lineWidth,
fill: BaseGlobal.defaultNode.linkPoints.fill,
stroke: BaseGlobal.defaultNode.linkPoints.stroke
},
icon: {
show: false,
img: "https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",
width: 20,
height: 20
},
stateStyles: __assign({}, BaseGlobal.nodeStateStyles)
},
shapeType: "circle",
labelPosition: "center",
drawShape: function drawShape11(cfg, group2) {
var _a6 = this.getOptions(cfg).icon, defaultIcon = _a6 === void 0 ? {} : _a6;
var style = this.getShapeStyle(cfg);
var icon = deep_mix_default({}, defaultIcon, cfg.icon);
var keyShape = group2.addShape("circle", {
attrs: style,
className: this.type + "-keyShape",
draggable: true
});
var width2 = icon.width, height = icon.height, show = icon.show;
if (show) {
group2.addShape("image", {
attrs: __assign({
x: -width2 / 2,
y: -height / 2
}, icon),
className: this.type + "-icon",
name: this.type + "-icon",
draggable: true
});
}
this.drawLinkPoints(cfg, group2);
return keyShape;
},
drawLinkPoints: function drawLinkPoints(cfg, group2) {
var _a6 = this.getOptions(cfg).linkPoints, linkPoints = _a6 === void 0 ? {} : _a6;
var top = linkPoints.top, left2 = linkPoints.left, right2 = linkPoints.right, bottom = linkPoints.bottom, markSize = linkPoints.size, markR = linkPoints.r, markStyle = __rest(linkPoints, ["top", "left", "right", "bottom", "size", "r"]);
var size2 = this.getSize(cfg);
var r4 = size2[0] / 2;
if (left2) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: -r4,
y: 0,
r: markSize / 2 || markR || 5
}),
className: "link-point-left",
name: "link-point-left",
isAnchorPoint: true
});
}
if (right2) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: r4,
y: 0,
r: markSize / 2 || markR || 5
}),
className: "link-point-right",
name: "link-point-right",
isAnchorPoint: true
});
}
if (top) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: 0,
y: -r4,
r: markSize / 2 || markR || 5
}),
className: "link-point-top",
name: "link-point-top",
isAnchorPoint: true
});
}
if (bottom) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: 0,
y: r4,
r: markSize / 2 || markR || 5
}),
className: "link-point-bottom",
name: "link-point-bottom",
isAnchorPoint: true
});
}
},
getShapeStyle: function getShapeStyle8(cfg) {
var defaultStyle = this.getOptions(cfg).style;
var strokeStyle = {
stroke: cfg.color
};
var style = deep_mix_default({}, defaultStyle, strokeStyle);
var size2 = this.getSize(cfg);
var r4 = size2[0] / 2;
var styles = __assign({
x: 0,
y: 0,
r: r4
}, style);
return styles;
},
update: function update7(cfg, item) {
var group2 = item.getContainer();
var size2 = this.getSize(cfg);
var strokeStyle = {
stroke: cfg.color,
r: size2[0] / 2
};
var keyShape = item.get("keyShape");
var style = deep_mix_default({}, keyShape.attr(), strokeStyle, cfg.style);
this.updateShape(cfg, item, style, true);
this.updateLinkPoints(cfg, group2);
}
}, "single-node");
// node_modules/@antv/g6-element/es/nodes/rect.js
registerNode("rect", {
options: {
size: [100, 30],
style: {
radius: 0,
stroke: BaseGlobal.defaultNode.style.stroke,
fill: BaseGlobal.defaultNode.style.fill,
lineWidth: BaseGlobal.defaultNode.style.lineWidth
},
labelCfg: {
style: {
fill: BaseGlobal.nodeLabel.style.fill,
fontSize: BaseGlobal.nodeLabel.style.fontSize
}
},
linkPoints: {
top: false,
right: false,
bottom: false,
left: false,
size: BaseGlobal.defaultNode.linkPoints.size,
lineWidth: BaseGlobal.defaultNode.linkPoints.lineWidth,
fill: BaseGlobal.defaultNode.linkPoints.fill,
stroke: BaseGlobal.defaultNode.linkPoints.stroke
},
icon: {
show: false,
img: "https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",
width: 20,
height: 20
},
anchorPoints: [[0, 0.5], [1, 0.5]],
stateStyles: __assign({}, BaseGlobal.nodeStateStyles)
},
shapeType: "rect",
labelPosition: "center",
drawShape: function drawShape12(cfg, group2) {
var style = this.getShapeStyle(cfg);
var keyShape = group2.addShape("rect", {
attrs: style,
className: this.type + "-keyShape",
name: this.type + "-keyShape",
draggable: true
});
this.drawLinkPoints(cfg, group2);
return keyShape;
},
drawLinkPoints: function drawLinkPoints2(cfg, group2) {
var _a6 = this.getOptions(cfg).linkPoints, linkPoints = _a6 === void 0 ? {} : _a6;
var top = linkPoints.top, left2 = linkPoints.left, right2 = linkPoints.right, bottom = linkPoints.bottom, markSize = linkPoints.size, markR = linkPoints.r, markStyle = __rest(linkPoints, ["top", "left", "right", "bottom", "size", "r"]);
var size2 = this.getSize(cfg);
var width2 = size2[0];
var height = size2[1];
if (left2) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: -width2 / 2,
y: 0,
r: markSize / 2 || markR || 5
}),
className: "link-point-left",
name: "link-point-left",
isAnchorPoint: true
});
}
if (right2) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: width2 / 2,
y: 0,
r: markSize / 2 || markR || 5
}),
className: "link-point-right",
name: "link-point-right",
isAnchorPoint: true
});
}
if (top) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: 0,
y: -height / 2,
r: markSize / 2 || markR || 5
}),
className: "link-point-top",
name: "link-point-top",
isAnchorPoint: true
});
}
if (bottom) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: 0,
y: height / 2,
r: markSize / 2 || markR || 5
}),
className: "link-point-bottom",
name: "link-point-bottom",
isAnchorPoint: true
});
}
},
getShapeStyle: function getShapeStyle9(cfg) {
var defaultStyle = this.getOptions(cfg).style;
var strokeStyle = {
stroke: cfg.color
};
var style = mix({}, defaultStyle, strokeStyle);
var size2 = this.getSize(cfg);
var width2 = style.width || size2[0];
var height = style.height || size2[1];
var styles = __assign({
x: -width2 / 2,
y: -height / 2,
width: width2,
height
}, style);
return styles;
},
update: function update8(cfg, item) {
var group2 = item.getContainer();
var defaultStyle = this.getOptions({}).style;
var size2 = this.getSize(cfg);
var keyShape = item.get("keyShape");
if (!cfg.size) {
size2[0] = keyShape.attr("width") || defaultStyle.width;
size2[1] = keyShape.attr("height") || defaultStyle.height;
}
var strokeStyle = {
stroke: cfg.color,
x: -size2[0] / 2,
y: -size2[1] / 2,
width: size2[0],
height: size2[1]
};
var style = mix({}, defaultStyle, keyShape.attr(), strokeStyle);
style = mix(style, cfg.style);
this.updateShape(cfg, item, style, false);
this.updateLinkPoints(cfg, group2);
}
}, "single-node");
// node_modules/@antv/g6-element/es/nodes/ellipse.js
registerNode("ellipse", {
options: {
size: [80, 40],
style: {
x: 0,
y: 0,
stroke: BaseGlobal.defaultNode.style.stroke,
fill: BaseGlobal.defaultNode.style.fill,
lineWidth: BaseGlobal.defaultNode.style.lineWidth
},
labelCfg: {
style: {
fill: BaseGlobal.nodeLabel.style.fill,
fontSize: BaseGlobal.nodeLabel.style.fontSize
}
},
linkPoints: {
top: false,
right: false,
bottom: false,
left: false,
size: BaseGlobal.defaultNode.linkPoints.size,
lineWidth: BaseGlobal.defaultNode.linkPoints.lineWidth,
fill: BaseGlobal.defaultNode.linkPoints.fill,
stroke: BaseGlobal.defaultNode.linkPoints.stroke
},
icon: {
show: false,
img: "https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",
width: 20,
height: 20
},
stateStyles: __assign({}, BaseGlobal.nodeStateStyles)
},
shapeType: "ellipse",
labelPosition: "center",
drawShape: function drawShape13(cfg, group2) {
var _a6 = this.getOptions(cfg).icon, icon = _a6 === void 0 ? {} : _a6;
var style = this.getShapeStyle(cfg);
var keyShape = group2.addShape("ellipse", {
attrs: style,
className: "ellipse-keyShape",
name: "ellipse-keyShape",
draggable: true
});
var width2 = icon.width, height = icon.height, show = icon.show;
if (show) {
var image = group2.addShape("image", {
attrs: __assign({
x: -width2 / 2,
y: -height / 2
}, icon),
className: this.type + "-icon",
name: this.type + "-icon",
draggable: true
});
}
this.drawLinkPoints(cfg, group2);
return keyShape;
},
drawLinkPoints: function drawLinkPoints3(cfg, group2) {
var _a6 = this.getOptions(cfg).linkPoints, linkPoints = _a6 === void 0 ? {} : _a6;
var top = linkPoints.top, left2 = linkPoints.left, right2 = linkPoints.right, bottom = linkPoints.bottom, markSize = linkPoints.size, markR = linkPoints.r, markStyle = __rest(linkPoints, ["top", "left", "right", "bottom", "size", "r"]);
var size2 = this.getSize(cfg);
var rx = size2[0] / 2;
var ry = size2[1] / 2;
if (left2) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: -rx,
y: 0,
r: markSize / 2 || markR || 5
}),
className: "link-point-left",
name: "link-point-left",
isAnchorPoint: true
});
}
if (right2) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: rx,
y: 0,
r: markSize / 2 || markR || 5
}),
className: "link-point-right",
name: "link-point-right",
isAnchorPoint: true
});
}
if (top) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: 0,
y: -ry,
r: markSize / 2 || markR || 5
}),
className: "link-point-top",
name: "link-point-top",
isAnchorPoint: true
});
}
if (bottom) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: 0,
y: ry,
r: markSize / 2 || markR || 5
}),
className: "link-point-bottom",
name: "link-point-bottom",
isAnchorPoint: true
});
}
},
getShapeStyle: function getShapeStyle10(cfg) {
var defaultStyle = this.getOptions(cfg).style;
var strokeStyle = {
stroke: cfg.color
};
var style = mix({}, defaultStyle, strokeStyle);
var size2 = this.getSize(cfg);
var rx = size2[0] / 2;
var ry = size2[1] / 2;
var styles = __assign({
x: 0,
y: 0,
rx,
ry
}, style);
return styles;
},
update: function update9(cfg, item) {
var group2 = item.getContainer();
var defaultStyle = this.getOptions({}).style;
var size2 = this.getSize(cfg);
var strokeStyle = {
stroke: cfg.color,
rx: size2[0] / 2,
ry: size2[1] / 2
};
var keyShape = item.get("keyShape");
var style = mix({}, defaultStyle, keyShape.attr(), strokeStyle);
style = mix(style, cfg.style);
this.updateShape(cfg, item, style, true);
this.updateLinkPoints(cfg, group2);
}
}, "single-node");
// node_modules/@antv/g6-element/es/nodes/diamond.js
registerNode("diamond", {
options: {
size: [80, 80],
style: {
stroke: BaseGlobal.defaultNode.style.stroke,
fill: BaseGlobal.defaultNode.style.fill,
lineWidth: BaseGlobal.defaultNode.style.lineWidth
},
labelCfg: {
style: {
fill: BaseGlobal.nodeLabel.style.fill,
fontSize: BaseGlobal.nodeLabel.style.fontSize
}
},
linkPoints: {
top: false,
right: false,
bottom: false,
left: false,
size: BaseGlobal.defaultNode.linkPoints.size,
lineWidth: BaseGlobal.defaultNode.linkPoints.lineWidth,
fill: BaseGlobal.defaultNode.linkPoints.fill,
stroke: BaseGlobal.defaultNode.linkPoints.stroke
},
icon: {
show: false,
img: "https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",
width: 20,
height: 20
},
stateStyles: __assign({}, BaseGlobal.nodeStateStyles)
},
shapeType: "diamond",
labelPosition: "center",
drawShape: function drawShape14(cfg, group2) {
var _a6 = this.getOptions(cfg).icon, icon = _a6 === void 0 ? {} : _a6;
var style = this.getShapeStyle(cfg);
var keyShape = group2.addShape("path", {
attrs: style,
className: this.type + "-keyShape",
name: this.type + "-keyShape",
draggable: true
});
var w4 = icon.width, h3 = icon.height, show = icon.show;
if (show) {
var image = group2.addShape("image", {
attrs: __assign({
x: -w4 / 2,
y: -h3 / 2
}, icon),
className: this.type + "-icon",
name: this.type + "-icon",
draggable: true
});
}
this.drawLinkPoints(cfg, group2);
return keyShape;
},
drawLinkPoints: function drawLinkPoints4(cfg, group2) {
var _a6 = this.getOptions(cfg).linkPoints, linkPoints = _a6 === void 0 ? {} : _a6;
var top = linkPoints.top, left2 = linkPoints.left, right2 = linkPoints.right, bottom = linkPoints.bottom, markSize = linkPoints.size, markR = linkPoints.r, markStyle = __rest(linkPoints, ["top", "left", "right", "bottom", "size", "r"]);
var size2 = this.getSize(cfg);
var width2 = size2[0];
var height = size2[1];
if (left2) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: -width2 / 2,
y: 0,
r: markSize / 2 || markR || 5
}),
className: "link-point-left",
name: "link-point-left",
isAnchorPoint: true
});
}
if (right2) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: width2 / 2,
y: 0,
r: markSize / 2 || markR || 5
}),
className: "link-point-right",
name: "link-point-right",
isAnchorPoint: true
});
}
if (top) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: 0,
y: -height / 2,
r: markSize / 2 || markR || 5
}),
className: "link-point-top",
name: "link-point-top",
isAnchorPoint: true
});
}
if (bottom) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: 0,
y: height / 2,
r: markSize / 2 || markR || 5
}),
className: "link-point-bottom",
name: "link-point-bottom",
isAnchorPoint: true
});
}
},
getPath: function getPath10(cfg) {
var size2 = this.getSize(cfg);
var width2 = size2[0];
var height = size2[1];
var path = [
["M", 0, -height / 2],
["L", width2 / 2, 0],
["L", 0, height / 2],
["L", -width2 / 2, 0],
["Z"]
];
return path;
},
getShapeStyle: function getShapeStyle11(cfg) {
var defaultStyle = this.getOptions(cfg).style;
var strokeStyle = {
stroke: cfg.color
};
var style = mix({}, defaultStyle, strokeStyle);
var path = this.getPath(cfg);
var styles = __assign({
path
}, style);
return styles;
},
update: function update10(cfg, item) {
var group2 = item.getContainer();
var defaultStyle = this.getOptions({}).style;
var path = this.getPath(cfg);
var strokeStyle = {
stroke: cfg.color,
path
};
var keyShape = item.get("keyShape");
var style = mix({}, defaultStyle, keyShape.attr(), strokeStyle);
style = mix(style, cfg.style);
this.updateShape(cfg, item, style, true);
this.updateLinkPoints(cfg, group2);
}
}, "single-node");
// node_modules/@antv/g6-element/es/nodes/triangle.js
registerNode("triangle", {
options: {
size: 40,
direction: "up",
style: {
stroke: BaseGlobal.defaultNode.style.stroke,
fill: BaseGlobal.defaultNode.style.fill,
lineWidth: BaseGlobal.defaultNode.style.lineWidth
},
labelCfg: {
style: {
fill: BaseGlobal.nodeLabel.style.fill,
fontSize: BaseGlobal.nodeLabel.style.fontSize
},
offset: 15
},
linkPoints: {
top: false,
right: false,
bottom: false,
left: false,
size: BaseGlobal.defaultNode.linkPoints.size,
lineWidth: BaseGlobal.defaultNode.linkPoints.lineWidth,
fill: BaseGlobal.defaultNode.linkPoints.fill,
stroke: BaseGlobal.defaultNode.linkPoints.stroke
},
icon: {
show: false,
img: "https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",
width: 20,
height: 20,
offset: 6
},
stateStyles: __assign({}, BaseGlobal.nodeStateStyles)
},
shapeType: "triangle",
labelPosition: "bottom",
drawShape: function drawShape15(cfg, group2) {
var _a6 = this.getOptions(cfg), _b = _a6.icon, icon = _b === void 0 ? {} : _b, defaultDirection = _a6.direction;
var style = this.getShapeStyle(cfg);
var direction5 = cfg.direction || defaultDirection;
var keyShape = group2.addShape("path", {
attrs: style,
className: this.type + "-keyShape",
name: this.type + "-keyShape",
draggable: true
});
var w4 = icon.width, h3 = icon.height, show = icon.show, offset = icon.offset;
if (show) {
var iconW = -w4 / 2;
var iconH = -h3 / 2;
if (direction5 === "up" || direction5 === "down") {
iconH += offset;
}
if (direction5 === "left" || direction5 === "right") {
iconW += offset;
}
group2.addShape("image", {
attrs: __assign({
x: iconW,
y: iconH
}, icon),
className: this.type + "-icon",
name: this.type + "-icon",
draggable: true
});
}
this.drawLinkPoints(cfg, group2);
return keyShape;
},
drawLinkPoints: function drawLinkPoints5(cfg, group2) {
var _a6 = this.getOptions(cfg), _b = _a6.linkPoints, linkPoints = _b === void 0 ? {} : _b, defaultDirection = _a6.direction;
var direction5 = cfg.direction || defaultDirection;
var top = linkPoints.top, left2 = linkPoints.left, right2 = linkPoints.right, bottom = linkPoints.bottom, markSize = linkPoints.size, markR = linkPoints.r, markStyle = __rest(linkPoints, ["top", "left", "right", "bottom", "size", "r"]);
var size2 = this.getSize(cfg);
var len5 = size2[0];
if (left2) {
var leftPos = null;
var diffY = len5 * Math.sin(1 / 3 * Math.PI);
var r4 = len5 * Math.sin(1 / 3 * Math.PI);
if (direction5 === "up") {
leftPos = [-r4, diffY];
} else if (direction5 === "down") {
leftPos = [-r4, -diffY];
} else if (direction5 === "left") {
leftPos = [-r4, r4 - diffY];
}
if (leftPos) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: leftPos[0],
y: leftPos[1],
r: markSize / 2 || markR || 5
}),
className: "link-point-left",
name: "link-point-left"
});
}
}
if (right2) {
var rightPos = null;
var diffY = len5 * Math.sin(1 / 3 * Math.PI);
var r4 = len5 * Math.sin(1 / 3 * Math.PI);
if (direction5 === "up") {
rightPos = [r4, diffY];
} else if (direction5 === "down") {
rightPos = [r4, -diffY];
} else if (direction5 === "right") {
rightPos = [r4, r4 - diffY];
}
if (rightPos) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: rightPos[0],
y: rightPos[1],
r: markSize / 2 || markR || 5
}),
className: "link-point-right",
name: "link-point-right"
});
}
}
if (top) {
var topPos = null;
var diffY = len5 * Math.sin(1 / 3 * Math.PI);
var r4 = len5 * Math.sin(1 / 3 * Math.PI);
if (direction5 === "up") {
topPos = [r4 - diffY, -diffY];
} else if (direction5 === "left") {
topPos = [r4, -diffY];
} else if (direction5 === "right") {
topPos = [-r4, -diffY];
}
if (topPos) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: topPos[0],
y: topPos[1],
r: markSize / 2 || markR || 5
}),
className: "link-point-top",
name: "link-point-top"
});
}
}
if (bottom) {
var bottomPos = null;
var diffY = len5 * Math.sin(1 / 3 * Math.PI);
var r4 = len5 * Math.sin(1 / 3 * Math.PI);
if (direction5 === "down") {
bottomPos = [-r4 + diffY, diffY];
} else if (direction5 === "left") {
bottomPos = [r4, diffY];
} else if (direction5 === "right") {
bottomPos = [-r4, diffY];
}
if (bottomPos) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: bottomPos[0],
y: bottomPos[1],
r: markSize / 2 || markR || 5
}),
className: "link-point-bottom",
name: "link-point-bottom"
});
}
}
},
getPath: function getPath11(cfg) {
var defaultDirection = this.getOptions(cfg).direction;
var direction5 = cfg.direction || defaultDirection;
var size2 = this.getSize(cfg);
var len5 = size2[0];
var diffY = len5 * Math.sin(1 / 3 * Math.PI);
var r4 = len5 * Math.sin(1 / 3 * Math.PI);
var path = [
["M", -r4, diffY],
["L", 0, -diffY],
["L", r4, diffY],
["Z"]
];
if (direction5 === "down") {
path = [
["M", -r4, -diffY],
["L", r4, -diffY],
["L", 0, diffY],
["Z"]
];
} else if (direction5 === "left") {
path = [
["M", -r4, r4 - diffY],
["L", r4, -r4],
["L", r4, r4],
["Z"]
];
} else if (direction5 === "right") {
path = [
["M", r4, r4 - diffY],
["L", -r4, r4],
["L", -r4, -r4],
["Z"]
];
}
return path;
},
getShapeStyle: function getShapeStyle12(cfg) {
var defaultStyle = this.getOptions(cfg).style;
var strokeStyle = {
stroke: cfg.color
};
var style = mix({}, defaultStyle, strokeStyle);
var path = this.getPath(cfg);
var styles = __assign({
path
}, style);
return styles;
},
update: function update11(cfg, item) {
var group2 = item.getContainer();
var defaultStyle = this.getOptions({}).style;
var path = this.getPath(cfg);
var strokeStyle = {
stroke: cfg.color,
path
};
var keyShape = item.get("keyShape");
var style = mix({}, defaultStyle, keyShape.attr(), strokeStyle);
style = mix(style, cfg.style);
this.updateShape(cfg, item, style, true);
this.updateLinkPoints(cfg, group2);
},
updateLinkPoints: function updateLinkPoints2(cfg, group2) {
var _a6 = this.getOptions({}), defaultLinkPoints = _a6.linkPoints, defaultDirection = _a6.direction;
var direction5 = cfg.direction || defaultDirection;
var markLeft = group2.find(function(element) {
return element.get("className") === "link-point-left";
});
var markRight = group2.find(function(element) {
return element.get("className") === "link-point-right";
});
var markTop = group2.find(function(element) {
return element.get("className") === "link-point-top";
});
var markBottom = group2.find(function(element) {
return element.get("className") === "link-point-bottom";
});
var currentLinkPoints = defaultLinkPoints;
var existLinkPoint = markLeft || markRight || markTop || markBottom;
if (existLinkPoint) {
currentLinkPoints = existLinkPoint.attr();
}
var linkPoints = mix({}, currentLinkPoints, cfg.linkPoints);
var markFill = linkPoints.fill, markStroke = linkPoints.stroke, borderWidth = linkPoints.lineWidth;
var markSize = linkPoints.size / 2;
if (!markSize)
markSize = linkPoints.r;
var _b = cfg.linkPoints ? cfg.linkPoints : {
left: void 0,
right: void 0,
top: void 0,
bottom: void 0
}, left2 = _b.left, right2 = _b.right, top = _b.top, bottom = _b.bottom;
var size2 = this.getSize(cfg);
var len5 = size2[0];
var styles = {
r: markSize,
fill: markFill,
stroke: markStroke,
lineWidth: borderWidth
};
var leftPos = null;
var diffY = len5 * Math.sin(1 / 3 * Math.PI);
var r4 = len5 * Math.sin(1 / 3 * Math.PI);
if (direction5 === "up") {
leftPos = [-r4, diffY];
} else if (direction5 === "down") {
leftPos = [-r4, -diffY];
} else if (direction5 === "left") {
leftPos = [-r4, r4 - diffY];
}
if (leftPos) {
if (markLeft) {
if (!left2 && left2 !== void 0) {
markLeft.remove();
} else {
markLeft.attr(__assign(__assign({}, styles), {
x: leftPos[0],
y: leftPos[1]
}));
}
} else if (left2) {
group2.addShape("circle", {
attrs: __assign(__assign({}, styles), {
x: leftPos[0],
y: leftPos[1]
}),
className: "link-point-left",
name: "link-point-left",
isAnchorPoint: true
});
}
}
var rightPos = null;
if (direction5 === "up") {
rightPos = [r4, diffY];
} else if (direction5 === "down") {
rightPos = [r4, -diffY];
} else if (direction5 === "right") {
rightPos = [r4, r4 - diffY];
}
if (rightPos) {
if (markRight) {
if (!right2 && right2 !== void 0) {
markRight.remove();
} else {
markRight.attr(__assign(__assign({}, styles), {
x: rightPos[0],
y: rightPos[1]
}));
}
} else if (right2) {
group2.addShape("circle", {
attrs: __assign(__assign({}, styles), {
x: rightPos[0],
y: rightPos[1]
}),
className: "link-point-right",
name: "link-point-right",
isAnchorPoint: true
});
}
}
var topPos = null;
if (direction5 === "up") {
topPos = [r4 - diffY, -diffY];
} else if (direction5 === "left") {
topPos = [r4, -diffY];
} else if (direction5 === "right") {
topPos = [-r4, -diffY];
}
if (topPos) {
if (markTop) {
if (!top && top !== void 0) {
markTop.remove();
} else {
markTop.attr(__assign(__assign({}, styles), {
x: topPos[0],
y: topPos[1]
}));
}
} else if (top) {
group2.addShape("circle", {
attrs: __assign(__assign({}, styles), {
x: topPos[0],
y: topPos[1]
}),
className: "link-point-top",
name: "link-point-top",
isAnchorPoint: true
});
}
}
var bottomPos = null;
if (direction5 === "down") {
bottomPos = [-r4 + diffY, diffY];
} else if (direction5 === "left") {
bottomPos = [r4, diffY];
} else if (direction5 === "right") {
bottomPos = [-r4, diffY];
}
if (bottomPos) {
if (markBottom) {
if (!bottom && bottom !== void 0) {
markBottom.remove();
} else {
markBottom.attr(__assign(__assign({}, styles), {
x: bottomPos[0],
y: bottomPos[1]
}));
}
} else if (bottom) {
group2.addShape("circle", {
attrs: __assign(__assign({}, styles), {
x: bottomPos[0],
y: bottomPos[1]
}),
className: "link-point-bottom",
name: "link-point-bottom",
isAnchorPoint: true
});
}
}
}
}, "single-node");
// node_modules/@antv/g6-element/es/nodes/modelRect.js
registerNode("modelRect", {
options: {
size: [185, 70],
style: {
radius: 5,
stroke: "#69c0ff",
fill: "#ffffff",
lineWidth: BaseGlobal.defaultNode.style.lineWidth,
fillOpacity: 1
},
labelCfg: {
style: {
fill: "#595959",
fontSize: 14
},
offset: 30
},
descriptionCfg: {
style: {
fontSize: 12,
fill: "#bfbfbf"
},
paddingTop: 0
},
preRect: {
show: true,
width: 4,
fill: "#40a9ff",
radius: 2
},
linkPoints: {
top: false,
right: false,
bottom: false,
left: false,
size: 10,
lineWidth: 1,
fill: "#72CC4A",
stroke: "#72CC4A"
},
logoIcon: {
show: true,
x: 0,
y: 0,
img: "https://gw.alipayobjects.com/zos/basement_prod/4f81893c-1806-4de4-aff3-9a6b266bc8a2.svg",
width: 16,
height: 16,
offset: 0
},
stateIcon: {
show: true,
x: 0,
y: 0,
img: "https://gw.alipayobjects.com/zos/basement_prod/300a2523-67e0-4cbf-9d4a-67c077b40395.svg",
width: 16,
height: 16,
offset: -5
},
anchorPoints: [[0, 0.5], [1, 0.5]]
},
shapeType: "modelRect",
drawShape: function drawShape16(cfg, group2) {
var _a6 = this.getOptions(cfg).preRect, preRect = _a6 === void 0 ? {} : _a6;
var style = this.getShapeStyle(cfg);
var size2 = this.getSize(cfg);
var width2 = size2[0];
var height = size2[1];
var keyShape = group2.addShape("rect", {
attrs: style,
className: this.type + "-keyShape",
name: this.type + "-keyShape",
draggable: true
});
var preRectShow = preRect.show, preRectStyle = __rest(preRect, ["show"]);
if (preRectShow) {
group2.addShape("rect", {
attrs: __assign({
x: -width2 / 2,
y: -height / 2,
height
}, preRectStyle),
className: "pre-rect",
name: "pre-rect",
draggable: true
});
}
this.drawLogoIcon(cfg, group2);
this.drawStateIcon(cfg, group2);
this.drawLinkPoints(cfg, group2);
return keyShape;
},
drawLogoIcon: function drawLogoIcon(cfg, group2) {
var _a6 = this.getOptions(cfg).logoIcon, logoIcon = _a6 === void 0 ? {} : _a6;
var size2 = this.getSize(cfg);
var width2 = size2[0];
if (logoIcon.show) {
var w4 = logoIcon.width, h3 = logoIcon.height, x6 = logoIcon.x, y5 = logoIcon.y, offset = logoIcon.offset, logoIconStyle = __rest(logoIcon, ["width", "height", "x", "y", "offset"]);
group2.addShape("image", {
attrs: __assign(__assign({}, logoIconStyle), {
x: x6 || -width2 / 2 + w4 + offset,
y: y5 || -h3 / 2,
width: w4,
height: h3
}),
className: "rect-logo-icon",
name: "rect-logo-icon",
draggable: true
});
}
},
drawStateIcon: function drawStateIcon(cfg, group2) {
var _a6 = this.getOptions(cfg).stateIcon, stateIcon = _a6 === void 0 ? {} : _a6;
var size2 = this.getSize(cfg);
var width2 = size2[0];
if (stateIcon.show) {
var w4 = stateIcon.width, h3 = stateIcon.height, x6 = stateIcon.x, y5 = stateIcon.y, offset = stateIcon.offset, iconStyle = __rest(stateIcon, ["width", "height", "x", "y", "offset"]);
group2.addShape("image", {
attrs: __assign(__assign({}, iconStyle), {
x: x6 || width2 / 2 - w4 + offset,
y: y5 || -h3 / 2,
width: w4,
height: h3
}),
className: "rect-state-icon",
name: "rect-state-icon",
draggable: true
});
}
},
drawLinkPoints: function drawLinkPoints6(cfg, group2) {
var _a6 = this.getOptions(cfg).linkPoints, linkPoints = _a6 === void 0 ? {} : _a6;
var top = linkPoints.top, left2 = linkPoints.left, right2 = linkPoints.right, bottom = linkPoints.bottom, markSize = linkPoints.size, markR = linkPoints.r, markStyle = __rest(linkPoints, ["top", "left", "right", "bottom", "size", "r"]);
var size2 = this.getSize(cfg);
var width2 = size2[0];
var height = size2[1];
if (left2) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: -width2 / 2,
y: 0,
r: markSize / 2 || markR || 5
}),
className: "link-point-left",
name: "link-point-left",
isAnchorPoint: true
});
}
if (right2) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: width2 / 2,
y: 0,
r: markSize / 2 || markR || 5
}),
className: "link-point-right",
name: "link-point-right",
isAnchorPoint: true
});
}
if (top) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: 0,
y: -height / 2,
r: markSize / 2 || markR || 5
}),
className: "link-point-top",
name: "link-point-top",
isAnchorPoint: true
});
}
if (bottom) {
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: 0,
y: height / 2,
r: markSize / 2 || markR || 5
}),
className: "link-point-bottom",
name: "link-point-bottom",
isAnchorPoint: true
});
}
},
drawLabel: function drawLabel3(cfg, group2) {
var _a6 = this.getOptions(cfg), _b = _a6.labelCfg, labelCfg = _b === void 0 ? {} : _b, _c = _a6.logoIcon, logoIcon = _c === void 0 ? {} : _c, _d = _a6.descriptionCfg, descriptionCfg = _d === void 0 ? {} : _d;
var size2 = this.getSize(cfg);
var width2 = size2[0];
var label17 = null;
var show = logoIcon.show, w4 = logoIcon.width;
var offsetX = -width2 / 2 + labelCfg.offset;
if (show) {
offsetX = -width2 / 2 + w4 + labelCfg.offset;
}
var fontStyle = labelCfg.style;
var descriptionStyle = descriptionCfg.style, descriptionPaddingTop = descriptionCfg.paddingTop;
if (is_string_default(cfg.description)) {
label17 = group2.addShape("text", {
attrs: __assign(__assign({}, fontStyle), {
x: offsetX,
y: -5,
text: cfg.label
}),
className: "text-shape",
name: "text-shape",
draggable: true
});
group2.addShape("text", {
attrs: __assign(__assign({}, descriptionStyle), {
x: offsetX,
y: 17 + (descriptionPaddingTop || 0),
text: cfg.description
}),
className: "rect-description",
name: "rect-description",
draggable: true
});
} else {
label17 = group2.addShape("text", {
attrs: __assign(__assign({}, fontStyle), {
x: offsetX,
y: 7,
text: cfg.label
}),
className: "text-shape",
name: "text-shape",
draggable: true
});
}
return label17;
},
getShapeStyle: function getShapeStyle13(cfg) {
var defaultStyle = this.getOptions(cfg).style;
var strokeStyle = {
stroke: cfg.color
};
var style = mix({}, defaultStyle, strokeStyle);
var size2 = this.getSize(cfg);
var width2 = style.width || size2[0];
var height = style.height || size2[1];
var styles = __assign({
x: -width2 / 2,
y: -height / 2,
width: width2,
height
}, style);
return styles;
},
update: function update12(cfg, item) {
var _a6 = this.getOptions(cfg), _b = _a6.style, style = _b === void 0 ? {} : _b, _c = _a6.labelCfg, labelCfg = _c === void 0 ? {} : _c, _d = _a6.descriptionCfg, descriptionCfg = _d === void 0 ? {} : _d;
var size2 = this.getSize(cfg);
var width2 = size2[0];
var height = size2[1];
var keyShape = item.get("keyShape");
keyShape.attr(__assign(__assign({}, style), {
x: -width2 / 2,
y: -height / 2,
width: width2,
height
}));
var group2 = item.getContainer();
var logoIconShape = group2.find(function(element) {
return element.get("className") === "rect-logo-icon";
});
var currentLogoIconAttr = logoIconShape ? logoIconShape.attr() : {};
var logoIcon = mix({}, currentLogoIconAttr, cfg.logoIcon);
var w4 = logoIcon.width;
if (w4 === void 0) {
w4 = this.options.logoIcon.width;
}
var show = cfg.logoIcon ? cfg.logoIcon.show : void 0;
var offset = labelCfg.offset;
var offsetX = -width2 / 2 + w4 + offset;
if (!show && show !== void 0) {
offsetX = -width2 / 2 + offset;
}
var label17 = group2.find(function(element) {
return element.get("className") === "node-label";
});
var description = group2.find(function(element) {
return element.get("className") === "rect-description";
});
if (cfg.label) {
if (!label17) {
group2.addShape("text", {
attrs: __assign(__assign({}, labelCfg.style), {
x: offsetX,
y: cfg.description ? -5 : 7,
text: cfg.label
}),
className: "node-label",
name: "node-label",
draggable: true
});
} else {
var cfgStyle = cfg.labelCfg ? cfg.labelCfg.style : {};
var labelStyle = mix({}, label17.attr(), cfgStyle);
if (cfg.label)
labelStyle.text = cfg.label;
labelStyle.x = offsetX;
if (is_string_default(cfg.description))
labelStyle.y = -5;
if (description) {
description.resetMatrix();
description.attr({
x: offsetX
});
}
label17.resetMatrix();
label17.attr(labelStyle);
}
}
if (is_string_default(cfg.description)) {
var paddingTop = descriptionCfg.paddingTop;
if (!description) {
group2.addShape("text", {
attrs: __assign(__assign({}, descriptionCfg.style), {
x: offsetX,
y: 17 + (paddingTop || 0),
text: cfg.description
}),
className: "rect-description",
name: "rect-description",
draggable: true
});
} else {
var cfgStyle = cfg.descriptionCfg ? cfg.descriptionCfg.style : {};
var descriptionStyle = mix({}, description.attr(), cfgStyle);
if (is_string_default(cfg.description))
descriptionStyle.text = cfg.description;
descriptionStyle.x = offsetX;
description.resetMatrix();
description.attr(__assign(__assign({}, descriptionStyle), {
y: 17 + (paddingTop || 0)
}));
}
}
var preRectShape = group2.find(function(element) {
return element.get("className") === "pre-rect";
});
if (preRectShape) {
var preRect = mix({}, preRectShape.attr(), cfg.preRect);
preRectShape.attr(__assign(__assign({}, preRect), {
x: -width2 / 2,
y: -height / 2,
height
}));
}
if (logoIconShape) {
if (!show && show !== void 0) {
logoIconShape.remove();
} else {
var logoW = logoIcon.width, h3 = logoIcon.height, x6 = logoIcon.x, y5 = logoIcon.y, logoOffset = logoIcon.offset, logoIconStyle = __rest(logoIcon, ["width", "height", "x", "y", "offset"]);
logoIconShape.attr(__assign(__assign({}, logoIconStyle), {
x: x6 || -width2 / 2 + logoW + logoOffset,
y: y5 || -h3 / 2,
width: logoW,
height: h3
}));
}
} else if (show) {
this.drawLogoIcon(cfg, group2);
}
var stateIconShape = group2.find(function(element) {
return element.get("className") === "rect-state-icon";
});
var currentStateIconAttr = stateIconShape ? stateIconShape.attr() : {};
var stateIcon = mix({}, currentStateIconAttr, cfg.stateIcon);
if (stateIconShape) {
if (!stateIcon.show && stateIcon.show !== void 0) {
stateIconShape.remove();
}
var stateW = stateIcon.width, h3 = stateIcon.height, x6 = stateIcon.x, y5 = stateIcon.y, stateOffset = stateIcon.offset, stateIconStyle = __rest(stateIcon, ["width", "height", "x", "y", "offset"]);
stateIconShape.attr(__assign(__assign({}, stateIconStyle), {
x: x6 || width2 / 2 - stateW + stateOffset,
y: y5 || -h3 / 2,
width: stateW,
height: h3
}));
} else if (stateIcon.show) {
this.drawStateIcon(cfg, group2);
}
this.updateLinkPoints(cfg, group2);
}
}, "single-node");
// node_modules/@antv/g6-element/es/nodes/star.js
registerNode("star", {
options: {
size: 60,
style: {
stroke: BaseGlobal.defaultNode.style.stroke,
fill: BaseGlobal.defaultNode.style.fill,
lineWidth: BaseGlobal.defaultNode.style.lineWidth
},
labelCfg: {
style: {
fill: BaseGlobal.nodeLabel.style.fill,
fontSize: BaseGlobal.nodeLabel.style.fontSize
}
},
linkPoints: {
top: false,
right: false,
bottom: false,
left: false,
size: BaseGlobal.defaultNode.linkPoints.size,
lineWidth: BaseGlobal.defaultNode.linkPoints.lineWidth,
fill: BaseGlobal.defaultNode.linkPoints.fill,
stroke: BaseGlobal.defaultNode.linkPoints.stroke
},
icon: {
show: false,
img: "https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",
width: 20,
height: 20
},
stateStyles: __assign({}, BaseGlobal.nodeStateStyles)
},
shapeType: "star",
labelPosition: "center",
drawShape: function drawShape17(cfg, group2) {
var _a6 = this.getOptions(cfg).icon, icon = _a6 === void 0 ? {} : _a6;
var style = this.getShapeStyle(cfg);
var keyShape = group2.addShape("path", {
attrs: style,
className: this.type + "-keyShape",
name: this.type + "-keyShape",
draggable: true
});
var w4 = icon.width, h3 = icon.height, show = icon.show;
if (show) {
var image = group2.addShape("image", {
attrs: __assign({
x: -w4 / 2,
y: -h3 / 2
}, icon),
className: this.type + "-icon",
name: this.type + "-icon",
draggable: true
});
}
this.drawLinkPoints(cfg, group2);
return keyShape;
},
drawLinkPoints: function drawLinkPoints7(cfg, group2) {
var _a6 = this.getOptions(cfg).linkPoints, linkPoints = _a6 === void 0 ? {} : _a6;
var top = linkPoints.top, left2 = linkPoints.left, right2 = linkPoints.right, leftBottom = linkPoints.leftBottom, rightBottom = linkPoints.rightBottom, markSize = linkPoints.size, markR = linkPoints.r, markStyle = __rest(linkPoints, ["top", "left", "right", "leftBottom", "rightBottom", "size", "r"]);
var size2 = this.getSize(cfg);
var outerR = size2[0];
if (right2) {
var x1 = Math.cos((18 + 72 * 0) / 180 * Math.PI) * outerR;
var y1 = Math.sin((18 + 72 * 0) / 180 * Math.PI) * outerR;
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: x1,
y: -y1,
r: markSize / 2 || markR || 5
}),
className: "link-point-right",
name: "link-point-right"
});
}
if (top) {
var x1 = Math.cos((18 + 72 * 1) / 180 * Math.PI) * outerR;
var y1 = Math.sin((18 + 72 * 1) / 180 * Math.PI) * outerR;
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: x1,
y: -y1,
r: markSize / 2 || markR || 5
}),
className: "link-point-top",
name: "link-point-top"
});
}
if (left2) {
var x1 = Math.cos((18 + 72 * 2) / 180 * Math.PI) * outerR;
var y1 = Math.sin((18 + 72 * 2) / 180 * Math.PI) * outerR;
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: x1,
y: -y1,
r: markSize / 2 || markR || 5
}),
className: "link-point-left",
name: "link-point-left"
});
}
if (leftBottom) {
var x1 = Math.cos((18 + 72 * 3) / 180 * Math.PI) * outerR;
var y1 = Math.sin((18 + 72 * 3) / 180 * Math.PI) * outerR;
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: x1,
y: -y1,
r: markSize / 2 || markR || 5
}),
className: "link-point-left-bottom",
name: "link-point-left-bottom"
});
}
if (rightBottom) {
var x1 = Math.cos((18 + 72 * 4) / 180 * Math.PI) * outerR;
var y1 = Math.sin((18 + 72 * 4) / 180 * Math.PI) * outerR;
group2.addShape("circle", {
attrs: __assign(__assign({}, markStyle), {
x: x1,
y: -y1,
r: markSize / 2 || markR || 5
}),
className: "link-point-right-bottom",
name: "link-point-right-bottom"
});
}
},
getPath: function getPath12(cfg) {
var size2 = this.getSize(cfg);
var outerR = size2[0];
var defaultInnerR = outerR * 3 / 8;
var innerR = cfg.innerR || defaultInnerR;
var path = [];
for (var i4 = 0; i4 < 5; i4++) {
var x1 = Math.cos((18 + 72 * i4) / 180 * Math.PI) * outerR;
var y1 = Math.sin((18 + 72 * i4) / 180 * Math.PI) * outerR;
var x22 = Math.cos((54 + 72 * i4) / 180 * Math.PI) * innerR;
var y22 = Math.sin((54 + 72 * i4) / 180 * Math.PI) * innerR;
if (i4 === 0) {
path.push(["M", x1, -y1]);
} else {
path.push(["L", x1, -y1]);
}
path.push(["L", x22, -y22]);
}
path.push(["Z"]);
return path;
},
getShapeStyle: function getShapeStyle14(cfg) {
var defaultStyle = this.getOptions(cfg).style;
var strokeStyle = {
stroke: cfg.color
};
var style = mix({}, defaultStyle, strokeStyle);
var path = this.getPath(cfg);
var styles = __assign({
path
}, style);
return styles;
},
update: function update13(cfg, item) {
var group2 = item.getContainer();
var defaultStyle = this.getOptions({}).style;
var path = this.getPath(cfg);
var strokeStyle = {
stroke: cfg.color,
path
};
var keyShape = item.get("keyShape");
var style = mix({}, defaultStyle, keyShape.attr(), strokeStyle);
style = mix(style, cfg.style);
this.updateShape(cfg, item, style, true);
this.updateLinkPoints(cfg, group2);
},
updateLinkPoints: function updateLinkPoints3(cfg, group2) {
var defaultLinkPoints = this.getOptions({}).linkPoints;
var markLeft = group2.find(function(element) {
return element.get("className") === "link-point-left";
});
var markRight = group2.find(function(element) {
return element.get("className") === "link-point-right";
});
var markTop = group2.find(function(element) {
return element.get("className") === "link-point-top";
});
var markLeftBottom = group2.find(function(element) {
return element.get("className") === "link-point-left-bottom";
});
var markRightBottom = group2.find(function(element) {
return element.get("className") === "link-point-right-bottom";
});
var currentLinkPoints = defaultLinkPoints;
var existLinkPoint = markLeft || markRight || markTop || markLeftBottom || markRightBottom;
if (existLinkPoint) {
currentLinkPoints = existLinkPoint.attr();
}
var linkPoints = mix({}, currentLinkPoints, cfg.linkPoints);
var markFill = linkPoints.fill, markStroke = linkPoints.stroke, borderWidth = linkPoints.lineWidth;
var markSize = linkPoints.size / 2;
if (!markSize)
markSize = linkPoints.r;
var _a6 = cfg.linkPoints ? cfg.linkPoints : {
left: void 0,
right: void 0,
top: void 0,
leftBottom: void 0,
rightBottom: void 0
}, left2 = _a6.left, right2 = _a6.right, top = _a6.top, leftBottom = _a6.leftBottom, rightBottom = _a6.rightBottom;
var size2 = this.getSize(cfg);
var outerR = size2[0];
var styles = {
r: markSize,
fill: markFill,
stroke: markStroke,
lineWidth: borderWidth
};
var x6 = Math.cos((18 + 72 * 0) / 180 * Math.PI) * outerR;
var y5 = Math.sin((18 + 72 * 0) / 180 * Math.PI) * outerR;
if (markRight) {
if (!right2 && right2 !== void 0) {
markRight.remove();
} else {
markRight.attr(__assign(__assign({}, styles), {
x: x6,
y: -y5
}));
}
} else if (right2) {
group2.addShape("circle", {
attrs: __assign(__assign({}, styles), {
x: x6,
y: -y5
}),
className: "link-point-right",
name: "link-point-right",
isAnchorPoint: true
});
}
x6 = Math.cos((18 + 72 * 1) / 180 * Math.PI) * outerR;
y5 = Math.sin((18 + 72 * 1) / 180 * Math.PI) * outerR;
if (markTop) {
if (!top && top !== void 0) {
markTop.remove();
} else {
markTop.attr(__assign(__assign({}, styles), {
x: x6,
y: -y5
}));
}
} else if (top) {
group2.addShape("circle", {
attrs: __assign(__assign({}, styles), {
x: x6,
y: -y5
}),
className: "link-point-top",
name: "link-point-top",
isAnchorPoint: true
});
}
x6 = Math.cos((18 + 72 * 2) / 180 * Math.PI) * outerR;
y5 = Math.sin((18 + 72 * 2) / 180 * Math.PI) * outerR;
if (markLeft) {
if (!left2 && left2 !== void 0) {
markLeft.remove();
} else {
markLeft.attr(__assign(__assign({}, styles), {
x: x6,
y: -y5
}));
}
} else if (left2) {
group2.addShape("circle", {
attrs: __assign(__assign({}, styles), {
x: x6,
y: -y5
}),
className: "link-point-left",
name: "link-point-left",
isAnchorPoint: true
});
}
x6 = Math.cos((18 + 72 * 3) / 180 * Math.PI) * outerR;
y5 = Math.sin((18 + 72 * 3) / 180 * Math.PI) * outerR;
if (markLeftBottom) {
if (!leftBottom && leftBottom !== void 0) {
markLeftBottom.remove();
} else {
markLeftBottom.attr(__assign(__assign({}, styles), {
x: x6,
y: -y5
}));
}
} else if (leftBottom) {
group2.addShape("circle", {
attrs: __assign(__assign({}, styles), {
x: x6,
y: -y5
}),
className: "link-point-left-bottom",
name: "link-point-left-bottom",
isAnchorPoint: true
});
}
x6 = Math.cos((18 + 72 * 4) / 180 * Math.PI) * outerR;
y5 = Math.sin((18 + 72 * 4) / 180 * Math.PI) * outerR;
if (markRightBottom) {
if (!rightBottom && rightBottom !== void 0) {
markLeftBottom.remove();
} else {
markRightBottom.attr(__assign(__assign({}, styles), {
x: x6,
y: -y5
}));
}
} else if (rightBottom) {
group2.addShape("circle", {
attrs: __assign(__assign({}, styles), {
x: x6,
y: -y5
}),
className: "link-point-right-bottom",
name: "link-point-right-bottom",
isAnchorPoint: true
});
}
}
}, "single-node");
// node_modules/@antv/g6-element/es/edges/polyline-util.js
var getBBoxFromPoint = function getBBoxFromPoint2(point2) {
var x6 = point2.x, y5 = point2.y;
return {
x: x6,
y: y5,
centerX: x6,
centerY: y5,
minX: x6,
minY: y5,
maxX: x6,
maxY: y5,
height: 0,
width: 0
};
};
var getBBoxFromPoints = function getBBoxFromPoints2(points) {
if (points === void 0) {
points = [];
}
var xs = [];
var ys = [];
points.forEach(function(p4) {
xs.push(p4.x);
ys.push(p4.y);
});
var minX = Math.min.apply(Math, xs);
var maxX = Math.max.apply(Math, xs);
var minY = Math.min.apply(Math, ys);
var maxY2 = Math.max.apply(Math, ys);
return {
centerX: (minX + maxX) / 2,
centerY: (minY + maxY2) / 2,
maxX,
maxY: maxY2,
minX,
minY,
height: maxY2 - minY,
width: maxX - minX
};
};
var filterConnectPoints = function filterConnectPoints2(points) {
var result = [];
var pointsMap = {};
var pointsLength = points.length;
for (var i4 = pointsLength - 1; i4 >= 0; i4--) {
var p4 = points[i4];
p4.id = p4.x + "|||" + p4.y;
pointsMap[p4.id] = p4;
result.push(p4);
}
return result;
};
var simplifyPolyline = function simplifyPolyline2(points) {
return filterConnectPoints(points);
};
var getExpandedBBox = function getExpandedBBox2(bbox, offset) {
if (bbox.width || bbox.height) {
return {
centerX: bbox.centerX,
centerY: bbox.centerY,
minX: bbox.minX - offset,
minY: bbox.minY - offset,
maxX: bbox.maxX + offset,
maxY: bbox.maxY + offset,
height: bbox.height + 2 * offset,
width: bbox.width + 2 * offset
};
}
return bbox;
};
var isHorizontalPort = function isHorizontalPort2(port, bbox) {
var dx = Math.abs(port.x - bbox.centerX);
var dy = Math.abs(port.y - bbox.centerY);
if (dx === 0 && dy === 0)
return 0;
return dx / bbox.width > dy / bbox.height;
};
var getExpandedBBoxPoint = function getExpandedBBoxPoint2(bbox, point2, anotherPoint) {
var isHorizontal2 = isHorizontalPort(point2, bbox);
if (isHorizontal2 === 0) {
var x6 = bbox.centerX;
var y5 = bbox.centerY;
if (anotherPoint.y < point2.y) {
y5 = bbox.minY;
} else if (anotherPoint.x > point2.x) {
x6 = bbox.maxX;
} else if (anotherPoint.x < point2.x) {
x6 = bbox.minX;
} else if (anotherPoint.x === point2.x) {
y5 = bbox.maxY;
}
return {
x: x6,
y: y5
};
}
if (isHorizontal2) {
return {
x: point2.x > bbox.centerX ? bbox.maxX : bbox.minX,
y: point2.y
};
}
return {
x: point2.x,
y: point2.y > bbox.centerY ? bbox.maxY : bbox.minY
};
};
var mergeBBox2 = function mergeBBox3(b12, b23) {
var minX = Math.min(b12.minX, b23.minX);
var minY = Math.min(b12.minY, b23.minY);
var maxX = Math.max(b12.maxX, b23.maxX);
var maxY2 = Math.max(b12.maxY, b23.maxY);
return {
centerX: (minX + maxX) / 2,
centerY: (minY + maxY2) / 2,
minX,
minY,
maxX,
maxY: maxY2,
height: maxY2 - minY,
width: maxX - minX
};
};
var getPointsFromBBox = function getPointsFromBBox2(bbox) {
return [{
x: bbox.minX,
y: bbox.minY
}, {
x: bbox.maxX,
y: bbox.minY
}, {
x: bbox.maxX,
y: bbox.maxY
}, {
x: bbox.minX,
y: bbox.maxY
}];
};
var isPointOutsideBBox = function isPointOutsideBBox2(point2, bbox) {
var x6 = point2.x, y5 = point2.y;
return x6 < bbox.minX || x6 > bbox.maxX || y5 < bbox.minY || y5 > bbox.maxY;
};
var getBBoxXCrossPoints = function getBBoxXCrossPoints2(bbox, x6) {
if (x6 < bbox.minX || x6 > bbox.maxX) {
return [];
}
return [{
x: x6,
y: bbox.minY
}, {
x: x6,
y: bbox.maxY
}];
};
var getBBoxYCrossPoints = function getBBoxYCrossPoints2(bbox, y5) {
if (y5 < bbox.minY || y5 > bbox.maxY) {
return [];
}
return [{
x: bbox.minX,
y: y5
}, {
x: bbox.maxX,
y: y5
}];
};
var getBBoxCrossPointsByPoint = function getBBoxCrossPointsByPoint2(bbox, point2) {
return getBBoxXCrossPoints(bbox, point2.x).concat(getBBoxYCrossPoints(bbox, point2.y));
};
var distance13 = function distance14(p1, p22) {
return Math.abs(p1.x - p22.x) + Math.abs(p1.y - p22.y);
};
var _costByPoints = function _costByPoints2(p4, points) {
var offset = -2;
var result = 0;
points.forEach(function(point2) {
if (point2) {
if (p4.x === point2.x) {
result += offset;
}
if (p4.y === point2.y) {
result += offset;
}
}
});
return result;
};
var heuristicCostEstimate = function heuristicCostEstimate2(p4, ps, pt, source, target) {
return distance13(p4, ps) + distance13(p4, pt) + _costByPoints(p4, [ps, pt, source, target]);
};
var reconstructPath = function reconstructPath2(pathPoints, pointById, cameFrom, currentId, iterator) {
if (iterator === void 0) {
iterator = 0;
}
pathPoints.unshift(pointById[currentId]);
if (cameFrom[currentId] && cameFrom[currentId] !== currentId && iterator <= 100) {
reconstructPath2(pathPoints, pointById, cameFrom, cameFrom[currentId], iterator + 1);
}
};
var removeFrom = function removeFrom2(arr, item) {
var index2 = arr.indexOf(item);
if (index2 > -1) {
arr.splice(index2, 1);
}
};
var isSegmentsIntersected = function isSegmentsIntersected2(p0, p1, p22, p32) {
var v1x = p22.x - p0.x;
var v1y = p22.y - p0.y;
var v2x = p32.x - p0.x;
var v2y = p32.y - p0.y;
var v3x = p22.x - p1.x;
var v3y = p22.y - p1.y;
var v4x = p32.x - p1.x;
var v4y = p32.y - p1.y;
var pd1 = v1x * v2y - v1y * v2x;
var pd2 = v3x * v4y - v3y * v4x;
var pd3 = v1x * v3y - v1y * v3x;
var pd4 = v2x * v4y - v2y * v4x;
return pd1 * pd2 <= 0 && pd3 * pd4 <= 0;
};
var isSegmentCrossingBBox = function isSegmentCrossingBBox2(p1, p22, bbox) {
if (bbox.width || bbox.height) {
var _a6 = getPointsFromBBox(bbox), pa = _a6[0], pb = _a6[1], pc = _a6[2], pd = _a6[3];
return isSegmentsIntersected(p1, p22, pa, pb) || isSegmentsIntersected(p1, p22, pa, pd) || isSegmentsIntersected(p1, p22, pb, pc) || isSegmentsIntersected(p1, p22, pc, pd);
}
return false;
};
var getNeighborPoints = function getNeighborPoints2(points, point2, bbox1, bbox2) {
var neighbors = [];
points.forEach(function(p4) {
if (p4 === point2)
return;
if (p4.x === point2.x || p4.y === point2.y) {
if (isSegmentCrossingBBox(p4, point2, bbox1) || isSegmentCrossingBBox(p4, point2, bbox2))
return;
neighbors.push(p4);
}
});
return filterConnectPoints(neighbors);
};
var pathFinder = function pathFinder2(points, start, goal, sBBox, tBBox, os, ot) {
var closedSet = [];
var openSet = [start];
var cameFrom = {};
var gScore = {};
var fScore = {};
gScore[start.id] = 0;
fScore[start.id] = heuristicCostEstimate(start, goal, start);
var pointById = {};
points.forEach(function(p4) {
pointById[p4.id] = p4;
});
var current, lowestFScore;
while (openSet.length) {
current = void 0;
lowestFScore = Infinity;
openSet.forEach(function(p4) {
if (fScore[p4.id] <= lowestFScore) {
lowestFScore = fScore[p4.id];
current = p4;
}
});
if (current === goal) {
var pathPoints = [];
reconstructPath(pathPoints, pointById, cameFrom, goal.id);
return pathPoints;
}
removeFrom(openSet, current);
closedSet.push(current);
getNeighborPoints(points, current, sBBox, tBBox).forEach(function(neighbor) {
if (closedSet.indexOf(neighbor) !== -1) {
return;
}
if (openSet.indexOf(neighbor) === -1) {
openSet.push(neighbor);
}
var tentativeGScore = fScore[current.id] + distance13(current, neighbor);
if (gScore[neighbor.id] && tentativeGScore >= gScore[neighbor.id]) {
return;
}
cameFrom[neighbor.id] = current.id;
gScore[neighbor.id] = tentativeGScore;
fScore[neighbor.id] = gScore[neighbor.id] + heuristicCostEstimate(neighbor, goal, start, os, ot);
});
}
return [start, goal];
};
var isBending = function isBending2(p0, p1, p22) {
return !(p0.x === p1.x && p1.x === p22.x || p0.y === p1.y && p1.y === p22.y);
};
var getBorderRadiusPoints = function getBorderRadiusPoints2(p0, p1, p22, r4) {
var d0 = distance13(p0, p1);
var d1 = distance13(p22, p1);
if (d0 < r4) {
r4 = d0;
}
if (d1 < r4) {
r4 = d1;
}
var ps = {
x: p1.x - r4 / d0 * (p1.x - p0.x),
y: p1.y - r4 / d0 * (p1.y - p0.y)
};
var pt = {
x: p1.x - r4 / d1 * (p1.x - p22.x),
y: p1.y - r4 / d1 * (p1.y - p22.y)
};
return [ps, pt];
};
var getPathWithBorderRadiusByPolyline = function getPathWithBorderRadiusByPolyline2(points, borderRadius) {
var pathSegments = [];
var startPoint = points[0];
pathSegments.push("M" + startPoint.x + " " + startPoint.y);
points.forEach(function(p4, i4) {
var p1 = points[i4 + 1];
var p22 = points[i4 + 2];
if (p1 && p22) {
if (isBending(p4, p1, p22)) {
var _a6 = getBorderRadiusPoints(p4, p1, p22, borderRadius), ps = _a6[0], pt = _a6[1];
pathSegments.push("L" + ps.x + " " + ps.y);
pathSegments.push("Q" + p1.x + " " + p1.y + " " + pt.x + " " + pt.y);
pathSegments.push("L" + pt.x + " " + pt.y);
} else {
pathSegments.push("L" + p1.x + " " + p1.y);
}
} else if (p1) {
pathSegments.push("L" + p1.x + " " + p1.y);
}
});
return pathSegments.join("");
};
var getPolylinePoints = function getPolylinePoints2(start, end2, sNode, tNode, offset) {
var sBBox, tBBox;
if (!sNode || !sNode.getType()) {
sBBox = getBBoxFromPoint(start);
} else if (sNode.getType() === "combo") {
var sNodeKeyShape = sNode.getKeyShape();
sBBox = sNodeKeyShape.getCanvasBBox() || getBBoxFromPoint(start);
sBBox.centerX = (sBBox.minX + sBBox.maxX) / 2;
sBBox.centerY = (sBBox.minY + sBBox.maxY) / 2;
} else {
sBBox = sNode.getBBox();
}
if (!tNode || !tNode.getType()) {
tBBox = getBBoxFromPoint(end2);
} else if (tNode.getType() === "combo") {
var tNodeKeyShape = tNode.getKeyShape();
tBBox = tNodeKeyShape.getCanvasBBox() || getBBoxFromPoint(end2);
tBBox.centerX = (tBBox.minX + tBBox.maxX) / 2;
tBBox.centerY = (tBBox.minY + tBBox.maxY) / 2;
} else {
tBBox = tNode && tNode.getBBox();
}
var sxBBox = getExpandedBBox(sBBox, offset);
var txBBox = getExpandedBBox(tBBox, offset);
var sPoint = getExpandedBBoxPoint(sxBBox, start, end2);
var tPoint = getExpandedBBoxPoint(txBBox, end2, start);
var lineBBox = getBBoxFromPoints([sPoint, tPoint]);
var sMixBBox = mergeBBox2(sxBBox, lineBBox);
var tMixBBox = mergeBBox2(txBBox, lineBBox);
var connectPoints = [];
connectPoints = connectPoints.concat(getPointsFromBBox(sMixBBox)).concat(getPointsFromBBox(tMixBBox));
var centerPoint = {
x: (start.x + end2.x) / 2,
y: (start.y + end2.y) / 2
};
[lineBBox, sMixBBox, tMixBBox].forEach(function(bbox) {
connectPoints = connectPoints.concat(getBBoxCrossPointsByPoint(bbox, centerPoint).filter(function(p4) {
return isPointOutsideBBox(p4, sxBBox) && isPointOutsideBBox(p4, txBBox);
}));
});
[{
x: sPoint.x,
y: tPoint.y
}, {
x: tPoint.x,
y: sPoint.y
}].forEach(function(p4) {
if (isPointOutsideBBox(p4, sxBBox) && isPointOutsideBBox(p4, txBBox)) {
connectPoints.push(p4);
}
});
connectPoints.unshift(sPoint);
connectPoints.push(tPoint);
connectPoints = filterConnectPoints(connectPoints);
var pathPoints = pathFinder(connectPoints, sPoint, tPoint, sBBox, tBBox, start, end2);
pathPoints.unshift(start);
pathPoints.push(end2);
return simplifyPolyline(pathPoints);
};
// node_modules/@antv/g6-element/es/edges/router.js
var manhattanDist = function manhattanDist2(p1, p22) {
return Math.abs(p1.x - p22.x) + Math.abs(p1.y - p22.y);
};
var eucliDist = function eucliDist2(p1, p22) {
return Math.sqrt(Math.pow(p1.x - p22.x, 2) + Math.pow(p1.y - p22.y, 2));
};
var straightPath = function straightPath2(start, end2) {
return [start, end2];
};
var simplePolyline = function simplePolyline2(start, end2, startNode, endNode, cfg) {
return simplifyPolyline(getPolylinePoints(start, end2, startNode, endNode, cfg.offset));
};
var defaultCfg = {
offset: 20,
maxAllowedDirectionChange: Math.PI / 2,
maximumLoops: 2e3,
gridSize: 10,
directions: [
{
stepX: 1,
stepY: 0
},
{
stepX: -1,
stepY: 0
},
{
stepX: 0,
stepY: 1
},
{
stepX: 0,
stepY: -1
}
],
get penalties() {
return {
0: 0,
45: this.gridSize / 2,
90: this.gridSize / 2
};
},
distFunc: manhattanDist,
fallbackRoute: simplePolyline
};
var octolinearCfg = {
maxAllowedDirectionChange: Math.PI / 4,
directions: [{
stepX: 1,
stepY: 0
}, {
stepX: 1,
stepY: 1
}, {
stepX: 0,
stepY: 1
}, {
stepX: -1,
stepY: 1
}, {
stepX: -1,
stepY: 0
}, {
stepX: -1,
stepY: -1
}, {
stepX: 0,
stepY: -1
}, {
stepX: 1,
stepY: -1
}],
distFunc: eucliDist,
fallbackRoute: straightPath
};
var pos2GridIx = function pos2GridIx2(pos, gridSize) {
var gridIx = Math.round(Math.abs(pos / gridSize));
var sign = pos < 0 ? -1 : 1;
return gridIx < 0 ? 0 : sign * gridIx;
};
var getObstacleMap = function getObstacleMap2(items, gridSize, offset) {
var map6 = {};
items.forEach(function(item) {
if (!item)
return;
var bbox = getExpandedBBox(item.getBBox(), offset);
for (var x6 = pos2GridIx(bbox.minX, gridSize); x6 <= pos2GridIx(bbox.maxX, gridSize); x6 += 1) {
for (var y5 = pos2GridIx(bbox.minY, gridSize); y5 <= pos2GridIx(bbox.maxY, gridSize); y5 += 1) {
map6[x6 + "|||" + y5] = true;
}
}
});
return map6;
};
var getDirectionAngle = function getDirectionAngle2(p1, p22) {
var deltaX = p22.x - p1.x;
var deltaY = p22.y - p1.y;
if (deltaX || deltaY) {
return Math.atan2(deltaY, deltaX);
}
return 0;
};
var getAngleDiff = function getAngleDiff2(angle1, angle22) {
var directionChange = Math.abs(angle1 - angle22);
return directionChange > Math.PI ? 2 * Math.PI - directionChange : directionChange;
};
var estimateCost = function estimateCost2(from, endPoints, distFunc) {
var min7 = Infinity;
for (var i4 = 0, len5 = endPoints.length; i4 < len5; i4++) {
var cost = distFunc(from, endPoints[i4]);
if (cost < min7) {
min7 = cost;
}
}
return min7;
};
var getBoxPoints2 = function getBoxPoints3(point2, oriPoint, node, anotherPoint, cfg) {
var points = [];
if (!node) {
return [point2];
}
var directions = cfg.directions, offset = cfg.offset;
var bbox = node.getBBox();
var isInside = oriPoint.x > bbox.minX && oriPoint.x < bbox.maxX && oriPoint.y > bbox.minY && oriPoint.y < bbox.maxY;
var expandBBox = getExpandedBBox(bbox, offset);
for (var i4 in expandBBox) {
expandBBox[i4] = pos2GridIx(expandBBox[i4], cfg.gridSize);
}
if (isInside) {
for (var _i = 0, directions_1 = directions; _i < directions_1.length; _i++) {
var dir = directions_1[_i];
var bounds = [[{
x: expandBBox.minX,
y: expandBBox.minY
}, {
x: expandBBox.maxX,
y: expandBBox.minY
}], [{
x: expandBBox.minX,
y: expandBBox.minY
}, {
x: expandBBox.minX,
y: expandBBox.maxY
}], [{
x: expandBBox.maxX,
y: expandBBox.minY
}, {
x: expandBBox.maxX,
y: expandBBox.maxY
}], [{
x: expandBBox.minX,
y: expandBBox.maxY
}, {
x: expandBBox.maxX,
y: expandBBox.maxY
}]];
for (var i4 = 0; i4 < 4; i4++) {
var boundLine = bounds[i4];
var insterctP_1 = util_default.getLineIntersect(point2, {
x: point2.x + dir.stepX * expandBBox.width,
y: point2.y + dir.stepY * expandBBox.height
}, boundLine[0], boundLine[1]);
if (insterctP_1 && !isSegmentCrossingBBox(point2, insterctP_1, bbox)) {
insterctP_1.id = insterctP_1.x + "|||" + insterctP_1.y;
points.push(insterctP_1);
}
}
}
return points;
}
var insterctP = getExpandedBBoxPoint(expandBBox, point2, anotherPoint);
insterctP.id = insterctP.x + "|||" + insterctP.y;
return [insterctP];
};
var getDirectionChange = function getDirectionChange2(current, neighbor, cameFrom, scaleStartPoint) {
var directionAngle = getDirectionAngle(current, neighbor);
if (!cameFrom[current.id]) {
var startAngle = getDirectionAngle(scaleStartPoint, current);
return getAngleDiff(startAngle, directionAngle);
}
var prevDirectionAngle = getDirectionAngle({
x: cameFrom[current.id].x,
y: cameFrom[current.id].y
}, current);
return getAngleDiff(prevDirectionAngle, directionAngle);
};
var getControlPoints12 = function getControlPoints13(current, cameFrom, scaleStartPoint, endPoint, startPoint, scaleEndPoint, gridSize) {
var controlPoints = [endPoint];
var currentId = current.id;
var currentX = current.x;
var currentY = current.y;
var lastPoint = {
x: currentX,
y: currentY,
id: currentId
};
if (getDirectionChange(lastPoint, scaleEndPoint, cameFrom, scaleStartPoint)) {
controlPoints.unshift({
x: scaleEndPoint.x === endPoint.x ? endPoint.x : lastPoint.x * gridSize,
y: scaleEndPoint.y === endPoint.y ? endPoint.y : lastPoint.y * gridSize
});
}
while (cameFrom[currentId] && cameFrom[currentId].id !== currentId) {
var point2 = {
x: currentX,
y: currentY,
id: currentId
};
var preId = cameFrom[currentId].id;
var preX = cameFrom[currentId].x;
var preY = cameFrom[currentId].y;
var prePoint = {
x: preX,
y: preY,
id: preId
};
var directionChange = getDirectionChange(prePoint, point2, cameFrom, scaleStartPoint);
if (directionChange) {
controlPoints.unshift({
x: prePoint.x === point2.x ? controlPoints[0].x : prePoint.x * gridSize,
y: prePoint.y === point2.y ? controlPoints[0].y : prePoint.y * gridSize
});
}
currentId = preId;
currentX = preX;
currentY = preY;
}
var firstPoint = {
x: currentX,
y: currentY,
id: currentId
};
controlPoints[0].x = firstPoint.x === scaleStartPoint.x ? startPoint.x : controlPoints[0].x;
controlPoints[0].y = firstPoint.y === scaleStartPoint.y ? startPoint.y : controlPoints[0].y;
controlPoints.unshift(startPoint);
return controlPoints;
};
var pathFinder3 = function pathFinder4(startPoint, endPoint, startNode, endNode, routerCfg) {
if (isNaN(startPoint.x) || isNaN(endPoint.x))
return [];
var cfg = deep_mix_default(defaultCfg, routerCfg);
cfg.obstacles = cfg.obstacles || [];
var gridSize = cfg.gridSize;
var map6 = getObstacleMap(cfg.obstacles.concat([startNode, endNode]), gridSize, cfg.offset);
var scaleStartPoint = {
x: pos2GridIx(startPoint.x, gridSize),
y: pos2GridIx(startPoint.y, gridSize)
};
var scaleEndPoint = {
x: pos2GridIx(endPoint.x, gridSize),
y: pos2GridIx(endPoint.y, gridSize)
};
startPoint.id = scaleStartPoint.x + "|||" + scaleStartPoint.y;
endPoint.id = scaleEndPoint.x + "|||" + scaleEndPoint.y;
var startPoints = getBoxPoints2(scaleStartPoint, startPoint, startNode, scaleEndPoint, cfg);
var endPoints = getBoxPoints2(scaleEndPoint, endPoint, endNode, scaleStartPoint, cfg);
startPoints.forEach(function(point2) {
delete map6[point2.id];
});
endPoints.forEach(function(point2) {
delete map6[point2.id];
});
var openSet = {};
var closedSet = {};
var cameFrom = {};
var gScore = {};
var fScore = {};
for (var i4 = 0; i4 < startPoints.length; i4++) {
var firstStep = startPoints[i4];
openSet[firstStep.id] = firstStep;
gScore[firstStep.id] = 0;
fScore[firstStep.id] = estimateCost(firstStep, endPoints, cfg.distFunc);
}
var remainLoops = cfg.maximumLoops;
var penalties = cfg.penalties;
var current, curCost, direction5, neighbor, neighborCost, costFromStart, directionChange;
while (Object.keys(openSet).length > 0 && remainLoops > 0) {
current = void 0;
curCost = Infinity;
Object.keys(openSet).forEach(function(key) {
var id = openSet[key].id;
if (fScore[id] <= curCost) {
curCost = fScore[id];
current = openSet[id];
}
});
if (!current)
break;
if (endPoints.findIndex(function(point2) {
return point2.x === current.x && point2.y === current.y;
}) > -1) {
return getControlPoints12(current, cameFrom, scaleStartPoint, endPoint, startPoint, scaleEndPoint, gridSize);
}
delete openSet[current.id];
closedSet[current.id] = true;
for (var i4 = 0; i4 < cfg.directions.length; i4++) {
direction5 = cfg.directions[i4];
neighbor = {
x: current.x + direction5.stepX,
y: current.y + direction5.stepY,
id: Math.round(current.x) + direction5.stepX + "|||" + (Math.round(current.y) + direction5.stepY)
};
if (closedSet[neighbor.id])
continue;
directionChange = getDirectionChange(current, neighbor, cameFrom, scaleStartPoint);
if (directionChange > cfg.maxAllowedDirectionChange)
continue;
if (map6[neighbor.id])
continue;
if (!openSet[neighbor.id]) {
openSet[neighbor.id] = neighbor;
}
neighborCost = cfg.distFunc(current, neighbor) + (isNaN(penalties[directionChange]) ? gridSize : penalties[directionChange]);
costFromStart = gScore[current.id] + neighborCost;
if (gScore[neighbor.id] && costFromStart >= gScore[neighbor.id]) {
continue;
}
cameFrom[neighbor.id] = current;
gScore[neighbor.id] = costFromStart;
fScore[neighbor.id] = costFromStart + estimateCost(neighbor, endPoints, cfg.distFunc);
}
remainLoops -= 1;
}
return cfg.fallbackRoute(startPoint, endPoint, startNode, endNode, cfg);
};
// node_modules/@antv/g6-element/es/edges/polyline.js
registerEdge("polyline", {
options: {
color: BaseGlobal.defaultEdge.color,
size: BaseGlobal.defaultEdge.size,
style: {
radius: 0,
offset: 15,
x: 0,
y: 0,
stroke: BaseGlobal.defaultEdge.style.stroke,
lineAppendWidth: BaseGlobal.defaultEdge.style.lineAppendWidth
},
labelCfg: {
style: {
fill: BaseGlobal.edgeLabel.style.fill,
fontSize: BaseGlobal.edgeLabel.style.fontSize
}
},
routeCfg: {
obstacles: [],
maxAllowedDirectionChange: Math.PI,
maximumLoops: 500,
gridSize: 10
},
stateStyles: __assign({}, BaseGlobal.edgeStateStyles)
},
shapeType: "polyline",
labelPosition: "center",
drawShape: function drawShape18(cfg, group2) {
var shapeStyle = this.getShapeStyle(cfg);
if (shapeStyle.radius === 0)
delete shapeStyle.radius;
var keyShape = group2.addShape("path", {
className: "edge-shape",
name: "edge-shape",
attrs: shapeStyle
});
return keyShape;
},
getShapeStyle: function getShapeStyle15(cfg) {
var defaultStyle = this.options.style;
var strokeStyle = {
stroke: cfg.color
};
var style = mix({}, defaultStyle, strokeStyle, cfg.style);
cfg = this.getPathPoints(cfg);
this.radius = style.radius;
this.offset = style.offset;
var startPoint = cfg.startPoint, endPoint = cfg.endPoint;
var controlPoints = this.getControlPoints(cfg);
var points = [startPoint];
if (controlPoints) {
points = points.concat(controlPoints);
}
points.push(endPoint);
var source = cfg.sourceNode;
var target = cfg.targetNode;
var radius = style.radius;
var defaultRouteCfg = this.options.routeCfg;
var routeCfg = mix({}, defaultRouteCfg, cfg.routeCfg);
routeCfg.offset = style.offset;
var path = this.getPath(points, source, target, radius, routeCfg);
if (is_array_default(path) && path.length <= 1 || is_string_default(path) && path.indexOf("L") === -1) {
path = "M0 0, L0 0";
}
if (isNaN(startPoint.x) || isNaN(startPoint.y) || isNaN(endPoint.x) || isNaN(endPoint.y)) {
path = "M0 0, L0 0";
}
var attrs = mix({}, BaseGlobal.defaultEdge.style, style, {
lineWidth: cfg.size,
path
});
return attrs;
},
updateShapeStyle: function updateShapeStyle4(cfg, item) {
var group2 = item.getContainer();
if (!item.isVisible())
return;
var strokeStyle = {
stroke: cfg.color
};
var shape = group2.find(function(element) {
return element.get("className") === "edge-shape";
}) || item.getKeyShape();
var size2 = cfg.size;
cfg = this.getPathPoints(cfg);
var startPoint = cfg.startPoint, endPoint = cfg.endPoint;
var controlPoints = this.getControlPoints(cfg);
var points = [startPoint];
if (controlPoints) {
points = points.concat(controlPoints);
}
points.push(endPoint);
var currentAttr = shape.attr();
var previousStyle = mix({}, strokeStyle, currentAttr, cfg.style);
var source = cfg.sourceNode;
var target = cfg.targetNode;
var radius = previousStyle.radius;
var defaultRouteCfg = this.options.routeCfg;
var routeCfg = mix({}, defaultRouteCfg, cfg.routeCfg);
routeCfg.offset = previousStyle.offset;
var path = this.getPath(points, source, target, radius, routeCfg);
if (is_array_default(path) && path.length <= 1 || is_string_default(path) && path.indexOf("L") === -1) {
path = "M0 0, L0 0";
}
if (isNaN(startPoint.x) || isNaN(startPoint.y) || isNaN(endPoint.x) || isNaN(endPoint.y)) {
path = "M0 0, L0 0";
}
if (currentAttr.endArrow && previousStyle.endArrow === false) {
cfg.style.endArrow = {
path: ""
};
}
if (currentAttr.startArrow && previousStyle.startArrow === false) {
cfg.style.startArrow = {
path: ""
};
}
var style = mix(strokeStyle, shape.attr(), {
lineWidth: size2,
path
}, cfg.style);
if (shape) {
shape.attr(style);
}
},
getPath: function getPath13(points, source, target, radius, routeCfg) {
var offset = routeCfg.offset, simple = routeCfg.simple;
if (!offset || points.length > 2) {
if (radius) {
return getPathWithBorderRadiusByPolyline(points, radius);
}
var pathArray_1 = [];
each_default(points, function(point2, index2) {
if (index2 === 0) {
pathArray_1.push(["M", point2.x, point2.y]);
} else {
pathArray_1.push(["L", point2.x, point2.y]);
}
});
return pathArray_1;
}
var polylinePoints = simple ? getPolylinePoints(points[points.length - 1], points[0], target, source, offset) : pathFinder3(points[0], points[points.length - 1], source, target, routeCfg);
if (!polylinePoints || !polylinePoints.length)
return "M0 0, L0 0";
if (radius) {
var res_1 = getPathWithBorderRadiusByPolyline(polylinePoints, radius);
return res_1;
}
var res = util_default.pointsToPolygon(polylinePoints);
return res;
}
}, "single-edge");
// node_modules/@antv/g6-pc/es/behavior/drag-canvas.js
var cloneEvent4 = util_default3.cloneEvent;
var isNaN5 = util_default3.isNaN;
var abs = Math.abs;
var DRAG_OFFSET = 10;
var ALLOW_EVENTS = ["shift", "ctrl", "alt", "control"];
var drag_canvas_default = {
getDefaultCfg: function getDefaultCfg2() {
return {
direction: "both",
enableOptimize: false,
scalableRange: 0,
allowDragOnItem: false
};
},
getEvents: function getEvents2() {
return {
dragstart: "onMouseDown",
drag: "onMouseMove",
dragend: "onMouseUp",
"canvas:click": "onMouseUp",
keyup: "onKeyUp",
focus: "onKeyUp",
keydown: "onKeyDown",
touchstart: "onTouchStart",
touchmove: "onTouchMove",
touchend: "onMouseUp"
};
},
updateViewport: function updateViewport(e4) {
var origin = this.origin;
var clientX = +e4.clientX;
var clientY = +e4.clientY;
if (isNaN5(clientX) || isNaN5(clientY)) {
return;
}
var dx = clientX - origin.x;
var dy = clientY - origin.y;
if (this.get("direction") === "x") {
dy = 0;
} else if (this.get("direction") === "y") {
dx = 0;
}
this.origin = {
x: clientX,
y: clientY
};
var width2 = this.graph.get("width");
var height = this.graph.get("height");
var graphCanvasBBox = this.graph.get("canvas").getCanvasBBox();
if (graphCanvasBBox.minX <= width2 + this.scalableRange && graphCanvasBBox.minX + dx > width2 + this.scalableRange || graphCanvasBBox.maxX + this.scalableRange >= 0 && graphCanvasBBox.maxX + this.scalableRange + dx < 0) {
dx = 0;
}
if (graphCanvasBBox.minY <= height + this.scalableRange && graphCanvasBBox.minY + dy > height + this.scalableRange || graphCanvasBBox.maxY + this.scalableRange >= 0 && graphCanvasBBox.maxY + this.scalableRange + dy < 0) {
dy = 0;
}
this.graph.translate(dx, dy);
},
onTouchStart: function onTouchStart(e4) {
var self2 = this;
var touches = e4.originalEvent.touches;
var event1 = touches[0];
var event2 = touches[1];
if (event1 && event2) {
return;
}
e4.preventDefault();
self2.onMouseDown(e4);
},
onMouseDown: function onMouseDown(e4) {
var self2 = this;
var event = e4.originalEvent;
if (event && e4.name !== G6Event.TOUCHSTART && event.button !== 0) {
return;
}
if (e4.name !== G6Event.TOUCHSTART && typeof window !== "undefined" && window.event && !window.event.buttons && !window.event.button) {
return;
}
if (!this.shouldBegin.call(this, e4)) {
return;
}
if (self2.keydown)
return;
var target = e4.target;
var targetIsCanvas = target && target.isCanvas && target.isCanvas();
if (!this.allowDragOnItem && !targetIsCanvas)
return;
self2.origin = {
x: e4.clientX,
y: e4.clientY
};
self2.dragging = false;
if (this.enableOptimize) {
var graph = this.graph;
var edges = graph.getEdges();
for (var i4 = 0, len5 = edges.length; i4 < len5; i4++) {
var shapes = edges[i4].get("group").get("children");
if (!shapes)
continue;
shapes.forEach(function(shape) {
shape.set("ori-visibility", shape.get("ori-visibility") || shape.get("visible"));
shape.hide();
});
}
var nodes = graph.getNodes();
for (var j4 = 0, nodeLen = nodes.length; j4 < nodeLen; j4++) {
var container2 = nodes[j4].getContainer();
var children = container2.get("children");
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
var child = children_1[_i];
var isKeyShape = child.get("isKeyShape");
if (!isKeyShape) {
child.set("ori-visibility", child.get("ori-visibility") || child.get("visible"));
child.hide();
}
}
}
}
},
onTouchMove: function onTouchMove(e4) {
var self2 = this;
var touches = e4.originalEvent.touches;
var event1 = touches[0];
var event2 = touches[1];
if (event1 && event2) {
this.onMouseUp(e4);
return;
}
e4.preventDefault();
self2.onMouseMove(e4);
},
onMouseMove: function onMouseMove(e4) {
var graph = this.graph;
if (this.keydown)
return;
var target = e4.target;
var targetIsCanvas = target && target.isCanvas && target.isCanvas();
if (!this.allowDragOnItem && !targetIsCanvas)
return;
e4 = cloneEvent4(e4);
if (!this.origin) {
return;
}
if (!this.dragging) {
if (abs(this.origin.x - e4.clientX) + abs(this.origin.y - e4.clientY) < DRAG_OFFSET) {
return;
}
if (this.shouldBegin.call(this, e4)) {
e4.type = "dragstart";
graph.emit("canvas:dragstart", e4);
this.dragging = true;
}
} else {
e4.type = "drag";
graph.emit("canvas:drag", e4);
}
if (this.shouldUpdate.call(this, e4)) {
this.updateViewport(e4);
}
},
onMouseUp: function onMouseUp(e4) {
var graph = this.graph;
if (this.keydown)
return;
if (this.enableOptimize) {
var edges = graph.getEdges();
for (var i4 = 0, len5 = edges.length; i4 < len5; i4++) {
var shapes = edges[i4].get("group").get("children");
if (!shapes)
continue;
shapes.forEach(function(shape) {
var oriVis2 = shape.get("ori-visibility");
if (oriVis2)
shape.show();
});
}
var nodes = graph.getNodes();
for (var j4 = 0, nodeLen = nodes.length; j4 < nodeLen; j4++) {
var container2 = nodes[j4].getContainer();
var children = container2.get("children");
for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {
var child = children_2[_i];
var isKeyShape = child.get("isKeyShape");
if (!isKeyShape) {
var oriVis = child.get("ori-visibility");
if (oriVis)
child.show();
}
}
}
}
if (!this.dragging) {
this.origin = null;
return;
}
e4 = cloneEvent4(e4);
if (this.shouldEnd.call(this, e4)) {
this.updateViewport(e4);
}
e4.type = "dragend";
graph.emit("canvas:dragend", e4);
this.endDrag();
},
endDrag: function endDrag() {
this.origin = null;
this.dragging = false;
this.dragbegin = false;
},
onKeyDown: function onKeyDown(e4) {
var self2 = this;
var code = e4.key;
if (!code) {
return;
}
if (ALLOW_EVENTS.indexOf(code.toLowerCase()) > -1) {
self2.keydown = true;
} else {
self2.keydown = false;
}
},
onKeyUp: function onKeyUp() {
this.keydown = false;
this.origin = null;
this.dragging = false;
this.dragbegin = false;
}
};
// node_modules/@antv/g6-pc/es/behavior/drag-node.js
var drag_node_default = {
getDefaultCfg: function getDefaultCfg3() {
return {
updateEdge: true,
delegateStyle: {},
enableDelegate: false,
onlyChangeComboSize: false,
comboActiveState: "",
selectedState: "selected",
enableOptimize: false,
enableDebounce: false
};
},
getEvents: function getEvents3() {
return {
"node:dragstart": "onDragStart",
"node:drag": "onDrag",
"node:dragend": "onDragEnd",
"combo:dragenter": "onDragEnter",
"combo:dragleave": "onDragLeave",
"combo:drop": "onDropCombo",
"node:drop": "onDropNode",
"canvas:drop": "onDropCanvas"
};
},
validationCombo: function validationCombo(item) {
if (!this.origin || !item || item.destroyed) {
return false;
}
var type2 = item.getType();
if (type2 !== "combo") {
return false;
}
return true;
},
onDragStart: function onDragStart(evt) {
var _this = this;
if (!this.shouldBegin.call(this, evt)) {
return;
}
var item = evt.item;
if (!item || item.destroyed || item.hasLocked()) {
return;
}
var group2 = item.getContainer();
group2.set("capture", false);
var target = evt.target;
if (target) {
var isAnchorPoint = target.get("isAnchorPoint");
if (isAnchorPoint) {
return;
}
}
var graph = this.graph;
this.targets = [];
this.targetCombo = null;
var nodes = graph.findAllByState("node", this.selectedState);
var currentNodeId = item.get("id");
var dragNodes = nodes.filter(function(node) {
var nodeId = node.get("id");
return currentNodeId === nodeId;
});
if (dragNodes.length === 0) {
this.targets.push(item);
} else if (nodes.length > 1) {
nodes.forEach(function(node) {
var locked = node.hasLocked();
if (!locked) {
_this.targets.push(node);
}
});
} else {
this.targets.push(item);
}
var beforeDragNodes = [];
this.targets.forEach(function(t4) {
beforeDragNodes.push(clone_default(t4.getModel()));
});
this.set("beforeDragNodes", beforeDragNodes);
this.hidenEdge = {};
if (this.get("updateEdge") && this.enableOptimize && !this.enableDelegate) {
this.targets.forEach(function(node) {
var edges = node.getEdges();
edges.forEach(function(edge2) {
if (!edge2.isVisible())
return;
_this.hidenEdge[edge2] = true;
edge2.hide();
});
});
}
this.origin = {
x: evt.x,
y: evt.y
};
this.point = {};
this.originPoint = {};
},
onDrag: function onDrag(evt) {
var _this = this;
if (!this.origin) {
return;
}
if (!this.shouldUpdate(this, evt)) {
return;
}
if (this.get("enableDelegate")) {
this.updateDelegate(evt);
} else {
if (this.enableDebounce)
this.debounceUpdate({
targets: this.targets,
graph: this.graph,
point: this.point,
origin: this.origin,
evt,
updateEdge: this.get("updateEdge")
});
else
this.targets.map(function(target) {
_this.update(target, evt);
});
}
},
onDragEnd: function onDragEnd(evt) {
var _this = this;
if (!this.origin || !this.shouldEnd.call(this, evt)) {
return;
}
var item = evt.item;
if (item) {
var group2 = item.getContainer();
group2.set("capture", true);
}
if (this.delegateRect) {
this.delegateRect.remove();
this.delegateRect = null;
}
this.updatePositions(evt);
if (this.get("updateEdge") && this.enableOptimize && !this.enableDelegate) {
this.targets.forEach(function(node) {
var edges = node.getEdges();
edges.forEach(function(edge2) {
if (_this.hidenEdge[edge2])
edge2.show();
edge2.refresh();
});
});
}
this.hidenEdge = {};
var graph = this.graph;
if (graph.get("enabledStack")) {
var stackData_1 = {
before: {
nodes: [],
edges: [],
combos: []
},
after: {
nodes: [],
edges: [],
combos: []
}
};
this.get("beforeDragNodes").forEach(function(model) {
stackData_1.before.nodes.push({
id: model.id,
x: model.x,
y: model.y
});
});
this.targets.forEach(function(target) {
var targetModel = target.getModel();
stackData_1.after.nodes.push({
id: targetModel.id,
x: targetModel.x,
y: targetModel.y
});
});
graph.pushStack("update", clone_default(stackData_1));
}
graph.emit("dragnodeend", {
items: this.targets,
targetItem: null
});
this.point = {};
this.origin = null;
this.originPoint = {};
this.targets.length = 0;
this.targetCombo = null;
},
onDropCombo: function onDropCombo(evt) {
var item = evt.item;
if (!this.validationCombo(item))
return;
this.updatePositions(evt);
var graph = this.graph;
if (this.comboActiveState) {
graph.setItemState(item, this.comboActiveState, false);
}
this.targetCombo = item;
if (this.onlyChangeComboSize) {
graph.updateCombos();
} else {
var targetComboModel_1 = item.getModel();
this.targets.map(function(node) {
var nodeModel = node.getModel();
if (nodeModel.comboId !== targetComboModel_1.id) {
graph.updateComboTree(node, targetComboModel_1.id);
}
});
graph.updateCombo(item);
}
graph.emit("dragnodeend", {
items: this.targets,
targetItem: this.targetCombo
});
},
onDropCanvas: function onDropCanvas(evt) {
var graph = this.graph;
if (!this.targets || this.targets.length === 0)
return;
this.updatePositions(evt);
if (this.onlyChangeComboSize) {
graph.updateCombos();
} else {
this.targets.map(function(node) {
var model = node.getModel();
if (model.comboId) {
graph.updateComboTree(node);
}
});
}
},
onDropNode: function onDropNode(evt) {
if (!this.targets || this.targets.length === 0)
return;
var self2 = this;
var item = evt.item;
this.updatePositions(evt);
var graph = self2.graph;
var comboId = item.getModel().comboId;
if (comboId) {
if (this.onlyChangeComboSize) {
graph.updateCombos();
} else {
var combo = graph.findById(comboId);
if (self2.comboActiveState) {
graph.setItemState(combo, self2.comboActiveState, false);
}
this.targets.map(function(node) {
var nodeModel = node.getModel();
if (comboId !== nodeModel.comboId) {
graph.updateComboTree(node, comboId);
}
});
graph.updateCombo(combo);
}
} else {
this.targets.map(function(node) {
var model = node.getModel();
if (model.comboId) {
graph.updateComboTree(node);
}
});
}
graph.emit("dragnodeend", {
items: this.targets,
targetItem: item
});
},
onDragEnter: function onDragEnter(evt) {
var item = evt.item;
if (!this.validationCombo(item))
return;
var graph = this.graph;
if (this.comboActiveState) {
graph.setItemState(item, this.comboActiveState, true);
}
},
onDragLeave: function onDragLeave(evt) {
var item = evt.item;
if (!this.validationCombo(item))
return;
var graph = this.graph;
if (this.comboActiveState) {
graph.setItemState(item, this.comboActiveState, false);
}
},
updatePositions: function updatePositions(evt) {
var _this = this;
if (!this.targets || this.targets.length === 0)
return;
if (this.get("enableDelegate")) {
if (this.enableDebounce)
this.debounceUpdate({
targets: this.targets,
graph: this.graph,
point: this.point,
origin: this.origin,
evt,
updateEdge: this.get("updateEdge"),
updateFunc: this.update
});
else
this.targets.map(function(node) {
return _this.update(node, evt);
});
}
},
update: function update14(item, evt) {
var origin = this.origin;
var model = item.get("model");
var nodeId = item.get("id");
if (!this.point[nodeId]) {
this.point[nodeId] = {
x: model.x || 0,
y: model.y || 0
};
}
var x6 = evt.x - origin.x + this.point[nodeId].x;
var y5 = evt.y - origin.y + this.point[nodeId].y;
var pos = {
x: x6,
y: y5
};
if (this.get("updateEdge")) {
this.graph.updateItem(item, pos, false);
} else {
item.updatePosition(pos);
}
},
debounceUpdate: debounce_default(function(event) {
var targets = event.targets, graph = event.graph, point2 = event.point, origin = event.origin, evt = event.evt, updateEdge = event.updateEdge, updateFunc = event.updateFunc;
targets.map(function(item) {
var model = item.get("model");
var nodeId = item.get("id");
if (!point2[nodeId]) {
point2[nodeId] = {
x: model.x || 0,
y: model.y || 0
};
}
var x6 = evt.x - origin.x + point2[nodeId].x;
var y5 = evt.y - origin.y + point2[nodeId].y;
var pos = {
x: x6,
y: y5
};
if (updateEdge) {
graph.updateItem(item, pos, false);
} else {
item.updatePosition(pos);
}
});
}, 50, true),
updateDelegate: function updateDelegate(e4) {
var graph = this.graph;
if (!this.delegateRect) {
var parent_1 = graph.get("group");
var attrs = deep_mix_default({}, global_default2.delegateStyle, this.delegateStyle);
var _a6 = this.calculationGroupPosition(e4), cx = _a6.x, cy = _a6.y, width2 = _a6.width, height = _a6.height, minX = _a6.minX, minY = _a6.minY;
this.originPoint = {
x: cx,
y: cy,
width: width2,
height,
minX,
minY
};
this.delegateRect = parent_1.addShape("rect", {
attrs: __assign({
width: width2,
height,
x: cx,
y: cy
}, attrs),
name: "rect-delegate-shape"
});
this.delegate = this.delegateRect;
this.delegateRect.set("capture", false);
} else {
var clientX = e4.x - this.origin.x + this.originPoint.minX;
var clientY = e4.y - this.origin.y + this.originPoint.minY;
this.delegateRect.attr({
x: clientX,
y: clientY
});
}
},
calculationGroupPosition: function calculationGroupPosition(evt) {
var nodes = this.targets;
if (nodes.length === 0) {
nodes.push(evt.item);
}
var minx = Infinity;
var maxx = -Infinity;
var miny = Infinity;
var maxy = -Infinity;
for (var i4 = 0; i4 < nodes.length; i4++) {
var element = nodes[i4];
var bbox = element.getBBox();
var minX = bbox.minX, minY = bbox.minY, maxX = bbox.maxX, maxY2 = bbox.maxY;
if (minX < minx) {
minx = minX;
}
if (minY < miny) {
miny = minY;
}
if (maxX > maxx) {
maxx = maxX;
}
if (maxY2 > maxy) {
maxy = maxY2;
}
}
var x6 = Math.floor(minx);
var y5 = Math.floor(miny);
var width2 = Math.ceil(maxx) - Math.floor(minx);
var height = Math.ceil(maxy) - Math.floor(miny);
return {
x: x6,
y: y5,
width: width2,
height,
minX: minx,
minY: miny
};
}
};
// node_modules/@antv/g6-pc/es/behavior/activate-relations.js
var activate_relations_default = {
getDefaultCfg: function getDefaultCfg4() {
return {
trigger: "mouseenter",
activeState: "active",
inactiveState: "inactive",
resetSelected: false,
shouldUpdate: function shouldUpdate3() {
return true;
}
};
},
getEvents: function getEvents4() {
if (this.get("trigger") === "mouseenter") {
return {
"node:mouseenter": "setAllItemStates",
"combo:mouseenter": "setAllItemStates",
"node:mouseleave": "clearActiveState",
"combo:mouseleave": "clearActiveState"
};
}
return {
"node:click": "setAllItemStates",
"combo:click": "setAllItemStates",
"canvas:click": "clearAllItemStates"
};
},
setAllItemStates: function setAllItemStates(e4) {
var item = e4.item;
var graph = this.graph;
this.item = item;
if (!this.shouldUpdate(e4.item, {
event: e4,
action: "activate"
})) {
return;
}
var self2 = this;
var activeState = this.activeState;
var inactiveState = this.inactiveState;
var nodes = graph.getNodes();
var combos = graph.getCombos();
var edges = graph.getEdges();
var vEdges = graph.get("vedges");
var nodeLength = nodes.length;
var comboLength = combos.length;
var edgeLength = edges.length;
var vEdgeLength = vEdges.length;
for (var i4 = 0; i4 < nodeLength; i4++) {
var node = nodes[i4];
var hasSelected = node.hasState("selected");
if (self2.resetSelected) {
if (hasSelected) {
graph.setItemState(node, "selected", false);
}
}
graph.setItemState(node, activeState, false);
if (inactiveState) {
graph.setItemState(node, inactiveState, true);
}
}
for (var i4 = 0; i4 < comboLength; i4++) {
var combo = combos[i4];
var hasSelected = combo.hasState("selected");
if (self2.resetSelected) {
if (hasSelected) {
graph.setItemState(combo, "selected", false);
}
}
graph.setItemState(combo, activeState, false);
if (inactiveState) {
graph.setItemState(combo, inactiveState, true);
}
}
for (var i4 = 0; i4 < edgeLength; i4++) {
var edge2 = edges[i4];
graph.setItemState(edge2, activeState, false);
if (inactiveState) {
graph.setItemState(edge2, inactiveState, true);
}
}
for (var i4 = 0; i4 < vEdgeLength; i4++) {
var vEdge = vEdges[i4];
graph.setItemState(vEdge, activeState, false);
if (inactiveState) {
graph.setItemState(vEdge, inactiveState, true);
}
}
if (inactiveState) {
graph.setItemState(item, inactiveState, false);
}
graph.setItemState(item, activeState, true);
var rEdges = item.getEdges();
var rEdgeLegnth = rEdges.length;
for (var i4 = 0; i4 < rEdgeLegnth; i4++) {
var edge2 = rEdges[i4];
var otherEnd = void 0;
if (edge2.getSource() === item) {
otherEnd = edge2.getTarget();
} else {
otherEnd = edge2.getSource();
}
if (inactiveState) {
graph.setItemState(otherEnd, inactiveState, false);
}
graph.setItemState(otherEnd, activeState, true);
graph.setItemState(edge2, inactiveState, false);
graph.setItemState(edge2, activeState, true);
edge2.toFront();
}
graph.emit("afteractivaterelations", {
item: e4.item,
action: "activate"
});
},
clearActiveState: function clearActiveState(e4) {
var self2 = this;
var graph = self2.get("graph");
if (!self2.shouldUpdate(e4.item, {
event: e4,
action: "deactivate"
})) {
return;
}
var activeState = this.activeState;
var inactiveState = this.inactiveState;
var autoPaint = graph.get("autoPaint");
graph.setAutoPaint(false);
var nodes = graph.getNodes();
var combos = graph.getCombos();
var edges = graph.getEdges();
var vEdges = graph.get("vedges");
var nodeLength = nodes.length;
var comboLength = combos.length;
var edgeLength = edges.length;
var vEdgeLength = vEdges.length;
for (var i4 = 0; i4 < nodeLength; i4++) {
var node = nodes[i4];
graph.clearItemStates(node, [activeState, inactiveState]);
}
for (var i4 = 0; i4 < comboLength; i4++) {
var combo = combos[i4];
graph.clearItemStates(combo, [activeState, inactiveState]);
}
for (var i4 = 0; i4 < edgeLength; i4++) {
var edge2 = edges[i4];
graph.clearItemStates(edge2, [activeState, inactiveState, "deactivate"]);
}
for (var i4 = 0; i4 < vEdgeLength; i4++) {
var vEdge = vEdges[i4];
graph.clearItemStates(vEdge, [activeState, inactiveState, "deactivate"]);
}
graph.paint();
graph.setAutoPaint(autoPaint);
graph.emit("afteractivaterelations", {
item: e4.item || self2.get("item"),
action: "deactivate"
});
},
clearAllItemStates: function clearAllItemStates(e4) {
var self2 = this;
var graph = self2.graph;
if (!self2.shouldUpdate(e4.item, {
event: e4,
action: "deactivate"
})) {
return;
}
var activeState = this.activeState;
var inactiveState = this.inactiveState;
var nodes = graph.getNodes();
var edges = graph.getEdges();
var nodeLength = nodes.length;
var edgeLength = edges.length;
for (var i4 = 0; i4 < nodeLength; i4++) {
var node = nodes[i4];
graph.clearItemStates(node, [activeState, inactiveState]);
}
for (var i4 = 0; i4 < edgeLength; i4++) {
var edge2 = edges[i4];
graph.clearItemStates(edge2, [activeState, inactiveState, "deactivate"]);
}
graph.emit("afteractivaterelations", {
item: e4.item || self2.get("item"),
action: "deactivate"
});
}
};
// node_modules/@antv/g6-pc/es/behavior/brush-select.js
var min6 = Math.min;
var max7 = Math.max;
var abs2 = Math.abs;
var DEFAULT_TRIGGER = "shift";
var ALLOW_EVENTS2 = ["drag", "shift", "ctrl", "alt", "control"];
var brush_select_default = {
getDefaultCfg: function getDefaultCfg5() {
return {
brushStyle: {
fill: "#EEF6FF",
fillOpacity: 0.4,
stroke: "#DDEEFE",
lineWidth: 1
},
onSelect: function onSelect() {
},
onDeselect: function onDeselect() {
},
selectedState: "selected",
trigger: DEFAULT_TRIGGER,
includeEdges: true,
selectedEdges: [],
selectedNodes: []
};
},
getEvents: function getEvents5() {
if (!(ALLOW_EVENTS2.indexOf(this.trigger.toLowerCase()) > -1)) {
this.trigger = DEFAULT_TRIGGER;
console.warn("Behavior brush-select \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'drag'\u3001'shift'\u3001'ctrl' \u6216 'alt'");
}
if (this.trigger === "drag") {
return {
dragstart: "onMouseDown",
drag: "onMouseMove",
dragend: "onMouseUp",
"canvas:click": "clearStates"
};
}
return {
dragstart: "onMouseDown",
drag: "onMouseMove",
dragend: "onMouseUp",
"canvas:click": "clearStates",
keyup: "onKeyUp",
keydown: "onKeyDown"
};
},
onMouseDown: function onMouseDown2(e4) {
var item = e4.item;
var brush = this.brush;
if (item) {
return;
}
if (this.trigger !== "drag" && !this.keydown) {
return;
}
if (this.selectedNodes && this.selectedNodes.length !== 0) {
this.clearStates();
}
if (!brush) {
brush = this.createBrush();
}
this.originPoint = {
x: e4.canvasX,
y: e4.canvasY
};
brush.attr({
width: 0,
height: 0
});
brush.show();
this.dragging = true;
},
onMouseMove: function onMouseMove2(e4) {
if (!this.dragging) {
return;
}
if (this.trigger !== "drag" && !this.keydown) {
return;
}
this.updateBrush(e4);
},
onMouseUp: function onMouseUp2(e4) {
var graph = this.graph;
if (!this.brush && !this.dragging) {
return;
}
if (this.trigger !== "drag" && !this.keydown) {
return;
}
this.brush.remove(true);
this.brush = null;
this.getSelectedNodes(e4);
this.dragging = false;
},
clearStates: function clearStates() {
var _a6 = this, graph = _a6.graph, selectedState = _a6.selectedState;
var nodes = graph.findAllByState("node", selectedState);
var edges = graph.findAllByState("edge", selectedState);
nodes.forEach(function(node) {
return graph.setItemState(node, selectedState, false);
});
edges.forEach(function(edge2) {
return graph.setItemState(edge2, selectedState, false);
});
this.selectedNodes = [];
this.selectedEdges = [];
if (this.onDeselect) {
this.onDeselect(this.selectedNodes, this.selectedEdges);
}
graph.emit("nodeselectchange", {
selectedItems: {
nodes: [],
edges: []
},
select: false
});
},
getSelectedNodes: function getSelectedNodes(e4) {
var _this = this;
var _a6 = this, graph = _a6.graph, originPoint = _a6.originPoint, shouldUpdate3 = _a6.shouldUpdate;
var state2 = this.selectedState;
var p1 = {
x: e4.x,
y: e4.y
};
var p22 = graph.getPointByCanvas(originPoint.x, originPoint.y);
var left2 = min6(p1.x, p22.x);
var right2 = max7(p1.x, p22.x);
var top = min6(p1.y, p22.y);
var bottom = max7(p1.y, p22.y);
var selectedNodes = [];
var selectedIds = [];
graph.getNodes().forEach(function(node) {
var bbox = node.getBBox();
if (bbox.centerX >= left2 && bbox.centerX <= right2 && bbox.centerY >= top && bbox.centerY <= bottom) {
if (shouldUpdate3(node, "select")) {
selectedNodes.push(node);
var model = node.getModel();
selectedIds.push(model.id);
graph.setItemState(node, state2, true);
}
}
});
var selectedEdges = [];
if (this.includeEdges) {
selectedNodes.forEach(function(node) {
var edges = node.getOutEdges();
edges.forEach(function(edge2) {
var model = edge2.getModel();
var source = model.source, target = model.target;
if (selectedIds.includes(source) && selectedIds.includes(target) && shouldUpdate3(edge2, "select")) {
selectedEdges.push(edge2);
graph.setItemState(edge2, _this.selectedState, true);
}
});
});
}
this.selectedEdges = selectedEdges;
this.selectedNodes = selectedNodes;
if (this.onSelect) {
this.onSelect(selectedNodes, selectedEdges);
}
graph.emit("nodeselectchange", {
selectedItems: {
nodes: selectedNodes,
edges: selectedEdges
},
select: true
});
},
createBrush: function createBrush() {
var self2 = this;
var brush = self2.graph.get("canvas").addShape("rect", {
attrs: self2.brushStyle,
capture: false,
name: "brush-shape"
});
this.brush = brush;
this.delegate = brush;
return brush;
},
updateBrush: function updateBrush(e4) {
var originPoint = this.originPoint;
this.brush.attr({
width: abs2(e4.canvasX - originPoint.x),
height: abs2(e4.canvasY - originPoint.y),
x: min6(e4.canvasX, originPoint.x),
y: min6(e4.canvasY, originPoint.y)
});
},
onKeyDown: function onKeyDown2(e4) {
var code = e4.key;
if (!code) {
return;
}
var triggerLowerCase = this.trigger.toLowerCase();
var codeLowerCase = code.toLowerCase();
if (codeLowerCase === triggerLowerCase || codeLowerCase === "control" && triggerLowerCase === "ctrl" || codeLowerCase === "ctrl" && triggerLowerCase === "control") {
this.keydown = true;
} else {
this.keydown = false;
}
},
onKeyUp: function onKeyUp2() {
if (this.brush) {
this.brush.remove(true);
this.brush = null;
this.dragging = false;
}
this.keydown = false;
}
};
// node_modules/@antv/g6-pc/es/behavior/click-select.js
var DEFAULT_TRIGGER2 = "shift";
var ALLOW_EVENTS3 = ["shift", "ctrl", "alt", "control"];
var click_select_default = {
getDefaultCfg: function getDefaultCfg6() {
return {
multiple: true,
trigger: DEFAULT_TRIGGER2,
selectedState: "selected"
};
},
getEvents: function getEvents6() {
var self2 = this;
if (!(ALLOW_EVENTS3.indexOf(self2.trigger.toLowerCase()) > -1)) {
self2.trigger = DEFAULT_TRIGGER2;
console.warn("Behavior brush-select \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'drag'\u3001'shift'\u3001'ctrl' \u6216 'alt'");
}
if (!self2.multiple) {
return {
"node:click": "onClick",
"combo:click": "onClick",
"canvas:click": "onCanvasClick"
};
}
return {
"node:click": "onClick",
"combo:click": "onClick",
"canvas:click": "onCanvasClick",
keyup: "onKeyUp",
keydown: "onKeyDown"
};
},
onClick: function onClick(evt) {
var self2 = this;
var item = evt.item;
if (!item || item.destroyed) {
return;
}
var type2 = item.getType();
var graph = self2.graph, keydown = self2.keydown, multiple = self2.multiple, shouldUpdate3 = self2.shouldUpdate, shouldBegin2 = self2.shouldBegin;
if (!shouldBegin2.call(self2, evt)) {
return;
}
if (!keydown || !multiple) {
var selected = graph.findAllByState(type2, self2.selectedState);
each_default(selected, function(combo) {
if (combo !== item) {
graph.setItemState(combo, self2.selectedState, false);
}
});
}
if (item.hasState(self2.selectedState)) {
if (shouldUpdate3.call(self2, evt)) {
graph.setItemState(item, self2.selectedState, false);
}
var selectedNodes = graph.findAllByState("node", self2.selectedState);
var selectedCombos = graph.findAllByState("combo", self2.selectedState);
graph.emit("nodeselectchange", {
target: item,
selectedItems: {
nodes: selectedNodes,
combos: selectedCombos
},
select: false
});
} else {
if (shouldUpdate3.call(self2, evt)) {
graph.setItemState(item, self2.selectedState, true);
}
var selectedNodes = graph.findAllByState("node", self2.selectedState);
var selectedCombos = graph.findAllByState("combo", self2.selectedState);
graph.emit("nodeselectchange", {
target: item,
selectedItems: {
nodes: selectedNodes,
combos: selectedCombos
},
select: true
});
}
},
onCanvasClick: function onCanvasClick() {
var _this = this;
var graph = this.graph;
var selected = graph.findAllByState("node", this.selectedState);
each_default(selected, function(node) {
graph.setItemState(node, _this.selectedState, false);
});
var selectedCombos = graph.findAllByState("combo", this.selectedState);
each_default(selectedCombos, function(combo) {
graph.setItemState(combo, _this.selectedState, false);
});
graph.emit("nodeselectchange", {
selectedItems: {
nodes: [],
edges: [],
combos: []
},
select: false
});
},
onKeyDown: function onKeyDown3(e4) {
var self2 = this;
var code = e4.key;
if (!code) {
return;
}
if (code.toLowerCase() === this.trigger.toLowerCase() || code.toLowerCase() === "control") {
self2.keydown = true;
} else {
self2.keydown = false;
}
},
onKeyUp: function onKeyUp3() {
var self2 = this;
self2.keydown = false;
}
};
// node_modules/@antv/g6-pc/es/behavior/zoom-canvas.js
var transform17 = ext_exports3.transform;
var DELTA4 = 0.05;
var zoom_canvas_default = {
getDefaultCfg: function getDefaultCfg7() {
return {
sensitivity: 2,
minZoom: void 0,
maxZoom: void 0,
enableOptimize: false,
optimizeZoom: 0.1,
fixSelectedItems: {
fixAll: false,
fixLineWidth: false,
fixLabel: false,
fixState: "selected"
}
};
},
getEvents: function getEvents7() {
var fixSelectedItems = this.fixSelectedItems;
if (!fixSelectedItems.fixState)
fixSelectedItems.fixState = "selected";
if (fixSelectedItems.fixAll) {
fixSelectedItems.fixLineWidth = true;
fixSelectedItems.fixLabel = true;
}
return {
wheel: "onWheel",
touchstart: "onTouchStart",
touchmove: "onTouchMove",
touchend: "onTouchEnd"
};
},
onTouchStart: function onTouchStart2(evt) {
var touches = evt.originalEvent.touches;
var event1 = touches[0];
var event2 = touches[1];
evt.preventDefault();
if (!event2) {
return;
}
if (this.shouldBegin && !this.shouldBegin.call(this, evt)) {
return;
}
this.startPoint = {
pageX: event1.pageX,
pageY: event1.pageY
};
this.moveable = true;
if (event2) {
this.endPoint = {
pageX: event2.pageX,
pageY: event2.pageY
};
}
this.originScale = this.graph.getZoom() || this.currentScale || 1;
},
onTouchMove: function onTouchMove2(evt) {
if (!this.moveable) {
return;
}
evt.preventDefault();
var touches = evt.originalEvent.touches;
var event1 = touches[0];
var event2 = touches[1];
if (!event2) {
return;
}
if (!this.endPoint) {
this.endPoint = {
pageX: event2.pageX,
pageY: event2.pageY
};
}
var getDistance3 = function getDistance4(start, end2) {
return Math.hypot(end2.x - start.x, end2.y - start.y);
};
var scale12 = getDistance3({
x: event1.pageX,
y: event1.pageY
}, {
x: event2.pageX,
y: event2.pageY
}) / getDistance3({
x: this.startPoint.pageX,
y: this.startPoint.pageY
}, {
x: this.endPoint.pageX,
y: this.endPoint.pageY
});
var zoom2 = this.originScale * scale12;
this.currentScale = zoom2;
var minZoom = this.get("minZoom") || this.graph.get("minZoom");
var maxZoom = this.get("maxZoom") || this.graph.get("maxZoom");
if (zoom2 > maxZoom || zoom2 < minZoom) {
return;
}
var canvas = this.graph.get("canvas");
var point2 = canvas.getPointByClient(evt.clientX, evt.clientY);
this.graph.zoomTo(zoom2, {
x: point2.x,
y: point2.y
});
this.graph.emit("wheelzoom", evt);
},
onTouchEnd: function onTouchEnd() {
this.moveable = false;
this.endPoint = null;
},
onWheel: function onWheel(e4) {
var _this = this;
var _a6 = this, graph = _a6.graph, fixSelectedItems = _a6.fixSelectedItems;
if (this.shouldBegin && !this.shouldBegin.call(this, e4)) {
return;
}
if (!this.shouldUpdate.call(this, e4)) {
return;
}
e4.preventDefault();
var canvas = graph.get("canvas");
var point2 = canvas.getPointByClient(e4.clientX, e4.clientY);
var sensitivity = this.get("sensitivity");
var graphZoom = graph.getZoom();
var ratio = graphZoom;
var zoom2 = graphZoom;
if (e4.wheelDelta < 0) {
ratio = 1 - DELTA4 * sensitivity;
} else {
ratio = 1 / (1 - DELTA4 * sensitivity);
}
zoom2 = graphZoom * ratio;
var minZoom = this.get("minZoom") || graph.get("minZoom");
var maxZoom = this.get("maxZoom") || graph.get("maxZoom");
if (zoom2 > maxZoom || zoom2 < minZoom) {
return;
}
var enableOptimize = this.get("enableOptimize");
if (enableOptimize) {
var optimizeZoom_1 = this.get("optimizeZoom");
var optimized = this.get("optimized");
var nodes_1 = graph.getNodes();
var edges_1 = graph.getEdges();
var nodesLength_1 = nodes_1.length;
var edgesLength_1 = edges_1.length;
if (!optimized) {
for (var n3 = 0; n3 < nodesLength_1; n3++) {
var node = nodes_1[n3];
if (!node.destroyed) {
var children = node.get("group").get("children");
var childrenLength = children.length;
for (var c5 = 0; c5 < childrenLength; c5++) {
var shape = children[c5];
if (!shape.destoryed && !shape.get("isKeyShape")) {
shape.set("ori-visibility", shape.get("ori-visibility") || shape.get("visible"));
shape.hide();
}
}
}
}
for (var edgeIndex = 0; edgeIndex < edgesLength_1; edgeIndex++) {
var edge2 = edges_1[edgeIndex];
var children = edge2.get("group").get("children");
var childrenLength = children.length;
for (var c5 = 0; c5 < childrenLength; c5++) {
var shape = children[c5];
shape.set("ori-visibility", shape.get("ori-visibility") || shape.get("visible"));
shape.hide();
}
}
this.set("optimized", true);
}
clearTimeout(this.get("timeout"));
var timeout2 = setTimeout(function() {
var currentZoom = graph.getZoom();
var curOptimized = _this.get("optimized");
if (curOptimized) {
_this.set("optimized", false);
for (var n4 = 0; n4 < nodesLength_1; n4++) {
var node2 = nodes_1[n4];
var children2 = node2.get("group").get("children");
var childrenLength2 = children2.length;
if (currentZoom < optimizeZoom_1) {
var keyShape = node2.getKeyShape();
var oriVis = keyShape.get("ori-visibility");
if (oriVis)
keyShape.show();
} else {
for (var c6 = 0; c6 < childrenLength2; c6++) {
var shape2 = children2[c6];
var oriVis = shape2.get("ori-visibility");
if (!shape2.get("visible") && oriVis) {
if (oriVis)
shape2.show();
}
}
}
}
for (var edgeIndex2 = 0; edgeIndex2 < edgesLength_1; edgeIndex2++) {
var edge3 = edges_1[edgeIndex2];
var children2 = edge3.get("group").get("children");
var childrenLength2 = children2.length;
if (currentZoom < optimizeZoom_1) {
var keyShape = edge3.getKeyShape();
var oriVis = keyShape.get("ori-visibility");
if (oriVis)
keyShape.show();
} else {
for (var c6 = 0; c6 < childrenLength2; c6++) {
var shape2 = children2[c6];
if (!shape2.get("visible")) {
var oriVis = shape2.get("ori-visibility");
if (oriVis)
shape2.show();
}
}
}
}
}
}, 100);
this.set("timeout", timeout2);
}
if (graphZoom <= 1) {
var fixNodes = void 0, fixEdges = void 0;
if (fixSelectedItems.fixAll || fixSelectedItems.fixLineWidth || fixSelectedItems.fixLabel) {
fixNodes = graph.findAllByState("node", fixSelectedItems.fixState);
fixEdges = graph.findAllByState("edge", fixSelectedItems.fixState);
var scale12 = graphZoom / zoom2;
var fixNodesLength = fixNodes.length;
for (var fn2 = 0; fn2 < fixNodesLength; fn2++) {
var node = fixNodes[fn2];
var group2 = node.getContainer();
var nodeModel = node.getModel();
var originStyle = node.getOriginStyle();
var itemStateStyle = node.getStateStyle(fixSelectedItems.fixState);
var shapeStateStyle = node.get("shapeFactory").getShape(nodeModel.type).getStateStyle(fixSelectedItems.fixState, node)[fixSelectedItems.fixState];
if (fixSelectedItems.fixAll) {
if (zoom2 <= 1) {
var groupMatrix = clone_default(group2.getMatrix());
if (!groupMatrix)
groupMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
var _b = node.getModel(), x6 = _b.x, y5 = _b.y;
groupMatrix = transform17(groupMatrix, [["t", -x6, -y5], ["s", scale12, scale12], ["t", x6, y5]]);
group2.setMatrix(groupMatrix);
}
} else {
var children = group2.get("children");
var childrenLength = children.length;
for (var c5 = 0; c5 < childrenLength; c5++) {
var shape = children[c5];
var fontSize = void 0, lineWidth = void 0;
if (fixSelectedItems.fixLabel) {
var shapeType = shape.get("type");
if (shapeType === "text") {
fontSize = shape.attr("fontSize") || 12;
var itemStyle = itemStateStyle[shape.get("name")];
var shapeStyle = shapeStateStyle[shape.get("name")];
var itemFontSize = itemStyle ? itemStyle.fontSize : 12;
var shapeFontSize = shapeStyle ? shapeStyle.fontSize : 12;
var oriFontSize = itemFontSize || shapeFontSize || 12;
if (zoom2 <= 1)
shape.attr("fontSize", oriFontSize / zoom2);
if (lineWidth)
break;
}
}
if (fixSelectedItems.fixLineWidth) {
if (shape.get("isKeyShape")) {
lineWidth = shape.attr("lineWidth") || 0;
var oriLineWidth = itemStateStyle.lineWidth || shapeStateStyle.lineWidth || originStyle.lineWidth || 0;
if (zoom2 <= 1)
shape.attr("lineWidth", oriLineWidth / zoom2);
if (fontSize)
break;
}
}
}
}
}
var fixEdgesLength = fixEdges.length;
for (var fe = 0; fe < fixEdgesLength; fe++) {
var edge2 = fixEdges[fe];
var group2 = edge2.getContainer();
var children = group2.get("children");
var nodeModel = edge2.getModel();
var itemStateStyle = edge2.getStateStyle(fixSelectedItems.fixState);
var shapeStateStyle = edge2.get("shapeFactory").getShape(nodeModel.type).getStateStyle(fixSelectedItems.fixState, edge2)[fixSelectedItems.fixState];
var childrenLength = children.length;
for (var c5 = 0; c5 < childrenLength; c5++) {
var shape = children[c5];
var fontSize = void 0, lineWidth = void 0;
if (fixSelectedItems.fixLabel || fixSelectedItems.fixAll) {
var shapeType = shape.get("type");
if (shapeType === "text") {
fontSize = shape.attr("fontSize") || 12;
var itemStyle = itemStateStyle[shape.get("name")];
var shapeStyle = shapeStateStyle[shape.get("name")];
var itemFontSize = itemStyle ? itemStyle.fontSize : 12;
var shapeFontSize = shapeStyle ? shapeStyle.fontSize : 12;
var oriFontSize = itemFontSize || shapeFontSize || 12;
if (zoom2 <= 1)
shape.attr("fontSize", oriFontSize / zoom2);
if (lineWidth)
break;
}
}
if (fixSelectedItems.fixLineWidth || fixSelectedItems.fixAll) {
if (shape.get("isKeyShape")) {
lineWidth = shape.attr("lineWidth") || 0;
var oriLineWidth = itemStateStyle.lineWidth || shapeStateStyle.lineWidth || 1;
if (zoom2 <= 1)
shape.attr("lineWidth", oriLineWidth / zoom2);
if (fontSize)
break;
}
}
}
}
}
}
graph.zoomTo(zoom2, {
x: point2.x,
y: point2.y
});
graph.emit("wheelzoom", e4);
}
};
// node_modules/@antv/g6-pc/es/behavior/tooltip-base.js
var tooltip_base_default = {
onMouseEnter: function onMouseEnter(e4) {
var item = e4.item;
this.currentTarget = item;
this.showTooltip(e4);
this.graph.emit("tooltipchange", {
item: e4.item,
action: "show"
});
},
onMouseMove: function onMouseMove3(e4) {
if (!this.shouldUpdate(e4)) {
this.hideTooltip();
return;
}
if (!this.currentTarget || e4.item !== this.currentTarget) {
return;
}
this.updatePosition(e4);
},
onMouseLeave: function onMouseLeave(e4) {
if (!this.shouldEnd(e4)) {
return;
}
this.hideTooltip();
this.graph.emit("tooltipchange", {
item: this.currentTarget,
action: "hide"
});
this.currentTarget = null;
},
showTooltip: function showTooltip(e4) {
var container2 = this.container;
if (!e4.item || e4.item.destroyed) {
return;
}
if (!container2) {
container2 = this.createTooltip(this.graph.get("canvas"));
this.container = container2;
}
var text = this.formatText(e4.item.get("model"), e4);
container2.innerHTML = text;
modifyCSS(this.container, {
visibility: "visible"
});
this.updatePosition(e4);
},
hideTooltip: function hideTooltip() {
modifyCSS(this.container, {
visibility: "hidden"
});
},
updatePosition: function updatePosition(e4) {
var shouldBegin2 = this.get("shouldBegin");
var _a6 = this, width2 = _a6.width, height = _a6.height, container2 = _a6.container, graph = _a6.graph;
if (!shouldBegin2(e4)) {
modifyCSS(container2, {
visibility: "hidden"
});
return;
}
var point2 = graph.getPointByClient(e4.clientX, e4.clientY);
var _b = graph.getCanvasByPoint(point2.x, point2.y), x6 = _b.x, y5 = _b.y;
var bbox = container2.getBoundingClientRect();
if (x6 > width2 / 2) {
x6 -= bbox.width;
} else {
x6 += this.offset;
}
if (y5 > height / 2) {
y5 -= bbox.height;
} else {
y5 += this.offset;
}
var left2 = x6 + "px";
var top = y5 + "px";
modifyCSS(this.container, {
left: left2,
top,
visibility: "visible"
});
},
createTooltip: function createTooltip(canvas) {
var el = canvas.get("el");
el.style.position = "relative";
var container2 = createDom('');
el.parentNode.appendChild(container2);
modifyCSS(container2, {
position: "absolute",
visibility: "visible"
});
this.width = canvas.get("width");
this.height = canvas.get("height");
this.container = container2;
this.graph.get("tooltips").push(container2);
return container2;
}
};
// node_modules/@antv/g6-pc/es/behavior/tooltip.js
var tooltip_default3 = __assign({
getDefaultCfg: function getDefaultCfg8() {
return {
item: "node",
offset: 12,
formatText: function formatText(model) {
return model.label;
}
};
},
getEvents: function getEvents8() {
return {
"node:mouseenter": "onMouseEnter",
"node:mouseleave": "onMouseLeave",
"node:mousemove": "onMouseMove",
afterremoveitem: "onMouseLeave"
};
}
}, tooltip_base_default);
// node_modules/@antv/g6-pc/es/behavior/edge-tooltip.js
var edge_tooltip_default = __assign({
getDefaultCfg: function getDefaultCfg9() {
return {
item: "edge",
offset: 12,
formatText: function formatText(model) {
return "source: " + model.source + " target: " + model.target;
}
};
},
getEvents: function getEvents9() {
return {
"edge:mouseenter": "onMouseEnter",
"edge:mouseleave": "onMouseLeave",
"edge:mousemove": "onMouseMove",
afterremoveitem: "onMouseLeave"
};
}
}, tooltip_base_default);
// node_modules/@antv/g6-pc/es/behavior/collapse-expand.js
var DEFAULT_TRIGGER3 = "click";
var ALLOW_EVENTS4 = ["click", "dblclick"];
var collapse_expand_default = {
getDefaultCfg: function getDefaultCfg10() {
return {
trigger: DEFAULT_TRIGGER3,
onChange: function onChange() {
}
};
},
getEvents: function getEvents10() {
var _a6;
var trigger;
if (ALLOW_EVENTS4.includes(this.trigger)) {
trigger = this.trigger;
} else {
trigger = DEFAULT_TRIGGER3;
console.warn("Behavior collapse-expand \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'click' \u6216 'dblclick'");
}
return _a6 = {}, _a6["node:" + trigger] = "onNodeClick", _a6.touchstart = "onNodeClick", _a6;
},
onNodeClick: function onNodeClick(e4) {
var item = e4.item;
if (!item)
return;
var sourceData = this.graph.findDataById(item.get("id"));
if (!sourceData) {
return;
}
var children = sourceData.children;
if (!children || children.length === 0) {
return;
}
var collapsed = !sourceData.collapsed;
if (!this.shouldBegin(e4, collapsed)) {
return;
}
sourceData.collapsed = collapsed;
item.getModel().collapsed = collapsed;
this.graph.emit("itemcollapsed", {
item: e4.item,
collapsed
});
if (!this.shouldUpdate(e4, collapsed)) {
return;
}
this.onChange(item, collapsed);
this.graph.layout();
}
};
// node_modules/@antv/g6-pc/es/behavior/drag-combo.js
var calculationItemsBBox3 = util_default3.calculationItemsBBox;
var traverseCombo = function traverseCombo2(data3, fn2) {
if (fn2(data3) === false) {
return;
}
if (data3) {
var combos = data3.get("combos");
if (combos.length === 0) {
return false;
}
each_default(combos, function(child) {
traverseCombo2(child, fn2);
});
}
};
var drag_combo_default = {
getDefaultCfg: function getDefaultCfg11() {
return {
enableDelegate: false,
delegateStyle: {},
onlyChangeComboSize: false,
activeState: "",
selectedState: "selected"
};
},
getEvents: function getEvents11() {
return {
"combo:dragstart": "onDragStart",
"combo:drag": "onDrag",
"combo:dragend": "onDragEnd",
"combo:drop": "onDrop",
"node:drop": "onNodeDrop",
"combo:dragenter": "onDragEnter",
"combo:dragleave": "onDragLeave"
};
},
validationCombo: function validationCombo2(evt) {
var item = evt.item;
if (!item || item.destroyed) {
return false;
}
if (!this.shouldUpdate(this, evt)) {
return false;
}
var type2 = item.getType();
if (type2 !== "combo") {
return false;
}
return true;
},
onDragStart: function onDragStart2(evt) {
var _this = this;
var graph = this.graph;
var item = evt.item;
if (!this.validationCombo(evt))
return;
this.targets = [];
var combos = graph.findAllByState("combo", this.selectedState);
var currentCombo = item.get("id");
var dragCombos = combos.filter(function(combo) {
var comboId = combo.get("id");
return currentCombo === comboId;
});
if (dragCombos.length === 0) {
this.targets.push(item);
} else {
this.targets = combos;
}
if (this.activeState) {
this.targets.map(function(combo) {
var model = combo.getModel();
if (model.parentId) {
var parentCombo = graph.findById(model.parentId);
if (parentCombo) {
graph.setItemState(parentCombo, _this.activeState, true);
}
}
});
}
this.point = {};
this.originPoint = {};
this.origin = {
x: evt.x,
y: evt.y
};
this.currentItemChildCombos = [];
traverseCombo(item, function(param) {
if (param.destroyed) {
return false;
}
var model = param.getModel();
_this.currentItemChildCombos.push(model.id);
return true;
});
},
onDrag: function onDrag2(evt) {
var _this = this;
if (!this.origin) {
return;
}
if (!this.validationCombo(evt))
return;
if (this.enableDelegate) {
this.updateDelegate(evt);
} else {
if (this.activeState) {
var graph_1 = this.graph;
var item = evt.item;
var model_1 = item.getModel();
var combos = graph_1.getCombos();
var sourceBBox = item.getBBox();
var centerX_1 = sourceBBox.centerX, centerY_1 = sourceBBox.centerY, width_1 = sourceBBox.width;
var calcCombos = combos.filter(function(combo) {
var cmodel = combo.getModel();
if (!model_1.parentId) {
return cmodel.id !== model_1.id && !_this.currentItemChildCombos.includes(cmodel.id);
}
return cmodel.id !== model_1.id && !_this.currentItemChildCombos.includes(cmodel.id);
});
calcCombos.map(function(combo) {
var _a6 = combo.getBBox(), cx = _a6.centerX, cy = _a6.centerY, w4 = _a6.width;
var disX = centerX_1 - cx;
var disY = centerY_1 - cy;
var distance15 = 2 * Math.sqrt(disX * disX + disY * disY);
if (width_1 + w4 - distance15 > 0.8 * width_1) {
graph_1.setItemState(combo, _this.activeState, true);
} else {
graph_1.setItemState(combo, _this.activeState, false);
}
});
}
each_default(this.targets, function(item2) {
_this.updateCombo(item2, evt);
});
}
},
updatePositions: function updatePositions2(evt) {
var _this = this;
if (this.enableDelegate) {
each_default(this.targets, function(item) {
_this.updateCombo(item, evt);
});
}
},
onDrop: function onDrop(evt) {
var _this = this;
var item = evt.item;
if (!item || !this.targets || item.destroyed) {
return;
}
this.updatePositions(evt);
var graph = this.graph;
var targetModel = item.getModel();
this.targets.map(function(combo) {
var model = combo.getModel();
if (model.parentId !== targetModel.id) {
if (_this.activeState) {
graph.setItemState(item, _this.activeState, false);
}
if (!_this.onlyChangeComboSize) {
graph.updateComboTree(combo, targetModel.id);
} else {
graph.updateCombo(combo);
}
} else {
graph.updateCombo(item);
}
});
this.end(item, evt);
this.endComparison = true;
},
onNodeDrop: function onNodeDrop(evt) {
var _this = this;
if (!this.targets || this.targets.length === 0)
return;
this.updatePositions(evt);
var graph = this.graph;
var item = evt.item;
var comboId = item.getModel().comboId;
var droppedCombo;
if (comboId) {
if (this.activeState) {
var combo = graph.findById(comboId);
graph.setItemState(combo, this.activeState, false);
}
this.targets.map(function(combo2) {
if (!_this.onlyChangeComboSize) {
if (comboId !== combo2.getID()) {
droppedCombo = graph.findById(comboId);
if (comboId !== combo2.getModel().parentId)
graph.updateComboTree(combo2, comboId);
}
} else {
graph.updateCombo(combo2);
}
});
} else {
this.targets.map(function(combo2) {
if (!_this.onlyChangeComboSize) {
var model = combo2.getModel();
if (model.comboId) {
graph.updateComboTree(combo2);
}
} else {
graph.updateCombo(combo2);
}
});
}
this.endComparison = true;
this.end(droppedCombo, evt);
},
onDragEnter: function onDragEnter2(evt) {
if (!this.origin) {
return;
}
if (!this.validationCombo(evt))
return;
var item = evt.item;
var graph = this.graph;
if (this.activeState) {
graph.setItemState(item, this.activeState, true);
}
},
onDragLeave: function onDragLeave2(evt) {
if (!this.origin) {
return;
}
if (!this.validationCombo(evt))
return;
var item = evt.item;
var graph = this.graph;
if (this.activeState) {
graph.setItemState(item, this.activeState, false);
}
},
onDragEnd: function onDragEnd2(evt) {
if (!this.targets || this.targets.length === 0)
return;
var item = evt.item;
this.updatePositions(evt);
var parentCombo = this.getParentCombo(item.getModel().parentId);
var graph = this.graph;
if (parentCombo && this.activeState) {
graph.setItemState(parentCombo, this.activeState, false);
}
this.end(void 0, evt);
},
end: function end(comboDropedOn, evt) {
var _this = this;
if (!this.origin)
return;
var graph = this.graph;
if (this.delegateShape) {
var delegateGroup = graph.get("delegateGroup");
delegateGroup.clear();
this.delegateShape = null;
}
if (comboDropedOn && this.activeState) {
graph.setItemState(comboDropedOn, this.activeState, false);
}
if (!comboDropedOn) {
this.targets.map(function(combo) {
if (!_this.onlyChangeComboSize) {
graph.updateComboTree(combo);
} else {
graph.updateCombo(combo);
}
});
}
this.point = [];
this.origin = null;
this.originPoint = null;
this.targets.length = 0;
},
traverse: function traverse3(data3, fn2) {
var _this = this;
if (fn2(data3) === false) {
return;
}
if (data3) {
var combos = data3.get("combos");
each_default(combos, function(child) {
_this.traverse(child, fn2);
});
var nodes = data3.get("nodes");
each_default(nodes, function(child) {
_this.traverse(child, fn2);
});
}
},
updateCombo: function updateCombo(item, evt) {
var _this = this;
this.traverse(item, function(param) {
if (param.destroyed) {
return false;
}
_this.updateSignleItem(param, evt);
return true;
});
},
updateSignleItem: function updateSignleItem(item, evt) {
var origin = this.origin;
var graph = this.graph;
var model = item.getModel();
var itemId = item.get("id");
if (!this.point[itemId]) {
this.point[itemId] = {
x: model.x,
y: model.y
};
}
var x6 = evt.x - origin.x + this.point[itemId].x;
var y5 = evt.y - origin.y + this.point[itemId].y;
graph.updateItem(item, {
x: x6,
y: y5
});
},
getParentCombo: function getParentCombo(parentId) {
var graph = this.graph;
if (!parentId) {
return void 0;
}
var parentCombo = graph.findById(parentId);
if (!parentCombo) {
return void 0;
}
return parentCombo;
},
updateDelegate: function updateDelegate2(evt) {
var graph = this.graph;
if (!this.delegateShape) {
var delegateGroup = graph.get("delegateGroup");
var bbox = null;
if (this.targets.length > 1) {
bbox = calculationItemsBBox3(this.targets);
} else {
bbox = this.targets[0].getBBox();
}
var x6 = bbox.x, y5 = bbox.y, width2 = bbox.width, height = bbox.height, minX = bbox.minX, minY = bbox.minY;
this.originPoint = {
x: x6,
y: y5,
width: width2,
height,
minX,
minY
};
var attrs = __assign(__assign({}, global_default2.delegateStyle), this.delegateStyle);
this.delegateShape = delegateGroup.addShape("rect", {
attrs: __assign({
width: bbox.width,
height: bbox.height,
x: bbox.x,
y: bbox.y
}, attrs),
name: "combo-delegate-shape"
});
this.delegate = this.delegateShape;
} else {
var clientX = evt.x - this.origin.x + this.originPoint.minX;
var clientY = evt.y - this.origin.y + this.originPoint.minY;
this.delegateShape.attr({
x: clientX,
y: clientY
});
}
}
};
// node_modules/@antv/g6-pc/es/behavior/collapse-expand-combo.js
var DEFAULT_TRIGGER4 = "dblclick";
var ALLOW_EVENTS5 = ["click", "dblclick"];
var collapse_expand_combo_default = {
getDefaultCfg: function getDefaultCfg12() {
return {
trigger: DEFAULT_TRIGGER4,
relayout: true
};
},
getEvents: function getEvents12() {
var _a6;
var trigger;
if (ALLOW_EVENTS5.includes(this.trigger)) {
trigger = this.trigger;
} else {
trigger = DEFAULT_TRIGGER4;
console.warn("Behavior collapse-expand-group \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'click' \u6216 'dblclick'");
}
return _a6 = {}, _a6["combo:" + trigger] = "onComboClick", _a6;
},
onComboClick: function onComboClick(evt) {
var item = evt.item;
var _a6 = this, graph = _a6.graph, relayout = _a6.relayout;
if (!item || item.destroyed || item.getType() !== "combo")
return;
var model = item.getModel();
var comboId = model.id;
if (!comboId) {
return;
}
graph.collapseExpandCombo(comboId);
if (relayout && graph.get("layout"))
graph.layout();
else
graph.refreshPositions();
}
};
// node_modules/@antv/g6-pc/es/behavior/lasso-select.js
var isPolygonsIntersect4 = util_default3.isPolygonsIntersect;
var pathToPoints4 = util_default3.pathToPoints;
var DEFAULT_TRIGGER5 = "shift";
var ALLOW_EVENTS6 = ["drag", "shift", "ctrl", "alt", "control"];
var isItemIntersecPolygon = function isItemIntersecPolygon2(item, polyPoints) {
var shapePoints;
var shape = item.getKeyShape();
if (item.get("type") === "path") {
shapePoints = pathToPoints4(shape.attr("path"));
} else {
var shapeBBox = shape.getCanvasBBox();
shapePoints = [[shapeBBox.minX, shapeBBox.minY], [shapeBBox.maxX, shapeBBox.minY], [shapeBBox.maxX, shapeBBox.maxY], [shapeBBox.minX, shapeBBox.maxY]];
}
return isPolygonsIntersect4(polyPoints, shapePoints);
};
var lasso_select_default = {
getDefaultCfg: function getDefaultCfg13() {
return {
delegateStyle: {
fill: "#EEF6FF",
fillOpacity: 0.4,
stroke: "#DDEEFE",
lineWidth: 1
},
onSelect: function onSelect() {
},
onDeselect: function onDeselect() {
},
selectedState: "selected",
trigger: DEFAULT_TRIGGER5,
includeEdges: true,
selectedEdges: [],
selectedNodes: []
};
},
getEvents: function getEvents13() {
if (!(ALLOW_EVENTS6.indexOf(this.trigger.toLowerCase()) > -1)) {
this.trigger = DEFAULT_TRIGGER5;
console.warn("Behavior lasso-select \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'drag'\u3001'shift'\u3001'ctrl' \u6216 'alt'");
}
if (this.trigger === "drag") {
return {
dragstart: "onDragStart",
drag: "onDragMove",
dragend: "onDragEnd",
"canvas:click": "clearStates"
};
}
return {
dragstart: "onDragStart",
drag: "onDragMove",
dragend: "onDragEnd",
keyup: "onKeyUp",
keydown: "onKeyDown",
"canvas:click": "clearStates"
};
},
onDragStart: function onDragStart3(e4) {
var lasso = this.lasso;
var item = e4.item;
if (item) {
return;
}
if (this.trigger !== "drag" && !this.keydown) {
return;
}
if (this.selectedNodes && this.selectedNodes.length !== 0) {
this.clearStates();
}
if (!lasso) {
lasso = this.createLasso();
}
this.dragging = true;
this.originPoint = {
x: e4.x,
y: e4.y
};
this.points.push(this.originPoint);
lasso.show();
},
onDragMove: function onDragMove(e4) {
if (!this.dragging) {
return;
}
if (this.trigger !== "drag" && !this.keydown) {
return;
}
this.points.push({
x: e4.x,
y: e4.y
});
this.updateLasso(e4);
},
onDragEnd: function onDragEnd3(e4) {
if (!this.lasso && !this.dragging) {
return;
}
if (this.trigger !== "drag" && !this.keydown) {
return;
}
this.points.push(this.originPoint);
this.getSelectedItems();
this.lasso.remove(true);
this.lasso = null;
this.points = [];
this.dragging = false;
},
getLassoPath: function getLassoPath() {
var points = this.points;
var path = [];
if (points.length) {
points.forEach(function(point2, index2) {
if (index2 === 0) {
path.push(["M", point2.x, point2.y]);
} else {
path.push(["L", point2.x, point2.y]);
}
});
path.push(["L", points[0].x, points[0].y]);
}
return path;
},
clearStates: function clearStates2() {
var _a6 = this, graph = _a6.graph, selectedState = _a6.selectedState;
var nodes = graph.findAllByState("node", selectedState);
var edges = graph.findAllByState("edge", selectedState);
nodes.forEach(function(node) {
return graph.setItemState(node, selectedState, false);
});
edges.forEach(function(edge2) {
return graph.setItemState(edge2, selectedState, false);
});
if (this.onDeselect) {
this.onDeselect(this.selectedNodes, this.selectedEdges);
}
this.selectedNodes = [];
this.selectedEdges = [];
graph.emit("nodeselectchange", {
selectedItems: {
nodes: [],
edges: []
},
select: false
});
},
getSelectedItems: function getSelectedItems() {
var _this = this;
var _a6 = this, graph = _a6.graph, shouldUpdate3 = _a6.shouldUpdate;
var lassoContour = this.points.map(function(point2) {
return [graph.getCanvasByPoint(point2.x, point2.y).x, graph.getCanvasByPoint(point2.x, point2.y).y];
});
var state2 = this.selectedState;
var selectedNodes = [];
var selectedIds = [];
graph.getNodes().forEach(function(node) {
if (isItemIntersecPolygon(node, lassoContour)) {
if (shouldUpdate3(node, "select")) {
selectedNodes.push(node);
var model = node.getModel();
selectedIds.push(model.id);
graph.setItemState(node, state2, true);
}
}
});
var selectedEdges = [];
if (this.includeEdges) {
selectedNodes.forEach(function(node) {
var edges = node.getOutEdges();
edges.forEach(function(edge2) {
var model = edge2.getModel();
var source = model.source, target = model.target;
if (selectedIds.includes(source) && selectedIds.includes(target) && shouldUpdate3(edge2, "select")) {
selectedEdges.push(edge2);
graph.setItemState(edge2, _this.selectedState, true);
}
});
});
}
this.selectedEdges = selectedEdges;
this.selectedNodes = selectedNodes;
if (this.onSelect) {
this.onSelect(selectedNodes, selectedEdges);
}
graph.emit("nodeselectchange", {
selectedItems: {
nodes: selectedNodes,
edges: selectedEdges
},
select: true
});
},
createLasso: function createLasso() {
var self2 = this;
var lasso = self2.graph.get("delegateGroup").addShape("path", {
attrs: __assign({
path: []
}, self2.delegateStyle),
capture: false,
name: "lasso-shape"
});
this.lasso = lasso;
this.delegate = lasso;
this.points = [];
return lasso;
},
updateLasso: function updateLasso(e4) {
var self2 = this;
this.lasso.attr({
path: self2.getLassoPath()
});
},
onKeyDown: function onKeyDown4(e4) {
var code = e4.key;
if (!code) {
return;
}
if (code.toLowerCase() === this.trigger.toLowerCase()) {
this.keydown = true;
} else {
this.keydown = false;
}
},
onKeyUp: function onKeyUp4() {
if (this.lasso) {
this.lasso.remove(true);
this.lasso = null;
this.points = [];
this.dragging = false;
}
this.keydown = false;
}
};
// node_modules/@antv/g6-pc/es/behavior/create-edge.js
var DEFAULT_TRIGGER6 = "click";
var ALLOW_EVENTS7 = ["click", "drag"];
var DEFAULT_KEY = void 0;
var ALLOW_KEYS = ["shift", "ctrl", "control", "alt", "meta", void 0];
var create_edge_default = {
getDefaultCfg: function getDefaultCfg14() {
return {
trigger: DEFAULT_TRIGGER6,
key: DEFAULT_KEY,
edgeConfig: {},
getEdgeConfig: void 0
};
},
getEvents: function getEvents14() {
var self2 = this;
if (!(ALLOW_EVENTS7.indexOf(self2.trigger.toLowerCase()) > -1)) {
self2.trigger = DEFAULT_TRIGGER6;
console.warn("Behavior create-edge \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'click'\uFF0C'drag'");
}
if (self2.key && ALLOW_KEYS.indexOf(self2.key.toLowerCase()) === -1) {
self2.trigger = DEFAULT_KEY;
console.warn("Behavior create-edge \u7684 key \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'shift'\uFF0C'ctrl'\uFF0C'alt'\uFF0C'control'\uFF0C\u6216 undefined");
}
var events;
if (self2.trigger === "drag") {
events = {
"node:dragstart": "onClick",
"combo:dragstart": "onClick",
drag: "updateEndPoint",
"node:drop": "onClick",
"combo:drop": "onClick",
dragend: "onDragEnd"
};
} else if (self2.trigger === "click") {
events = {
"node:click": "onClick",
mousemove: "updateEndPoint",
"edge:click": "cancelCreating",
"canvas:click": "cancelCreating",
"combo:click": "onClick"
};
}
if (self2.key) {
events.keydown = "onKeyDown";
events.keyup = "onKeyUp";
}
return events;
},
onDragEnd: function onDragEnd4(ev) {
var self2 = this;
if (self2.key && !self2.keydown)
return;
var item = ev.item;
if (!item || item.getID() === self2.source || item.getType() !== "node")
self2.cancelCreating({
item: self2.edge,
x: ev.x,
y: ev.y
});
},
onClick: function onClick2(ev) {
var self2 = this;
if (self2.key && !self2.keydown)
return;
var node = ev.item;
var graph = self2.graph;
var model = node.getModel();
var getEdgeConfig = self2.getEdgeConfig;
if (self2.addingEdge && self2.edge) {
if (!self2.shouldEnd.call(self2, ev))
return;
var edgeConfig = void 0;
if (getEdgeConfig && is_function_default(getEdgeConfig)) {
edgeConfig = getEdgeConfig({
source: self2.source,
target: model.id
});
} else {
edgeConfig = self2.edgeConfig;
}
var updateCfg2 = __assign({
target: model.id
}, edgeConfig);
if (self2.source === model.id) {
updateCfg2.type = "loop";
}
graph.emit("beforecreateedge", {});
graph.updateItem(self2.edge, updateCfg2, false);
if (graph.get("enabledStack")) {
var addedModel = __assign(__assign({}, self2.edge.getModel()), {
itemType: "edge"
});
var after = {};
after.edges = [addedModel];
graph.pushStack("add", {
before: {},
after
});
}
graph.emit("aftercreateedge", {
edge: self2.edge
});
self2.edge.getKeyShape().set("capture", true);
self2.edge = null;
self2.addingEdge = false;
} else {
if (!self2.shouldBegin.call(self2, ev))
return;
var edgeConfig = void 0;
if (getEdgeConfig && is_function_default(getEdgeConfig)) {
edgeConfig = getEdgeConfig({
source: model.id,
target: model.id
});
} else {
edgeConfig = self2.edgeConfig;
}
self2.edge = graph.addItem("edge", __assign({
source: model.id,
target: model.id
}, edgeConfig), false);
self2.source = model.id;
self2.addingEdge = true;
self2.edge.getKeyShape().set("capture", false);
}
},
updateEndPoint: function updateEndPoint(ev) {
var self2 = this;
if (self2.key && !self2.keydown)
return;
var point2 = {
x: ev.x,
y: ev.y
};
if (!self2.graph.findById(self2.source)) {
self2.addingEdge = false;
return;
}
if (self2.addingEdge && self2.edge) {
self2.graph.updateItem(self2.edge, {
target: point2
}, false);
}
},
cancelCreating: function cancelCreating(ev) {
var self2 = this;
if (self2.key && !self2.keydown)
return;
var graph = self2.graph;
var currentEdge = ev.item;
if (self2.addingEdge && ev.target && ev.target.isCanvas && ev.target.isCanvas()) {
graph.removeItem(self2.edge, false);
self2.edge = null;
self2.addingEdge = false;
return;
}
if (self2.addingEdge && self2.edge === currentEdge) {
graph.removeItem(self2.edge, false);
self2.edge = null;
self2.addingEdge = false;
}
},
onKeyDown: function onKeyDown5(e4) {
var self2 = this;
var code = e4.key;
if (!code) {
return;
}
if (code.toLowerCase() === self2.key.toLowerCase()) {
self2.keydown = true;
} else {
self2.keydown = false;
}
},
onKeyUp: function onKeyUp5() {
var self2 = this;
if (self2.addingEdge && self2.edge) {
self2.graph.removeItem(self2.edge, false);
self2.addingEdge = false;
self2.edge = null;
}
this.keydown = false;
}
};
// node_modules/@antv/g6-pc/es/behavior/shortcuts-call.js
var DEFAULT_TRIGGER7 = "ctrl";
var ALLOW_EVENTS8 = ["shift", "ctrl", "alt", "control"];
var DEFAULT_COMBINED_KEY = "1";
var shortcuts_call_default = {
getDefaultCfg: function getDefaultCfg15() {
return {
trigger: DEFAULT_TRIGGER7,
combinedKey: DEFAULT_COMBINED_KEY,
functionName: "fitView",
functionParams: []
};
},
getEvents: function getEvents15() {
if (!(ALLOW_EVENTS8.indexOf(this.trigger.toLowerCase()) > -1)) {
this.trigger = DEFAULT_TRIGGER7;
console.warn("Behavior shortcuts-fit-view \u7684 trigger \u53C2\u6570 '" + this.trigger + "' \u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'drag'\u3001'shift'\u3001'ctrl' \u6216 'alt'");
}
if (this.combinedKey === this.trigger) {
this.combinedKey = void 0;
}
return {
keyup: "onKeyUp",
keydown: "onKeyDown"
};
},
onKeyDown: function onKeyDown6(e4) {
var code = e4.key;
if (!code) {
return;
}
var triggerLowerCase = this.trigger.toLowerCase();
var codeLowerCase = code.toLowerCase();
if (!this.triggerKeydown) {
if (codeLowerCase === triggerLowerCase || codeLowerCase === "control" && triggerLowerCase === "ctrl" || codeLowerCase === "ctrl" && triggerLowerCase === "control") {
this.triggerKeydown = true;
} else {
this.triggerKeydown = false;
}
}
var graph = this.graph;
if (!graph[this.functionName]) {
console.warn("Behavior shortcuts-fit-view \u7684 functionName \u53C2\u6570 '" + this.functionName + "' \u4E0D\u5408\u6CD5\uFF0C\u5B83\u4E0D\u662F Graph \u7684\u4E00\u4E2A\u51FD\u6570\u540D");
return {};
}
if (this.triggerKeydown && !this.combinedKey) {
if (this.functionParams && this.functionParams.length)
graph[this.functionName].apply(graph, this.functionParams);
else
graph[this.functionName]();
return;
}
var combinedKeyLowerCase = this.combinedKey.toLowerCase();
if (this.triggerKeydown) {
if (codeLowerCase === combinedKeyLowerCase || codeLowerCase === "control" && combinedKeyLowerCase === "ctrl" || codeLowerCase === "ctrl" && combinedKeyLowerCase === "control") {
if (this.functionParams && this.functionParams.length)
graph[this.functionName].apply(graph, this.functionParams);
else
graph[this.functionName]();
}
}
},
onKeyUp: function onKeyUp6() {
if (this.brush) {
this.brush.remove(true);
this.brush = null;
this.dragging = false;
}
this.triggerKeydown = false;
}
};
// node_modules/@antv/g6-pc/es/behavior/index.js
var behaviors = {
"drag-canvas": drag_canvas_default,
"zoom-canvas": zoom_canvas_default,
"drag-node": drag_node_default,
"activate-relations": activate_relations_default,
"brush-select": brush_select_default,
"click-select": click_select_default,
"lasso-select": lasso_select_default,
tooltip: tooltip_default3,
"edge-tooltip": edge_tooltip_default,
"collapse-expand": collapse_expand_default,
"drag-combo": drag_combo_default,
"collapse-expand-combo": collapse_expand_combo_default,
"create-edge": create_edge_default,
"shortcuts-call": shortcuts_call_default
};
each_default(behaviors, function(behavior, type2) {
registerBehavior(type2, behavior);
});
// node_modules/@antv/g6-pc/es/index.js
var Minimap = plugin_default.Minimap;
var Grid4 = plugin_default.Grid;
var Bundling2 = plugin_default.Bundling;
var Menu2 = plugin_default.Menu;
var Fisheye2 = plugin_default.Fisheye;
var ToolBar2 = plugin_default.ToolBar;
var Tooltip4 = plugin_default.Tooltip;
var TimeBar2 = plugin_default.TimeBar;
var ImageMinimap = plugin_default.ImageMinimap;
var EdgeFilterLens2 = plugin_default.EdgeFilterLens;
var es_default4 = {
version: global_default2.version,
Graph: graph_default2,
TreeGraph: tree_graph_default,
Util: util_default3,
Layout: Layouts,
registerLayout: registerLayout2,
Global: global_default2,
registerBehavior,
registerCombo,
registerEdge,
registerNode,
Minimap: plugin_default.Minimap,
Grid: plugin_default.Grid,
Bundling: plugin_default.Bundling,
Menu: plugin_default.Menu,
ToolBar: plugin_default.ToolBar,
Tooltip: plugin_default.Tooltip,
TimeBar: TimeBar2,
Fisheye: Fisheye2,
ImageMinimap,
EdgeFilterLens: EdgeFilterLens2,
Algorithm: es_exports,
Arrow: arrow_default2,
Marker: marker_default3,
Shape: element_default3
};
// node_modules/@antv/g6/es/index.js
es_default4.version = "4.2.4";
var es_default5 = es_default4;
// node_modules/@ant-design/charts/es/graphs/constants.js
var defaultStateStyles = {
hover: {
stroke: "#1890ff",
lineWidth: 2
}
};
var defaultNodeSize = [120, 40];
var defaultNodeStyle = {
stroke: "#40a9ff"
};
var defaultFlowGraphAnchorPoints = [
[0, 0.5],
[1, 0.5]
];
var defaultLabelStyle = {
fill: "#000",
fontSize: 12
};
var defaultMinimapCfg = {
show: false,
size: [150, 100],
type: "keyShape"
};
var defaultCardStyle = {
fill: "#fff",
stroke: "#40a9ff",
radius: 2
};
var defaultMargin = 6;
var prefix = "g";
// node_modules/@ant-design/charts/es/graphs/utils.js
var __assign16 = function() {
__assign16 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
return t4;
};
return __assign16.apply(this, arguments);
};
var __awaiter6 = function(thisArg, _arguments, P4, generator) {
function adopt(value2) {
return value2 instanceof P4 ? value2 : new P4(function(resolve) {
resolve(value2);
});
}
return new (P4 || (P4 = Promise))(function(resolve, reject) {
function fulfilled(value2) {
try {
step(generator.next(value2));
} catch (e4) {
reject(e4);
}
}
function rejected(value2) {
try {
step(generator["throw"](value2));
} catch (e4) {
reject(e4);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator4 = function(thisArg, body) {
var _8 = { label: 0, sent: function() {
if (t4[0] & 1)
throw t4[1];
return t4[1];
}, trys: [], ops: [] }, f3, y5, t4, g4;
return g4 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g4[Symbol.iterator] = function() {
return this;
}), g4;
function verb(n3) {
return function(v3) {
return step([n3, v3]);
};
}
function step(op) {
if (f3)
throw new TypeError("Generator is already executing.");
while (_8)
try {
if (f3 = 1, y5 && (t4 = op[0] & 2 ? y5["return"] : op[0] ? y5["throw"] || ((t4 = y5["return"]) && t4.call(y5), 0) : y5.next) && !(t4 = t4.call(y5, op[1])).done)
return t4;
if (y5 = 0, t4)
op = [op[0] & 2, t4.value];
switch (op[0]) {
case 0:
case 1:
t4 = op;
break;
case 4:
_8.label++;
return { value: op[1], done: false };
case 5:
_8.label++;
y5 = op[1];
op = [0];
continue;
case 7:
op = _8.ops.pop();
_8.trys.pop();
continue;
default:
if (!(t4 = _8.trys, t4 = t4.length > 0 && t4[t4.length - 1]) && (op[0] === 6 || op[0] === 2)) {
_8 = 0;
continue;
}
if (op[0] === 3 && (!t4 || op[1] > t4[0] && op[1] < t4[3])) {
_8.label = op[1];
break;
}
if (op[0] === 6 && _8.label < t4[1]) {
_8.label = t4[1];
t4 = op;
break;
}
if (t4 && _8.label < t4[2]) {
_8.label = t4[2];
_8.ops.push(op);
break;
}
if (t4[2])
_8.ops.pop();
_8.trys.pop();
continue;
}
op = body.call(thisArg, _8);
} catch (e4) {
op = [6, e4];
y5 = 0;
} finally {
f3 = t4 = 0;
}
if (op[0] & 5)
throw op[1];
return { value: op[0] ? op[1] : void 0, done: true };
}
};
var getGraphSize = function(width2, height, container2) {
var CANVAS_WIDTH;
var CANVAS_HEIGHT;
if (container2 && container2.current) {
CANVAS_WIDTH = container2.current.offsetWidth;
CANVAS_HEIGHT = container2.current.offsetHeight || 500;
}
if (!width2 && !CANVAS_WIDTH || !height && !CANVAS_HEIGHT) {
console.warn("\u8BF7\u4E3A Graph \u6307\u5B9A width \u4E0E height\uFF01\u5426\u5219\u5C06\u4F7F\u7528\u9ED8\u8BA4\u503C 500 * 500");
return [500, 500];
}
return [width2 || CANVAS_WIDTH || 500, height || CANVAS_HEIGHT || 500];
};
var EventData = function() {
function EventData2(data3) {
data3 && this.setData(data3);
}
EventData2.prototype.getData = function() {
return this.data;
};
EventData2.prototype.setData = function(data3) {
this.data = data3;
};
return EventData2;
}();
var bindDefaultEvents = function(graph, level, getChildren) {
var onClick3 = function(e4) {
return __awaiter6(void 0, void 0, void 0, function() {
var item, _a6, collapsed, g_currentPath_1, _b, children, g_parentId_1, g_level_1, id_1, appendChildren, appendChildrenData, currentData;
var _c;
return __generator4(this, function(_d) {
switch (_d.label) {
case 0:
item = e4.item;
if (!(e4.target.get("name") === "collapse-icon"))
return [3, 3];
_a6 = item.getModel(), collapsed = _a6.collapsed, g_currentPath_1 = _a6.g_currentPath, _b = _a6.children, children = _b === void 0 ? [] : _b, g_parentId_1 = _a6.g_parentId, g_level_1 = _a6.g_level, id_1 = _a6.id;
appendChildren = level && !children.length && getChildrenData(graph.get("eventData").getData(), g_currentPath_1);
if (!(getChildren && !((_c = children) === null || _c === void 0 ? void 0 : _c.length) && !(appendChildren === null || appendChildren === void 0 ? void 0 : appendChildren.length)))
return [3, 2];
createLoading();
return [4, getChildren(item.getModel())];
case 1:
appendChildrenData = _d.sent();
if (appendChildrenData) {
appendChildrenData = appendChildrenData.map(function(t4, index2) {
var _a7;
return __assign16((_a7 = {}, _a7[prefix + "_level"] = g_level_1 + 1, _a7[prefix + "_parentId"] = g_parentId_1 + "-" + id_1, _a7[prefix + "_currentPath"] = g_currentPath_1 + "-" + index2, _a7), t4);
});
setLevelData(graph, appendChildrenData, g_currentPath_1);
}
appendChildren = appendChildrenData;
closeLoading();
_d.label = 2;
case 2:
if ((appendChildren === null || appendChildren === void 0 ? void 0 : appendChildren.length) > 0) {
currentData = setParentChildren(graph.get("data"), g_currentPath_1, appendChildren);
graph.changeData(currentData);
if (graph.get("fitCenter")) {
graph.fitCenter();
}
} else {
graph.updateItem(item, {
collapsed: !collapsed
});
graph.layout();
}
_d.label = 3;
case 3:
return [2];
}
});
});
};
graph.on("node:click", function(e4) {
onClick3(e4);
});
graph.on("node:touchstart", function(e4) {
onClick3(e4);
});
};
var renderGraph = function(graph, data3, level) {
var originData = deepClone(data3);
var tagData = originData;
if (level) {
tagData = setTag4(data3);
originData = getLevelData(tagData, level);
}
graph.data(originData);
graph.set("eventData", new EventData(tagData));
graph.render();
graph.get("canvas").set("localRefresh", false);
};
var grapgMinmapMaps = {};
var processMinimap = function(cfg, graph) {
if (cfg === void 0) {
cfg = {};
}
var graphId = graph === null || graph === void 0 ? void 0 : graph.get("id");
if (!graph || graph.destroyed) {
grapgMinmapMaps[graphId] = null;
return;
}
if ((!cfg || !cfg.show) && grapgMinmapMaps[graphId]) {
var pluginMinimap = graph.get("plugins")[0];
if (pluginMinimap) {
graph.removePlugin(pluginMinimap);
}
grapgMinmapMaps[graphId] = null;
}
if (cfg.show && !grapgMinmapMaps[graphId]) {
var curMminimapCfg = Object.assign(defaultMinimapCfg, cfg);
var minimap = new es_default5.Minimap(__assign16(__assign16({}, curMminimapCfg), { id: graphId }));
graph.addPlugin(minimap);
grapgMinmapMaps[graphId] = minimap;
return minimap;
}
return null;
};
var getUuid = function() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c5) {
var r4 = Math.random() * 16 | 0;
var v3 = c5 == "x" ? r4 : r4 & 3 | 8;
return v3.toString(16);
});
};
var getGraphId = function(graph) {
if (graph.current) {
return graph.current;
}
graph.current = "graph-" + getUuid();
return graph.current;
};
var getMarkerPosition = function(direction5, size2) {
if (direction5 === void 0) {
direction5 = "right";
}
var width2 = size2[0], height = size2[1];
var x6 = 0;
var y5 = 0;
switch (direction5) {
case "top":
x6 = width2 / 2;
y5 = 0;
break;
case "right":
x6 = width2;
y5 = height / 2;
break;
case "bottom":
x6 = width2 / 2;
y5 = height;
break;
case "left":
x6 = 0;
y5 = height / 2;
break;
}
return { x: x6, y: y5 };
};
var bindSourceMapCollapseEvents = function(graph) {
var onClick3 = function(e4) {
var _a6;
var controlData = graph.get("eventData").getData();
if (e4.target.get("name") === "collapse-icon") {
var item = e4.item;
var collapsed = item.getModel().collapsed;
if (!isType3(collapsed, "Boolean")) {
collapsed = (_a6 = item._cfg.group.getChildren().find(function(item2) {
return item2.get("name") === "main-box";
})) === null || _a6 === void 0 ? void 0 : _a6.attr("defaultCollapsed");
}
var marker = e4.item._cfg.group.getChildren().find(function(item2) {
return item2.cfg.type === "marker";
});
var _b = (controlData !== null && controlData !== void 0 ? controlData : {}).edges, fullEdges_1 = _b === void 0 ? [] : _b;
var nodeId = item.getModel().id;
var targetNodeIds_1 = [];
var updateItems_1 = [];
var updateIds_1 = [];
var getLinkedId_1 = function(currentId) {
fullEdges_1.forEach(function(edge2) {
var source = edge2.source, target = edge2.target;
if (source === currentId) {
targetNodeIds_1.push(target);
getLinkedId_1(target);
}
});
};
getLinkedId_1(nodeId);
if (!collapsed) {
graph.findAll("node", function(node) {
return targetNodeIds_1.includes(node.get("id"));
}).forEach(function(node) {
return graph.hideItem(node);
});
controlData.nodes.forEach(function(node) {
var _a7 = node.collapsedLevel, collapsedLevel = _a7 === void 0 ? 0 : _a7, id = node.id;
if (targetNodeIds_1.includes(id)) {
node.collapsedLevel = collapsedLevel + 1;
}
});
} else {
graph.findAll("node", function(node) {
var collapsedLevel = controlData.nodes.find(function(item2) {
return item2.id === node.get("id");
}).collapsedLevel;
return targetNodeIds_1.includes(node.get("id")) && (!collapsedLevel || collapsedLevel < 2);
}).forEach(function(node) {
return graph.showItem(node);
});
controlData.nodes.forEach(function(node) {
var _a7 = node.collapsedLevel, collapsedLevel = _a7 === void 0 ? 0 : _a7, id = node.id;
if (targetNodeIds_1.includes(id)) {
node.collapsedLevel = collapsedLevel - 1;
}
});
}
fullEdges_1.forEach(function(edge2) {
var source = edge2.source, target = edge2.target;
if (targetNodeIds_1.includes(target)) {
updateIds_1.push(source);
}
});
updateIds_1 = Array.from(new Set(updateIds_1));
updateIds_1.forEach(function(id) {
updateItems_1.push(graph.find("node", function(node) {
return node.get("id") === id;
}));
});
updateItems_1.forEach(function(nodeItem) {
graph.updateItem(nodeItem, {
collapsed: !nodeItem.getModel().collapsed
});
graph.refreshItem(nodeItem);
});
}
};
graph.on("node:click", function(e4) {
onClick3(e4);
});
graph.on("node:touchstart", function(e4) {
onClick3(e4);
});
};
var getCssPadding = function(padding3) {
if (typeof padding3 === "number") {
return [padding3, padding3, padding3, padding3];
}
var result = [];
switch (padding3.length) {
case 1:
result = [padding3[0], padding3[0], padding3[0], padding3[0]];
break;
case 2:
result = [padding3[0], padding3[1], padding3[0], padding3[1]];
break;
case 3:
result = [padding3[0], padding3[1], padding3[2], padding3[1]];
break;
case 4:
result = padding3;
break;
default:
break;
}
return result;
};
var getArrowCfg = function(arrowCfg, edge2) {
if (!arrowCfg) {
return;
}
if (typeof arrowCfg === "object" && (arrowCfg === null || arrowCfg === void 0 ? void 0 : arrowCfg.show) === false) {
return;
}
var cfg = typeof arrowCfg === "function" ? arrowCfg(edge2) : arrowCfg;
var _a6 = cfg.type, type2 = _a6 === void 0 ? "vee" : _a6, _b = cfg.d, d3 = _b === void 0 ? 0 : _b, _c = cfg.size, size2 = _c === void 0 ? 10 : _c;
return __assign16({ path: es_default5.Arrow[type2](size2, size2, d3), fill: "#ccc", d: d3 }, cfg);
};
var bindStateEvents = function(graph, cfg) {
var _a6 = cfg !== null && cfg !== void 0 ? cfg : {}, _b = _a6.nodeCfg, nodeCfg = _b === void 0 ? {} : _b, _c = _a6.edgeCfg, edgeCfg = _c === void 0 ? {} : _c;
var nodeStateStyles = nodeCfg.nodeStateStyles;
var edgeStateStyles = edgeCfg.edgeStateStyles;
var statusCache = {};
var updateArrowFill = function(item, endArrowFill, stratArrowFill) {
graph.updateItem(item, {
style: {
endArrow: !!endArrowFill && {
fill: endArrowFill
},
startArrow: !!stratArrowFill && {
fill: stratArrowFill
}
}
});
};
var setState4 = function(item, name, status) {
var _a7, _b2, _c2;
status ? item.toFront() : item.toBack();
var _d = (_a7 = item.getModel().style) !== null && _a7 !== void 0 ? _a7 : {}, endArrow = _d.endArrow, startArrow = _d.startArrow;
if (endArrow || startArrow) {
if (!statusCache[item.getID()]) {
var endArrowFill = (endArrow !== null && endArrow !== void 0 ? endArrow : {}).fill;
var startArrowFill = (startArrow !== null && startArrow !== void 0 ? startArrow : {}).fill;
var hoverStatus = (_c2 = (_b2 = item.getModel().style) === null || _b2 === void 0 ? void 0 : _b2[name]) === null || _c2 === void 0 ? void 0 : _c2.stroke;
statusCache[item.getID()] = [
[hoverStatus !== null && hoverStatus !== void 0 ? hoverStatus : endArrowFill, endArrowFill],
[hoverStatus !== null && hoverStatus !== void 0 ? hoverStatus : startArrowFill, startArrowFill]
];
}
var fill = statusCache[item.getID()];
updateArrowFill(item, endArrow && fill[0][status ? 0 : 1], startArrow && fill[1][status ? 0 : 1]);
}
graph.setItemState(item, name, status);
};
var getRelationItems = function(currentItem, name, status, type2) {
var relationItems = type2 === "node" ? graph.findAll("edge", function(edge2) {
return edge2.getSource() === currentItem || edge2.getTarget() === currentItem;
}) : graph.findAll("node", function(node) {
return currentItem.getSource().get("id") === node.get("id") || currentItem.getTarget().get("id") === node.get("id");
});
var highlightItems = [currentItem].concat(relationItems);
highlightItems.forEach(function(item) {
setState4(item, name, status);
});
};
if (nodeStateStyles) {
graph.on("node:mouseenter", function(evt) {
var item = evt.item;
getRelationItems(item, "hover", true, "node");
});
graph.on("node:mouseleave", function(evt) {
var item = evt.item;
getRelationItems(item, "hover", false, "node");
});
}
if (edgeStateStyles) {
graph.on("edge:mouseenter", function(evt) {
var item = evt.item;
getRelationItems(item, "hover", true, "edge");
});
graph.on("edge:mouseleave", function(evt) {
var item = evt.item;
getRelationItems(item, "hover", false, "edge");
});
}
};
var getStyle3 = function(source, cfg, item, current) {
if (typeof source === "function") {
return source(cfg, item, current);
}
return source || {};
};
var getCommonConfig = function(cfg, item, graph) {
if (typeof cfg === "function") {
return cfg(item, graph);
}
return cfg;
};
var getSize4 = function(size2) {
if (Array.isArray(size2)) {
return size2;
}
return size2 ? [size2, size2] : defaultNodeSize;
};
var DefaultStatusBarWidth = 4;
var getStatusBBox = function(cfg) {
if (!cfg) {
return [0, 0, 0, 0];
}
var _a6 = cfg.size, size2 = _a6 === void 0 ? [] : _a6, _b = cfg.position, position2 = _b === void 0 ? "left" : _b;
var _c = getSize4(size2), width2 = _c[0], height = _c[1];
var appendPadding = [];
switch (position2) {
case "top":
appendPadding.push(height !== null && height !== void 0 ? height : DefaultStatusBarWidth, 0, 0, 0);
break;
case "right":
appendPadding.push(0, width2 !== null && width2 !== void 0 ? width2 : DefaultStatusBarWidth, 0, 0);
break;
case "bottom":
appendPadding.push(0, 0, height !== null && height !== void 0 ? height : DefaultStatusBarWidth, 0);
break;
case "left":
appendPadding.push(0, 0, 0, width2 !== null && width2 !== void 0 ? width2 : DefaultStatusBarWidth);
break;
}
return appendPadding;
};
var getStatusCfg = function(cfg, cardSize) {
var _a6 = cfg !== null && cfg !== void 0 ? cfg : {}, _b = _a6.size, size2 = _b === void 0 ? [] : _b, _c = _a6.position, position2 = _c === void 0 ? "left" : _c;
var _d = getSize4(size2), width2 = _d[0], height = _d[1];
var cardWidth = cardSize[0], cardHeight = cardSize[1];
var x6 = 0;
var y5 = 0;
var w4 = 0;
var h3 = 0;
switch (position2) {
case "top":
x6 = 0;
y5 = 0;
w4 = width2 !== null && width2 !== void 0 ? width2 : cardWidth;
h3 = height !== null && height !== void 0 ? height : DefaultStatusBarWidth;
break;
case "left":
x6 = 0;
y5 = 0;
w4 = width2 !== null && width2 !== void 0 ? width2 : DefaultStatusBarWidth;
h3 = height !== null && height !== void 0 ? height : cardHeight;
break;
case "right":
x6 = cardWidth - (is_number_default(width2) ? width2 : DefaultStatusBarWidth);
y5 = 0;
w4 = width2 !== null && width2 !== void 0 ? width2 : DefaultStatusBarWidth;
h3 = height !== null && height !== void 0 ? height : cardHeight;
break;
case "bottom":
x6 = 0;
y5 = cardHeight - (is_number_default(height) ? height : DefaultStatusBarWidth);
w4 = width2 !== null && width2 !== void 0 ? width2 : cardWidth;
h3 = height !== null && height !== void 0 ? height : DefaultStatusBarWidth;
break;
}
return {
x: x6,
y: y5,
width: w4,
height: h3
};
};
var createMarker = function(cfg, group2, size2) {
var show = cfg.show, position2 = cfg.position, collapsed = cfg.collapsed, style = cfg.style;
if (show) {
group2.addShape("marker", {
attrs: __assign16(__assign16(__assign16({}, getMarkerPosition(position2, size2)), { r: 6, cursor: "pointer", symbol: collapsed ? es_default5.Marker.expand : es_default5.Marker.collapse, stroke: defaultCardStyle.stroke, lineWidth: 1, fill: "#fff" }), style),
defaultCollapsed: false,
name: "collapse-icon"
});
}
};
var cloneBesidesImg3 = function(obj) {
var clonedObj = {};
Object.keys(obj).forEach(function(key1) {
var obj2 = obj[key1];
if (is_object_default(obj2)) {
var clonedObj2_1 = {};
Object.keys(obj2).forEach(function(key2) {
var v3 = obj2[key2];
if (key2 === "img" && !is_string_default(v3))
return;
clonedObj2_1[key2] = clone_default(v3);
});
clonedObj[key1] = clonedObj2_1;
} else {
clonedObj[key1] = clone_default(obj2);
}
});
return clonedObj;
};
var setStyles = function(container2, style) {
if (style === void 0) {
style = {};
}
var keys2 = Object.keys(style);
keys2.forEach(function(key) {
container2.style[key] = style[key];
});
};
var setTag4 = function(data3, level, parentId, path) {
var _a6;
if (level === void 0) {
level = 0;
}
if (parentId === void 0) {
parentId = "";
}
if (path === void 0) {
path = "";
}
var id = data3.id, _b = data3.children, children = _b === void 0 ? [] : _b;
return __assign16(__assign16((_a6 = {}, _a6[prefix + "_level"] = level, _a6[prefix + "_parentId"] = parentId, _a6[prefix + "_currentPath"] = path, _a6), data3), { children: children === null || children === void 0 ? void 0 : children.map(function(item, index2) {
return setTag4(item, level + 1, parentId ? parentId + "-" + id : id, path + "-" + index2);
}) });
};
var getLevelData = function(data3, level) {
var _a6 = data3.children, children = _a6 === void 0 ? [] : _a6, _b = data3.g_level, g_level = _b === void 0 ? 0 : _b;
if (level <= 0) {
return data3;
}
return __assign16(__assign16({}, data3), { children: g_level + 1 < level ? children === null || children === void 0 ? void 0 : children.map(function(item) {
return getLevelData(item, level);
}) : [] });
};
var setLevelData = function(graph, data3, currentPath) {
var currentData = graph.get("eventData").getData();
var path = currentPath.split("-");
path.shift();
var current = currentData;
path.forEach(function(childrenIndex) {
current = current.children[Number(childrenIndex)];
});
current.children = data3;
};
var getChildrenData = function(data3, currentPath) {
var path = currentPath.split("-");
path.shift();
var current = data3;
path.forEach(function(childrenIndex) {
current = current.children[Number(childrenIndex)];
});
if (!(current === null || current === void 0 ? void 0 : current.children)) {
return [];
}
return current.children.map(function(item) {
return __assign16(__assign16({}, item), { children: [] });
});
};
var setParentChildren = function(parendData, currentPath, children) {
var path = currentPath.split("-");
path.shift();
var current = parendData;
path.forEach(function(childrenIndex) {
current = current.children[Number(childrenIndex)];
});
current.children = children;
return parendData;
};
var useEllipsis = function(text, fontSize, contentWidth) {
if (fontSize === void 0) {
fontSize = 12;
}
if (contentWidth === void 0) {
contentWidth = 120;
}
var size2 = is_number_default(fontSize) ? fontSize : Number(fontSize.replace("px", ""));
var maxWords = Math.floor(contentWidth / size2);
if (text.length <= maxWords) {
return text;
}
return text.slice(0, maxWords - 1) + "...";
};
var createLoading = function() {
var container2 = document.createElement("div");
container2.className = prefix + "-antd-loading";
var styles = {
position: "fixed",
left: "0",
top: "0",
width: "100vw",
height: "100vh",
display: "flex",
alignItems: "center",
justifyContent: "center",
background: "rgba(0,0,0, 0.25)",
color: "#fff",
fontSize: "16px",
zIndex: 999
};
var span = document.createElement("span");
span.innerText = "loading...";
setStyles(container2, styles);
container2.appendChild(span);
document.body.appendChild(container2);
};
var closeLoading = function() {
var hideContainer = document.getElementsByClassName(prefix + "-antd-loading");
Array.from(hideContainer).forEach(function(el) {
document.body.removeChild(el);
});
};
// node_modules/@ant-design/charts/es/obsolescent/hooks/useGraph.js
var __assign17 = function() {
__assign17 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
return t4;
};
return __assign17.apply(this, arguments);
};
function useGraph(graphInstance, config, container2) {
var graphHook = s3();
var data3 = config.data, width2 = config.width, height = config.height, layout6 = config.layout, minimapCfg = config.minimapCfg, behaviors2 = config.behaviors, fitCenter = config.fitCenter, nodeCfg = config.nodeCfg, edgeCfg = config.edgeCfg, markerCfg = config.markerCfg, level = config.level;
var graphOptions = s3();
var graphData = s3();
var setEdgesState = function(edges) {
edges.forEach(function(edge2) {
var _a6, _b;
var _c = edge2.getModel(), source = _c.source, target = _c.target;
var sourceVisible = (_a6 = graphInstance === null || graphInstance === void 0 ? void 0 : graphInstance.findById(source)) === null || _a6 === void 0 ? void 0 : _a6.get("visible");
var targetVisible = (_b = graphInstance === null || graphInstance === void 0 ? void 0 : graphInstance.findById(target)) === null || _b === void 0 ? void 0 : _b.get("visible");
if (sourceVisible === false || targetVisible === false) {
edge2.changeVisibility(false);
}
});
};
var changeData = function() {
var _a6;
if (!graphInstance) {
return;
}
var currentData = data3;
if (level) {
currentData = setTag4(data3);
}
graphInstance.changeData(level ? getLevelData(currentData, level) : data3);
(_a6 = graphInstance.get("eventData")) === null || _a6 === void 0 ? void 0 : _a6.setData(currentData);
setEdgesState(graphInstance.getEdges());
if (fitCenter) {
graphInstance.fitCenter();
}
};
var updateLayout = function() {
graphInstance === null || graphInstance === void 0 ? void 0 : graphInstance.updateLayout(layout6);
if (fitCenter) {
graphInstance === null || graphInstance === void 0 ? void 0 : graphInstance.fitCenter();
}
};
var updateNodes = function() {
if (!graphInstance) {
return;
}
var _a6 = nodeCfg !== null && nodeCfg !== void 0 ? nodeCfg : {}, nodeType = _a6.type, nodeAnchorPoints = _a6.anchorPoints, nodeStyle = _a6.style, nodeLabelCfg = _a6.title;
graphInstance.getNodes().forEach(function(node) {
graphInstance.updateItem(node, {
nodeCfg,
markerCfg,
type: nodeType,
style: nodeStyle,
anchorPoints: nodeAnchorPoints,
labelCfg: nodeLabelCfg
});
});
};
var updateEdges = function() {
if (!graphInstance) {
return;
}
var _a6 = edgeCfg !== null && edgeCfg !== void 0 ? edgeCfg : {}, edgeType = _a6.type, edgeStyle = _a6.style, startArrowCfg = _a6.startArrow, endArrowCfg = _a6.endArrow, labelCfg = _a6.label;
graphInstance.getEdges().forEach(function(edge2) {
if (edgeType === "fund-line") {
graphInstance.updateItem(edge2, {
edgeCfg
});
} else {
var edgeCfgModel = edge2.getModel();
var startArrow = getArrowCfg(startArrowCfg, edgeCfgModel);
var endArrow = getArrowCfg(endArrowCfg, edgeCfgModel);
var _a7 = labelCfg !== null && labelCfg !== void 0 ? labelCfg : {}, style = _a7.style, content = _a7.content;
graphInstance.updateItem(edge2, {
type: edgeType,
label: getCommonConfig(content, edgeCfgModel, graphInstance),
labelCfg: {
style: getCommonConfig(style, edgeCfgModel, graphInstance)
},
style: __assign17({ stroke: "#ccc", startArrow, endArrow }, typeof edgeStyle === "function" ? edgeStyle(edgeCfgModel, graphInstance) : edgeStyle)
});
}
});
};
var updateMarker = function() {
if (!graphInstance) {
return;
}
graphInstance.getNodes().forEach(function(node) {
var _a6 = (typeof markerCfg === "function" ? markerCfg(node.getModel(), node.get("group")) : markerCfg).position, position2 = _a6 === void 0 ? "right" : _a6;
var _b = node.getBBox(), width3 = _b.width, height2 = _b.height;
var markerShape = node.get("group").get("children").find(function(item) {
return item.get("name") === "collapse-icon";
});
if (markerShape) {
markerShape === null || markerShape === void 0 ? void 0 : markerShape.attr(__assign17({}, getMarkerPosition(position2, [width3, height2])));
}
});
};
y2(function() {
if (graphInstance && !graphInstance.destroyed) {
if (is_equal_default(data3, graphData.current)) {
return;
}
graphData.current = deepClone(data3);
changeData();
}
}, [data3]);
y2(function() {
var _a6, _b, _c, _d, _e;
if (graphInstance && !graphInstance.destroyed) {
if (is_equal_default(config, graphOptions.current)) {
return;
}
if (!is_equal_default(layout6, (_a6 = graphOptions.current) === null || _a6 === void 0 ? void 0 : _a6.layout)) {
updateLayout();
}
if (!is_equal_default(minimapCfg, (_b = graphOptions.current) === null || _b === void 0 ? void 0 : _b.minimapCfg)) {
processMinimap(minimapCfg, graphInstance);
}
if (!is_equal_default(nodeCfg, (_c = graphOptions.current) === null || _c === void 0 ? void 0 : _c.nodeCfg)) {
updateNodes();
}
if (!is_equal_default(edgeCfg, (_d = graphOptions.current) === null || _d === void 0 ? void 0 : _d.edgeCfg)) {
updateEdges();
}
if (!is_equal_default(markerCfg, (_e = graphOptions.current) === null || _e === void 0 ? void 0 : _e.markerCfg)) {
updateMarker();
}
graphOptions.current = config;
}
}, [config]);
y2(function() {
if (graphInstance && !graphInstance.destroyed) {
var graphSize = getGraphSize(width2, height, container2);
graphInstance.changeSize(graphSize[0], graphSize[1]);
}
}, [container2, width2, height]);
y2(function() {
if (graphInstance && !graphInstance.destroyed) {
var defaultMode = graphInstance.get("modes").default;
var removingBehaviors_1 = [];
defaultMode.forEach(function(be) {
if (is_object_default(be)) {
removingBehaviors_1.push(be.type);
} else if (is_string_default(be)) {
removingBehaviors_1.push(be);
}
});
graphInstance.removeBehaviors(removingBehaviors_1, "default");
graphInstance.addBehaviors(behaviors2, "default");
}
}, [behaviors2]);
y2(function() {
graphHook.current = graphInstance;
return function() {
if (graphInstance && !graphInstance.destroyed) {
graphInstance.destroy();
graphInstance = void 0;
}
};
}, []);
return {
graphHook
};
}
// node_modules/@ant-design/charts/es/obsolescent/graph/customItems.js
var __assign18 = function() {
__assign18 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
return t4;
};
return __assign18.apply(this, arguments);
};
var registerCustomItems = function() {
es_default5.registerNode("card-node", {
draw: function(cfg, group2) {
var _a6;
if (cfg === void 0) {
cfg = {};
}
var size2 = cfg.size || [100, 30];
if (typeof size2 === "number")
size2 = [size2, size2];
var style = __assign18({ radius: 2, fill: "#fff" }, cfg.style);
var color4 = style.stroke || cfg.color || "#5B8FF9";
var r4 = style.radius || 0;
var shape = group2.addShape("rect", {
attrs: __assign18({ x: 0, y: 0, width: size2[0], height: size2[1], stroke: color4 }, style),
name: "main-box",
draggable: true
});
var title = cfg.title || cfg.label;
var titleTextShape;
var labelStyle = ((_a6 = cfg.labelCfg) === null || _a6 === void 0 ? void 0 : _a6.style) || {};
if (title) {
var titleStyle = __assign18({ fill: "#fff" }, labelStyle);
titleTextShape = group2.addShape("text", {
attrs: __assign18(__assign18({
textBaseline: "top",
x: 8,
y: 2,
text: title
}, titleStyle), { fill: "#fff" }),
name: "title"
});
}
var titleBox = titleTextShape ? titleTextShape.getBBox() : { height: size2[1] / 2 };
var titleRectShape = group2.addShape("rect", {
attrs: {
x: 0,
y: 0,
width: size2[0],
height: titleBox.height + 4,
fill: color4,
radius: [r4, r4, 0, 0]
},
name: "title-rect",
draggable: true
});
titleTextShape === null || titleTextShape === void 0 ? void 0 : titleTextShape.toFront();
var markerShape;
if (cfg === null || cfg === void 0 ? void 0 : cfg.children) {
markerShape = group2.addShape("marker", {
attrs: {
x: size2[0] / 2,
y: 0,
r: 6,
cursor: "pointer",
symbol: cfg.collapsed ? es_default5.Marker.expand : es_default5.Marker.collapse,
stroke: color4,
lineWidth: 1,
fill: "#fff"
},
name: "collapse-icon"
});
}
var description = cfg && cfg.description ? cfg.description : void 0;
var titleRectBox = titleRectShape.getBBox();
var descriptionTextShape;
if (description) {
descriptionTextShape = group2.addShape("text", {
attrs: __assign18({ textBaseline: "top", x: 8, y: titleRectBox.height + 8, text: description }, labelStyle),
name: "description"
});
}
if (descriptionTextShape) {
var desTextShapeBBox = descriptionTextShape.getBBox();
var height = titleRectBox.height + 16 + desTextShapeBBox.height;
var width2 = size2[0] > desTextShapeBBox.width + 16 ? size2[0] : desTextShapeBBox.width + 16;
shape.attr({ width: width2, height });
titleRectShape === null || titleRectShape === void 0 ? void 0 : titleRectShape.attr("width", width2);
markerShape === null || markerShape === void 0 ? void 0 : markerShape.attr({
x: width2,
y: height / 2
});
}
return shape;
},
update: void 0
}, "single-node");
es_default5.registerNode("round-rect", {
drawShape: function(cfg, group2) {
if (cfg === void 0) {
cfg = {};
}
var size2 = cfg.size || [100, 30];
if (typeof size2 === "number")
size2 = [size2, size2];
var style = cfg.style || {};
var color4 = style.stroke || cfg.color || "#5B8FF9";
var fill = style.fill || "#fff";
style = __assign18({ width: size2[0], height: size2[1], radius: size2[1] / 2, fill, lineWidth: 1.2, stroke: color4 }, style);
var rect3 = group2.addShape("rect", {
attrs: __assign18({ x: -size2[0] / 2, y: -size2[1] / 2 }, style),
name: "rect-shape"
});
group2.addShape("circle", {
attrs: {
x: -size2[0] / 2,
y: 0,
r: 3,
fill: style.stroke
},
name: "circle-shape"
});
group2.addShape("circle", {
attrs: {
x: size2[0] / 2,
y: 0,
r: 3,
fill: style.stroke
},
name: "circle-shape2"
});
return rect3;
},
getAnchorPoints: function getAnchorPoints4() {
return [
[0, 0.5],
[1, 0.5]
];
},
update: function update15(cfg, item) {
var _a6;
if (cfg === void 0) {
cfg = {};
}
var group2 = item.getContainer();
var children = group2.get("children");
var node = children[0];
var circleLeft = children[1];
var circleRight = children[2];
var stroke = ((_a6 = cfg.style) === null || _a6 === void 0 ? void 0 : _a6.stroke) || "#5B8FF9";
if (stroke) {
node.attr("stroke", stroke);
circleLeft.attr("fill", stroke);
circleRight.attr("fill", stroke);
}
}
}, "single-node");
es_default5.registerEdge("fund-polyline", {
draw: function draw4(cfg, group2) {
var _a6;
if (cfg === void 0) {
cfg = {};
}
var startPoint = cfg.startPoint;
var endPoint = cfg.endPoint;
var Ydiff = endPoint.y - startPoint.y;
var slope = Ydiff !== 0 ? Math.min(500 / Math.abs(Ydiff), 20) : 0;
var cpOffset = slope > 15 ? 0 : 16;
var offset = Ydiff < 0 ? cpOffset : -cpOffset;
var line1EndPoint = {
x: startPoint.x + slope,
y: endPoint.y + offset
};
var line2StartPoint = {
x: line1EndPoint.x + cpOffset,
y: endPoint.y
};
var controlPoint = {
x: (line1EndPoint.x - startPoint.x) * (endPoint.y - startPoint.y) / (line1EndPoint.y - startPoint.y) + startPoint.x,
y: endPoint.y
};
var path = [
["M", startPoint.x, startPoint.y],
["L", line1EndPoint.x, line1EndPoint.y],
["Q", controlPoint.x, controlPoint.y, line2StartPoint.x, line2StartPoint.y],
["L", endPoint.x, endPoint.y]
];
if (Math.abs(Ydiff) <= 5) {
path = [
["M", startPoint.x, startPoint.y],
["L", endPoint.x, endPoint.y]
];
}
var style = cfg.style;
var stroke = style.stroke || (cfg === null || cfg === void 0 ? void 0 : cfg.colorMap) && cfg.colorMap[cfg.dataType] ? (cfg === null || cfg === void 0 ? void 0 : cfg.colorMap)[cfg === null || cfg === void 0 ? void 0 : cfg.dataType] : "#5B8FF9";
var endArrow = ((_a6 = cfg.style) === null || _a6 === void 0 ? void 0 : _a6.endArrow) || false;
if (is_object_default(endArrow))
endArrow.fill = stroke;
var line2 = group2.addShape("path", {
attrs: {
path,
stroke,
lineWidth: style.lineWidth || 1.2,
endArrow
},
name: "path-shape"
});
var labelLeftOffset = 0;
var labelTopOffset = 8;
var labelTextShape;
var textBeginX = line2StartPoint.x + labelLeftOffset;
if (cfg === null || cfg === void 0 ? void 0 : cfg.label) {
labelTextShape = group2.addShape("text", {
attrs: {
text: cfg.label,
x: textBeginX,
y: endPoint.y - labelTopOffset - 2,
fontSize: 14,
textAlign: "left",
textBaseline: "middle",
fill: "#000"
},
name: "text-shape-label"
});
}
if (cfg === null || cfg === void 0 ? void 0 : cfg.dataType) {
var labelTextShapeBBox = labelTextShape ? labelTextShape.getBBox() : { height: 0 };
group2.addShape("text", {
attrs: {
text: cfg.dataType,
x: textBeginX,
y: endPoint.y - labelTopOffset - labelTextShapeBBox.height - 2,
fontSize: 10,
textAlign: "left",
textBaseline: "middle",
fill: "#000"
},
name: "text-shape-type"
});
}
if (cfg === null || cfg === void 0 ? void 0 : cfg.subLabel) {
group2.addShape("text", {
attrs: {
text: cfg.subLabel,
x: textBeginX,
y: endPoint.y + labelTopOffset + 4,
fontSize: 12,
fontWeight: 300,
textAlign: "left",
textBaseline: "middle",
fill: "#000"
},
name: "text-shape-sub-label"
});
}
return line2;
},
update: void 0
}, "single-edge");
es_default5.registerEdge("flow-line", {
draw: function(cfg, group2) {
if (cfg === void 0) {
cfg = {};
}
var startPoint = cfg.startPoint, endPoint = cfg.endPoint;
var _a6 = cfg.style, style = _a6 === void 0 ? {} : _a6;
var shape = group2.addShape("path", {
attrs: {
stroke: style.stroke,
endArrow: style.endArrow,
path: [
["M", startPoint.x, startPoint.y],
["L", startPoint.x, (startPoint.y + endPoint.y) / 2],
["L", endPoint.x, (startPoint.y + endPoint.y) / 2],
["L", endPoint.x, endPoint.y]
]
}
});
return shape;
}
});
};
var customIconNode = function(params) {
es_default5.registerNode("icon-node", {
options: {
size: [60, 20],
stroke: "#91d5ff",
fill: "#91d5ff"
},
draw: function(cfg, group2) {
if (cfg === void 0) {
cfg = {};
}
var styles = this.getShapeStyle(cfg);
var _a6 = cfg.labelCfg, labelCfg = _a6 === void 0 ? {} : _a6;
var keyShape = group2.addShape("rect", {
attrs: __assign18(__assign18({}, styles), { x: 0, y: 0 })
});
var style = {
fill: "#e6fffb"
};
var img = "https://g.alicdn.com/cm-design/arms-trace/1.0.155/styles/armsTrace/images/TAIR.png";
if (cfg.leftIcon) {
style = __assign18(__assign18({}, style), cfg.leftIcon.style);
img = cfg.leftIcon.img;
}
group2.addShape("rect", {
attrs: __assign18({ x: 1, y: 1, width: 38, height: styles.height - 2 }, style)
});
group2.addShape("image", {
attrs: {
x: 8,
y: 8,
width: 24,
height: 24,
img
},
name: "image-shape"
});
if (params.enableEdit) {
group2.addShape("marker", {
attrs: {
x: styles.width / 3,
y: styles.height + 6,
r: 6,
stroke: "#73d13d",
cursor: "pointer",
symbol: es_default5.Marker.expand
},
name: "add-item"
});
group2.addShape("marker", {
attrs: {
x: styles.width * 2 / 3,
y: styles.height + 6,
r: 6,
stroke: "#ff4d4f",
cursor: "pointer",
symbol: es_default5.Marker.collapse
},
name: "remove-item"
});
}
if (cfg.label) {
group2.addShape("text", {
attrs: __assign18(__assign18({}, labelCfg.style), { text: cfg.label, x: styles.width / 2, y: styles.height / 1.5 })
});
}
return keyShape;
}
}, "rect");
};
// node_modules/@ant-design/charts/es/obsolescent/graph/constants.js
var defaultLabelCfg = {
style: {
fill: "#000",
fontSize: 12
}
};
var defaultEdgeStyle = {
stroke: "#91d5ff",
endArrow: {
path: es_default5.Arrow.vee(10, 10)
}
};
var defaultNodeAnchorPoints = [
[0.5, 0],
[0.5, 1]
];
var defaultStateStyles2 = {
hover: {
stroke: "#1890ff",
lineWidth: 2
}
};
var defaultNodeSize2 = [120, 40];
// node_modules/@ant-design/charts/es/obsolescent/graph/utils.js
var __assign19 = function() {
__assign19 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
return t4;
};
return __assign19.apply(this, arguments);
};
var defaultMinimapCfg2 = {
show: false,
size: [150, 100],
type: "keyShape"
};
var getGraphSize2 = function(width2, height, container2) {
var CANVAS_WIDTH;
var CANVAS_HEIGHT;
if (container2 && container2.current) {
CANVAS_WIDTH = container2.current.offsetWidth;
CANVAS_HEIGHT = container2.current.offsetHeight || 500;
}
if (!width2 && !CANVAS_WIDTH || !height && !CANVAS_HEIGHT) {
console.warn("\u8BF7\u4E3A Graph \u6307\u5B9A width \u4E0E height\uFF01\u5426\u5219\u5C06\u4F7F\u7528\u9ED8\u8BA4\u503C 500 * 500");
return [500, 500];
}
return [width2 || CANVAS_WIDTH || 500, height || CANVAS_HEIGHT || 500];
};
var processMinimap2 = function(cfg, graph) {
if (!graph || graph.destroyed)
return;
if (cfg && cfg.show) {
var curMminimapCfg = Object.assign(defaultMinimapCfg2, cfg);
var minimap = new es_default5.Minimap(__assign19({}, curMminimapCfg));
graph.addPlugin(minimap);
return minimap;
}
return null;
};
var uuid = function() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c5) {
var r4 = Math.random() * 16 | 0;
var v3 = c5 == "x" ? r4 : r4 & 3 | 8;
return v3.toString(16);
});
};
var getGraphId2 = function(graph) {
if (graph.current) {
return graph.current;
}
graph.current = "IndentedTreeGraph-" + uuid();
return graph.current;
};
var renderGraph2 = function(graph, data3) {
var originData = deepClone(data3);
graph.data(originData);
graph.render();
};
var bindEvents = function(graph, props) {
var handleEdgeClick = props.handleEdgeClick, handleEdgeHover = props.handleEdgeHover, handleEdgeUnHover = props.handleEdgeUnHover, handleNodeClick = props.handleNodeClick, handleNodeHover = props.handleNodeHover, handleNodeUnHover = props.handleNodeUnHover, handleCanvasClick = props.handleCanvasClick;
graph.on("edge:mouseenter", function(evt) {
var item = evt.item;
graph.setItemState(item, "hover", true);
handleEdgeHover === null || handleEdgeHover === void 0 ? void 0 : handleEdgeHover(item, graph);
});
graph.on("edge:mouseleave", function(evt) {
var item = evt.item;
graph.setItemState(item, "hover", false);
handleEdgeUnHover === null || handleEdgeUnHover === void 0 ? void 0 : handleEdgeUnHover(item, graph);
});
graph.on("edge:click", function(evt) {
var item = evt.item;
handleEdgeClick === null || handleEdgeClick === void 0 ? void 0 : handleEdgeClick(item, graph);
});
graph.on("edge:touchstart", function(evt) {
var item = evt.item;
handleEdgeClick === null || handleEdgeClick === void 0 ? void 0 : handleEdgeClick(item, graph);
});
graph.on("node:mouseenter", function(evt) {
var item = evt.item;
graph.setItemState(item, "hover", true);
handleNodeHover === null || handleNodeHover === void 0 ? void 0 : handleNodeHover(item, graph);
});
graph.on("node:mouseleave", function(evt) {
var item = evt.item;
graph.setItemState(item, "hover", false);
handleNodeUnHover === null || handleNodeUnHover === void 0 ? void 0 : handleNodeUnHover(item, graph);
});
graph.on("node:click", function(evt) {
var item = evt.item;
handleNodeClick === null || handleNodeClick === void 0 ? void 0 : handleNodeClick(item, graph);
});
graph.on("canvas:click", function() {
handleCanvasClick === null || handleCanvasClick === void 0 ? void 0 : handleCanvasClick(graph);
});
graph.on("canvas:touchstart", function() {
handleCanvasClick === null || handleCanvasClick === void 0 ? void 0 : handleCanvasClick(graph);
});
};
var useProps = function(props, defaultProps13) {
return __assign19(__assign19(__assign19({}, defaultProps13), props), { layout: __assign19(__assign19({}, defaultProps13 === null || defaultProps13 === void 0 ? void 0 : defaultProps13.layout), props === null || props === void 0 ? void 0 : props.layout) });
};
// node_modules/@ant-design/charts/es/obsolescent/graph/organizationTreeGraph.js
var defaultNodeStyle2 = {
fill: "#91d5ff",
stroke: "#40a9ff",
radius: 2
};
var defaultEdgeStyle2 = {
stroke: "#91d5ff",
endArrow: {
path: "M 0,0 L 12, 6 L 9,0 L 12, -6 Z",
fill: "#91d5ff",
d: -20
}
};
var defaultLayout2 = {
type: "compactBox",
direction: "TB",
getId: function getId(d3) {
return d3.id;
},
getHeight: function getHeight3() {
return 16;
},
getWidth: function getWidth() {
return 16;
},
getVGap: function getVGap() {
return 40;
},
getHGap: function getHGap() {
return 70;
}
};
var defaultProps = {
nodeType: "rect",
edgeType: "flow-line",
collapseExpand: false,
nodeSize: [120, 40],
nodeLabelCfg: defaultLabelCfg,
edgeLabelCfg: defaultLabelCfg,
layout: defaultLayout2,
enableEdit: false,
nodeStyle: defaultNodeStyle2,
edgeStyle: defaultEdgeStyle2,
nodeStateStyles: defaultStateStyles2,
edgeStateStyles: defaultStateStyles2,
autoFit: true
};
var graphs = {};
var OrganizationTreeGraphComponent = function(props) {
var uProps = useProps(props, defaultProps);
var data3 = uProps.data, className = uProps.className, style = uProps.style, width2 = uProps.width, height = uProps.height, _a6 = uProps.nodeType, nodeType = _a6 === void 0 ? "rect" : _a6, _b = uProps.edgeType, edgeType = _b === void 0 ? "flow-line" : _b, _c = uProps.collapseExpand, collapseExpand = _c === void 0 ? false : _c, _d = uProps.nodeSize, nodeSize = _d === void 0 ? [120, 40] : _d, _e = uProps.nodeLabelCfg, nodeLabelCfg = _e === void 0 ? defaultLabelCfg : _e, _f = uProps.edgeLabelCfg, edgeLabelCfg = _f === void 0 ? defaultLabelCfg : _f, _g = uProps.layout, layout6 = _g === void 0 ? defaultLayout2 : _g, _h = uProps.enableEdit, enableEdit = _h === void 0 ? false : _h, minimapCfg = uProps.minimapCfg, _j = uProps.nodeStyle, nodeStyle = _j === void 0 ? defaultNodeStyle2 : _j, _k = uProps.edgeStyle, edgeStyle = _k === void 0 ? defaultEdgeStyle2 : _k, _l = uProps.nodeStateStyles, nodeStateStyles = _l === void 0 ? defaultStateStyles2 : _l, _m = uProps.edgeStateStyles, edgeStateStyles = _m === void 0 ? defaultStateStyles2 : _m, _o = uProps.autoFit, autoFit = _o === void 0 ? true : _o, graphRef = uProps.graphRef, onReady = uProps.onReady, loading = uProps.loading, loadingTemplate = uProps.loadingTemplate, errorTemplate = uProps.errorTemplate;
var container2 = compat_module_default.useRef(null);
var graph = compat_module_default.useRef(null);
var graphId = getGraphId2(graph);
useGraph(graphs[graphId], uProps, container2);
y2(function() {
var graphSize = getGraphSize2(width2, height, container2);
if (nodeType === "icon-node") {
customIconNode({ enableEdit });
}
var graph2 = graphs[graphId];
if (!graph2) {
graph2 = new es_default5.TreeGraph({
container: container2.current,
width: graphSize[0],
height: graphSize[1],
linkCenter: true,
modes: {
default: ["drag-canvas", "zoom-canvas"]
},
defaultNode: {
type: nodeType,
size: nodeSize,
style: nodeStyle,
labelCfg: nodeLabelCfg
},
defaultEdge: {
type: edgeType,
style: edgeStyle,
labelCfg: edgeLabelCfg
},
nodeStateStyles,
edgeStateStyles,
layout: layout6,
fitView: autoFit
});
graphs[graphId] = graph2;
}
if (graphRef) {
graphRef.current = graph2;
}
processMinimap2(minimapCfg, graph2);
renderGraph2(graph2, data3);
if (onReady) {
onReady(graph2);
}
if (collapseExpand) {
graph2.addBehaviors({
type: "collapse-expand"
}, "default");
}
bindEvents(graph2, props);
return function() {
if (graphs[graphId]) {
graphs[graphId].destroy();
delete graphs[graphId];
}
};
}, []);
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
};
var organizationTreeGraph_default = OrganizationTreeGraphComponent;
// node_modules/@ant-design/charts/es/obsolescent/graphs/constants.js
var defaultStateStyles3 = {
hover: {
stroke: "#1890ff",
lineWidth: 2
}
};
var defaultNodeSize3 = [120, 40];
var defaultNodeStyle3 = {
stroke: "#40a9ff"
};
var defaultNodeAnchorPoints2 = [
[0, 0.5],
[1, 0.5]
];
var Margin = 6;
var defaultTitleLabelCfg = {
fill: "#fff",
fontSize: 12
};
var cardTitlePadding = 2;
var defaultLabelStyle2 = {
fill: "#000",
fontSize: 12
};
var defaultMinimapCfg3 = {
show: false,
size: [150, 100],
type: "keyShape"
};
// node_modules/@ant-design/charts/es/obsolescent/graphs/utils.js
var __assign20 = function() {
__assign20 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
return t4;
};
return __assign20.apply(this, arguments);
};
var getGraphSize3 = function(width2, height, container2) {
var CANVAS_WIDTH;
var CANVAS_HEIGHT;
if (container2 && container2.current) {
CANVAS_WIDTH = container2.current.offsetWidth;
CANVAS_HEIGHT = container2.current.offsetHeight || 500;
}
if (!width2 && !CANVAS_WIDTH || !height && !CANVAS_HEIGHT) {
console.warn("\u8BF7\u4E3A Graph \u6307\u5B9A width \u4E0E height\uFF01\u5426\u5219\u5C06\u4F7F\u7528\u9ED8\u8BA4\u503C 500 * 500");
return [500, 500];
}
return [width2 || CANVAS_WIDTH || 500, height || CANVAS_HEIGHT || 500];
};
var bindDefaultEvents2 = function(graph, collapseExpand) {
if (collapseExpand) {
var onClick_1 = function(e4) {
var item = e4.item;
if (e4.target.get("name") === "collapse-icon") {
graph.updateItem(item, {
collapsed: !item.getModel().collapsed
});
graph.layout();
}
};
graph.on("node:click", function(e4) {
onClick_1(e4);
});
graph.on("node:touchstart", function(e4) {
onClick_1(e4);
});
}
};
var getDefaultEdgeArrowCfg = function(d3, arrowType, fill) {
if (d3 === void 0) {
d3 = 0;
}
if (arrowType === void 0) {
arrowType = "vee";
}
if (fill === void 0) {
fill = "#ccc";
}
return {
endArrow: {
path: es_default5.Arrow[arrowType](10, 10, d3),
fill,
d: d3
}
};
};
var getContentAndStyle = function(cfg) {
if (typeof cfg === "string" || typeof cfg === "number") {
return {
text: cfg
};
}
var content = cfg.content, style = cfg.style;
return {
text: content,
style
};
};
var getConfig = function(source, item, cfg) {
if (typeof source === "function") {
return source(item, cfg);
}
return source || {};
};
var uuid2 = function() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c5) {
var r4 = Math.random() * 16 | 0;
var v3 = c5 == "x" ? r4 : r4 & 3 | 8;
return v3.toString(16);
});
};
var getGraphId3 = function(graph) {
if (graph.current) {
return graph.current;
}
graph.current = "IndentedTreeGraph-" + uuid2();
return graph.current;
};
var renderGraph3 = function(graph, data3) {
var originData = deepClone(data3);
graph.data(originData);
graph.render();
};
var processMinimap3 = function(cfg, graph) {
if (cfg === void 0) {
cfg = {};
}
if (!graph || graph.destroyed)
return;
if (cfg.show) {
var curMminimapCfg = Object.assign(defaultMinimapCfg3, cfg);
var minimap = new es_default5.Minimap(__assign20({}, curMminimapCfg));
graph.addPlugin(minimap);
return minimap;
}
return null;
};
var getMarkerPosition2 = function(direction5, size2) {
if (direction5 === void 0) {
direction5 = "right";
}
var width2 = size2[0], height = size2[1];
var x6 = 0;
var y5 = 0;
switch (direction5) {
case "top":
x6 = width2 / 2;
y5 = 0;
break;
case "right":
x6 = width2;
y5 = height / 2;
break;
case "bottom":
x6 = width2 / 2;
y5 = height;
break;
case "left":
x6 = 0;
y5 = height / 2;
break;
}
return { x: x6, y: y5 };
};
var useProps2 = function(props, defaultProps13) {
return __assign20(__assign20(__assign20({}, defaultProps13), props), { layout: __assign20(__assign20({}, defaultProps13 === null || defaultProps13 === void 0 ? void 0 : defaultProps13.layout), props === null || props === void 0 ? void 0 : props.layout) });
};
// node_modules/@ant-design/charts/es/obsolescent/graphs/customItems.js
var __assign21 = function() {
__assign21 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
return t4;
};
return __assign21.apply(this, arguments);
};
var registerCardNode = function() {
es_default5.registerNode("card", {
draw: function(cfg, group2) {
var _a6;
if (cfg === void 0) {
cfg = {};
}
var title = cfg.title, body = cfg.body, footer = cfg.footer, collapseExpand = cfg.collapseExpand, children = cfg.children, markerPosition = cfg.markerPosition;
var size2 = cfg.size || [100, 30];
var height = 0;
if (typeof size2 === "number")
size2 = [size2, size2];
var style = __assign21({ radius: 2, fill: "#fff" }, cfg.style);
var color4 = style.stroke || cfg.color || "#5B8FF9";
var radius = style.radius;
var shape = group2.addShape("rect", {
attrs: __assign21({ x: 0, y: 0, width: size2[0], height: size2[1], stroke: color4 }, style),
name: "main-box",
draggable: true
});
var titleTextShape;
if (title) {
var _b = getContentAndStyle(title), text = _b.text, _c = _b.style, titleStyle = _c === void 0 ? cfg.titleStyle : _c;
titleTextShape = group2.addShape("text", {
attrs: __assign21(__assign21({ textBaseline: "top", x: Margin, y: cardTitlePadding, text }, defaultTitleLabelCfg), getConfig(titleStyle, group2)),
name: "title"
});
}
var titleHeight = (titleTextShape ? titleTextShape.getBBox() : { height: size2[1] / 2 }).height;
var titleRectShape = group2.addShape("rect", {
attrs: {
x: 0,
y: 0,
width: size2[0],
height: titleHeight + 2 * cardTitlePadding,
fill: color4,
radius: [radius, radius, 0, 0]
},
name: "title-rect",
draggable: true
});
titleTextShape === null || titleTextShape === void 0 ? void 0 : titleTextShape.toFront();
var markerShape;
if (collapseExpand && children) {
markerShape = group2.addShape("marker", {
attrs: __assign21(__assign21(__assign21({}, getMarkerPosition2(markerPosition, size2)), { r: 6, cursor: "pointer", symbol: cfg.collapsed ? es_default5.Marker.expand : es_default5.Marker.collapse, stroke: color4, lineWidth: 1, fill: "#fff" }), getConfig(cfg.markerStyle, group2, __assign21(__assign21({}, cfg), { name: "collapse-icon" }))),
name: "collapse-icon"
});
}
var titleRectBoxHeight = titleRectShape.getBBox().height;
height += titleRectBoxHeight;
var bodyShape;
if (body) {
var _d = getContentAndStyle(body), text = _d.text, _e = _d.style, bodyStyle = _e === void 0 ? cfg.bodyStyle : _e;
bodyShape = group2.addShape("text", {
attrs: __assign21(__assign21({ textBaseline: "top", x: Margin, y: height + Margin, text }, defaultLabelStyle2), getConfig(bodyStyle, group2)),
name: "body"
});
height += bodyShape.getBBox().height;
}
var footerTextShape;
if (footer) {
if (bodyShape) {
height += Margin;
}
var _f = getContentAndStyle(footer), labelText = _f.text, _g = _f.style, labelStyle = _g === void 0 ? cfg.footerStyle : _g;
footerTextShape = group2.addShape("text", {
attrs: __assign21(__assign21({ textBaseline: "top", x: Margin, y: height + Margin, text: labelText }, defaultLabelStyle2), getConfig(labelStyle, group2)),
name: "footer-label"
});
var _h = footerTextShape.getBBox(), width2 = _h.width, contentHeight = _h.height;
var footerValueHeight = 0;
if (typeof cfg.footer === "object" && ((_a6 = cfg.footer) === null || _a6 === void 0 ? void 0 : _a6.value)) {
var _j = getContentAndStyle({
content: cfg.footer.value,
style: cfg.footer.valueStyle
}), valueText = _j.text, _k = _j.style, valueStyle = _k === void 0 ? cfg.footerValueStyle || cfg.footerStyle : _k;
var valueTextShape = group2.addShape("text", {
attrs: __assign21(__assign21({ textBaseline: "top", x: width2 + Margin * 2, y: height + Margin, text: valueText }, defaultLabelStyle2), getConfig(valueStyle, group2)),
name: "footer-value"
});
var valueHeight = valueTextShape.getBBox().height;
footerValueHeight = valueHeight;
}
height += Math.max(contentHeight, footerValueHeight);
}
if (bodyShape) {
var desTextShapeBBox = bodyShape.getBBox();
var width2 = size2[0] > desTextShapeBBox.width + 16 ? size2[0] : desTextShapeBBox.width + 16;
shape.attr({ width: width2, height: height + 16 });
titleRectShape === null || titleRectShape === void 0 ? void 0 : titleRectShape.attr("width", width2);
markerShape === null || markerShape === void 0 ? void 0 : markerShape.attr(__assign21({}, getMarkerPosition2(markerPosition, [
width2,
height + titleHeight + 2 * cardTitlePadding
])));
}
return shape;
},
update: void 0
}, "single-node");
};
var registerIconNode = function() {
es_default5.registerNode("icon-node", {
options: {
size: [60, 20],
stroke: "#91d5ff",
fill: "#91d5ff"
},
draw: function(cfg, group2) {
if (cfg === void 0) {
cfg = {};
}
var styles = this.getShapeStyle(cfg);
var _a6 = cfg.labelCfg, labelCfg = _a6 === void 0 ? {} : _a6, labelStyle = cfg.labelStyle, label17 = cfg.label, markerStyle = cfg.markerStyle, showMarker = cfg.showMarker, title = cfg.title, titleStyle = cfg.titleStyle;
var keyShape = group2.addShape("rect", {
attrs: __assign21(__assign21({}, styles), { x: 0, y: 0 })
});
var keyShapeHeight = keyShape.getBBox().height;
var headShape;
if (cfg.leftIcon) {
var _b = cfg.leftIcon, _c = _b.x, x6 = _c === void 0 ? 8 : _c, y5 = _b.y, _d = _b.width, width2 = _d === void 0 ? 24 : _d, _e = _b.height, height = _e === void 0 ? 24 : _e, style = _b.style;
if (style) {
group2.addShape("rect", {
attrs: __assign21({ x: 1, y: 1, width: 38, height: styles.height - 2 }, style)
});
}
headShape = group2.addShape("image", {
attrs: {
x: x6,
y: y5 || keyShapeHeight / 2 - height / 2,
width: width2,
height,
img: cfg.leftIcon.img
},
name: "image-shape"
});
}
if (showMarker) {
group2.addShape("marker", {
attrs: __assign21({ x: styles.width / 3, y: styles.height + 6, r: 6, stroke: "#73d13d", cursor: "pointer", symbol: es_default5.Marker.expand }, getConfig(markerStyle, group2, __assign21(__assign21({}, cfg), { name: "add-item" }))),
name: "add-item"
});
group2.addShape("marker", {
attrs: __assign21({ x: styles.width * 2 / 3, y: styles.height + 6, r: 6, stroke: "#ff4d4f", cursor: "pointer", symbol: es_default5.Marker.collapse }, getConfig(markerStyle, group2, __assign21(__assign21({}, cfg), { name: "remove-item" }))),
name: "remove-item"
});
}
if (label17) {
var textCfg = labelStyle ? getConfig(labelStyle, group2, cfg) : labelCfg.style;
var y5 = title ? styles.height / 2 - (textCfg.fontSize * 1 || 12) - Margin / 2 : styles.height / 2;
group2.addShape("text", {
attrs: __assign21({ text: label17, x: styles.width / 2, y: y5, textAlign: headShape ? "start" : "center", textBaseline: title ? "top" : "middle" }, textCfg)
});
}
if (title) {
var titleCfg = titleStyle ? getConfig(titleStyle, group2, cfg) : labelCfg.style;
group2.addShape("text", {
attrs: __assign21({ text: title, x: styles.width / 2, y: styles.height / 2 + Margin / 2, textAlign: headShape ? "start" : "center", textBaseline: "top" }, titleCfg)
});
}
return keyShape;
}
}, "rect");
};
// node_modules/@ant-design/charts/es/obsolescent/graph/dagre.js
registerCustomItems();
registerCardNode();
var defaultNodeStyle4 = {
stroke: "#40a9ff"
};
var defaultLayout3 = {
type: "dagre",
rankdir: "TB",
nodesepFunc: function() {
return 0;
},
ranksepFunc: function() {
return 0;
},
controlPoints: true
};
var defaultProps2 = {
nodeType: "modelRect",
edgeType: "polyline",
behaviors: ["zoom-canvas", "drag-canvas"],
nodeSize: defaultNodeSize2,
nodeLabelCfg: defaultLabelCfg,
edgeLabelCfg: defaultLabelCfg,
nodeAnchorPoints: defaultNodeAnchorPoints,
layout: defaultLayout3,
nodeStyle: defaultNodeStyle4,
edgeStyle: defaultEdgeStyle,
nodeStateStyles: defaultStateStyles2,
edgeStateStyles: defaultStateStyles2,
autoFit: true
};
var graphs2 = {};
var DagreGraph = function(props) {
var uProps = useProps(props, defaultProps2);
var data3 = uProps.data, className = uProps.className, style = uProps.style, width2 = uProps.width, height = uProps.height, _a6 = uProps.nodeType, nodeType = _a6 === void 0 ? "modelRect" : _a6, _b = uProps.edgeType, edgeType = _b === void 0 ? "polyline" : _b, _c = uProps.behaviors, behaviors2 = _c === void 0 ? ["zoom-canvas", "drag-canvas"] : _c, _d = uProps.nodeSize, nodeSize = _d === void 0 ? defaultNodeSize2 : _d, _e = uProps.nodeLabelCfg, nodeLabelCfg = _e === void 0 ? defaultLabelCfg : _e, _f = uProps.edgeLabelCfg, edgeLabelCfg = _f === void 0 ? defaultLabelCfg : _f, _g = uProps.nodeAnchorPoints, nodeAnchorPoints = _g === void 0 ? defaultNodeAnchorPoints : _g, _h = uProps.layout, layout6 = _h === void 0 ? defaultLayout3 : _h, minimapCfg = uProps.minimapCfg, _j = uProps.nodeStyle, nodeStyle = _j === void 0 ? defaultNodeStyle4 : _j, _k = uProps.edgeStyle, edgeStyle = _k === void 0 ? defaultEdgeStyle : _k, _l = uProps.nodeStateStyles, nodeStateStyles = _l === void 0 ? defaultStateStyles2 : _l, _m = uProps.edgeStateStyles, edgeStateStyles = _m === void 0 ? defaultStateStyles2 : _m, _o = uProps.autoFit, autoFit = _o === void 0 ? true : _o, graphRef = uProps.graphRef, onReady = uProps.onReady, loading = uProps.loading, loadingTemplate = uProps.loadingTemplate, errorTemplate = uProps.errorTemplate;
var container2 = compat_module_default.useRef(null);
var graph = compat_module_default.useRef(null);
var graphId = getGraphId2(graph);
useGraph(graphs2[graphId], uProps, container2);
y2(function() {
var graphSize = getGraphSize2(width2, height, container2);
var graph2 = graphs2[graphId];
if (!graph2) {
graph2 = new es_default5.Graph({
container: container2.current,
width: graphSize[0],
height: graphSize[1],
modes: {
default: behaviors2
},
defaultNode: {
type: nodeType,
size: nodeSize,
style: nodeStyle,
anchorPoints: nodeAnchorPoints,
labelCfg: nodeLabelCfg
},
defaultEdge: {
type: edgeType,
style: edgeStyle,
labelCfg: edgeLabelCfg
},
nodeStateStyles,
edgeStateStyles,
layout: layout6,
fitView: autoFit
});
graphs2[graphId] = graph2;
}
if (graphRef) {
graphRef.current = graph2;
}
processMinimap2(minimapCfg, graph2);
renderGraph2(graph2, data3);
if (onReady) {
onReady(graph2);
}
bindEvents(graph2, props);
return function() {
if (graphs2[graphId]) {
graphs2[graphId].destroy();
delete graphs2[graphId];
}
};
}, []);
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
};
var dagre_default2 = DagreGraph;
// node_modules/@ant-design/charts/es/obsolescent/graph/dagreFundFlow.js
registerCustomItems();
var defaultNodeSize4 = [150, 30];
var defaultNodeStyle5 = {
stroke: "#72CC4A",
fill: "#f00"
};
var defaultLayout4 = {
type: "dagre",
rankdir: "LR",
nodesep: 30,
ranksep: 50
};
var defaultLabelCfg2 = {
style: {
fill: "#000000A6",
fontSize: 10
}
};
var defaultProps3 = {
nodeType: "round-rect",
edgeType: "fund-polyline",
behaviors: ["zoom-canvas", "drag-canvas"],
nodeSize: defaultNodeSize4,
nodeLabelCfg: defaultLabelCfg2,
edgeLabelCfg: defaultLabelCfg2,
nodeAnchorPoints: defaultNodeAnchorPoints,
layout: defaultLayout4,
nodeStyle: defaultNodeStyle5,
edgeStyle: defaultEdgeStyle,
nodeStateStyles: defaultStateStyles2,
edgeStateStyles: defaultStateStyles2,
colorMap: {},
autoFit: true
};
var graphs3 = {};
var DagreFundFlowGraph = function(props) {
var uProps = useProps(props, defaultProps3);
var data3 = uProps.data, className = uProps.className, style = uProps.style, width2 = uProps.width, height = uProps.height, _a6 = uProps.nodeType, nodeType = _a6 === void 0 ? "round-rect" : _a6, _b = uProps.edgeType, edgeType = _b === void 0 ? "fund-polyline" : _b, _c = uProps.behaviors, behaviors2 = _c === void 0 ? ["zoom-canvas", "drag-canvas"] : _c, _d = uProps.nodeSize, nodeSize = _d === void 0 ? defaultNodeSize4 : _d, _e = uProps.nodeLabelCfg, nodeLabelCfg = _e === void 0 ? defaultLabelCfg2 : _e, _f = uProps.edgeLabelCfg, edgeLabelCfg = _f === void 0 ? defaultLabelCfg2 : _f, _g = uProps.nodeAnchorPoints, nodeAnchorPoints = _g === void 0 ? defaultNodeAnchorPoints : _g, _h = uProps.layout, layout6 = _h === void 0 ? defaultLayout4 : _h, minimapCfg = uProps.minimapCfg, _j = uProps.nodeStyle, nodeStyle = _j === void 0 ? defaultNodeStyle5 : _j, _k = uProps.edgeStyle, edgeStyle = _k === void 0 ? defaultEdgeStyle : _k, _l = uProps.nodeStateStyles, nodeStateStyles = _l === void 0 ? defaultStateStyles2 : _l, _m = uProps.edgeStateStyles, edgeStateStyles = _m === void 0 ? defaultStateStyles2 : _m, _o = uProps.colorMap, colorMap2 = _o === void 0 ? {} : _o, _p = uProps.autoFit, autoFit = _p === void 0 ? true : _p, graphRef = uProps.graphRef, onReady = uProps.onReady, loading = uProps.loading, loadingTemplate = uProps.loadingTemplate, errorTemplate = uProps.errorTemplate;
var container2 = compat_module_default.useRef(null);
var graph = compat_module_default.useRef(null);
var graphId = getGraphId2(graph);
useGraph(graphs3[graphId], uProps, container2);
y2(function() {
var graphSize = getGraphSize2(width2, height, container2);
var graph2 = graphs3[graphId];
if (!graph2) {
graph2 = new es_default5.Graph({
container: container2.current,
width: graphSize[0],
height: graphSize[1],
modes: {
default: behaviors2
},
defaultNode: {
type: nodeType,
size: nodeSize,
style: nodeStyle,
anchorPoints: nodeAnchorPoints,
labelCfg: nodeLabelCfg
},
defaultEdge: {
type: edgeType,
style: edgeStyle,
colorMap: colorMap2,
labelCfg: edgeLabelCfg
},
nodeStateStyles,
edgeStateStyles,
layout: layout6,
fitView: autoFit
});
graphs3[graphId] = graph2;
}
if (graphRef) {
graphRef.current = graph2;
}
processMinimap2(minimapCfg, graph2);
var originData = deepClone(data3);
graph2.data(originData);
graph2.render();
if (onReady) {
onReady(graph2);
}
var edges = graph2.getEdges();
edges.forEach(function(edge2) {
var line2 = edge2.getKeyShape();
var stroke = line2.attr("stroke");
var targetNode = edge2.getTarget();
targetNode.update({
style: {
stroke
}
});
});
bindEvents(graph2, props);
return function() {
if (graphs3[graphId]) {
graphs3[graphId].destroy();
delete graphs3[graphId];
}
};
}, []);
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
};
var dagreFundFlow_default = DagreFundFlowGraph;
// node_modules/@ant-design/charts/es/obsolescent/graph/indented.js
registerCustomItems();
var defaultNodeStyle6 = {
stroke: "#40a9ff"
};
var defaultNodeAnchorPoints3 = [
[0, 0.5],
[1, 0.5]
];
var defaultEdgeStyle3 = {
stroke: "#ccc",
endArrow: {
path: es_default5.Arrow.vee(10, 10),
fill: "#ccc"
}
};
var defaultLayout5 = {
type: "indented",
direction: "LR",
dropCap: false,
indent: 250,
getHeight: function() {
return 60;
},
getWidth: function() {
return 100;
}
};
var defaultProps4 = {
nodeType: "card-node",
edgeType: "cubic-horizontal",
behaviors: ["zoom-canvas", "drag-canvas"],
nodeSize: defaultNodeSize2,
nodeLabelCfg: defaultLabelCfg,
nodeAnchorPoints: defaultNodeAnchorPoints3,
layout: defaultLayout5,
nodeStyle: defaultNodeStyle6,
edgeStyle: defaultEdgeStyle3,
nodeStateStyles: defaultStateStyles2,
edgeStateStyles: defaultStateStyles2,
collapseExpand: true,
autoFit: true
};
var graphs4 = {};
var IndentedTree = function(props) {
var uProps = useProps(props, defaultProps4);
var data3 = uProps.data, className = uProps.className, style = uProps.style, width2 = uProps.width, height = uProps.height, _a6 = uProps.nodeType, nodeType = _a6 === void 0 ? "card-node" : _a6, _b = uProps.edgeType, edgeType = _b === void 0 ? "cubic-horizontal" : _b, _c = uProps.behaviors, behaviors2 = _c === void 0 ? ["zoom-canvas", "drag-canvas"] : _c, _d = uProps.nodeSize, nodeSize = _d === void 0 ? defaultNodeSize2 : _d, _e = uProps.nodeLabelCfg, nodeLabelCfg = _e === void 0 ? defaultLabelCfg : _e, _f = uProps.nodeAnchorPoints, nodeAnchorPoints = _f === void 0 ? defaultNodeAnchorPoints3 : _f, _g = uProps.layout, layout6 = _g === void 0 ? defaultLayout5 : _g, minimapCfg = uProps.minimapCfg, _h = uProps.nodeStyle, nodeStyle = _h === void 0 ? defaultNodeStyle6 : _h, _j = uProps.edgeStyle, edgeStyle = _j === void 0 ? defaultEdgeStyle3 : _j, _k = uProps.nodeStateStyles, nodeStateStyles = _k === void 0 ? defaultStateStyles2 : _k, _l = uProps.edgeStateStyles, edgeStateStyles = _l === void 0 ? defaultStateStyles2 : _l, _m = uProps.collapseExpand, collapseExpand = _m === void 0 ? true : _m, _o = uProps.autoFit, autoFit = _o === void 0 ? true : _o, handleNodeClick = uProps.handleNodeClick, graphRef = uProps.graphRef, onReady = uProps.onReady, loading = uProps.loading, loadingTemplate = uProps.loadingTemplate, errorTemplate = uProps.errorTemplate;
var graph = compat_module_default.useRef(null);
var graphId = getGraphId2(graph);
var container2 = compat_module_default.useRef(null);
useGraph(graphs4[graphId], uProps, container2);
y2(function() {
var graphSize = getGraphSize2(width2, height, container2);
var graph2 = graphs4[graphId];
if (!graph2) {
graph2 = new es_default5.TreeGraph({
container: container2.current,
width: graphSize[0],
height: graphSize[1],
modes: {
default: behaviors2
},
defaultNode: {
type: nodeType,
size: nodeSize,
style: nodeStyle,
anchorPoints: nodeAnchorPoints,
labelCfg: nodeLabelCfg
},
defaultEdge: {
type: edgeType,
style: edgeStyle
},
nodeStateStyles,
edgeStateStyles,
layout: layout6,
fitView: autoFit
});
graphs4[graphId] = graph2;
}
if (graphRef) {
graphRef.current = graph2;
}
processMinimap2(minimapCfg, graph2);
renderGraph2(graph2, data3);
if (onReady) {
onReady(graph2);
}
if (collapseExpand) {
var onClick_1 = function(e4) {
var item = e4.item;
if (e4.target.get("name") === "collapse-icon") {
graph2.updateItem(item, {
collapsed: !item.getModel().collapsed
});
graph2.layout();
} else if (handleNodeClick) {
handleNodeClick(item, graph2);
}
};
graph2.on("node:click", function(e4) {
onClick_1(e4);
});
graph2.on("node:touchstart", function(e4) {
onClick_1(e4);
});
}
bindEvents(graph2, props);
return function() {
if (graphs4[graphId]) {
graphs4[graphId].destroy();
delete graphs4[graphId];
}
};
}, []);
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
};
var indented_default = IndentedTree;
// node_modules/@ant-design/charts/es/obsolescent/graphs/indentedTreeGraph/index.js
var __assign22 = function() {
__assign22 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
return t4;
};
return __assign22.apply(this, arguments);
};
var graphs5 = {};
registerCardNode();
var defaultLayout6 = {
type: "compactBox",
direction: "LR",
getId: function(d3) {
return d3.id;
},
getHeight: function() {
return 60;
},
getWidth: function() {
return 16;
},
getVGap: function() {
return 16;
},
getHGap: function() {
return 100;
}
};
var defaultProps5 = {
nodeType: "card",
edgeType: "cubic-horizontal",
behaviors: ["zoom-canvas", "drag-canvas"],
nodeAnchorPoints: defaultNodeAnchorPoints2,
nodeSize: defaultNodeSize3,
layout: defaultLayout6,
animate: true,
markerPosition: "right",
nodeStateStyles: defaultStateStyles3,
edgeStateStyles: defaultStateStyles3,
collapseExpand: true,
showArrow: true,
arrowType: "vee",
autoFit: true,
style: {
height: "inherit"
}
};
var IndentedTreeGraph = function(props) {
var uProps = useProps2(props, defaultProps5);
var data3 = uProps.data, className = uProps.className, style = uProps.style, width2 = uProps.width, height = uProps.height, _a6 = uProps.nodeType, nodeType = _a6 === void 0 ? "card" : _a6, _b = uProps.edgeType, edgeType = _b === void 0 ? "cubic-horizontal" : _b, _c = uProps.behaviors, behaviors2 = _c === void 0 ? ["zoom-canvas", "drag-canvas"] : _c, _d = uProps.nodeAnchorPoints, nodeAnchorPoints = _d === void 0 ? defaultNodeAnchorPoints2 : _d, _e = uProps.nodeSize, nodeSize = _e === void 0 ? defaultNodeSize3 : _e, layout6 = uProps.layout, _f = uProps.animate, animate = _f === void 0 ? true : _f, nodeStyle = uProps.nodeStyle, edgeStyle = uProps.edgeStyle, edgeCfg = uProps.edgeCfg, markerStyle = uProps.markerStyle, _g = uProps.markerPosition, markerPosition = _g === void 0 ? "right" : _g, _h = uProps.nodeStateStyles, nodeStateStyles = _h === void 0 ? defaultStateStyles3 : _h, _j = uProps.edgeStateStyles, edgeStateStyles = _j === void 0 ? defaultStateStyles3 : _j, _k = uProps.collapseExpand, collapseExpand = _k === void 0 ? true : _k, titleStyle = uProps.titleStyle, bodyStyle = uProps.bodyStyle, footerStyle = uProps.footerStyle, footerValueStyle = uProps.footerValueStyle, _l = uProps.showArrow, showArrow = _l === void 0 ? true : _l, _m = uProps.arrowType, arrowType = _m === void 0 ? "vee" : _m, _o = uProps.autoFit, autoFit = _o === void 0 ? true : _o, onReady = uProps.onReady, loading = uProps.loading, loadingTemplate = uProps.loadingTemplate, errorTemplate = uProps.errorTemplate;
var container2 = compat_module_default.useRef(null);
var graph = compat_module_default.useRef(null);
var graphId = getGraphId3(graph);
useGraph(graphs5[graphId], uProps, container2);
y2(function() {
var graphSize = getGraphSize3(width2, height, container2);
var graph2 = graphs5[graphId];
if (!graph2) {
graph2 = new es_default5.TreeGraph({
container: container2.current,
width: graphSize[0],
height: graphSize[1],
animate,
modes: {
default: behaviors2
},
defaultNode: {
type: nodeType,
size: nodeSize,
anchorPoints: nodeAnchorPoints,
titleStyle,
bodyStyle,
footerStyle,
footerValueStyle,
markerStyle,
collapseExpand,
markerPosition
},
defaultEdge: {
type: edgeType
},
nodeStateStyles,
edgeStateStyles,
layout: layout6,
fitView: autoFit
});
graphs5[graphId] = graph2;
}
graph2.node(function(node) {
if (typeof nodeStyle === "function") {
return {
style: nodeStyle(node, graph2)
};
}
return {
style: __assign22(__assign22({}, defaultNodeStyle3), nodeStyle)
};
});
graph2.edge(function(edge2) {
if (edgeCfg) {
return typeof edgeCfg === "function" ? edgeCfg(edge2, graph2) : edgeCfg;
}
if (typeof edgeStyle === "function") {
return {
style: edgeStyle(edge2, graph2)
};
}
return {
style: __assign22(__assign22({ stroke: "#ccc" }, showArrow && getDefaultEdgeArrowCfg(0, arrowType)), edgeStyle)
};
});
if (collapseExpand) {
bindDefaultEvents2(graph2, collapseExpand);
}
renderGraph3(graph2, data3);
if (onReady) {
onReady(graph2);
}
return function() {
if (graphs5[graphId]) {
graphs5[graphId].destroy();
delete graphs5[graphId];
}
};
}, []);
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
};
var indentedTreeGraph_default = IndentedTreeGraph;
// node_modules/@ant-design/charts/es/obsolescent/graphs/organizationalGraph/index.js
var __assign23 = function() {
__assign23 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
return t4;
};
return __assign23.apply(this, arguments);
};
var defaultNodeStyle7 = {
fill: "#91d5ff",
stroke: "#40a9ff",
radius: 2
};
var defaultLayout7 = {
type: "compactBox",
direction: "TB",
getId: function getId2(d3) {
return d3.id;
},
getHeight: function getHeight4() {
return 16;
},
getWidth: function getWidth2() {
return 16;
},
getVGap: function getVGap2() {
return 40;
},
getHGap: function getHGap2() {
return 70;
}
};
var defaultProps6 = {
animate: true,
nodeType: "rect",
edgeType: "polyline",
nodeSize: defaultNodeSize3,
behaviors: ["drag-canvas", "zoom-canvas"],
nodeLabelCfg: {
style: defaultLabelStyle2
},
layout: defaultLayout7,
showMarker: false,
showArrow: true,
arrowType: "triangle",
nodeStateStyles: defaultStateStyles3,
edgeStateStyles: defaultStateStyles3,
autoFit: true,
style: {
height: "inherit"
}
};
var graphs6 = {};
var OrganizationalGraph = function(props) {
var uProps = useProps2(props, defaultProps6);
var data3 = uProps.data, className = uProps.className, style = uProps.style, width2 = uProps.width, height = uProps.height, _a6 = uProps.animate, animate = _a6 === void 0 ? true : _a6, _b = uProps.nodeType, nodeType = _b === void 0 ? "rect" : _b, _c = uProps.edgeType, edgeType = _c === void 0 ? "polyline" : _c, _d = uProps.nodeSize, nodeSize = _d === void 0 ? defaultNodeSize3 : _d, _e = uProps.behaviors, behaviors2 = _e === void 0 ? ["drag-canvas", "zoom-canvas"] : _e, nodeLabelCfg = uProps.nodeLabelCfg, nodeCfg = uProps.nodeCfg, _f = uProps.layout, layout6 = _f === void 0 ? defaultLayout7 : _f, _g = uProps.showMarker, showMarker = _g === void 0 ? false : _g, _h = uProps.showArrow, showArrow = _h === void 0 ? true : _h, _j = uProps.arrowType, arrowType = _j === void 0 ? "triangle" : _j, minimapCfg = uProps.minimapCfg, edgeCfg = uProps.edgeCfg, markerStyle = uProps.markerStyle, _k = uProps.nodeStateStyles, nodeStateStyles = _k === void 0 ? defaultStateStyles3 : _k, _l = uProps.edgeStateStyles, edgeStateStyles = _l === void 0 ? defaultStateStyles3 : _l, _m = uProps.autoFit, autoFit = _m === void 0 ? true : _m, onReady = uProps.onReady, loading = uProps.loading, loadingTemplate = uProps.loadingTemplate, errorTemplate = uProps.errorTemplate;
var container2 = compat_module_default.useRef(null);
var graph = compat_module_default.useRef(null);
var graphId = getGraphId3(graph);
useGraph(graphs6[graphId], uProps, container2);
var arrowOffset = (Array.isArray(nodeSize) ? nodeSize[1] : nodeSize) / 2;
y2(function() {
var graphSize = getGraphSize3(width2, height, container2);
if (nodeType === "icon-node") {
registerIconNode();
}
var graph2 = graphs6[graphId];
if (!graph2) {
graph2 = new es_default5.TreeGraph({
container: container2.current,
width: graphSize[0],
height: graphSize[1],
linkCenter: true,
animate,
modes: {
default: behaviors2
},
defaultNode: {
type: nodeType,
size: nodeSize,
labelCfg: nodeLabelCfg,
markerStyle,
showMarker
},
defaultEdge: {
type: edgeType
},
nodeStateStyles,
edgeStateStyles,
layout: layout6,
fitView: autoFit
});
graphs6[graphId] = graph2;
}
graph2.node(function(node) {
if (typeof nodeCfg === "function") {
return nodeCfg(node, graph2);
}
return {
style: __assign23(__assign23({}, defaultNodeStyle7), nodeCfg === null || nodeCfg === void 0 ? void 0 : nodeCfg.style)
};
});
graph2.edge(function(edge2) {
if (typeof edgeCfg === "function") {
return edgeCfg(edge2, graph2);
}
return __assign23(__assign23({}, edgeCfg), { style: __assign23(__assign23({ stroke: "#91d5ff" }, showArrow && getDefaultEdgeArrowCfg(arrowOffset, arrowType, "#91d5ff")), edgeCfg === null || edgeCfg === void 0 ? void 0 : edgeCfg.style) });
});
processMinimap3(minimapCfg, graph2);
renderGraph3(graph2, data3);
if (onReady) {
onReady(graph2);
}
return function() {
if (graphs6[graphId]) {
graphs6[graphId].destroy();
delete graphs6[graphId];
}
};
}, []);
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
};
var organizationalGraph_default = OrganizationalGraph;
// node_modules/@ant-design/charts/es/obsolescent/graphs/radialGraph/index.js
var __assign24 = function() {
__assign24 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
return t4;
};
return __assign24.apply(this, arguments);
};
var graphs7 = {};
var defaultLayout8 = {
type: "dendrogram",
direction: "LR",
nodeSep: 20,
rankSep: 100,
radial: true
};
var defaultProps7 = {
nodeType: "circle",
linkCenter: true,
edgeType: "line",
behaviors: ["zoom-canvas", "drag-canvas"],
nodeAnchorPoints: defaultNodeAnchorPoints2,
nodeSize: 30,
layout: defaultLayout8,
animate: true,
nodeStateStyles: defaultStateStyles3,
edgeStateStyles: defaultStateStyles3,
showArrow: false,
arrowType: "triangle",
autoFit: true
};
var RadialGraph = function(props) {
var uProps = useProps2(props, defaultProps7);
var data3 = uProps.data, className = uProps.className, style = uProps.style, width2 = uProps.width, height = uProps.height, _a6 = uProps.nodeType, nodeType = _a6 === void 0 ? "circle" : _a6, _b = uProps.linkCenter, linkCenter = _b === void 0 ? true : _b, _c = uProps.edgeType, edgeType = _c === void 0 ? "line" : _c, _d = uProps.behaviors, behaviors2 = _d === void 0 ? ["zoom-canvas", "drag-canvas"] : _d, _e = uProps.nodeAnchorPoints, nodeAnchorPoints = _e === void 0 ? defaultNodeAnchorPoints2 : _e, _f = uProps.nodeSize, nodeSize = _f === void 0 ? 30 : _f, layout6 = uProps.layout, _g = uProps.animate, animate = _g === void 0 ? true : _g, nodeCfg = uProps.nodeCfg, edgeCfg = uProps.edgeCfg, _h = uProps.nodeStateStyles, nodeStateStyles = _h === void 0 ? defaultStateStyles3 : _h, _j = uProps.edgeStateStyles, edgeStateStyles = _j === void 0 ? defaultStateStyles3 : _j, _k = uProps.showArrow, showArrow = _k === void 0 ? false : _k, _l = uProps.arrowType, arrowType = _l === void 0 ? "triangle" : _l, _m = uProps.autoFit, autoFit = _m === void 0 ? true : _m, onReady = uProps.onReady, loading = uProps.loading, loadingTemplate = uProps.loadingTemplate, errorTemplate = uProps.errorTemplate;
var container2 = compat_module_default.useRef(null);
var graph = compat_module_default.useRef(null);
var graphId = getGraphId3(graph);
useGraph(graphs7[graphId], uProps, container2);
var arrowOffset = (Array.isArray(nodeSize) ? nodeSize[0] : nodeSize) / 2;
y2(function() {
var graphSize = getGraphSize3(width2, height, container2);
var graph2 = graphs7[graphId];
if (!graph2) {
graph2 = new es_default5.TreeGraph({
container: container2.current,
width: graphSize[0],
height: graphSize[1],
animate,
linkCenter,
modes: {
default: behaviors2
},
defaultNode: {
type: nodeType,
size: nodeSize,
anchorPoints: nodeAnchorPoints
},
defaultEdge: {
type: edgeType
},
nodeStateStyles,
edgeStateStyles,
layout: layout6,
fitView: autoFit
});
graphs7[graphId] = graph2;
}
graph2.node(function(node) {
if (typeof nodeCfg === "function") {
return nodeCfg(node, graph2);
}
return __assign24(__assign24({}, nodeCfg), { style: __assign24(__assign24({}, defaultNodeStyle3), nodeCfg === null || nodeCfg === void 0 ? void 0 : nodeCfg.style) });
});
graph2.edge(function(edge2) {
if (typeof edgeCfg === "function") {
return edgeCfg(edge2, graph2);
}
return {
style: __assign24(__assign24({ stroke: "#ccc" }, showArrow && getDefaultEdgeArrowCfg(arrowOffset, arrowType)), edgeCfg === null || edgeCfg === void 0 ? void 0 : edgeCfg.style)
};
});
renderGraph3(graph2, data3);
if (onReady) {
onReady(graph2);
}
return function() {
if (graphs7[graphId]) {
graphs7[graphId].destroy();
delete graphs7[graphId];
}
};
}, []);
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
};
var radialGraph_default = RadialGraph;
// node_modules/@ant-design/charts/es/graphs/hooks/useFullscreen.js
var useFullscreen = function(el) {
var _a6 = l3(false), fullscreen = _a6[0], setFullscreen = _a6[1];
var handleFullScreenChange = function() {
if (!document.fullscreenElement) {
setFullscreen(false);
}
};
var enterFullscreen = function() {
if (el && el.requestFullscreen) {
el.requestFullscreen().then(function() {
setFullscreen(true);
}).catch(function(err) {
console.error("requestFullscreen error: ", err);
});
}
};
var exitFullscreen = function() {
if (document.exitFullscreen) {
document.exitFullscreen().then(function() {
setFullscreen(false);
}).catch(function(err) {
console.error("exitFullscreen error: ", err);
});
}
};
var toggleFullscreen = function() {
if (!el) {
console.error("need dom");
return;
}
if (!fullscreen) {
enterFullscreen();
} else {
exitFullscreen();
}
};
y2(function() {
document.addEventListener("fullscreenchange", handleFullScreenChange, false);
return function() {
document.removeEventListener("fullscreenchange", handleFullScreenChange);
};
}, []);
return [fullscreen, toggleFullscreen];
};
var useFullscreen_default = useFullscreen;
// node_modules/@ant-design/charts/es/graphs/components/toolbar.js
var Toolbar = function(_a6) {
var toolbarCfg = _a6.toolbarCfg, container2 = _a6.container, graph = _a6.graph;
var useGraph3 = s3();
var width2 = s3();
var height = s3();
var zoom2 = s3(1);
var _b = toolbarCfg.zoomFactor, zoomFactor = _b === void 0 ? 0.25 : _b, renderIcon = toolbarCfg.renderIcon;
var _c = useFullscreen_default(container2), fullscreen = _c[0], toggleFullscreen = _c[1];
var getWindow = function() {
return [window.outerWidth, window.outerHeight];
};
var toggleWidth = function(f3) {
var _a7;
var size2 = f3 ? getWindow() : [width2.current, height.current];
(_a7 = useGraph3.current) === null || _a7 === void 0 ? void 0 : _a7.changeSize(size2[0], size2[1]);
};
var getCenter2 = function() {
if (!container2) {
return {
x: 0,
y: 0
};
}
return {
x: container2.clientWidth / 2,
y: container2.clientHeight / 2
};
};
var zoomIn2 = function() {
var _a7;
(_a7 = useGraph3.current) === null || _a7 === void 0 ? void 0 : _a7.zoom(Math.min(zoom2.current + zoomFactor, 5), getCenter2());
};
var zoomOut2 = function() {
var _a7;
(_a7 = useGraph3.current) === null || _a7 === void 0 ? void 0 : _a7.zoom(Math.max(zoom2.current - zoomFactor, 0.25), getCenter2());
};
y2(function() {
if (graph) {
useGraph3.current = graph;
width2.current = container2 === null || container2 === void 0 ? void 0 : container2.clientWidth;
height.current = container2 === null || container2 === void 0 ? void 0 : container2.clientHeight;
}
}, [graph]);
var setToggleFullscreen = function() {
toggleFullscreen();
toggleWidth(!document.fullscreenElement);
};
if (renderIcon) {
return renderIcon(zoomIn2, zoomOut2, toggleFullscreen);
}
return compat_module_default.createElement(d, null, !fullscreen ? compat_module_default.createElement("span", { style: {
cursor: "pointer"
}, onClick: setToggleFullscreen }, "\u2610") : compat_module_default.createElement("span", { style: {
cursor: "pointer"
}, onClick: setToggleFullscreen }, "\u2684"), compat_module_default.createElement("span", { style: {
cursor: "pointer"
}, onClick: zoomIn2 }, "+"), compat_module_default.createElement("span", { style: {
cursor: "pointer"
}, onClick: zoomIn2 }, "-"));
};
var createToolbar = function(_a6) {
var _b;
var graph = _a6.graph, container2 = _a6.container, toolbarCfg = _a6.toolbarCfg;
var style = toolbarCfg.style, show = toolbarCfg.show, className = toolbarCfg.className;
var toolbarId = graph.get("id") + "-toolbar";
var exist = document.querySelector("#" + toolbarId);
if (exist) {
(_b = exist.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(exist);
}
if (!show) {
return;
}
var defaultStyle = {
position: "absolute",
right: "12px",
top: "12px",
display: "flex",
flexDirection: "column",
padding: "6px",
borderRadius: "2px",
fontSize: "24px",
textAlign: "center",
lineHeight: "24px",
color: "rgba(0,0,0,.65)",
backgroundColor: "#fff",
boxShadow: "0 0 3px #ccc"
};
var mountPoint = document.createElement("div");
mountPoint.id = toolbarId;
mountPoint.className = className !== null && className !== void 0 ? className : "charts-toolbar";
setStyles(mountPoint, defaultStyle);
setStyles(mountPoint, style);
compat_module_default.render(compat_module_default.createElement(Toolbar, { graph, container: container2, toolbarCfg }), mountPoint);
container2.appendChild(mountPoint);
};
// node_modules/@ant-design/charts/es/graphs/components/tooltip.js
var createTooltip2 = function(_a6) {
var graph = _a6.graph, container2 = _a6.container, tooltipCfg = _a6.tooltipCfg, nodeCfg = _a6.nodeCfg;
var _b = nodeCfg.size, size2 = _b === void 0 ? [120, 40] : _b;
var style = tooltipCfg.style, show = tooltipCfg.show, className = tooltipCfg.className, customContent = tooltipCfg.customContent;
if (typeof size2 === "number")
size2 = [size2, size2];
var nodeWidth = size2[0], nodeHeight = size2[1];
var createTooltipContainer = function(positionStyle, item) {
var _a7;
var tooltipId = graph.get("id") + "-toolitp";
var exist = document.querySelector("#" + tooltipId);
if (exist) {
(_a7 = exist.parentNode) === null || _a7 === void 0 ? void 0 : _a7.removeChild(exist);
}
if (!show || !positionStyle) {
return;
}
var defaultStyle = {
position: "absolute",
width: nodeWidth + "px",
padding: "6px",
borderRadius: "2px",
fontSize: "24px",
backgroundColor: "#fff",
boxShadow: "0 0 3px #ccc",
minHeight: "40px",
boxSizing: "border-box"
};
var mountPoint = document.createElement("div");
mountPoint.id = tooltipId;
mountPoint.className = className !== null && className !== void 0 ? className : "charts-toolbar";
setStyles(mountPoint, defaultStyle);
setStyles(mountPoint, positionStyle);
setStyles(mountPoint, style);
compat_module_default.render(customContent(item), mountPoint);
container2.appendChild(mountPoint);
};
var bindEvents2 = function() {
var currentNode = {
current: ""
};
graph.on("node:mousemove", function(evt) {
var _a7, _b2, _c;
if (!currentNode.current) {
var _d = (_a7 = get_default(evt, "shape.cfg.canvasBBox")) !== null && _a7 !== void 0 ? _a7 : {}, minX = _d.minX, minY = _d.minY;
if (!minX) {
return;
}
var modelId = get_default((_b2 = evt.item) === null || _b2 === void 0 ? void 0 : _b2.getModel(), "id", "");
if (modelId) {
currentNode.current = modelId;
}
createTooltipContainer({
left: Math.min(Math.max(minX, 0), graph.getWidth() - nodeWidth) + "px",
bottom: graph.getHeight() - minY + nodeHeight + "px"
}, (_c = evt.item) === null || _c === void 0 ? void 0 : _c.getModel());
}
});
graph.on("node:mouseleave", function() {
currentNode.current = "";
createTooltipContainer();
});
};
bindEvents2();
};
// node_modules/@ant-design/charts/es/graphs/hooks/useGraphs.js
var __assign25 = function() {
__assign25 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
return t4;
};
return __assign25.apply(this, arguments);
};
function useGraph2(graphClass, config, extra) {
if (extra === void 0) {
extra = {};
}
var container2 = s3(null);
var graphRef = s3();
var graphOptions = s3();
var graphData = s3();
var data3 = config.data, width2 = config.width, height = config.height, layout6 = config.layout, minimapCfg = config.minimapCfg, behaviors2 = config.behaviors, fitCenter = config.fitCenter, nodeCfg = config.nodeCfg, edgeCfg = config.edgeCfg, markerCfg = config.markerCfg, level = config.level, toolbarCfg = config.toolbarCfg, tooltipCfg = config.tooltipCfg;
var graph = graphRef.current;
var setEdgesState = function(edges) {
edges.forEach(function(edge2) {
var _a6, _b;
var _c = edge2.getModel(), source = _c.source, target = _c.target;
var sourceVisible = (_a6 = graph === null || graph === void 0 ? void 0 : graph.findById(source)) === null || _a6 === void 0 ? void 0 : _a6.get("visible");
var targetVisible = (_b = graph === null || graph === void 0 ? void 0 : graph.findById(target)) === null || _b === void 0 ? void 0 : _b.get("visible");
if (sourceVisible === false || targetVisible === false) {
edge2.changeVisibility(false);
}
});
};
var changeData = function() {
var _a6;
if (!graph) {
return;
}
var currentData = data3;
if (level) {
currentData = setTag4(data3);
}
graph.changeData(level ? getLevelData(currentData, level) : data3);
(_a6 = graph.get("eventData")) === null || _a6 === void 0 ? void 0 : _a6.setData(currentData);
setEdgesState(graph.getEdges());
if (fitCenter) {
graph.fitCenter();
}
};
var updateLayout = function() {
graph === null || graph === void 0 ? void 0 : graph.updateLayout(layout6);
if (fitCenter) {
graph === null || graph === void 0 ? void 0 : graph.fitCenter();
}
};
var updateNodes = function() {
if (!graph) {
return;
}
var _a6 = nodeCfg !== null && nodeCfg !== void 0 ? nodeCfg : {}, nodeType = _a6.type, nodeAnchorPoints = _a6.anchorPoints, nodeStyle = _a6.style, nodeLabelCfg = _a6.title;
graph.getNodes().forEach(function(node) {
graph.updateItem(node, {
nodeCfg,
markerCfg,
type: nodeType,
style: nodeStyle,
anchorPoints: nodeAnchorPoints,
labelCfg: nodeLabelCfg
});
});
};
var updateEdges = function() {
if (!graph) {
return;
}
var _a6 = edgeCfg !== null && edgeCfg !== void 0 ? edgeCfg : {}, edgeType = _a6.type, edgeStyle = _a6.style, startArrowCfg = _a6.startArrow, endArrowCfg = _a6.endArrow, labelCfg = _a6.label;
graph.getEdges().forEach(function(edge2) {
if (edgeType === "fund-line") {
graph.updateItem(edge2, {
edgeCfg
});
} else {
var edgeCfgModel = edge2.getModel();
var startArrow = getArrowCfg(startArrowCfg, edgeCfgModel);
var endArrow = getArrowCfg(endArrowCfg, edgeCfgModel);
var _a7 = labelCfg !== null && labelCfg !== void 0 ? labelCfg : {}, style = _a7.style, content = _a7.content;
graph.updateItem(edge2, {
type: edgeType,
label: getCommonConfig(content, edgeCfgModel, graph),
labelCfg: {
style: getCommonConfig(style, edgeCfgModel, graph)
},
style: __assign25({ stroke: "#ccc", startArrow, endArrow }, typeof edgeStyle === "function" ? edgeStyle(edgeCfgModel, graph) : edgeStyle)
});
}
});
};
var updateMarker = function() {
if (!graph) {
return;
}
graph.getNodes().forEach(function(node) {
var _a6 = (typeof markerCfg === "function" ? markerCfg(node.getModel(), node.get("group")) : markerCfg).position, position2 = _a6 === void 0 ? "right" : _a6;
var _b = node.getBBox(), width3 = _b.width, height2 = _b.height;
var markerShape = node.get("group").get("children").find(function(item) {
return item.get("name") === "collapse-icon";
});
if (markerShape) {
markerShape === null || markerShape === void 0 ? void 0 : markerShape.attr(__assign25({}, getMarkerPosition(position2, [width3, height2])));
}
});
};
var getEdgeStateStyles = function(edgeStateStyles) {
var _a6 = extra.name, name = _a6 === void 0 ? "" : _a6;
if (name !== "FundFlowGraph") {
return edgeStateStyles;
}
if (!edgeStateStyles) {
return;
}
var _b = edgeStateStyles.hover, hover = _b === void 0 ? {} : _b;
var endArrow = hover.endArrow, startArrow = hover.startArrow;
if (!endArrow && !startArrow) {
return edgeStateStyles;
}
return {
hover: __assign25(__assign25({}, hover), { endArrow: endArrow ? getArrowCfg(endArrow) : false, startArrow: startArrow ? getArrowCfg(startArrow) : false })
};
};
y2(function() {
if (graph && !graph.destroyed) {
if (is_equal_default(data3, graphData.current)) {
return;
}
graphData.current = deepClone(data3);
changeData();
}
}, [data3]);
y2(function() {
var _a6, _b, _c, _d, _e;
if (graph && !graph.destroyed) {
if (is_equal_default(config, graphOptions.current)) {
return;
}
if (!is_equal_default(layout6, (_a6 = graphOptions.current) === null || _a6 === void 0 ? void 0 : _a6.layout)) {
updateLayout();
}
if (!is_equal_default(minimapCfg, (_b = graphOptions.current) === null || _b === void 0 ? void 0 : _b.minimapCfg)) {
processMinimap(minimapCfg, graph);
}
if (!is_equal_default(nodeCfg, (_c = graphOptions.current) === null || _c === void 0 ? void 0 : _c.nodeCfg)) {
updateNodes();
}
if (!is_equal_default(edgeCfg, (_d = graphOptions.current) === null || _d === void 0 ? void 0 : _d.edgeCfg)) {
updateEdges();
}
if (!is_equal_default(markerCfg, (_e = graphOptions.current) === null || _e === void 0 ? void 0 : _e.markerCfg)) {
updateMarker();
}
graphOptions.current = config;
}
}, [config]);
y2(function() {
if (graph && !graph.destroyed) {
var graphSize = getGraphSize(width2, height, container2);
graph.changeSize(graphSize[0], graphSize[1]);
}
}, [container2, width2, height]);
y2(function() {
if (graph && !graph.destroyed) {
var defaultMode = graph.get("modes").default;
var removingBehaviors_1 = [];
defaultMode.forEach(function(be) {
if (is_object_default(be)) {
removingBehaviors_1.push(be.type);
} else if (is_string_default(be)) {
removingBehaviors_1.push(be);
}
});
graph.removeBehaviors(removingBehaviors_1, "default");
graph.addBehaviors(behaviors2, "default");
}
}, [behaviors2]);
y2(function() {
if (container2.current && graphClass) {
var _a6 = extra.name, name_1 = _a6 === void 0 ? "" : _a6;
var graphSize = getGraphSize(width2, height, container2);
var nodeCfg_1 = config.nodeCfg, edgeCfg_1 = config.edgeCfg, behaviors_1 = config.behaviors, layout_1 = config.layout, animate = config.animate, autoFit = config.autoFit, fitCenter_1 = config.fitCenter, onReady = config.onReady;
var _b = nodeCfg_1 !== null && nodeCfg_1 !== void 0 ? nodeCfg_1 : {}, nodeType_1 = _b.type, nodeSize = _b.size, nodeAnchorPoints = _b.anchorPoints, nodeStateStyles = _b.nodeStateStyles, nodeStyle_1 = _b.style, nodeLabelCfg_1 = _b.title, linkCenter = _b.linkCenter, getChildren = _b.getChildren;
var _c = edgeCfg_1 !== null && edgeCfg_1 !== void 0 ? edgeCfg_1 : {}, edgeType = _c.type, edgeStyle_1 = _c.style, startArrowCfg_1 = _c.startArrow, endArrowCfg_1 = _c.endArrow, labelCfg_1 = _c.label, edgeStateStyles = _c.edgeStateStyles;
graphRef.current = new es_default5[graphClass]({
container: container2.current,
width: graphSize[0],
height: graphSize[1],
animate,
linkCenter,
modes: {
default: behaviors_1
},
defaultNode: {
type: nodeType_1,
size: nodeSize,
anchorPoints: nodeAnchorPoints,
nodeCfg: nodeCfg_1
},
defaultEdge: {
type: edgeType,
edgeCfg: edgeCfg_1,
labelCfg: labelCfg_1 === null || labelCfg_1 === void 0 ? void 0 : labelCfg_1.style
},
nodeStateStyles,
edgeStateStyles: getEdgeStateStyles(edgeStateStyles),
layout: layout_1,
fitView: autoFit,
fitCenter: fitCenter_1
});
var graphId = getGraphId(graphRef.current);
var graph_1 = graphRef.current;
graph_1.set("id", graphId);
var getLabel_1 = function(value2) {
if (is_string_default(value2)) {
return value2;
}
if (name_1 === "FundFlowGraph") {
return value2 === null || value2 === void 0 ? void 0 : value2.text;
}
return value2 === null || value2 === void 0 ? void 0 : value2.title;
};
var customNode_1 = ["fund-card", "indicator-card"];
graph_1.node(function(node) {
if (customNode_1.includes(nodeType_1) || name_1 === "OrganizationGraph") {
node.markerCfg = markerCfg;
return {};
}
var style = (nodeLabelCfg_1 !== null && nodeLabelCfg_1 !== void 0 ? nodeLabelCfg_1 : {}).style;
return {
label: getLabel_1(node.value),
labelCfg: {
style: getCommonConfig(style, node, graph_1)
},
style: __assign25({ stroke: "#ccc" }, typeof nodeStyle_1 === "function" ? nodeStyle_1(node, graph_1) : nodeStyle_1)
};
});
var getEdgeLabel_1 = function(edge2) {
var content = (labelCfg_1 !== null && labelCfg_1 !== void 0 ? labelCfg_1 : {}).content;
if (["DecompositionTreeGraph", "OrganizationGraph", "RadialTreeGraph"].includes(name_1)) {
return getCommonConfig(content, edge2, graph_1);
}
if (name_1 === "FundFlowGraph") {
var value2 = edge2.value;
return typeof value2 === "object" ? value2 === null || value2 === void 0 ? void 0 : value2.text : value2;
}
return edge2.value;
};
if (edgeType !== "fund-line") {
graph_1.edge(function(edge2) {
var startArrow = getArrowCfg(startArrowCfg_1, edge2);
var endArrow = getArrowCfg(endArrowCfg_1, edge2);
var style = (labelCfg_1 !== null && labelCfg_1 !== void 0 ? labelCfg_1 : {}).style;
return {
label: getEdgeLabel_1(edge2),
labelCfg: {
style: getCommonConfig(style, edge2, graph_1)
},
style: __assign25({ stroke: "#ccc", startArrow, endArrow }, typeof edgeStyle_1 === "function" ? edgeStyle_1(edge2, graph_1) : edgeStyle_1)
};
});
}
processMinimap(minimapCfg, graph_1);
bindStateEvents(graph_1, config);
if (markerCfg) {
var sourceGraph = ["FlowAnalysisGraph", "FundFlowGraph"];
sourceGraph.includes(name_1) ? bindSourceMapCollapseEvents(graph_1) : bindDefaultEvents(graph_1, level, getChildren);
}
renderGraph(graph_1, data3, level);
if (fitCenter_1) {
graph_1.fitCenter();
}
if (onReady) {
onReady(graph_1);
}
}
}, []);
y2(function() {
if (graphRef.current && toolbarCfg) {
createToolbar({ graph: graphRef.current, container: container2.current, toolbarCfg });
}
}, [graphRef, toolbarCfg]);
y2(function() {
if (graphRef.current && tooltipCfg) {
createTooltip2({ graph: graphRef.current, container: container2.current, tooltipCfg, nodeCfg });
}
}, [graphRef, tooltipCfg]);
y2(function() {
return function() {
if ((graph === null || graph === void 0 ? void 0 : graph.current) && !graph.current.destroyed) {
graph.current.destroy();
}
};
}, []);
return {
container: container2
};
}
// node_modules/@ant-design/charts/es/graphs/hooks/useProps.js
var __assign26 = function() {
__assign26 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
return t4;
};
return __assign26.apply(this, arguments);
};
function useProps3(props, defaultProps13) {
var cloneProps = deepClone(props);
var mergeProps = A2(function(p4, defaultProps14) {
var config = __assign26({}, defaultProps14);
var propsKeys = Object.keys(p4);
propsKeys.forEach(function(key) {
if (getType2(p4[key]) === "Object") {
config[key] = __assign26(__assign26({}, defaultProps14[key]), p4[key]);
} else {
config[key] = p4[key];
}
});
return config;
}, [props, defaultProps13]);
var uProps = mergeProps(cloneProps, defaultProps13);
return {
uProps
};
}
// node_modules/@ant-design/charts/es/graphs/organizationGraph/customItem.js
var __assign27 = function() {
__assign27 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
return t4;
};
return __assign27.apply(this, arguments);
};
var registerOrganizationCardNode = function() {
var defaultIconStyle = {
width: 12,
height: 12
};
es_default5.registerNode("organization-card", {
draw: function(cfg, group2) {
if (cfg === void 0) {
cfg = {};
}
var _a6 = cfg.value, value2 = _a6 === void 0 ? {} : _a6, nodeCfg = cfg.nodeCfg, markerCfg = cfg.markerCfg;
var _b = nodeCfg, style = _b.style, _c = _b.padding, padding3 = _c === void 0 ? 0 : _c, _d = _b.label, label17 = _d === void 0 ? {} : _d, customContent = _b.customContent;
var labelStyle = label17.style;
var paddingArray = getCssPadding(padding3);
var size2 = (cfg === null || cfg === void 0 ? void 0 : cfg.size) || [100, 30];
if (typeof size2 === "number")
size2 = [size2, size2];
var height = 0;
var contentWidth = size2[0] - paddingArray[1] - paddingArray[3];
var cardStyle = getStyle3(style, cfg, group2);
var shape = group2.addShape("rect", {
attrs: __assign27(__assign27({ x: 0, y: 0, width: size2[0], height: size2[1] }, defaultCardStyle), cardStyle),
name: "main-box",
draggable: true
});
if (value2) {
height += paddingArray[0];
var createRowItems_1 = function(item, contentWidth2, startX, index2) {
if (index2 === void 0) {
index2 = 0;
}
var iconWidth = 0;
var rowHeight = [];
var keys2 = ["icon", "text", "value"];
var getXY = function(type2, layoutCfg) {
var _a7 = layoutCfg.fontSize, fontSize = _a7 === void 0 ? 12 : _a7;
var x6 = 0;
var y5 = 0;
switch (type2) {
case "icon":
x6 = startX;
y5 = height;
break;
case "text":
x6 = startX + (contentWidth2 + iconWidth) / 2;
y5 = item.value ? paddingArray[0] : (size2[1] - fontSize) / 2;
break;
case "value":
x6 = startX + (contentWidth2 + iconWidth) / 2;
y5 = item.text ? paddingArray[0] + rowHeight[1] + defaultMargin : (size2[1] - fontSize) / 2;
break;
default:
break;
}
return { x: x6, y: y5 };
};
keys2.forEach(function(key, keyIndex) {
var isIcon = key.startsWith("icon");
var shapeStyle = getStyle3(labelStyle, cfg, group2, key);
if (key === "icon" && item[key]) {
iconWidth = shapeStyle.width || 32;
}
var keyShape = group2.addShape(isIcon ? "image" : "text", {
attrs: __assign27(__assign27(__assign27(__assign27({ textBaseline: "top", textAlign: "center" }, getXY(key, shapeStyle)), { text: item[key], img: item[key] }), isIcon ? defaultIconStyle : defaultLabelStyle), shapeStyle),
name: key + "-" + index2 + "-" + keyIndex
});
rowHeight.push(keyShape.getBBox().height);
});
return rowHeight;
};
var createItems = function(item, index2) {
var _a7;
if (index2 === void 0) {
index2 = 0;
}
var itemsHeight = [];
if (customContent) {
itemsHeight.push((_a7 = customContent(item, group2, {
startX: paddingArray[3],
startY: height,
width: contentWidth
})) !== null && _a7 !== void 0 ? _a7 : 0);
} else {
itemsHeight.push.apply(itemsHeight, createRowItems_1(item, contentWidth, paddingArray[3], index2));
}
height += Math.max.apply(Math, itemsHeight);
};
createItems(value2);
}
shape === null || shape === void 0 ? void 0 : shape.attr("height", Math.max(height + paddingArray[2], size2[1]));
if (markerCfg) {
var _e = shape.getBBox(), shapeWidth = _e.width, shapeHeight = _e.height;
var _f = typeof markerCfg === "function" ? markerCfg(cfg, group2) : markerCfg, show = _f.show, _g = _f.position, position2 = _g === void 0 ? "right" : _g, collapsed = _f.collapsed, markerStyle = _f.style;
createMarker({
show,
position: position2,
collapsed,
style: markerStyle
}, group2, [shapeWidth, shapeHeight]);
shape.attr("defaultCollapsed", collapsed);
}
return shape;
}
}, "single-node");
};
// node_modules/@ant-design/charts/es/graphs/organizationGraph/index.js
var __rest41 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
registerOrganizationCardNode();
var defaultNodeStyle8 = {
fill: "#91d5ff",
stroke: "#40a9ff",
radius: 2
};
var defaultLayout9 = {
type: "compactBox",
direction: "TB",
getId: function getId3(d3) {
return d3.id;
},
getHeight: function getHeight5() {
return 16;
},
getWidth: function getWidth3() {
return 16;
},
getVGap: function getVGap3() {
return 40;
},
getHGap: function getHGap3() {
return 70;
}
};
var defaultProps8 = {
nodeCfg: {
type: "organization-card",
size: [100, 44],
style: defaultNodeStyle8,
padding: 6,
anchorPoints: [
[0.5, 0],
[0.5, 1]
],
nodeStateStyles: defaultStateStyles,
label: {
style: function(cfg, group2, type2) {
var styles = {
icon: {
width: 32,
height: 32
},
value: {
fill: "#fff"
},
text: {
fill: "#000"
}
};
return type2 ? styles[type2] : {};
}
}
},
edgeCfg: {
type: "polyline",
endArrow: {
type: "triangle",
fill: "#91d5ff"
},
edgeStateStyles: defaultStateStyles,
style: {
stroke: "#91d5ff"
}
},
behaviors: ["zoom-canvas", "drag-canvas"],
layout: defaultLayout9,
animate: true,
markerPosition: "right",
autoFit: true,
fitCenter: true,
style: {
position: "relative",
height: "inherit",
backgroundColor: "#fff"
}
};
var OrganizationGraph = function(props) {
var uProps = useProps3(props, defaultProps8).uProps;
var className = uProps.className, style = uProps.style, loading = uProps.loading, loadingTemplate = uProps.loadingTemplate, errorTemplate = uProps.errorTemplate, rest = __rest41(uProps, ["className", "style", "loading", "loadingTemplate", "errorTemplate"]);
var container2 = useGraph2("TreeGraph", rest, { name: "OrganizationGraph" }).container;
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
};
var organizationGraph_default = OrganizationGraph;
// node_modules/@ant-design/charts/es/graphs/radialTreeGraph/index.js
var __rest42 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
var defaultLayout10 = {
type: "dendrogram",
direction: "LR",
nodeSep: 20,
rankSep: 100,
radial: true
};
var defaultProps9 = {
nodeCfg: {
type: "circle",
size: 30,
anchorPoints: defaultFlowGraphAnchorPoints,
linkCenter: true,
nodeStateStyles: defaultStateStyles,
style: defaultNodeStyle
},
edgeCfg: {
type: "line",
edgeStateStyles: defaultStateStyles
},
behaviors: ["zoom-canvas", "drag-canvas"],
layout: defaultLayout10,
animate: true,
markerPosition: "right",
autoFit: true,
fitCenter: true,
style: {
position: "relative",
height: "inherit",
backgroundColor: "#fff"
}
};
var RadialTreeGraph = function(props) {
var uProps = useProps3(props, defaultProps9).uProps;
var className = uProps.className, style = uProps.style, loading = uProps.loading, loadingTemplate = uProps.loadingTemplate, errorTemplate = uProps.errorTemplate, rest = __rest42(uProps, ["className", "style", "loading", "loadingTemplate", "errorTemplate"]);
var container2 = useGraph2("TreeGraph", rest, { name: "RadialTreeGraph" }).container;
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
};
var radialTreeGraph_default = RadialTreeGraph;
// node_modules/@ant-design/charts/es/graphs/flowAnalysisGraph/customItem.js
var __assign28 = function() {
__assign28 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
return t4;
};
return __assign28.apply(this, arguments);
};
var registerIndicatorCardNode = function() {
var defaultTitleLabelStyle = {
fill: "#fff",
fontSize: 12
};
var defaultTitleRectStyle = {
fill: "#40a9ff",
radius: [2, 2, 0, 0]
};
var defaultIconStyle = {
width: 12,
height: 12
};
var ARROWS2 = ["startArrow", "endArrow"];
var SHAPE_DEFAULT_ATTRS2 = {
lineWidth: 1,
stroke: void 0,
fill: void 0,
lineAppendWidth: 1,
opacity: void 0,
strokeOpacity: void 0,
fillOpacity: void 0,
x: 0,
y: 0,
r: 10,
width: 20,
height: 20,
shadowColor: void 0,
shadowBlur: 0,
shadowOffsetX: 0,
shadowOffsetY: 0
};
var PATH_SHAPE_DEFAULT_ATTRS2 = {
lineWidth: 1,
stroke: "#000",
lineDash: void 0,
startArrow: false,
endArrow: false,
opacity: void 0,
strokeOpacity: void 0,
fillOpacity: void 0,
shadowColor: void 0,
shadowBlur: 0,
shadowOffsetX: 0,
shadowOffsetY: 0
};
var SHAPES_DEFAULT_ATTRS2 = {
edge: PATH_SHAPE_DEFAULT_ATTRS2,
node: SHAPE_DEFAULT_ATTRS2
};
es_default5.registerNode("indicator-card", {
draw: function(cfg, group2) {
var _a6, _b;
if (cfg === void 0) {
cfg = {};
}
var _c = cfg.value, value2 = _c === void 0 ? {} : _c, nodeCfg = cfg.nodeCfg, markerCfg = cfg.markerCfg;
var _d = nodeCfg, titleCfg = _d.title, itemsCfg = _d.items, _e = _d.label, label17 = _e === void 0 ? {} : _e, style = _d.style, _f = _d.padding, padding3 = _f === void 0 ? 0 : _f, badge = _d.badge, customContent = _d.customContent;
var appendPadding = getStatusBBox(badge);
var labelStyle = label17.style;
var cardPadding = getCssPadding(padding3);
var paddingArray = cardPadding.map(function(item, index2) {
return item + appendPadding[index2];
});
var _g = titleCfg !== null && titleCfg !== void 0 ? titleCfg : {}, titleStyle = _g.style, titleContainerStyle = _g.containerStyle, _h = _g.autoEllipsis, autoEllipsis = _h === void 0 ? true : _h;
var _j = itemsCfg !== null && itemsCfg !== void 0 ? itemsCfg : {}, itemStyle = _j.style, itemContainerStyle = _j.containerStyle, layout6 = _j.layout, _k = _j.itemSpacing, itemSpacing = _k === void 0 ? 4 : _k, sort2 = _j.sort, _l = _j.padding, itemPadding = _l === void 0 ? [6, 0, 0] : _l;
var itemPaddingArray = getCssPadding(itemPadding);
var _m = value2, title = _m.title, items = _m.items;
var size2 = (cfg === null || cfg === void 0 ? void 0 : cfg.size) || [100, 30];
if (typeof size2 === "number")
size2 = [size2, size2];
var height = 0;
var shapeWidth = size2[0];
var contentWidth = shapeWidth - paddingArray[1] - paddingArray[3];
var cardStyle = getStyle3(style, cfg, group2);
var shape = group2.addShape("rect", {
attrs: __assign28(__assign28({ x: 0, y: 0, width: size2[0], height: size2[1] }, defaultCardStyle), cardStyle),
name: "main-box",
draggable: true
});
var titleTextShape;
var itemShape;
var titleShape;
if (title) {
titleShape = group2.addShape("rect", {
attrs: __assign28(__assign28({ x: 0, y: 0, width: size2[0], height: 0 }, defaultTitleRectStyle), getStyle3(titleContainerStyle, cfg, group2)),
name: "title-rect",
draggable: true
});
var textStyle2 = __assign28(__assign28({}, defaultTitleLabelStyle), getStyle3(titleStyle, cfg, group2));
titleTextShape = group2.addShape("text", {
attrs: __assign28({ x: paddingArray[3], y: paddingArray[0], textBaseline: "top", text: autoEllipsis ? useEllipsis(title, textStyle2 === null || textStyle2 === void 0 ? void 0 : textStyle2.fontSize, contentWidth) : title }, textStyle2),
name: "title"
});
var titleHeight_1 = (titleTextShape ? titleTextShape.getBBox() : { height: size2[1] / 2 }).height;
titleShape === null || titleShape === void 0 ? void 0 : titleShape.attr("height", titleHeight_1 + paddingArray[0] + paddingArray[2]);
height += titleShape.getBBox().height;
}
if (items) {
if (!titleShape) {
height += paddingArray[0];
}
itemShape = group2.addShape("rect", {
attrs: __assign28({ x: paddingArray[3], y: height, width: contentWidth, height: 0 }, getStyle3(itemContainerStyle, cfg, group2)),
name: "item-box",
draggable: true
});
height += itemPaddingArray[0];
var itemContentWidth_1 = contentWidth - itemPaddingArray[1] - itemPaddingArray[3];
var isArray_1 = Array.isArray(items);
var createRowItems_1 = function(item, contentWidth2, startX, index2) {
if (index2 === void 0) {
index2 = 0;
}
var rowHeight = [];
var valueShapeWidth = 0;
var keys2 = sort2 ? Object.keys(item) : ["text", "value", "icon"];
keys2.forEach(function(key, keyIndex) {
var x6;
var isIcon = key.startsWith("icon");
if (sort2 || layout6 === "flex") {
x6 = keyIndex * contentWidth2 / keys2.length;
} else if (layout6 === "follow") {
x6 = valueShapeWidth;
} else {
x6 = key === "text" ? 0 : contentWidth2 / 2;
x6 += isIcon ? valueShapeWidth : 0;
}
var keyShape = group2.addShape(isIcon ? "image" : "text", {
attrs: __assign28(__assign28({ textBaseline: "top", x: startX + x6, y: height, text: item[key], img: item[key] }, isIcon ? defaultIconStyle : defaultLabelStyle), getStyle3(itemStyle || labelStyle, cfg, group2, key)),
name: key + "-" + index2 + "-" + keyIndex
});
if (key === "value" || layout6 === "follow") {
valueShapeWidth += keyShape.getBBox().width;
valueShapeWidth += layout6 === "follow" ? itemSpacing : 0;
}
rowHeight.push(keyShape.getBBox().height);
});
return rowHeight;
};
var createItems_1 = function(item, index2) {
var _a7;
if (index2 === void 0) {
index2 = 0;
}
var itemsHeight = [];
if (customContent) {
itemsHeight.push((_a7 = customContent(item, group2, {
startX: paddingArray[3] + itemPaddingArray[3],
startY: height,
width: itemContentWidth_1
})) !== null && _a7 !== void 0 ? _a7 : 0);
} else {
itemsHeight.push.apply(itemsHeight, createRowItems_1(item, itemContentWidth_1, paddingArray[3] + itemPaddingArray[3], index2));
}
height += Math.max.apply(Math, itemsHeight);
if (isArray_1 && index2 !== items.length - 1) {
height += defaultMargin;
}
};
if (Array.isArray(items)) {
items.forEach(function(item, index2) {
createItems_1(item, index2);
});
} else {
createItems_1(items);
}
}
var titleHeight = (titleShape === null || titleShape === void 0 ? void 0 : titleShape.getBBox().height) || 0;
itemShape === null || itemShape === void 0 ? void 0 : itemShape.attr("height", Math.max(height - titleHeight + itemPaddingArray[2], size2[1]));
var itemHeight = (itemShape === null || itemShape === void 0 ? void 0 : itemShape.getBBox().height) || 0;
var shapeHeight = items ? (titleHeight || paddingArray[0]) + itemHeight + paddingArray[2] : titleHeight + itemHeight;
shape === null || shape === void 0 ? void 0 : shape.attr("height", shapeHeight);
if (badge) {
var statusConfig = getStatusCfg(badge, [size2[0], shapeHeight]);
group2.addShape("rect", {
attrs: __assign28(__assign28({ fill: "#40a9ff" }, statusConfig), getStyle3(badge.style, cfg, group2)),
name: "status-rect"
});
}
if (markerCfg) {
var stateCollapsed = ((_b = (_a6 = group2 === null || group2 === void 0 ? void 0 : group2.get("item")) === null || _a6 === void 0 ? void 0 : _a6.getModel()) !== null && _b !== void 0 ? _b : {}).collapsed;
var _o = shape.getBBox(), shapeWidth_1 = _o.width, shapeHeight_1 = _o.height;
var _p = typeof markerCfg === "function" ? markerCfg(cfg, group2) : markerCfg, show = _p.show, _q = _p.position, position2 = _q === void 0 ? "right" : _q, collapsed = _p.collapsed, markerStyle = _p.style;
createMarker({
show,
position: position2,
collapsed: stateCollapsed !== null && stateCollapsed !== void 0 ? stateCollapsed : collapsed,
style: markerStyle
}, group2, [shapeWidth_1, shapeHeight_1]);
shape.attr("defaultCollapsed", collapsed);
}
return shape;
},
update: void 0,
setState: function(name, value2, item) {
var _a6, _b;
var shape = item.get("keyShape");
if (!shape || shape.destroyed)
return;
var type2 = item.getType();
var stateName = is_boolean_default(value2) ? name : name + ":" + value2;
var itemStateStyle = item.getStateStyle(stateName);
if (!itemStateStyle) {
return;
}
var styles = Object.assign({}, itemStateStyle);
var group2 = item.getContainer();
var keptAttrs = { x: 1, y: 1, cx: 1, cy: 1 };
if (value2) {
var _loop_1 = function(key2) {
var _c;
var style = styles[key2];
if (is_plain_object_default(style) && !ARROWS2.includes(key2)) {
var subShape = group2.find(function(element) {
return element.get("name") === key2;
});
if (subShape) {
subShape.attr(style);
}
} else {
shape.attr((_c = {}, _c[key2] = style, _c));
}
};
for (var key in styles) {
_loop_1(key);
}
} else {
var enableStatesStyle = cloneBesidesImg3(item.getCurrentStatesStyle());
var model = item.getModel();
var originStyle_1 = mix({}, model.style, cloneBesidesImg3(item.getOriginStyle()));
var keyShapeName_1 = shape.get("name");
var shapeAttrs_1 = shape.attr();
var keyShapeStyles_1 = {};
Object.keys(shapeAttrs_1).forEach(function(key2) {
if (key2 === "img")
return;
var attr = shapeAttrs_1[key2];
if (attr && typeof attr === "object") {
keyShapeStyles_1[key2] = clone_default(attr);
} else {
keyShapeStyles_1[key2] = attr;
}
});
var filtetDisableStatesStyle = {};
var _loop_2 = function(p5) {
var style = styles[p5];
if (is_plain_object_default(style) && !ARROWS2.includes(p5)) {
var subShape_1 = group2.find(function(element) {
return element.get("name") === p5;
});
if (subShape_1) {
var subShapeStyles_1 = clone_default(subShape_1.attr());
each_default(style, function(v3, key2) {
if (p5 === keyShapeName_1 && keyShapeStyles_1[key2] && !keptAttrs[key2]) {
delete keyShapeStyles_1[key2];
var value_1 = originStyle_1[p5][key2] || SHAPES_DEFAULT_ATTRS2[type2][key2];
shape.attr(key2, value_1);
} else if (subShapeStyles_1[key2] || subShapeStyles_1[key2] === 0) {
delete subShapeStyles_1[key2];
var value_2 = originStyle_1[p5][key2] || SHAPES_DEFAULT_ATTRS2[type2][key2];
subShape_1.attr(key2, value_2);
}
});
filtetDisableStatesStyle[p5] = subShapeStyles_1;
}
} else {
if (keyShapeStyles_1[p5] && !keptAttrs[p5]) {
delete keyShapeStyles_1[p5];
var value_3 = originStyle_1[p5] || (originStyle_1[keyShapeName_1] ? originStyle_1[keyShapeName_1][p5] : void 0) || SHAPES_DEFAULT_ATTRS2[type2][p5];
shape.attr(p5, value_3);
}
}
};
for (var p4 in styles) {
_loop_2(p4);
}
if (!keyShapeName_1) {
mix(filtetDisableStatesStyle, keyShapeStyles_1);
} else {
filtetDisableStatesStyle[keyShapeName_1] = keyShapeStyles_1;
}
for (var key in enableStatesStyle) {
if (keptAttrs[key])
continue;
var enableStyle = enableStatesStyle[key];
if (!is_plain_object_default(enableStyle) || ARROWS2.includes(key)) {
if (!keyShapeName_1) {
mix(originStyle_1, (_a6 = {}, _a6[key] = enableStyle, _a6));
} else {
mix(originStyle_1[keyShapeName_1], (_b = {}, _b[key] = enableStyle, _b));
delete originStyle_1[key];
}
delete enableStatesStyle[key];
}
}
var originstyles = {};
deep_mix_default(originstyles, originStyle_1, filtetDisableStatesStyle, enableStatesStyle);
var keyShapeSetted = false;
var _loop_3 = function(originKey2) {
var _d;
var style = originstyles[originKey2];
if (is_plain_object_default(style) && !ARROWS2.includes(originKey2)) {
var subShape = group2.find(function(element) {
return element.get("name") === originKey2;
});
if (subShape) {
if (originKey2 === keyShapeName_1) {
keyShapeSetted = true;
}
if (originKey2 !== "collapse-icon")
subShape.attr(style);
}
} else if (!keyShapeSetted) {
var value_4 = style || SHAPES_DEFAULT_ATTRS2[type2][originKey2];
shape.attr((_d = {}, _d[originKey2] = value_4, _d));
}
};
for (var originKey in originstyles) {
_loop_3(originKey);
}
}
}
}, "single-node");
};
// node_modules/@ant-design/charts/es/graphs/flowAnalysisGraph/index.js
var __rest43 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
registerIndicatorCardNode();
var defaultLayout11 = {
type: "dagre",
rankdir: "LR",
center: [0, 0],
nodesepFunc: function() {
return 1;
},
ranksepFunc: function() {
return 1;
}
};
var defaultProps10 = {
nodeCfg: {
type: "indicator-card",
size: defaultNodeSize,
style: defaultNodeStyle,
anchorPoints: defaultFlowGraphAnchorPoints,
padding: 6,
layout: "bundled",
nodeStateStyles: defaultStateStyles
},
edgeCfg: {
type: "cubic-horizontal",
edgeStateStyles: defaultStateStyles
},
behaviors: ["zoom-canvas", "drag-canvas"],
layout: defaultLayout11,
animate: true,
markerPosition: "right",
autoFit: true,
fitCenter: true,
style: {
position: "relative",
height: "inherit",
backgroundColor: "#fff"
}
};
var FlowAnalysisGraph = function(props) {
var uProps = useProps3(props, defaultProps10).uProps;
var className = uProps.className, style = uProps.style, loading = uProps.loading, loadingTemplate = uProps.loadingTemplate, errorTemplate = uProps.errorTemplate, rest = __rest43(uProps, ["className", "style", "loading", "loadingTemplate", "errorTemplate"]);
var container2 = useGraph2("Graph", rest, { name: "FlowAnalysisGraph" }).container;
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
};
var flowAnalysisGraph_default = FlowAnalysisGraph;
// node_modules/@ant-design/charts/es/graphs/decompositionTreeGraph/index.js
var __rest44 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
registerIndicatorCardNode();
var defaultLayout12 = {
type: "compactBox",
direction: "LR",
getId: function(d3) {
return d3.id;
},
getHeight: function() {
return 60;
},
getWidth: function() {
return 16;
},
getVGap: function() {
return 16;
},
getHGap: function() {
return 100;
}
};
var defaultProps11 = {
nodeCfg: {
type: "indicator-card",
size: defaultNodeSize,
style: defaultNodeStyle,
anchorPoints: defaultFlowGraphAnchorPoints,
padding: 6,
layout: "bundled",
nodeStateStyles: defaultStateStyles,
label: {
style: function(cfg, group2, type2) {
var styles = {
icon: {
width: 10,
height: 10
},
value: {
fill: "#000"
},
text: {
fill: "#aaa"
}
};
return type2 ? styles[type2] : {};
}
}
},
edgeCfg: {
type: "cubic-horizontal",
endArrow: {
type: "vee"
},
edgeStateStyles: defaultStateStyles
},
behaviors: ["zoom-canvas", "drag-canvas"],
layout: defaultLayout12,
animate: true,
autoFit: true,
fitCenter: true,
style: {
position: "relative",
height: "inherit",
backgroundColor: "#fff"
},
level: 100
};
var DecompositionTreeGraph = function(props) {
var uProps = useProps3(props, defaultProps11).uProps;
var className = uProps.className, style = uProps.style, loading = uProps.loading, loadingTemplate = uProps.loadingTemplate, errorTemplate = uProps.errorTemplate, rest = __rest44(uProps, ["className", "style", "loading", "loadingTemplate", "errorTemplate"]);
var container2 = useGraph2("TreeGraph", rest, {
name: "DecompositionTreeGraph"
}).container;
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
};
var decompositionTreeGraph_default = DecompositionTreeGraph;
// node_modules/@ant-design/charts/es/graphs/fundFlowGraph/customItem.js
var __assign29 = function() {
__assign29 = Object.assign || function(t4) {
for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) {
s4 = arguments[i4];
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4))
t4[p4] = s4[p4];
}
return t4;
};
return __assign29.apply(this, arguments);
};
var getPathInfo = function(cfg) {
var edgeCfg = cfg.edgeCfg;
var startPoint = cfg.startPoint;
var endPoint = cfg.endPoint;
var startX = startPoint.x, startY = startPoint.y;
var endX = endPoint.x, endY = endPoint.y;
var Ydiff = endY - startY;
var slope = Ydiff !== 0 ? Math.min(500 / Math.abs(Ydiff), 20) : 0;
var cpOffset = slope > 15 ? 0 : 16;
var offset = Ydiff < 0 ? cpOffset : -cpOffset;
var line1EndPoint = {
x: startX + slope,
y: endY + offset
};
var line2StartPoint = {
x: line1EndPoint.x + cpOffset,
y: endY
};
var controlPoint = {
x: (line1EndPoint.x - startX) * (endY - startY) / (line1EndPoint.y - startY) + startX,
y: endY
};
var path = [
["M", startX, startY],
["L", line1EndPoint.x, line1EndPoint.y],
["Q", controlPoint.x, controlPoint.y, line2StartPoint.x, line2StartPoint.y],
["L", endX, endY]
];
if (Math.abs(Ydiff) <= 5) {
path = [
["M", startX, startY],
["L", endX, endY]
];
}
var _a6 = edgeCfg, startArrowCfg = _a6.startArrow, endArrowCfg = _a6.endArrow;
var startArrow = getArrowCfg(startArrowCfg, cfg);
var endArrow = getArrowCfg(endArrowCfg, cfg);
return {
startArrow,
endArrow,
path,
line2StartPoint,
endY
};
};
var getPathText = function(value2) {
var text;
var subText;
if (value2 instanceof Object) {
text = value2.text;
subText = value2.subText;
} else {
text = value2;
}
return { text, subText };
};
var registerFundFlowItems = function() {
es_default5.registerNode("fund-card", {
draw: function(cfg, group2) {
var _a6, _b;
if (cfg === void 0) {
cfg = {};
}
var _c = cfg.value, value2 = _c === void 0 ? {} : _c, nodeCfg = cfg.nodeCfg, markerCfg = cfg.markerCfg;
var _d = nodeCfg, _e = _d.label, label17 = _e === void 0 ? {} : _e, style = _d.style, _f = _d.padding, padding3 = _f === void 0 ? 0 : _f, customContent = _d.customContent;
var labelStyle = label17.style;
var paddingArray = getCssPadding(padding3);
var size2 = getSize4(cfg.size);
var height = 0;
var shapeWidth = size2[0];
var contentWidth = shapeWidth - paddingArray[1] - paddingArray[3];
var contentHeight = size2[1] - paddingArray[0] - paddingArray[2];
var cardStyle = getStyle3(style, cfg, group2);
var shape = group2.addShape("rect", {
attrs: __assign29({ x: 0, y: 0, width: size2[0], height: size2[1], radius: size2[1] / 2, fill: "#fff", stroke: "#40a9ff" }, cardStyle),
name: "main-box",
draggable: true
});
if (value2) {
height += paddingArray[0];
var createRowItems_1 = function(item, contentWidth2, startX) {
var _a7, _b2;
var text = item.text, icon = item.icon;
var textShape;
var iconShape;
if (icon) {
iconShape = group2.addShape("image", {
attrs: __assign29({ x: startX, y: height, img: icon, width: contentHeight, height: contentHeight }, getStyle3(labelStyle, cfg, group2, "icon")),
name: "fund-icon"
});
}
textShape = group2 === null || group2 === void 0 ? void 0 : group2.addShape("text", {
attrs: __assign29(__assign29({ textBaseline: "middle", textAlign: iconShape ? "start" : "center", x: startX + (iconShape ? (iconShape === null || iconShape === void 0 ? void 0 : iconShape.getBBox().width) + defaultMargin : contentWidth2 / 2), y: paddingArray[0] + contentHeight / 2, text }, defaultLabelStyle), getStyle3(labelStyle, cfg, group2, "text")),
name: "fund-text"
});
return [(_a7 = textShape === null || textShape === void 0 ? void 0 : textShape.getBBox().height) !== null && _a7 !== void 0 ? _a7 : 0, (_b2 = iconShape === null || iconShape === void 0 ? void 0 : iconShape.getBBox().height) !== null && _b2 !== void 0 ? _b2 : 0];
};
var createItems = function(item) {
var _a7;
var itemsHeight = [];
if (customContent) {
itemsHeight.push((_a7 = customContent(item, group2, {
startX: paddingArray[3],
startY: height,
width: contentWidth
})) !== null && _a7 !== void 0 ? _a7 : 0);
} else {
itemsHeight.push.apply(itemsHeight, createRowItems_1(item, contentWidth, paddingArray[3]));
}
height += Math.max.apply(Math, itemsHeight);
};
createItems(value2);
}
shape === null || shape === void 0 ? void 0 : shape.attr("height", Math.max(size2[1], height + paddingArray[2]));
if (markerCfg) {
var stateCollapsed = ((_b = (_a6 = group2 === null || group2 === void 0 ? void 0 : group2.get("item")) === null || _a6 === void 0 ? void 0 : _a6.getModel()) !== null && _b !== void 0 ? _b : {}).collapsed;
var _g = shape.getBBox(), shapeWidth_1 = _g.width, shapeHeight = _g.height;
var _h = typeof markerCfg === "function" ? markerCfg(cfg, group2) : markerCfg, show = _h.show, _j = _h.position, position2 = _j === void 0 ? "right" : _j, collapsed = _h.collapsed, markerStyle = _h.style;
createMarker({
show,
position: position2,
collapsed: stateCollapsed !== null && stateCollapsed !== void 0 ? stateCollapsed : collapsed,
style: markerStyle
}, group2, [shapeWidth_1, shapeHeight]);
shape.attr("defaultCollapsed", collapsed);
}
return shape;
},
update: void 0
}, "single-node");
es_default5.registerEdge("fund-line", {
draw: function draw4(cfg, group2) {
if (cfg === void 0) {
cfg = {};
}
var edgeCfg = cfg.edgeCfg, value2 = cfg.value;
var _a6 = getPathText(value2), text = _a6.text, subText = _a6.subText;
var _b = edgeCfg, edgeStyle = _b.style, labelCfg = _b.label;
var _c = getPathInfo(cfg), startArrow = _c.startArrow, endArrow = _c.endArrow, path = _c.path, line2StartPoint = _c.line2StartPoint, endY = _c.endY;
var labelStyle = (labelCfg !== null && labelCfg !== void 0 ? labelCfg : {}).style;
var line2 = group2.addShape("path", {
attrs: __assign29({ path, stroke: "#ccc", startArrow, endArrow }, typeof edgeStyle === "function" ? edgeStyle(cfg, group2) : edgeStyle),
name: "path-shape"
});
var createItem = function(itemText, key) {
group2.addShape("text", {
attrs: __assign29(__assign29({ text: itemText, x: line2StartPoint.x, y: key === "text" ? endY - 4 : endY + 16 }, defaultLabelStyle), getStyle3(labelStyle, cfg, group2, key)),
name: "line-text-" + key
});
};
text && createItem(text, "text");
subText && createItem(subText, "subText");
return line2;
},
update: function(cfg, edge2) {
var edgeCfg = cfg.edgeCfg, value2 = cfg.value;
var _a6 = getPathText(value2), text = _a6.text, subText = _a6.subText;
var group2 = edge2.getContainer();
var getShape3 = function(shapeName) {
return group2.get("children").find(function(item) {
return item.get("name") === shapeName;
});
};
var _b = getPathInfo(cfg), startArrow = _b.startArrow, endArrow = _b.endArrow, path = _b.path, line2StartPoint = _b.line2StartPoint, endY = _b.endY;
var _c = edgeCfg, edgeStyle = _c.style, labelCfg = _c.label;
var labelStyle = (labelCfg !== null && labelCfg !== void 0 ? labelCfg : {}).style;
var pathShape = getShape3("path-shape");
pathShape === null || pathShape === void 0 ? void 0 : pathShape.attr(__assign29({ path, stroke: "#ccc", startArrow, endArrow }, typeof edgeStyle === "function" ? edgeStyle(cfg, group2) : edgeStyle));
var texts = ["text", "subText"];
texts.forEach(function(key) {
var textShape = getShape3("line-text-" + key);
textShape === null || textShape === void 0 ? void 0 : textShape.attr(__assign29(__assign29({ x: line2StartPoint.x, y: key === "text" ? endY - 4 : endY + 16, text: key === "text" ? text : subText }, defaultLabelStyle), getStyle3(labelStyle, cfg, group2, key)));
});
}
}, "single-edge");
};
// node_modules/@ant-design/charts/es/graphs/fundFlowGraph/index.js
var __rest45 = function(s4, e4) {
var t4 = {};
for (var p4 in s4)
if (Object.prototype.hasOwnProperty.call(s4, p4) && e4.indexOf(p4) < 0)
t4[p4] = s4[p4];
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
for (var i4 = 0, p4 = Object.getOwnPropertySymbols(s4); i4 < p4.length; i4++) {
if (e4.indexOf(p4[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p4[i4]))
t4[p4[i4]] = s4[p4[i4]];
}
return t4;
};
registerFundFlowItems();
var defaultLayout13 = {
type: "dagre",
rankdir: "LR",
nodesep: 30,
ranksep: 50
};
var defaultProps12 = {
nodeCfg: {
type: "fund-card",
size: defaultNodeSize,
style: defaultNodeStyle,
anchorPoints: defaultFlowGraphAnchorPoints,
nodeStateStyles: defaultStateStyles,
padding: 6
},
edgeCfg: {
type: "fund-line",
edgeStateStyles: defaultStateStyles,
style: {
stroke: "#40a9ff"
},
endArrow: {
fill: "#40a9ff"
}
},
behaviors: ["zoom-canvas", "drag-canvas"],
layout: defaultLayout13,
animate: true,
autoFit: true,
fitCenter: true,
style: {
position: "relative",
height: "inherit",
backgroundColor: "#fff"
}
};
var FundFlowGraph = function(props) {
var uProps = useProps3(props, defaultProps12).uProps;
var className = uProps.className, style = uProps.style, loading = uProps.loading, loadingTemplate = uProps.loadingTemplate, errorTemplate = uProps.errorTemplate, rest = __rest45(uProps, ["className", "style", "loading", "loadingTemplate", "errorTemplate"]);
var container2 = useGraph2("Graph", rest, { name: "FundFlowGraph" }).container;
return compat_module_default.createElement(errorBoundary_default, { errorTemplate }, loading && compat_module_default.createElement(createLoading_default, { loadingTemplate }), compat_module_default.createElement("div", { className, style, ref: container2 }));
};
var fundFlowGraph_default = FundFlowGraph;
// node_modules/@ant-design/charts/es/index.js
var es_default6 = {
Area: area_default2,
Bar: bar_default,
Box: box_default,
Bullet: bullet_default,
Column: column_default,
Funnel: funnel_default,
Histogram: histogram_default,
Line: line_default10,
Liquid: liquid_default,
Heatmap: heatmap_default2,
Pie: pie_default2,
Progress: progress_default,
Radar: radar_default,
Facet: facet_default,
RingProgress: ringProgress_default,
Rose: rose_default,
Chord: chord_default,
Scatter: scatter_default,
TinyArea: tinyArea_default,
TinyColumn: tinyColumn_default,
TinyLine: tinyLine_default,
Waterfall: waterfall_default,
WordCloud: wordCloud_default,
Sunburst: sunburst_default,
DualAxes: dualAxes_default,
Stock: stock_default,
RadialBar: radialBar_default,
Gauge: gauge_default,
Sankey: sankey_default,
Treemap: treemap_default2,
Violin: violin_default2,
MultiView: mix_default,
Mix: mix_default,
Venn: venn_default,
BidirectionalBar: bidirectionalBar_default,
OrganizationTreeGraph: organizationTreeGraph_default,
DagreGraph: dagre_default2,
IndentedTree: indented_default,
DagreFundFlowGraph: dagreFundFlow_default,
IndentedTreeGraph: indentedTreeGraph_default,
FlowAnalysisGraph: flowAnalysisGraph_default,
RadialTreeGraph: radialTreeGraph_default,
DecompositionTreeGraph: decompositionTreeGraph_default,
OrganizationGraph: organizationGraph_default,
OrganizationalGraph: organizationalGraph_default,
RadialGraph: radialGraph_default,
FundFlowGraph: fundFlowGraph_default,
G2: esm_exports3,
flow,
measureTextWidth: measureTextWidth2,
adaptors
};
// src/components/Chart.tsx
var import_errorBoundary2 = __toModule(require_errorBoundary());
es_default6.G2.registerTheme("theme1", {
colors10: ["#FF6B3B", "#626681", "#FFC100", "#9FB40F", "#76523B", "#DAD5B5", "#0E8E89", "#E19348", "#F383A2", "#247FEA"],
colors20: ["#FF6B3B", "#626681", "#FFC100", "#9FB40F", "#76523B", "#DAD5B5", "#0E8E89", "#E19348", "#F383A2", "#247FEA", "#2BCB95", "#B1ABF4", "#1D42C2", "#1D9ED1", "#D64BC0", "#255634", "#8C8C47", "#8CDAE5", "#8E283B", "#791DC9"]
});
es_default6.G2.registerTheme("theme2", {
"colors10": ["#025DF4", "#DB6BCF", "#2498D1", "#BBBDE6", "#4045B2", "#21A97A", "#FF745A", "#007E99", "#FFA8A8", "#2391FF"],
"colors20": ["#025DF4", "#DB6BCF", "#2498D1", "#BBBDE6", "#4045B2", "#21A97A", "#FF745A", "#007E99", "#FFA8A8", "#2391FF", "#FFC328", "#A0DC2C", "#946DFF", "#626681", "#EB4185", "#CD8150", "#36BCCB", "#327039", "#803488", "#83BC99"]
});
var Chart2 = ({ type: type2, config }) => {
const Component4 = es_default6[type2];
return /* @__PURE__ */ compat_module_default.createElement(import_errorBoundary2.default, null, /* @__PURE__ */ compat_module_default.createElement(Component4, __spreadProps(__spreadValues({}, config), {
onReady: (chart) => {
if (chart instanceof Plot) {
const custom12 = {};
if (config.theme && config.backgroundColor) {
custom12.theme = { background: config.backgroundColor };
}
if (config.padding) {
custom12.padding = config.padding;
}
if (custom12.theme || config.padding) {
chart.update(custom12);
}
}
}
})));
};
// src/parser.ts
var import_obsidian2 = __toModule(require("obsidian"));
// src/tools.ts
var import_papaparse = __toModule(require_papaparse_min());
var import_obsidian = __toModule(require("obsidian"));
function insertEditor(editor, data3) {
editor.somethingSelected ? editor.replaceSelection(data3) : editor.setLine(editor.getCursor().line, data3);
}
function getFolderOptions(app) {
const options = {};
import_obsidian.Vault.recurseChildren(app.vault.getRoot(), (f3) => {
if (f3 instanceof import_obsidian.TFolder) {
options[f3.path] = f3.path;
}
});
return options;
}
function parseCsv(content) {
return import_papaparse.default.parse(content, {
header: true,
skipEmptyLines: true,
comments: false,
dynamicTyping: true
}).data;
}
function getWordCountRegex() {
const spaceDelimitedChars = /A-Za-z\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source;
const nonSpaceDelimitedWords = /\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u4E00-\u9FD5/.source;
const nonSpaceDelimitedWordsOther = /[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u4E00-\u9FD5]{1}/.source;
return new RegExp([
`(?:[0-9]+(?:(?:,|\\.)[0-9]+)*|[\\-${spaceDelimitedChars}])+`,
nonSpaceDelimitedWords,
nonSpaceDelimitedWordsOther
].join("|"), "g");
}
function getWordCount(text, filter2) {
const words = {};
const matchs = text.match(getWordCountRegex());
if (matchs) {
matchs.forEach((match) => {
match = match.toLowerCase();
words[match] = words[match] ? words[match] + 1 : 1;
});
}
const wordCount = [];
const ignoreRegex = new RegExp(filter2.split("\n").map((e4) => ["^", e4.trim(), "$"].join("")).join("|"), "i");
for (const word2 in words) {
if (!ignoreRegex.test(word2)) {
wordCount.push({ word: word2, count: words[word2] });
}
}
return wordCount;
}
// src/parser.ts
var import_obsidian_dataview = __toModule(require_lib4());
var functionRegex = /^\s*function\s*.*\(.*\)\s*\{[\w\W]*\}\s*/i;
function parseConfig(content, plugin, sourcePath) {
return __async(this, null, function* () {
const dataProps = (0, import_obsidian2.parseYaml)(content);
const type2 = dataProps["type"];
const chart = es_default6[type2];
if (chart === void 0) {
throw new Error(`Unsupported chart type ${type2}.`);
}
const data3 = dataProps["data"];
const options = stringToFunction(dataProps["options"] || {});
if (type2 == "MultiView" || type2 == "Mix") {
return {
type: type2,
config: yield parseMultiViewConfig(dataProps, data3, options, plugin, sourcePath)
};
} else {
return {
type: type2,
config: __spreadValues({ data: yield loadFromFile(data3, plugin, sourcePath) }, options)
};
}
});
}
function stringToFunction(options) {
for (const key in options) {
const value2 = options[key];
if (value2) {
if (typeof value2 === "string" && functionRegex.test(value2)) {
options[key] = (0, eval)(`(${value2})`);
} else if (Array.isArray(value2)) {
options[key] = value2.map(stringToFunction);
} else if (typeof value2 === "object") {
options[key] = stringToFunction(value2);
}
}
}
return options;
}
function parseMultiViewConfig(dataProps, data3, options, plugin, sourcePath) {
return __async(this, null, function* () {
const temp = new Map();
const views = [];
for (const key in dataProps) {
const keyParts = key.split(".");
if (keyParts.length !== 2 || keyParts[0] !== "options" && keyParts[0] !== "data") {
continue;
}
const viewType = keyParts[1];
const view = temp.get(viewType) || {};
view[keyParts[0]] = dataProps[key];
temp.set(viewType, view);
}
for (let v3 of temp.values()) {
views.push(__spreadValues({ data: (yield loadFromFile(v3["data"], plugin, sourcePath)) || data3 }, stringToFunction(v3["options"] || {})));
}
return __spreadValues({ views }, options);
});
}
function loadFromFile(data3, plugin, sourcePath) {
return __async(this, null, function* () {
if (typeof data3 === "string") {
if (data3.startsWith("wordcount:")) {
return loadFromMdWordCount(data3.replace("wordcount:", ""), plugin);
} else if (data3.startsWith("dataviewjs:")) {
return loadFromDataViewPlugin(data3.replace("dataviewjs:", ""), plugin, sourcePath);
} else {
return loadFromCsv(data3, plugin);
}
} else {
return data3;
}
});
}
var dataViewApiProxy = function(api, currentFilePath) {
return {
pagePaths: function(query) {
return api.pagePaths(query, currentFilePath);
},
page: function(path) {
return api.page(path, currentFilePath);
},
pages: function(query) {
return api.pages(query, currentFilePath);
},
current: function() {
return api.page(currentFilePath, currentFilePath);
},
array: function(raw) {
return api.array(raw);
},
isArray: function(raw) {
return api.isArray(raw);
},
fileLink: function(path, embed = false, display) {
return import_obsidian_dataview.Link.file(path, embed, display);
},
date: function(pathlike) {
return api.date(pathlike);
}
};
};
function loadFromDataViewPlugin(content, plugin, sourcePath) {
return __async(this, null, function* () {
var _a6;
if (plugin.app.plugins.enabledPlugins.has("dataview")) {
const api = (_a6 = plugin.app.plugins.plugins.dataview) == null ? void 0 : _a6.api;
if (api) {
return new Function("dv", content).call(void 0, dataViewApiProxy(api, sourcePath));
} else {
throw new Error(`Obsidian Dataview is not ready.`);
}
} else {
throw new Error(`Obsidian Dataview is required.`);
}
});
}
function loadFromMdWordCount(fileName, plugin) {
return __async(this, null, function* () {
const fileOrPaths = fileName.split(",");
const contents = [];
for (const file of plugin.app.vault.getMarkdownFiles()) {
if (file.basename == fileName || fileOrPaths.contains(file.basename) || containedParent(file.parent, fileOrPaths)) {
const content = yield plugin.app.vault.cachedRead(file);
contents.push(content);
}
}
if (contents.length == 0) {
throw new Error("No words found.");
}
return getWordCount(contents.join("\n"), plugin.settings.wordCountFilter);
});
}
function containedParent(folder, fileOrPaths) {
const contained = fileOrPaths.contains(`${folder.name}/`);
if (contained || folder.parent == void 0) {
return contained;
} else {
return containedParent(folder.parent, fileOrPaths);
}
}
function loadFromCsv(data3, plugin) {
return __async(this, null, function* () {
const csvFileNames = data3.split(",");
const value2 = [];
for (const name of csvFileNames.values()) {
const file = plugin.app.vault.getAbstractFileByPath(plugin.settings.dataPath + "/" + name.trim());
if (file instanceof import_obsidian2.TFile) {
value2.push(parseCsv(yield plugin.app.vault.read(file)));
} else {
value2.push({});
}
}
if (value2.length == 0) {
return {};
}
if (value2.length == 1) {
return value2[0];
}
return value2;
});
}
// src/settings.tsx
var import_obsidian3 = __toModule(require("obsidian"));
var DEFAULT_SETTINGS = {
theme: "default",
dataPath: "",
backgroundColor: "transparent",
paddingTop: 30,
paddingRight: 30,
paddingBottom: 30,
paddingLeft: 30,
wordCountFilter: `[A-z]{1,2}
[0-9]+
(?=[MDCLXVI])M*(C[MD]|D?C*)(X[CL]|L?X*)(I[XV]|V?I*)
and
are
but
did
for
get
got
had
has
her
him
his
its
not
our
she
the
was
you
been
from
have
into
mine
ours
that
them
they
this
went
were
with
these
those`
};
var ChartsViewSettingTab = class extends import_obsidian3.PluginSettingTab {
constructor(app, plugin) {
super(app, plugin);
this.plugin = plugin;
}
display() {
let { containerEl } = this;
containerEl.empty();
containerEl.createEl("h2", { text: "Charts View Settings" });
new import_obsidian3.Setting(containerEl).setName("Theme").setDesc("Choose default color scheme.").addDropdown((dropdown) => dropdown.addOption("default", "default").addOption("dark", "dark").addOption("theme1", "Theme #1").addOption("theme2", "Theme #2").setValue(this.plugin.settings.theme).onChange((value2) => __async(this, null, function* () {
this.plugin.settings.theme = value2;
yield this.plugin.saveSettings();
})));
new import_obsidian3.Setting(containerEl).setName("Background Color").setDesc("Change the background color of chart. e.g., #FFFFFF").addText((text) => text.setPlaceholder("transparent").setValue(this.plugin.settings.backgroundColor).onChange((value2) => __async(this, null, function* () {
this.plugin.settings.backgroundColor = value2;
yield this.plugin.saveSettings();
})));
new import_obsidian3.Setting(containerEl).setName("Chart Padding").setDesc("Change the padding of chart. (Top, Right, Bottom, Left)").addText((text) => {
text.inputEl.size = 5;
text.setPlaceholder("30").setValue(String(this.plugin.settings.paddingTop)).onChange((value2) => __async(this, null, function* () {
this.plugin.settings.paddingTop = Number(value2);
yield this.plugin.saveSettings();
}));
}).addText((text) => {
text.inputEl.size = 5;
text.setPlaceholder("30").setValue(String(this.plugin.settings.paddingRight)).onChange((value2) => __async(this, null, function* () {
this.plugin.settings.paddingRight = Number(value2);
yield this.plugin.saveSettings();
}));
}).addText((text) => {
text.inputEl.size = 5;
text.setPlaceholder("30").setValue(String(this.plugin.settings.paddingBottom)).onChange((value2) => __async(this, null, function* () {
this.plugin.settings.paddingBottom = Number(value2);
yield this.plugin.saveSettings();
}));
}).addText((text) => {
text.inputEl.size = 5;
text.setPlaceholder("30").setValue(String(this.plugin.settings.paddingLeft)).onChange((value2) => __async(this, null, function* () {
this.plugin.settings.paddingLeft = Number(value2);
yield this.plugin.saveSettings();
}));
});
new import_obsidian3.Setting(containerEl).setName("Data Folder").setDesc("Choose default folder for loading chart datas.").addDropdown((dropdown) => dropdown.addOptions(getFolderOptions(this.app)).setValue(this.plugin.settings.dataPath).onChange((value2) => __async(this, null, function* () {
this.plugin.settings.dataPath = value2;
yield this.plugin.saveSettings();
})));
new import_obsidian3.Setting(containerEl).setName("Word Filter").setDesc("For word count, any words in the list will be ignored.").addTextArea((text) => {
text.inputEl.rows = 6;
text.setValue(this.plugin.settings.wordCountFilter).onChange((value2) => __async(this, null, function* () {
this.plugin.settings.wordCountFilter = value2;
yield this.plugin.saveSettings();
}));
});
if (import_obsidian3.Platform.isDesktopApp) {
compat_module_default.render(/* @__PURE__ */ compat_module_default.createElement(compat_module_default.Fragment, null, /* @__PURE__ */ compat_module_default.createElement("p", null, "Make a donation to support Charts View plugin development."), /* @__PURE__ */ compat_module_default.createElement("p", null, "\u2764\uFE0F Thank you for your support. \u2764\uFE0F"), /* @__PURE__ */ compat_module_default.createElement("a", {
href: "https://paypal.me/caronchenhz",
className: "paypal"
}, /* @__PURE__ */ compat_module_default.createElement("svg", {
width: "145px",
height: "37px",
viewBox: "0 0 145 37",
version: "1.1",
xmlns: "http://www.w3.org/2000/svg",
xmlnsXlink: "http://www.w3.org/1999/xlink"
}, /* @__PURE__ */ compat_module_default.createElement("defs", null, /* @__PURE__ */ compat_module_default.createElement("polygon", {
id: "path-1",
points: "0 0.30377 29.7890799 0.30377 29.7890799 36.629778 0 36.629778"
}), /* @__PURE__ */ compat_module_default.createElement("polygon", {
id: "path-3",
points: "0 0.30377 27.0026179 0.30377 27.0026179 32.599368 0 32.599368"
}), /* @__PURE__ */ compat_module_default.createElement("polygon", {
id: "path-5",
points: "0 0.30377 27.0025944 0.30377 27.0025944 32.599368 0 32.599368"
})), /* @__PURE__ */ compat_module_default.createElement("g", {
id: "Page-1",
stroke: "none",
strokeWidth: "1",
fill: "none",
fillRule: "evenodd"
}, /* @__PURE__ */ compat_module_default.createElement("g", {
id: "01.2---Corp-Landing---Sticky-Nav",
transform: "translate(-80.000000, -21.000000)"
}, /* @__PURE__ */ compat_module_default.createElement("g", {
id: "logo-paypal",
transform: "translate(80.000000, 21.000000)"
}, /* @__PURE__ */ compat_module_default.createElement("path", {
d: "M112.489747,16.203225 C112.054389,19.158415 109.870796,19.158415 107.758093,19.158415 L106.556562,19.158415 L107.399352,13.640975 C107.450549,13.307605 107.728735,13.061925 108.055253,13.061925 L108.606253,13.061925 C110.04408,13.061925 111.402426,13.061925 112.102364,13.908485 C112.521611,14.415015 112.647994,15.165745 112.489747,16.203225 M111.570698,8.493535 L103.60429,8.493535 C103.059735,8.493535 102.595735,8.903125 102.511241,9.458865 L99.2897346,30.568475 C99.2260062,30.985095 99.5374877,31.362125 99.9456358,31.362125 L104.033204,31.362125 C104.414142,31.362125 104.739228,31.075005 104.798302,30.686135 L105.711623,24.701385 C105.796833,24.145275 106.260475,23.735315 106.805031,23.735315 L109.325525,23.735315 C114.572735,23.735315 117.600907,21.111645 118.3925,15.910185 C118.748735,13.635425 118.406821,11.847955 117.376068,10.596615 C116.243278,9.220955 114.235475,8.493535 111.570698,8.493535",
id: "Fill-1",
fill: "#009CDE"
}), /* @__PURE__ */ compat_module_default.createElement("path", {
d: "M55.6725531,16.203225 C55.2371951,19.158415 53.0532444,19.158415 50.9412568,19.158415 L49.7393679,19.158415 L50.582158,13.640975 C50.6333556,13.307605 50.9115407,13.061925 51.2380593,13.061925 L51.7890593,13.061925 C53.2268864,13.061925 54.5852321,13.061925 55.2851704,13.908485 C55.7040593,14.415015 55.8308,15.165745 55.6725531,16.203225 M54.7535037,8.493535 L46.7870963,8.493535 C46.2425407,8.493535 45.7788988,8.903125 45.6936889,9.458865 L42.4725407,30.568475 C42.4091704,30.985095 42.7206519,31.362125 43.128442,31.362125 L46.9320963,31.362125 C47.4766519,31.362125 47.9402938,30.952165 48.0255037,30.396055 L48.8944296,24.701385 C48.9792815,24.145275 49.4432815,23.735315 49.987837,23.735315 L52.5086889,23.735315 C57.7555407,23.735315 60.7840716,21.111645 61.5753062,15.910185 C61.9315407,13.635425 61.5896272,11.847955 60.5592321,10.596615 C59.426084,9.220955 57.4182815,8.493535 54.7535037,8.493535",
id: "Fill-3",
fill: "#003087"
}), /* @__PURE__ */ compat_module_default.createElement("path", {
d: "M73.2472333,23.781713 C72.8788259,26.034273 71.1484926,27.546093 68.9416284,27.546093 C67.8353321,27.546093 66.949579,27.178313 66.3803198,26.482343 C65.8160728,25.791923 65.6034062,24.808093 65.7824185,23.712893 C66.1261222,21.480683 67.8840235,19.919653 70.0572333,19.919653 C71.140616,19.919653 72.0199247,20.291133 72.6002827,20.994133 C73.184579,21.701943 73.4144309,22.692063 73.2472333,23.781713 M78.563184,16.108653 L74.7487889,16.108653 C74.4219123,16.108653 74.1437272,16.354333 74.0925296,16.688073 L73.9253321,17.790303 L73.6582457,17.391073 C72.8322827,16.151573 70.9913198,15.737913 69.1525049,15.737913 C64.9385543,15.737913 61.338616,19.038313 60.6379617,23.667013 C60.2731346,25.976553 60.7908383,28.183233 62.0578877,29.723543 C63.222184,31.138793 64.8830605,31.727833 66.862221,31.727833 C70.2588012,31.727833 72.1430852,29.472683 72.1430852,29.472683 L71.9726654,30.568253 C71.908937,30.984873 72.2204185,31.361903 72.6285667,31.361903 L76.0638136,31.361903 C76.6083691,31.361903 77.0720111,30.952683 77.156863,30.396573 L79.2190852,16.901563 C79.2824556,16.485313 78.9709741,16.108653 78.563184,16.108653",
id: "Fill-5",
fill: "#003087"
}), /* @__PURE__ */ compat_module_default.createElement("path", {
d: "M130.064427,23.781713 C129.69602,26.034273 127.966044,27.546093 125.75918,27.546093 C124.652526,27.546093 123.766773,27.178313 123.197156,26.482343 C122.633267,25.791923 122.4206,24.808093 122.599612,23.712893 C122.943316,21.480683 124.701217,19.919653 126.874427,19.919653 C127.957452,19.919653 128.837119,20.291133 129.417477,20.994133 C130.001773,21.701943 130.231625,22.692063 130.064427,23.781713 M135.380378,16.108653 L131.565983,16.108653 C131.239106,16.108653 130.960921,16.354333 130.909723,16.688073 L130.742526,17.790303 L130.47544,17.391073 C129.649477,16.151573 127.808156,15.737913 125.969699,15.737913 C121.755748,15.737913 118.15581,19.038313 117.455156,23.667013 C117.090686,25.976553 117.608032,28.183233 118.875081,29.723543 C120.03902,31.138793 121.700254,31.727833 123.679415,31.727833 C127.075995,31.727833 128.960279,29.472683 128.960279,29.472683 L128.789859,30.568253 C128.726131,30.984873 129.037612,31.361903 129.44576,31.361903 L132.881007,31.361903 C133.425563,31.361903 133.889205,30.952683 133.974057,30.396573 L136.036279,16.901563 C136.099649,16.485313 135.788168,16.108653 135.380378,16.108653",
id: "Fill-7",
fill: "#009CDE"
}), /* @__PURE__ */ compat_module_default.createElement("path", {
d: "M98.8795457,16.108727 L95.0454593,16.108727 C94.678842,16.108727 94.3358543,16.296687 94.1296321,16.610077 L88.8408914,24.660167 L86.5992988,16.924947 C86.4593111,16.440617 86.0278914,16.108727 85.5391877,16.108727 L81.7702617,16.108727 C81.3148543,16.108727 80.9951383,16.571227 81.1415704,17.016707 L85.3633975,29.823147 L81.3925457,35.613277 C81.0807062,36.068007 81.3954099,36.696267 81.9345951,36.696267 L85.7647432,36.696267 C86.1277802,36.696267 86.4675457,36.512377 86.674484,36.204167 L99.4251753,17.186167 C99.7302123,16.731067 99.4151506,16.108727 98.8795457,16.108727",
id: "Fill-9",
fill: "#003087"
}), /* @__PURE__ */ compat_module_default.createElement("path", {
d: "M139.876523,9.07314 L136.606684,30.56903 C136.543314,30.98565 136.855153,31.36194 137.262585,31.36194 L140.551042,31.36194 C141.095598,31.36194 141.55924,30.95235 141.644091,30.39661 L144.867746,9.287 C144.931474,8.87038 144.619993,8.49372 144.211844,8.49372 L140.532425,8.49372 C140.205548,8.49372 139.927363,8.7394 139.876523,9.07314",
id: "Fill-11",
fill: "#009CDE"
}), /* @__PURE__ */ compat_module_default.createElement("g", {
id: "Group-15",
transform: "translate(0.000000, 0.066415)"
}, /* @__PURE__ */ compat_module_default.createElement("mask", {
id: "mask-2",
fill: "white"
}, /* @__PURE__ */ compat_module_default.createElement("use", {
xlinkHref: "#path-1"
})), /* @__PURE__ */ compat_module_default.createElement("g", {
id: "Clip-14"
}), /* @__PURE__ */ compat_module_default.createElement("path", {
d: "M26.8450852,9.532828 C27.2739988,6.706768 26.842221,4.784248 25.363221,3.042288 C23.7349247,1.124948 20.7933938,0.303548 17.0294802,0.303548 L6.10471481,0.303548 C5.33567778,0.303548 4.68085062,0.881858 4.56091235,1.667368 L0.0114925926,31.479008 C-0.0780135802,32.067308 0.361998765,32.599368 0.938060494,32.599368 L7.68252963,32.599368 L7.21709753,35.650018 C7.13869012,36.164688 7.52320864,36.629778 8.02730741,36.629778 L13.7120235,36.629778 C14.3851099,36.629778 14.9579494,36.123988 15.0628506,35.437268 L15.1187025,35.138308 L16.1895543,28.120148 L16.2586531,27.732388 C16.3635543,27.045668 16.9363938,26.539508 17.6091222,26.539508 L18.4594309,26.539508 C23.9669247,26.539508 28.2793321,24.227378 29.539221,17.539998 C30.0658753,14.745388 29.7934185,12.413278 28.4014185,10.773438 C27.9800235,10.277268 27.4562333,9.867308 26.8450852,9.532828",
id: "Fill-13",
fill: "#009CDE",
mask: "url(#mask-2)"
})), /* @__PURE__ */ compat_module_default.createElement("g", {
id: "Group-18",
transform: "translate(0.000000, 0.066415)"
}, /* @__PURE__ */ compat_module_default.createElement("mask", {
id: "mask-4",
fill: "white"
}, /* @__PURE__ */ compat_module_default.createElement("use", {
xlinkHref: "#path-3"
})), /* @__PURE__ */ compat_module_default.createElement("g", {
id: "Clip-17"
}), /* @__PURE__ */ compat_module_default.createElement("path", {
d: "M26.8450852,9.532828 C27.2739988,6.706768 26.842221,4.784248 25.363221,3.042288 C23.7349247,1.124948 20.7933938,0.303548 17.0294802,0.303548 L6.10471481,0.303548 C5.33567778,0.303548 4.68085062,0.881858 4.56091235,1.667368 L0.0114925926,31.479008 C-0.0780135802,32.067308 0.361998765,32.599368 0.938060494,32.599368 L7.68252963,32.599368 L9.37670247,21.496778 L9.32407284,21.844948 C9.44401111,21.059808 10.0931099,20.481498 10.8625049,20.481498 L14.0679,20.481498 C20.3634062,20.481498 25.2930481,17.838218 26.7333815,10.194018 C26.7759864,9.967578 26.8125049,9.748538 26.8450852,9.532828",
id: "Fill-16",
fill: "#012169",
mask: "url(#mask-4)"
})), /* @__PURE__ */ compat_module_default.createElement("g", {
id: "Group-21",
transform: "translate(0.000000, 0.066415)"
}, /* @__PURE__ */ compat_module_default.createElement("mask", {
id: "mask-6",
fill: "white"
}, /* @__PURE__ */ compat_module_default.createElement("use", {
xlinkHref: "#path-5"
})), /* @__PURE__ */ compat_module_default.createElement("g", {
id: "Clip-20"
}), /* @__PURE__ */ compat_module_default.createElement("path", {
d: "M11.196721,9.570198 C11.268684,9.098078 11.5622642,8.711058 11.9571654,8.515698 C12.1365358,8.426898 12.3370296,8.377318 12.5471901,8.377318 L21.1107827,8.377318 C22.1254247,8.377318 23.0713259,8.445768 23.9363136,8.590068 C24.1833506,8.630768 24.4239432,8.678128 24.6573753,8.731778 C24.8911654,8.785428 25.1177951,8.845368 25.3372642,8.911598 C25.4471778,8.944898 25.5549432,8.979678 25.6612765,9.015938 C26.0858938,9.161718 26.4811531,9.333398 26.8452642,9.532828 C27.2738198,6.706768 26.842042,4.783878 25.363042,3.042288 C23.7351037,1.124948 20.7932148,0.303548 17.0296593,0.303548 L6.10489383,0.303548 C5.33549877,0.303548 4.6806716,0.881858 4.56073333,1.667368 L0.0116716049,31.479008 C-0.0781925926,32.067308 0.361819753,32.599368 0.937881481,32.599368 L7.68270864,32.599368 L9.37688148,21.496778 L11.196721,9.570198 Z",
id: "Fill-19",
fill: "#003087",
mask: "url(#mask-6)"
})))))))), containerEl.createDiv({ cls: "chartsview-donation" }));
}
}
};
// src/components/Modal.ts
var import_obsidian4 = __toModule(require("obsidian"));
// src/templates.ts
var ChartTemplateType;
(function(ChartTemplateType2) {
ChartTemplateType2["Bar"] = "YGBgY2hhcnRzdmlldwojLS0tLS0tLS0tLS0tLS0tLS0jCiMtIGNoYXJ0IHR5cGUgICAgLSMKIy0tLS0tLS0tLS0tLS0tLS0tIwp0eXBlOiBCYXIKCiMtLS0tLS0tLS0tLS0tLS0tLSMKIy0gY2hhcnQgZGF0YSAgICAtIwojLS0tLS0tLS0tLS0tLS0tLS0jCmRhdGE6CiAgLSBhY3Rpb246ICJCcm93c2UgdGhlIHdlYnNpdGUiCiAgICBwdjogNTAwMDAKICAtIGFjdGlvbjogIkFkZCB0byBjYXJ0IgogICAgcHY6IDM1MDAwCiAgLSBhY3Rpb246ICJHZW5lcmF0ZSBvcmRlcnMiCiAgICBwdjogMjUwMDAKICAtIGFjdGlvbjogIlBheSBvcmRlciIKICAgIHB2OiAxNTAwMAogIC0gYWN0aW9uOiAiU2VhbCB0aGUgZGVhbCIKICAgIHB2OiA4NTAwCgojLS0tLS0tLS0tLS0tLS0tLS0jCiMtIGNoYXJ0IG9wdGlvbnMgLSMKIy0tLS0tLS0tLS0tLS0tLS0tIwpvcHRpb25zOgogIHhGaWVsZDogInB2IgogIHlGaWVsZDogImFjdGlvbiIKICBjb252ZXJzaW9uVGFnOiB7fQpgYGA=";
ChartTemplateType2["Pie"] = "YGBgY2hhcnRzdmlldwojLS0tLS0tLS0tLS0tLS0tLS0jCiMtIGNoYXJ0IHR5cGUgICAgLSMKIy0tLS0tLS0tLS0tLS0tLS0tIwp0eXBlOiBQaWUKCiMtLS0tLS0tLS0tLS0tLS0tLSMKIy0gY2hhcnQgZGF0YSAgICAtIwojLS0tLS0tLS0tLS0tLS0tLS0jCmRhdGE6CiAgLSB0eXBlOiAiV2FnZSBpbmNvbWUgcGVyIGNhcGl0YSAowqUpIgogICAgdmFsdWU6IDE3OTE3CiAgLSB0eXBlOiAiT3BlcmF0aW5nIG5ldCBpbmNvbWUgcGVyIGNhcGl0YSAowqUpIgogICAgdmFsdWU6IDUzMDcKICAtIHR5cGU6ICJQcm9wZXJ0eSBQZXIgQ2FwaXRhIE5ldCBJbmNvbWUgKMKlKSIKICAgIHZhbHVlOiAyNzkxCiAgLSB0eXBlOiAiVHJhbnNmZXIgb2YgbmV0IGluY29tZSBwZXIgY2FwaXRhICjCpSkiCiAgICB2YWx1ZTogNjE3MwoKIy0tLS0tLS0tLS0tLS0tLS0tIwojLSBjaGFydCBvcHRpb25zIC0jCiMtLS0tLS0tLS0tLS0tLS0tLSMKb3B0aW9uczoKICBhbmdsZUZpZWxkOiAidmFsdWUiCiAgY29sb3JGaWVsZDogInR5cGUiCiAgcmFkaXVzOiAwLjUKICBsYWJlbDoKICAgIHR5cGU6ICJzcGlkZXIiCiAgICBjb250ZW50OiAie3BlcmNlbnRhZ2V9XG57bmFtZX0iCiAgbGVnZW5kOgogICAgbGF5b3V0OiAiaG9yaXpvbnRhbCIKICAgIHBvc2l0aW9uOiAiYm90dG9tIgpgYGA=";
ChartTemplateType2["WordCloud"] = "YGBgY2hhcnRzdmlldwojLS0tLS0tLS0tLS0tLS0tLS0jCiMtIGNoYXJ0IHR5cGUgICAgLSMKIy0tLS0tLS0tLS0tLS0tLS0tIwp0eXBlOiBXb3JkQ2xvdWQKCiMtLS0tLS0tLS0tLS0tLS0tLSMKIy0gY2hhcnQgZGF0YSAgICAtIwojLS0tLS0tLS0tLS0tLS0tLS0jCmRhdGE6CiAgLSB4OiAiQ2hpbmEiCiAgICB2YWx1ZTogMjM4MzIyMDAwMAogICAgY2F0ZWdvcnk6ICJhc2lhIgogIC0geDogIkluZG9uZXNpYSIKICAgIHZhbHVlOiAyNjM1MTAwMDAKICAgIGNhdGVnb3J5OiAiYXNpYSIKICAtIHg6ICJQYWtpc3RhbiIKICAgIHZhbHVlOiAzOTY0NTkwMDAKICAgIGNhdGVnb3J5OiAiYXNpYSIKICAtIHg6ICJSdXNzaWEiCiAgICB2YWx1ZTogNTQ2ODA0MzcyCiAgICBjYXRlZ29yeTogImV1cm9wZSIKICAtIHg6ICJKYXBhbiIKICAgIHZhbHVlOiAxMjY3OTAwMDAKICAgIGNhdGVnb3J5OiAiYXNpYSIKICAtIHg6ICJWaWV0bmFtIgogICAgdmFsdWU6IDkyNzAwMDAwCiAgICBjYXRlZ29yeTogImFzaWEiCiAgLSB4OiAiR2VybWFueSIKICAgIHZhbHVlOiA4MjgwMDAwMAogICAgY2F0ZWdvcnk6ICJldXJvcGUiCiAgLSB4OiAiSXJhbiIKICAgIHZhbHVlOiA4MDEzNTQwMAogICAgY2F0ZWdvcnk6ICJhc2lhIgogIC0geDogIlRoYWlsYW5kIgogICAgdmFsdWU6IDY4Mjk4MDAwCiAgICBjYXRlZ29yeTogImFzaWEiCiAgLSB4OiAiRnJhbmNlIgogICAgdmFsdWU6IDY3MDEzMDAwCiAgICBjYXRlZ29yeTogImV1cm9wZSIKICAtIHg6ICJJdGFseSIKICAgIHZhbHVlOiA2MDU5OTkzNgogICAgY2F0ZWdvcnk6ICJldXJvcGUiCiAgLSB4OiAiU291dGggS29yZWEiCiAgICB2YWx1ZTogNTE0NDYyMDEKICAgIGNhdGVnb3J5OiAiYXNpYSIKICAtIHg6ICJLZW55YSIKICAgIHZhbHVlOiA0ODQ2NzAwMAogICAgY2F0ZWdvcnk6ICJhZnJpY2EiCiAgLSB4OiAiU3BhaW4iCiAgICB2YWx1ZTogNDY4MTIwMDAKICAgIGNhdGVnb3J5OiAiZXVyb3BlIgogIC0geDogIlN1ZGFuIgogICAgdmFsdWU6IDQyMTc2MDAwCiAgICBjYXRlZ29yeTogImFmcmljYSIKICAtIHg6ICJJcmFxIgogICAgdmFsdWU6IDQ3ODgzNTQzCiAgICBjYXRlZ29yeTogImFzaWEiCiAgLSB4OiAiTmVwYWwiCiAgICB2YWx1ZTogMjg4MjU3MDkKICAgIGNhdGVnb3J5OiAiYXNpYSIKICAtIHg6ICJOb3J0aCBLb3JlYSIKICAgIHZhbHVlOiAyNDIxMzUxMAogICAgY2F0ZWdvcnk6ICJhc2lhIgogIC0geDogIkNoaWxlIgogICAgdmFsdWU6IDI4MTkxOTAwCiAgICBjYXRlZ29yeTogImFtZXJpY2EiCgojLS0tLS0tLS0tLS0tLS0tLS0jCiMtIGNoYXJ0IG9wdGlvbnMgLSMKIy0tLS0tLS0tLS0tLS0tLS0tIwpvcHRpb25zOgogIHdvcmRGaWVsZDogIngiCiAgd2VpZ2h0RmllbGQ6ICJ2YWx1ZSIKICBjb2xvcjogIiMxMjJjNmEiCiAgd29yZFN0eWxlOgogICAgZm9udEZhbWlseTogIlZlcmRhbmEiCiAgICBmb250U2l6ZTogWzI0LCA4MF0KICBpbnRlcmFjdGlvbnM6CiAgICB0eXBlOiAiZWxlbWVudC1hY3RpdmUiCiAgc3R5bGU6CiAgICBiYWNrZ3JvdW5kQ29sb3I6ICJ3aGl0ZSIKICBzdGF0ZToKICAgIGFjdGl2ZToKICAgICAgc3R5bGU6CiAgICAgICAgbGluZVdpZHRoOiAzCmBgYA==";
ChartTemplateType2["WordCount"] = "YGBgY2hhcnRzdmlldwojLS0tLS0tLS0tLS0tLS0tLS0jCiMtIGNoYXJ0IHR5cGUgICAgLSMKIy0tLS0tLS0tLS0tLS0tLS0tIwp0eXBlOiBXb3JkQ2xvdWQKCiMtLS0tLS0tLS0tLS0tLS0tLSMKIy0gY2hhcnQgZGF0YSAgICAtIwojLS0tLS0tLS0tLS0tLS0tLS0jCmRhdGE6ICJ3b3JkY291bnQ6bm90ZS1uYW1lLWhlcmUtd2l0aG91dC1mb2xkLXBhdGgiCgojLS0tLS0tLS0tLS0tLS0tLS0jCiMtIGNoYXJ0IG9wdGlvbnMgLSMKIy0tLS0tLS0tLS0tLS0tLS0tIwpvcHRpb25zOgogIHdvcmRGaWVsZDogIndvcmQiCiAgd2VpZ2h0RmllbGQ6ICJjb3VudCIKICBjb2xvckZpZWxkOiAiY291bnQiCiAgd29yZFN0eWxlOgogICAgcm90YXRpb246IDMwCmBgYA==";
ChartTemplateType2["Treemap"] = "YGBgY2hhcnRzdmlldwojLS0tLS0tLS0tLS0tLS0tLS0jCiMtIGNoYXJ0IHR5cGUgICAgLSMKIy0tLS0tLS0tLS0tLS0tLS0tIwp0eXBlOiBUcmVlbWFwCgojLS0tLS0tLS0tLS0tLS0tLS0jCiMtIGNoYXJ0IGRhdGEgICAgLSMKIy0tLS0tLS0tLS0tLS0tLS0tIwpkYXRhOgogIG5hbWU6ICdyb290JwogIGNoaWxkcmVuOgogICAgLSBuYW1lOiAnRm9sZGVyIDEnCiAgICAgIHZhbHVlOiA1NjAKICAgIC0gbmFtZTogJ0ZvbGRlciAyJwogICAgICB2YWx1ZTogNTAwCiAgICAtIG5hbWU6ICdGb2xkZXIgMycKICAgICAgdmFsdWU6IDE1MAogICAgLSBuYW1lOiAnRm9sZGVyIDQnCiAgICAgIHZhbHVlOiAxNDAKICAgIC0gbmFtZTogJ0ZvbGRlciA1JwogICAgICB2YWx1ZTogMTE1CiAgICAtIG5hbWU6ICdGb2xkZXIgNicKICAgICAgdmFsdWU6IDk1CiAgICAtIG5hbWU6ICdGb2xkZXIgNycKICAgICAgdmFsdWU6IDkwCiAgICAtIG5hbWU6ICdGb2xkZXIgOCcKICAgICAgdmFsdWU6IDc1CiAgICAtIG5hbWU6ICdGb2xkZXIgOScKICAgICAgdmFsdWU6IDk4CiAgICAtIG5hbWU6ICdGb2xkZXIgMTAnCiAgICAgIHZhbHVlOiA2MAogICAgLSBuYW1lOiAnRm9sZGVyIDExJwogICAgICB2YWx1ZTogNDUKICAgIC0gbmFtZTogJ0ZvbGRlciAxMicKICAgICAgdmFsdWU6IDQwCiAgICAtIG5hbWU6ICdGb2xkZXIgMTMnCiAgICAgIHZhbHVlOiA0MAogICAgLSBuYW1lOiAnRm9sZGVyIDE0JwogICAgICB2YWx1ZTogMzUKICAgIC0gbmFtZTogJ0ZvbGRlciAxNScKICAgICAgdmFsdWU6IDQwCiAgICAtIG5hbWU6ICdGb2xkZXIgMTYnCiAgICAgIHZhbHVlOiA0MAogICAgLSBuYW1lOiAnRm9sZGVyIDE3JwogICAgICB2YWx1ZTogNDAKICAgIC0gbmFtZTogJ0ZvbGRlciAxOCcKICAgICAgdmFsdWU6IDMwCiAgICAtIG5hbWU6ICdGb2xkZXIgMTknCiAgICAgIHZhbHVlOiAyOAogICAgLSBuYW1lOiAnRm9sZGVyIDIwJwogICAgICB2YWx1ZTogMTYKCiMtLS0tLS0tLS0tLS0tLS0tLSMKIy0gY2hhcnQgb3B0aW9ucyAtIwojLS0tLS0tLS0tLS0tLS0tLS0jCm9wdGlvbnM6CiAgY29sb3JGaWVsZDogIm5hbWUiCmBgYAo=";
ChartTemplateType2["DualAxes"] = "YGBgY2hhcnRzdmlldwojLS0tLS0tLS0tLS0tLS0tLS0jCiMtIGNoYXJ0IHR5cGUgICAgLSMKIy0tLS0tLS0tLS0tLS0tLS0tIwp0eXBlOiBEdWFsQXhlcwoKIy0tLS0tLS0tLS0tLS0tLS0tIwojLSBjaGFydCBkYXRhICAgIC0jCiMtLS0tLS0tLS0tLS0tLS0tLSMKZGF0YToKICAtCiAgICAtIHRpbWU6ICIyMDE5LTAzIgogICAgICB2YWx1ZTogMzUwCiAgICAgIGNvdW50OiA4MDAKICAgIC0gdGltZTogIjIwMTktMDQiCiAgICAgIHZhbHVlOiA5MDAKICAgICAgY291bnQ6IDYwMAogICAgLSB0aW1lOiAiMjAxOS0wNSIKICAgICAgdmFsdWU6IDMwMAogICAgICBjb3VudDogNDAwCiAgICAtIHRpbWU6ICIyMDE5LTA2IgogICAgICB2YWx1ZTogNDUwCiAgICAgIGNvdW50OiAzODAKICAgIC0gdGltZTogIjIwMTktMDciCiAgICAgIHZhbHVlOiA0NzAKICAgICAgY291bnQ6IDIyCiAgLQogICAgLSB0aW1lOiAiMjAxOS0wMyIKICAgICAgdmFsdWU6IDM1MAogICAgICBjb3VudDogODAwCiAgICAtIHRpbWU6ICIyMDE5LTA0IgogICAgICB2YWx1ZTogOTAwCiAgICAgIGNvdW50OiA2MDAKICAgIC0gdGltZTogIjIwMTktMDUiCiAgICAgIHZhbHVlOiAzMDAKICAgICAgY291bnQ6IDQwMAogICAgLSB0aW1lOiAiMjAxOS0wNiIKICAgICAgdmFsdWU6IDQ1MAogICAgICBjb3VudDogMzgwCiAgICAtIHRpbWU6ICIyMDE5LTA3IgogICAgICB2YWx1ZTogNDcwCiAgICAgIGNvdW50OiAyMgoKIy0tLS0tLS0tLS0tLS0tLS0tIwojLSBjaGFydCBvcHRpb25zIC0jCiMtLS0tLS0tLS0tLS0tLS0tLSMKb3B0aW9uczoKICB4RmllbGQ6ICd0aW1lJwogIHlGaWVsZDogWyd2YWx1ZScsICdjb3VudCddCiAgeUF4aXM6CiAgICB2YWx1ZToKICAgICAgbWluOiAwCiAgICAgIGxhYmVsOgogICAgICAgIGZvcm1hdHRlcjoKICAgICAgICAgIGZ1bmN0aW9uIGZvcm1hdHRlcih2YWwpIHsKICAgICAgICAgICAgcmV0dXJuICcnLmNvbmNhdCh2YWwsICfkuKonKTsKICAgICAgICAgIH0KICBnZW9tZXRyeU9wdGlvbnM6CiAgICAtIGdlb21ldHJ5OiAnY29sdW1uJwogICAgLSBnZW9tZXRyeTogJ2xpbmUnCiAgICAgIGxpbmVTdHlsZToKICAgICAgICBsaW5lV2lkdGg6IDIKYGBg";
ChartTemplateType2["Mix"] = "YGBgY2hhcnRzdmlldwojLS0tLS0tLS0tLS0tLS0tLS0jCiMtIGNoYXJ0IHR5cGUgICAgLSMKIy0tLS0tLS0tLS0tLS0tLS0tIwp0eXBlOiBNaXgKCiMtLS0tLS0tLS0tLS0tLS0tLSMKIy0gY2hhcnQgZGF0YSAgICAtIwojLS0tLS0tLS0tLS0tLS0tLS0jCmRhdGEuYXJlYToKICAtIHRpbWU6IDEyNDY0MDY0MDAwMDAKICAgIHRlbXBlcmF0dXJlOiBbMTQuMywgMjcuN10KICAtIHRpbWU6IDEyNDY0OTI4MDAwMDAKICAgIHRlbXBlcmF0dXJlOiBbMTQuNSwgMjcuOF0KICAtIHRpbWU6IDEyNDY1NzkyMDAwMDAKICAgIHRlbXBlcmF0dXJlOiBbMTUuNSwgMjkuNl0KICAtIHRpbWU6IDEyNDY2NjU2MDAwMDAKICAgIHRlbXBlcmF0dXJlOiBbMTYuNywgMzAuN10KICAtIHRpbWU6IDEyNDY3NTIwMDAwMDAKICAgIHRlbXBlcmF0dXJlOiBbMTYuNSwgMjUuMF0KICAtIHRpbWU6IDEyNDY4Mzg0MDAwMDAKICAgIHRlbXBlcmF0dXJlOiBbMTcuOCwgMjUuN10KCmRhdGEubGluZToKICAtIHRpbWU6IDEyNDY0MDY0MDAwMDAKICAgIHRlbXBlcmF0dXJlOiAyMS41CiAgLSB0aW1lOiAxMjQ2NDkyODAwMDAwCiAgICB0ZW1wZXJhdHVyZTogMjIuMQogIC0gdGltZTogMTI0NjU3OTIwMDAwMAogICAgdGVtcGVyYXR1cmU6IDIzCiAgLSB0aW1lOiAxMjQ2NjY1NjAwMDAwCiAgICB0ZW1wZXJhdHVyZTogMjMuOAogIC0gdGltZTogMTI0Njc1MjAwMDAwMAogICAgdGVtcGVyYXR1cmU6IDIxLjQKICAtIHRpbWU6IDEyNDY4Mzg0MDAwMDAKICAgIHRlbXBlcmF0dXJlOiAyMS4zCgojLS0tLS0tLS0tLS0tLS0tLS0jCiMtIGNoYXJ0IG9wdGlvbnMgLSMKIy0tLS0tLS0tLS0tLS0tLS0tIwpvcHRpb25zOgogIGFwcGVuZFBhZGRpbmc6IDgKICBzeW5jVmlld1BhZGRpbmc6IHRydWUKICB0b29sdGlwOgogICAgc2hhcmVkOiB0cnVlCiAgICBzaG93TWFya2VyczogZmFsc2UKICAgIHNob3dDcm9zc2hhaXJzOiB0cnVlCiAgICBvZmZzZXRZOiAtNTAKCm9wdGlvbnMuYXJlYToKICBheGVzOiB7fQogIG1ldGE6CiAgICB0aW1lOgogICAgICB0eXBlOiAndGltZScKICAgICAgbWFzazogJ01NLUREJwogICAgICBuaWNlOiB0cnVlCiAgICAgIHRpY2tJbnRlcnZhbDogMTcyODAwMDAwCiAgICAgIHJhbmdlOiBbMCwgMV0KICAgIHRlbXBlcmF0dXJlOgogICAgICBuaWNlOiB0cnVlCiAgICAgIHN5bmM6IHRydWUKICAgICAgYWxpYXM6ICfmuKnluqbojIPlm7QnCiAgZ2VvbWV0cmllczoKICAgIC0gdHlwZTogJ2FyZWEnCiAgICAgIHhGaWVsZDogJ3RpbWUnCiAgICAgIHlGaWVsZDogJ3RlbXBlcmF0dXJlJwogICAgICBtYXBwaW5nOiB7fQoKb3B0aW9ucy5saW5lOgogIGF4ZXM6IGZhbHNlCiAgbWV0YToKICAgIHRpbWU6CiAgICAgIHR5cGU6ICd0aW1lJwogICAgICBtYXNrOiAnTU0tREQnCiAgICAgIG5pY2U6IHRydWUKICAgICAgdGlja0ludGVydmFsOiAxNzI4MDAwMDAKICAgICAgcmFuZ2U6IFswLCAxXQogICAgdGVtcGVyYXR1cmU6CiAgICAgIHN5bmM6ICd0ZW1wZXJhdHVyZScKICAgICAgYWxpYXM6ICfmuKnluqYnCiAgZ2VvbWV0cmllczoKICAgIC0gdHlwZTogJ2xpbmUnCiAgICAgIHhGaWVsZDogJ3RpbWUnCiAgICAgIHlGaWVsZDogJ3RlbXBlcmF0dXJlJwogICAgICBtYXBwaW5nOiB7fQogICAgLSB0eXBlOiAncG9pbnQnCiAgICAgIHhGaWVsZDogJ3RpbWUnCiAgICAgIHlGaWVsZDogJ3RlbXBlcmF0dXJlJwogICAgICBtYXBwaW5nOgogICAgICAgIHNoYXBlOiAnY2lyY2xlJwogICAgICAgIHN0eWxlOgogICAgICAgICAgZmlsbE9wYWNpdHk6IDEKYGBg";
ChartTemplateType2["OrganizationTreeGraph"] = "YGBgY2hhcnRzdmlldwojLS0tLS0tLS0tLS0tLS0tLS0jCiMtIGNoYXJ0IHR5cGUgICAgLSMKIy0tLS0tLS0tLS0tLS0tLS0tIwp0eXBlOiBPcmdhbml6YXRpb25UcmVlR3JhcGgKCiMtLS0tLS0tLS0tLS0tLS0tLSMKIy0gY2hhcnQgZGF0YSAgICAtIwojLS0tLS0tLS0tLS0tLS0tLS0jCmRhdGE6CiAgaWQ6ICJyb290IgogIGxhYmVsOiAiUm9vdCIKICBjaGlsZHJlbjoKICAgIC0gaWQ6ICJjMSIKICAgICAgbGFiZWw6ICJDMSIKICAgICAgY2hpbGRyZW46CiAgICAgICAgLSBpZDogImMxLTEiCiAgICAgICAgICBsYWJlbDogIkMxLTEiCiAgICAgICAgICBjaGlsZHJlbjoKICAgICAgICAgICAgLSBpZDogImMxLTEtMSIKICAgICAgICAgICAgICBsYWJlbDogIkMxLTEtMSIKICAgICAgICAgICAgLSBpZDogImMxLTEtMiIKICAgICAgICAgICAgICBsYWJlbDogIkMxLTEtMiIKICAgICAgICAtIGlkOiAiYzEtMiIKICAgICAgICAgIGxhYmVsOiAiQzEtMiIKICAgICAgICAgIGNoaWxkcmVuOgogICAgICAgICAgICAtIGlkOiAiYzEtMi0xIgogICAgICAgICAgICAgIGxhYmVsOiAiQzEtMi0xIgogICAgICAgICAgICAtIGlkOiAiYzEtMi0yIgogICAgICAgICAgICAgIGxhYmVsOiAiQzEtMi0yIgogICAgLSBpZDogImMyIgogICAgICBsYWJlbDogIkMyIgogICAgICBjaGlsZHJlbjoKICAgICAgICAtIGlkOiAiYzItMSIKICAgICAgICAgIGxhYmVsOiAiQzItMSIKICAgICAgICAgIGNoaWxkcmVuOgogICAgICAgICAgICAtIGlkOiAiYzItMS0xIgogICAgICAgICAgICAgIGxhYmVsOiAiQzItMS0xIgoKIy0tLS0tLS0tLS0tLS0tLS0tIwojLSBjaGFydCBvcHRpb25zIC0jCiMtLS0tLS0tLS0tLS0tLS0tLSMKb3B0aW9uczoge30KYGBg";
ChartTemplateType2["Radar"] = "YGBgY2hhcnRzdmlldwojLS0tLS0tLS0tLS0tLS0tLS0jCiMtIGNoYXJ0IHR5cGUgICAgLSMKIy0tLS0tLS0tLS0tLS0tLS0tIwp0eXBlOiBSYWRhcgoKIy0tLS0tLS0tLS0tLS0tLS0tIwojLSBjaGFydCBkYXRhICAgIC0jCiMtLS0tLS0tLS0tLS0tLS0tLSMKZGF0YToKICAtIGl0ZW06ICJEZXNpZ24iCiAgICB1c2VyOiAiYSIKICAgIHNjb3JlOiA3MAogIC0gaXRlbTogIkRlc2lnbiIKICAgIHVzZXI6ICJiIgogICAgc2NvcmU6IDMwCiAgLSBpdGVtOiAiTWFya2V0aW5nIgogICAgdXNlcjogImEiCiAgICBzY29yZTogNTAKICAtIGl0ZW06ICJNYXJrZXRpbmciCiAgICB1c2VyOiAiYiIKICAgIHNjb3JlOiA2MAogIC0gaXRlbTogIlRlY2hub2xvZ3kiCiAgICB1c2VyOiAiYSIKICAgIHNjb3JlOiA1MAogIC0gaXRlbTogIlRlY2hub2xvZ3kiCiAgICB1c2VyOiAiYiIKICAgIHNjb3JlOiA0MAogIC0gaXRlbTogIlN1cHBvcnQiCiAgICB1c2VyOiAiYSIKICAgIHNjb3JlOiAzMAogIC0gaXRlbTogIlN1cHBvcnQiCiAgICB1c2VyOiAiYiIKICAgIHNjb3JlOiA0MAogIC0gaXRlbTogIlNhbGVzIgogICAgdXNlcjogImEiCiAgICBzY29yZTogNjAKICAtIGl0ZW06ICJTYWxlcyIKICAgIHVzZXI6ICJiIgogICAgc2NvcmU6IDQwCgojLS0tLS0tLS0tLS0tLS0tLS0jCiMtIGNoYXJ0IG9wdGlvbnMgLSMKIy0tLS0tLS0tLS0tLS0tLS0tIwpvcHRpb25zOgogIHhGaWVsZDogIml0ZW0iCiAgeUZpZWxkOiAic2NvcmUiCiAgc2VyaWVzRmllbGQ6ICJ1c2VyIgogIG1ldGE6CiAgICBzY29yZToKICAgICAgYWxpYXM6ICJTY29yZSIKICAgICAgbWluOiAwCiAgICAgIG5pY2U6IHRydWUKICB4QXhpczoKICAgIGxpbmU6IG51bGwKICAgIHRpY2tMaW5lOiBudWxsCiAgeUF4aXM6CiAgICBsYWJlbDogZmFsc2UKICAgIGdyaWQ6CiAgICAgIGFsdGVybmF0ZUNvbG9yOiAicmdiYSgwLCAwLCAwLCAwLjA0KSIKICBwb2ludDoge30KICBhcmVhOiB7fQpgYGA=";
ChartTemplateType2["TinyLine"] = "YGBgY2hhcnRzdmlldwojLS0tLS0tLS0tLS0tLS0tLS0jCiMtIGNoYXJ0IHR5cGUgICAgLSMKIy0tLS0tLS0tLS0tLS0tLS0tIwp0eXBlOiBUaW55TGluZQoKIy0tLS0tLS0tLS0tLS0tLS0tIwojLSBjaGFydCBkYXRhICAgIC0jCiMtLS0tLS0tLS0tLS0tLS0tLSMKZGF0YTogWzI2NCwgNDE3LCA0MzgsIDg4NywgMzA5LCAzOTcsIDU1MCwgNTc1LCA1NjMsIDQzMCwgNTI1LCA1OTIsIDQ5MiwgNDY3LCA1MTMsIDU0NiwgOTgzLCAzNDAsIDUzOSwgMjQzLCAyMjYsIDE5Ml0KCiMtLS0tLS0tLS0tLS0tLS0tLSMKIy0gY2hhcnQgb3B0aW9ucyAtIwojLS0tLS0tLS0tLS0tLS0tLS0jCm9wdGlvbnM6CiAgaGVpZ2h0OiA2MAogIGF1dG9GaXQ6IGZhbHNlCiAgc21vb3RoOiB0cnVlCiAgdG9vbHRpcDogZmFsc2UKICBhbm5vdGF0aW9uczoKICAgIC0gdHlwZTogImxpbmUiCiAgICAgIHN0YXJ0OiBbIm1pbiIsICJtZWFuIl0KICAgICAgZW5kOiBbIm1heCIsICJtZWFuIl0KICAgICAgc3R5bGU6CiAgICAgICAgc3Ryb2tlOiAicmdiYSgwLCAwLCAwLCAwLjQ1KSIKICAgICAgdGV4dDoKICAgICAgICBjb250ZW50OiAiQXZlcmFnZSIKICAgICAgICBvZmZzZXRZOiAtMgogICAgICAgIHN0eWxlOgogICAgICAgICAgdGV4dEFsaWduOiAibGVmdCIKICAgICAgICAgIGZvbnRTaXplOiAxMAogICAgICAgICAgZmlsbDogInJnYmEoNDQsIDUzLCA2NiwgMC40NSkiCiAgICAgICAgICB0ZXh0QmFzZWxpbmU6ICJib3R0b20iCiAgICAtIHR5cGU6ICJsaW5lIgogICAgICBzdGFydDogWyJtaW4iLCA4MDBdCiAgICAgIGVuZDogWyJtYXgiLCA4MDBdCiAgICAgIHN0eWxlOgogICAgICAgIHN0cm9rZTogInJnYmEoMjAwLCAwLCAwLCAwLjU1KSIKICAgICAgdGV4dDoKICAgICAgICBjb250ZW50OiAiVGFyZ2V0IgogICAgICAgIG9mZnNldFk6IC0yCiAgICAgICAgc3R5bGU6CiAgICAgICAgICB0ZXh0QWxpZ246ICJsZWZ0IgogICAgICAgICAgZm9udFNpemU6IDEwCiAgICAgICAgICBmaWxsOiAicmdiYSg0NCwgNTMsIDY2LCAwLjQ1KSIKICAgICAgICAgIHRleHRCYXNlbGluZTogImJvdHRvbSIKYGBg";
ChartTemplateType2["Dataviewjs Example (Column)"] = "YGBgY2hhcnRzdmlldwojLS0tLS0tLS0tLS0tLS0tLS0jCiMtIGNoYXJ0IHR5cGUgICAgLSMKIy0tLS0tLS0tLS0tLS0tLS0tIwp0eXBlOiBDb2x1bW4KCiMtLS0tLS0tLS0tLS0tLS0tLSMKIy0gY2hhcnQgZGF0YSAgICAtIwojLS0tLS0tLS0tLS0tLS0tLS0jCmRhdGE6IHwKICBkYXRhdmlld2pzOgogIHJldHVybiBkdi5wYWdlcygpCiAgICAgICAgICAgLmdyb3VwQnkocCA9PiBwLmZpbGUuZm9sZGVyKQogICAgICAgICAgIC5tYXAocCA9PiAoe2ZvbGRlcjogcC5rZXkgfHwgIlJPT1QiLCBjb3VudDogcC5yb3dzLmxlbmd0aH0pKQogICAgICAgICAgIC5hcnJheSgpOwoKIy0tLS0tLS0tLS0tLS0tLS0tIwojLSBjaGFydCBvcHRpb25zIC0jCiMtLS0tLS0tLS0tLS0tLS0tLSMKb3B0aW9uczoKICB4RmllbGQ6ICJmb2xkZXIiCiAgeUZpZWxkOiAiY291bnQiCiAgcGFkZGluZzogYXV0bwogIGxhYmVsOgogICAgcG9zaXRpb246ICJtaWRkbGUiCiAgICBzdHlsZToKICAgICAgb3BhY2l0eTogMC42CiAgICAgIGZvbnRTaXplOiAxMgogIGNvbHVtblN0eWxlOgogICAgZmlsbE9wYWNpdHk6IDAuNQogICAgbGluZVdpZHRoOiAxCiAgICBzdHJva2VPcGFjaXR5OiAwLjcKICAgIHNoYWRvd0NvbG9yOiAiZ3JleSIKICAgIHNoYWRvd0JsdXI6IDEwCiAgICBzaGFkb3dPZmZzZXRYOiA1CiAgICBzaGFkb3dPZmZzZXRZOiA1CiAgeEF4aXM6CiAgICBsYWJlbDoKICAgICAgYXV0b0hpZGU6IGZhbHNlCiAgICAgIGF1dG9Sb3RhdGU6IHRydWUKICBtZXRhOgogICAgY291bnQ6CiAgICAgIGFsaWFzOiAiQ291bnQiCmBgYA==";
})(ChartTemplateType || (ChartTemplateType = {}));
var ChartThumbnailMapping = {
[ChartTemplateType.Bar]: "https://user-images.githubusercontent.com/150803/123117024-fa43b180-d473-11eb-84eb-8e1806ce5dec.png",
[ChartTemplateType.Pie]: "https://user-images.githubusercontent.com/150803/119069882-87c95700-ba19-11eb-8cef-02d1e021d1a2.png",
[ChartTemplateType.WordCloud]: "https://user-images.githubusercontent.com/150803/119069991-bba47c80-ba19-11eb-873f-847563daea39.png",
[ChartTemplateType.WordCount]: "https://user-images.githubusercontent.com/150803/136478725-be28a56b-0075-4f0a-a719-f61b30e83b6a.png",
[ChartTemplateType.Treemap]: "https://user-images.githubusercontent.com/150803/119070047-decf2c00-ba19-11eb-9d59-21c051da593c.png",
[ChartTemplateType.DualAxes]: "https://user-images.githubusercontent.com/150803/119969638-618b5480-bfe1-11eb-8a36-0a5d60408b00.png",
[ChartTemplateType.Mix]: "https://user-images.githubusercontent.com/150803/120421841-a1638a80-c399-11eb-9464-d773931fdd6f.png",
[ChartTemplateType.OrganizationTreeGraph]: "https://user-images.githubusercontent.com/150803/123117254-2b23e680-d474-11eb-845f-0d663a458fa7.png",
[ChartTemplateType.Radar]: "https://user-images.githubusercontent.com/150803/123117394-4a227880-d474-11eb-8a11-23f3cd482251.png",
[ChartTemplateType.TinyLine]: "https://user-images.githubusercontent.com/150803/123117476-5a3a5800-d474-11eb-9db8-4b3785bb010c.png",
[ChartTemplateType["Dataviewjs Example (Column)"]]: "https://user-images.githubusercontent.com/150803/140684190-fa6a08ea-3394-44fe-ae92-265810f6b9a9.png"
};
// src/components/Modal.ts
var import_buffer = __toModule(require("buffer"));
var ChartTemplateSuggestModal = class extends import_obsidian4.FuzzySuggestModal {
constructor(app, editor) {
super(app);
this.editor = editor;
}
getItems() {
return Object.entries(ChartTemplateType);
}
getItemText(item) {
return item[0];
}
renderSuggestion(item, el) {
const div4 = createDiv({ cls: "chartsview-thumbnail" });
const type2 = ChartTemplateType[item.item[0]];
const img = createEl("img", {
attr: {
src: ChartThumbnailMapping[type2]
}
});
div4.appendChild(img);
el.appendChild(div4);
el.addClass("chartsview-thumbnail-container");
super.renderSuggestion(item, el);
}
onChooseItem(item) {
insertEditor(this.editor, import_buffer.Buffer.from(item[1], "base64").toString("utf8"));
}
};
// src/main.tsx
var CSV_FILE_EXTENSION = "csv";
var VIEW_TYPE_CSV = "csv";
var ChartsViewPlugin = class extends import_obsidian5.Plugin {
ChartsViewProcessor(source, el, ctx4) {
return __async(this, null, function* () {
compat_module_default.unmountComponentAtNode(el);
try {
const chartProps = yield parseConfig(source, this, ctx4.sourcePath);
const cfg = chartProps.config;
const isBackgroundColorCustomed = cfg.theme && (cfg.theme.background || cfg.theme.styleSheet && cfg.theme.styleSheet.backgroundColor);
const isPaddingCustomed = cfg.padding;
cfg.theme = cfg.theme || esm_exports3.getTheme(this.settings.theme);
cfg.backgroundColor = isBackgroundColorCustomed ? void 0 : this.settings.backgroundColor;
cfg.padding = isPaddingCustomed ? void 0 : [
this.settings.paddingTop,
this.settings.paddingRight,
this.settings.paddingBottom,
this.settings.paddingLeft
];
compat_module_default.render(/* @__PURE__ */ compat_module_default.createElement(Chart2, __spreadValues({}, chartProps)), el);
} catch (e4) {
compat_module_default.render(/* @__PURE__ */ compat_module_default.createElement("div", {
style: { color: "var(--text-title-h1)" }
}, e4.toString()), el);
}
});
}
onload() {
return __async(this, null, function* () {
try {
yield this.loadSettings();
this.addSettingTab(new ChartsViewSettingTab(this.app, this));
this.registerMarkdownCodeBlockProcessor("chartsview", this.ChartsViewProcessor.bind(this));
this.addCommand({
id: "insert-chartsview-template",
name: "Insert Template",
editorCallback: (editor) => {
new ChartTemplateSuggestModal(this.app, editor).open();
}
});
if (import_obsidian5.Platform.isDesktopApp) {
this.addCommand({
id: `import-chartsview-data-csv`,
name: `Import data from external CSV file`,
editorCallback: (editor) => __async(this, null, function* () {
const file = yield r({ accept: ".csv", strict: true });
const content = yield file.text();
const records = parseCsv(content);
insertEditor(editor, js_yaml_default.dump(records, { quotingType: '"', noRefs: true }).replace(/\n/g, "\n" + " ".repeat(editor.getCursor().ch)));
})
});
}
} catch (error) {
console.log(`Load error. ${error}`);
}
try {
this.registerExtensions([CSV_FILE_EXTENSION], VIEW_TYPE_CSV);
} catch (error) {
console.log(`Existing file extension ${CSV_FILE_EXTENSION}`);
}
console.log("Loaded Charts View plugin");
});
}
onunload() {
console.log("Unloading Charts View plugin");
}
loadSettings() {
return __async(this, null, function* () {
this.settings = Object.assign(DEFAULT_SETTINGS, yield this.loadData());
});
}
saveSettings() {
return __async(this, null, function* () {
yield this.saveData(this.settings);
});
}
};
/* @license
Papa Parse
v5.3.1
https://github.com/mholt/PapaParse
License: MIT
*/
/*! *****************************************************************************
Copyright (C) Microsoft. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
/**
* @license
* Lodash
* Copyright OpenJS Foundation and other contributors
* Released under MIT license
* Based on Underscore.js 1.8.3
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/