diff --git a/node_modules/.bin/esbuild b/node_modules/.bin/esbuild deleted file mode 120000 index c83ac07..0000000 --- a/node_modules/.bin/esbuild +++ /dev/null @@ -1 +0,0 @@ -../esbuild/bin/esbuild \ No newline at end of file diff --git a/node_modules/.bin/nanoid b/node_modules/.bin/nanoid deleted file mode 120000 index e2be547..0000000 --- a/node_modules/.bin/nanoid +++ /dev/null @@ -1 +0,0 @@ -../nanoid/bin/nanoid.cjs \ No newline at end of file diff --git a/node_modules/.bin/rollup b/node_modules/.bin/rollup deleted file mode 120000 index 5939621..0000000 --- a/node_modules/.bin/rollup +++ /dev/null @@ -1 +0,0 @@ -../rollup/dist/bin/rollup \ No newline at end of file diff --git a/node_modules/.bin/vite b/node_modules/.bin/vite deleted file mode 120000 index 6d1e3be..0000000 --- a/node_modules/.bin/vite +++ /dev/null @@ -1 +0,0 @@ -../vite/bin/vite.js \ No newline at end of file diff --git a/node_modules/.vite/_metadata.json b/node_modules/.vite/_metadata.json deleted file mode 100644 index 604cffc..0000000 --- a/node_modules/.vite/_metadata.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "hash": "ee5cc2cf", - "browserHash": "7292be66", - "optimized": { - "neataptic": { - "file": "/home/satori/sakuya/node_modules/.vite/neataptic.js", - "src": "/home/satori/sakuya/node_modules/neataptic/src/neataptic.js", - "needsInterop": true - }, - "frappe-charts": { - "file": "/home/satori/sakuya/node_modules/.vite/frappe-charts.js", - "src": "/home/satori/sakuya/node_modules/frappe-charts/dist/frappe-charts.min.esm.js", - "needsInterop": false - }, - "p5": { - "file": "/home/satori/sakuya/node_modules/.vite/p5.js", - "src": "/home/satori/sakuya/node_modules/p5/lib/p5.min.js", - "needsInterop": true - } - } -} \ No newline at end of file diff --git a/node_modules/.vite/chunk-ELXAK55F.js b/node_modules/.vite/chunk-ELXAK55F.js deleted file mode 100644 index bfe9a46..0000000 --- a/node_modules/.vite/chunk-ELXAK55F.js +++ /dev/null @@ -1,28 +0,0 @@ -var __defProp = Object.defineProperty; -var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); -var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { - get: (a, b) => (typeof require !== "undefined" ? require : a)[b] -}) : x)(function(x) { - if (typeof require !== "undefined") - return require.apply(this, arguments); - throw new Error('Dynamic require of "' + x + '" is not supported'); -}); -var __esm = (fn, res) => function __init() { - return fn && (res = (0, fn[Object.keys(fn)[0]])(fn = 0)), res; -}; -var __commonJS = (cb, mod) => function __require2() { - return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; -}; -var __export = (target, all) => { - __markAsModule(target); - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; - -export { - __require, - __esm, - __commonJS, - __export -}; -//# sourceMappingURL=chunk-ELXAK55F.js.map diff --git a/node_modules/.vite/chunk-ELXAK55F.js.map b/node_modules/.vite/chunk-ELXAK55F.js.map deleted file mode 100644 index 9865211..0000000 --- a/node_modules/.vite/chunk-ELXAK55F.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": [], - "sourcesContent": [], - "mappings": "", - "names": [] -} diff --git a/node_modules/.vite/frappe-charts.js b/node_modules/.vite/frappe-charts.js deleted file mode 100644 index 5f18274..0000000 --- a/node_modules/.vite/frappe-charts.js +++ /dev/null @@ -1,1988 +0,0 @@ -import "./chunk-ELXAK55F.js"; - -// node_modules/frappe-charts/dist/frappe-charts.min.esm.js -function styleInject(t7, e) { - e === void 0 && (e = {}); - var n = e.insertAt; - if (t7 && typeof document != "undefined") { - var i = document.head || document.getElementsByTagName("head")[0], a = document.createElement("style"); - a.type = "text/css", n === "top" && i.firstChild ? i.insertBefore(a, i.firstChild) : i.appendChild(a), a.styleSheet ? a.styleSheet.cssText = t7 : a.appendChild(document.createTextNode(t7)); - } -} -function $(t7, e) { - return typeof t7 == "string" ? (e || document).querySelector(t7) : t7 || null; -} -function getOffset(t7) { - var e = t7.getBoundingClientRect(); - return { top: e.top + (document.documentElement.scrollTop || document.body.scrollTop), left: e.left + (document.documentElement.scrollLeft || document.body.scrollLeft) }; -} -function isHidden(t7) { - return t7.offsetParent === null; -} -function isElementInViewport(t7) { - var e = t7.getBoundingClientRect(); - return e.top >= 0 && e.left >= 0 && e.bottom <= (window.innerHeight || document.documentElement.clientHeight) && e.right <= (window.innerWidth || document.documentElement.clientWidth); -} -function getElementContentWidth(t7) { - var e = window.getComputedStyle(t7), n = parseFloat(e.paddingLeft) + parseFloat(e.paddingRight); - return t7.clientWidth - n; -} -function fire(t7, e, n) { - var i = document.createEvent("HTMLEvents"); - i.initEvent(e, true, true); - for (var a in n) - i[a] = n[a]; - return t7.dispatchEvent(i); -} -function getTopOffset(t7) { - return t7.titleHeight + t7.margins.top + t7.paddings.top; -} -function getLeftOffset(t7) { - return t7.margins.left + t7.paddings.left; -} -function getExtraHeight(t7) { - return t7.margins.top + t7.margins.bottom + t7.paddings.top + t7.paddings.bottom + t7.titleHeight + t7.legendHeight; -} -function getExtraWidth(t7) { - return t7.margins.left + t7.margins.right + t7.paddings.left + t7.paddings.right; -} -function _classCallCheck$4(t7, e) { - if (!(t7 instanceof e)) - throw new TypeError("Cannot call a class as a function"); -} -function floatTwo(t7) { - return parseFloat(t7.toFixed(2)); -} -function fillArray(t7, e, n) { - var i = arguments.length > 3 && arguments[3] !== void 0 && arguments[3]; - n || (n = i ? t7[0] : t7[t7.length - 1]); - var a = new Array(Math.abs(e)).fill(n); - return t7 = i ? a.concat(t7) : t7.concat(a); -} -function getStringWidth(t7, e) { - return (t7 + "").length * e; -} -function getPositionByAngle(t7, e) { - return { x: Math.sin(t7 * ANGLE_RATIO) * e, y: Math.cos(t7 * ANGLE_RATIO) * e }; -} -function isValidNumber(t7) { - var e = arguments.length > 1 && arguments[1] !== void 0 && arguments[1]; - return !Number.isNaN(t7) && (t7 !== void 0 && (!!Number.isFinite(t7) && !(e && t7 < 0))); -} -function round(t7) { - return Number(Math.round(t7 + "e4") + "e-4"); -} -function deepClone(t7) { - var e = void 0, n = void 0, i = void 0; - if (t7 instanceof Date) - return new Date(t7.getTime()); - if ((t7 === void 0 ? "undefined" : _typeof$2(t7)) !== "object" || t7 === null) - return t7; - e = Array.isArray(t7) ? [] : {}; - for (i in t7) - n = t7[i], e[i] = deepClone(n); - return e; -} -function getBarHeightAndYAttr(t7, e) { - var n = void 0, i = void 0; - return t7 <= e ? (n = e - t7, i = t7) : (n = t7 - e, i = e), [n, i]; -} -function equilizeNoOfElements(t7, e) { - var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : e.length - t7.length; - return n > 0 ? t7 = fillArray(t7, n) : e = fillArray(e, n), [t7, e]; -} -function truncateString(t7, e) { - if (t7) - return t7.length > e ? t7.slice(0, e - 3) + "..." : t7; -} -function shortenLargeNumber(t7) { - var e = void 0; - if (typeof t7 == "number") - e = t7; - else if (typeof t7 == "string" && (e = Number(t7), Number.isNaN(e))) - return t7; - var n = Math.floor(Math.log10(Math.abs(e))); - if (n <= 2) - return e; - var i = Math.floor(n / 3), a = Math.pow(10, n - 3 * i) * +(e / Math.pow(10, n)).toFixed(1); - return Math.round(100 * a) / 100 + " " + ["", "K", "M", "B", "T"][i]; -} -function getSplineCurvePointsStr(t7, e) { - for (var n = [], i = 0; i < t7.length; i++) - n.push([t7[i], e[i]]); - var a = function(t8, e2) { - var n2 = e2[0] - t8[0], i2 = e2[1] - t8[1]; - return { length: Math.sqrt(Math.pow(n2, 2) + Math.pow(i2, 2)), angle: Math.atan2(i2, n2) }; - }, r = function(t8, e2, n2, i2) { - var r2 = a(e2 || t8, n2 || t8), o = r2.angle + (i2 ? Math.PI : 0), s = 0.2 * r2.length; - return [t8[0] + Math.cos(o) * s, t8[1] + Math.sin(o) * s]; - }; - return function(t8, e2) { - return t8.reduce(function(t9, n2, i2, a2) { - return i2 === 0 ? n2[0] + "," + n2[1] : t9 + " " + e2(n2, i2, a2); - }, ""); - }(n, function(t8, e2, n2) { - var i2 = r(n2[e2 - 1], n2[e2 - 2], t8), a2 = r(t8, n2[e2 - 1], n2[e2 + 1], true); - return "C " + i2[0] + "," + i2[1] + " " + a2[0] + "," + a2[1] + " " + t8[0] + "," + t8[1]; - }); -} -function limitColor(t7) { - return t7 > 255 ? 255 : t7 < 0 ? 0 : t7; -} -function lightenDarkenColor(t7, e) { - var n = getColor(t7), i = false; - n[0] == "#" && (n = n.slice(1), i = true); - var a = parseInt(n, 16), r = limitColor((a >> 16) + e), o = limitColor((a >> 8 & 255) + e), s = limitColor((255 & a) + e); - return (i ? "#" : "") + (s | o << 8 | r << 16).toString(16); -} -function isValidColor(t7) { - var e = /(^\s*)(rgb|hsl)(a?)[(]\s*([\d.]+\s*%?)\s*,\s*([\d.]+\s*%?)\s*,\s*([\d.]+\s*%?)\s*(?:,\s*([\d.]+)\s*)?[)]$/i; - return /(^\s*)(#)((?:[A-Fa-f0-9]{3}){1,2})$/i.test(t7) || e.test(t7); -} -function $$1(t7, e) { - return typeof t7 == "string" ? (e || document).querySelector(t7) : t7 || null; -} -function createSVG(t7, e) { - var n = document.createElementNS("http://www.w3.org/2000/svg", t7); - for (var i in e) { - var a = e[i]; - if (i === "inside") - $$1(a).appendChild(n); - else if (i === "around") { - var r = $$1(a); - r.parentNode.insertBefore(n, r), n.appendChild(r); - } else - i === "styles" ? (a === void 0 ? "undefined" : _typeof$1(a)) === "object" && Object.keys(a).map(function(t8) { - n.style[t8] = a[t8]; - }) : (i === "className" && (i = "class"), i === "innerHTML" ? n.textContent = a : n.setAttribute(i, a)); - } - return n; -} -function renderVerticalGradient(t7, e) { - return createSVG("linearGradient", { inside: t7, id: e, x1: 0, x2: 0, y1: 0, y2: 1 }); -} -function setGradientStop(t7, e, n, i) { - return createSVG("stop", { inside: t7, style: "stop-color: " + n, offset: e, "stop-opacity": i }); -} -function makeSVGContainer(t7, e, n, i) { - return createSVG("svg", { className: e, inside: t7, width: n, height: i }); -} -function makeSVGDefs(t7) { - return createSVG("defs", { inside: t7 }); -} -function makeSVGGroup(t7) { - var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : void 0, i = { className: t7, transform: e }; - return n && (i.inside = n), createSVG("g", i); -} -function makePath(t7) { - return createSVG("path", { className: arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", d: t7, styles: { stroke: arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "none", fill: arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "none", "stroke-width": arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 2 } }); -} -function makeArcPathStr(t7, e, n, i) { - var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 1, r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0, o = n.x + t7.x, s = n.y + t7.y, l = n.x + e.x, u = n.y + e.y; - return "M" + n.x + " " + n.y + "\n L" + o + " " + s + "\n A " + i + " " + i + " 0 " + r + " " + (a ? 1 : 0) + "\n " + l + " " + u + " z"; -} -function makeCircleStr(t7, e, n, i) { - var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 1, r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0, o = n.x + t7.x, s = n.y + t7.y, l = n.x + e.x, u = 2 * n.y, c = n.y + e.y; - return "M" + n.x + " " + n.y + "\n L" + o + " " + s + "\n A " + i + " " + i + " 0 " + r + " " + (a ? 1 : 0) + "\n " + l + " " + u + " z\n L" + o + " " + u + "\n A " + i + " " + i + " 0 " + r + " " + (a ? 1 : 0) + "\n " + l + " " + c + " z"; -} -function makeArcStrokePathStr(t7, e, n, i) { - var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 1, r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0, o = n.x + t7.x, s = n.y + t7.y, l = n.x + e.x, u = n.y + e.y; - return "M" + o + " " + s + "\n A " + i + " " + i + " 0 " + r + " " + (a ? 1 : 0) + "\n " + l + " " + u; -} -function makeStrokeCircleStr(t7, e, n, i) { - var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 1, r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0, o = n.x + t7.x, s = n.y + t7.y, l = n.x + e.x, u = 2 * i + s, c = n.y + t7.y; - return "M" + o + " " + s + "\n A " + i + " " + i + " 0 " + r + " " + (a ? 1 : 0) + "\n " + l + " " + u + "\n M" + o + " " + u + "\n A " + i + " " + i + " 0 " + r + " " + (a ? 1 : 0) + "\n " + l + " " + c; -} -function makeGradient(t7, e) { - var n = arguments.length > 2 && arguments[2] !== void 0 && arguments[2], i = "path-fill-gradient-" + e + "-" + (n ? "lighter" : "default"), a = renderVerticalGradient(t7, i), r = [1, 0.6, 0.2]; - return n && (r = [0.4, 0.2, 0]), setGradientStop(a, "0%", e, r[0]), setGradientStop(a, "50%", e, r[1]), setGradientStop(a, "100%", e, r[2]), i; -} -function percentageBar(t7, e, n, i) { - var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : PERCENTAGE_BAR_DEFAULT_DEPTH, r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : "none"; - return createSVG("rect", { className: "percentage-bar", x: t7, y: e, width: n, height: i, fill: r, styles: { stroke: lightenDarkenColor(r, -25), "stroke-dasharray": "0, " + (i + n) + ", " + n + ", " + i, "stroke-width": a } }); -} -function heatSquare(t7, e, n, i, a) { - var r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : "none", o = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : {}, s = { className: t7, x: e, y: n, width: i, height: i, rx: a, fill: r }; - return Object.keys(o).map(function(t8) { - s[t8] = o[t8]; - }), createSVG("rect", s); -} -function legendBar(t7, e, n) { - var i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "none", a = arguments[4]; - a = arguments.length > 5 && arguments[5] !== void 0 && arguments[5] ? truncateString(a, LABEL_MAX_CHARS) : a; - var r = { className: "legend-bar", x: 0, y: 0, width: n, height: "2px", fill: i }, o = createSVG("text", { className: "legend-dataset-text", x: 0, y: 0, dy: 2 * FONT_SIZE + "px", "font-size": 1.2 * FONT_SIZE + "px", "text-anchor": "start", fill: FONT_FILL, innerHTML: a }), s = createSVG("g", { transform: "translate(" + t7 + ", " + e + ")" }); - return s.appendChild(createSVG("rect", r)), s.appendChild(o), s; -} -function legendDot(t7, e, n) { - var i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "none", a = arguments[4]; - a = arguments.length > 5 && arguments[5] !== void 0 && arguments[5] ? truncateString(a, LABEL_MAX_CHARS) : a; - var r = { className: "legend-dot", cx: 0, cy: 0, r: n, fill: i }, o = createSVG("text", { className: "legend-dataset-text", x: 0, y: 0, dx: FONT_SIZE + "px", dy: FONT_SIZE / 3 + "px", "font-size": 1.2 * FONT_SIZE + "px", "text-anchor": "start", fill: FONT_FILL, innerHTML: a }), s = createSVG("g", { transform: "translate(" + t7 + ", " + e + ")" }); - return s.appendChild(createSVG("circle", r)), s.appendChild(o), s; -} -function makeText(t7, e, n, i) { - var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {}, r = a.fontSize || FONT_SIZE; - return createSVG("text", { className: t7, x: e, y: n, dy: (a.dy !== void 0 ? a.dy : r / 2) + "px", "font-size": r + "px", fill: a.fill || FONT_FILL, "text-anchor": a.textAnchor || "start", innerHTML: i }); -} -function makeVertLine(t7, e, n, i) { - var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {}; - a.stroke || (a.stroke = BASE_LINE_COLOR); - var r = createSVG("line", { className: "line-vertical " + a.className, x1: 0, x2: 0, y1: n, y2: i, styles: { stroke: a.stroke } }), o = createSVG("text", { x: 0, y: n > i ? n + LABEL_MARGIN : n - LABEL_MARGIN - FONT_SIZE, dy: FONT_SIZE + "px", "font-size": FONT_SIZE + "px", "text-anchor": "middle", innerHTML: e + "" }), s = createSVG("g", { transform: "translate(" + t7 + ", 0)" }); - return s.appendChild(r), s.appendChild(o), s; -} -function makeHoriLine(t7, e, n, i) { - var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {}; - a.stroke || (a.stroke = BASE_LINE_COLOR), a.lineType || (a.lineType = ""), a.shortenNumbers && (e = shortenLargeNumber(e)); - var r = createSVG("line", { className: "line-horizontal " + a.className + (a.lineType === "dashed" ? "dashed" : ""), x1: n, x2: i, y1: 0, y2: 0, styles: { stroke: a.stroke } }), o = createSVG("text", { x: n < i ? n - LABEL_MARGIN : n + LABEL_MARGIN, y: 0, dy: FONT_SIZE / 2 - 2 + "px", "font-size": FONT_SIZE + "px", "text-anchor": n < i ? "end" : "start", innerHTML: e + "" }), s = createSVG("g", { transform: "translate(0, " + t7 + ")", "stroke-opacity": 1 }); - return o !== 0 && o !== "0" || (s.style.stroke = "rgba(27, 31, 35, 0.6)"), s.appendChild(r), s.appendChild(o), s; -} -function yLine(t7, e, n) { - var i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; - isValidNumber(t7) || (t7 = 0), i.pos || (i.pos = "left"), i.offset || (i.offset = 0), i.mode || (i.mode = "span"), i.stroke || (i.stroke = BASE_LINE_COLOR), i.className || (i.className = ""); - var a = -1 * AXIS_TICK_LENGTH, r = i.mode === "span" ? n + AXIS_TICK_LENGTH : 0; - return i.mode === "tick" && i.pos === "right" && (a = n + AXIS_TICK_LENGTH, r = n), a += i.offset, r += i.offset, makeHoriLine(t7, e, a, r, { stroke: i.stroke, className: i.className, lineType: i.lineType, shortenNumbers: i.shortenNumbers }); -} -function xLine(t7, e, n) { - var i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; - isValidNumber(t7) || (t7 = 0), i.pos || (i.pos = "bottom"), i.offset || (i.offset = 0), i.mode || (i.mode = "span"), i.stroke || (i.stroke = BASE_LINE_COLOR), i.className || (i.className = ""); - var a = n + AXIS_TICK_LENGTH, r = i.mode === "span" ? -1 * AXIS_TICK_LENGTH : n; - return i.mode === "tick" && i.pos === "top" && (a = -1 * AXIS_TICK_LENGTH, r = 0), makeVertLine(t7, e, a, r, { stroke: i.stroke, className: i.className, lineType: i.lineType }); -} -function yMarker(t7, e, n) { - var i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; - i.labelPos || (i.labelPos = "right"); - var a = createSVG("text", { className: "chart-label", x: i.labelPos === "left" ? LABEL_MARGIN : n - getStringWidth(e, 5) - LABEL_MARGIN, y: 0, dy: FONT_SIZE / -2 + "px", "font-size": FONT_SIZE + "px", "text-anchor": "start", innerHTML: e + "" }), r = makeHoriLine(t7, "", 0, n, { stroke: i.stroke || BASE_LINE_COLOR, className: i.className || "", lineType: i.lineType }); - return r.appendChild(a), r; -} -function yRegion(t7, e, n, i) { - var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {}, r = t7 - e, o = createSVG("rect", { className: "bar mini", styles: { fill: "rgba(228, 234, 239, 0.49)", stroke: BASE_LINE_COLOR, "stroke-dasharray": n + ", " + r }, x: 0, y: 0, width: n, height: r }); - a.labelPos || (a.labelPos = "right"); - var s = createSVG("text", { className: "chart-label", x: a.labelPos === "left" ? LABEL_MARGIN : n - getStringWidth(i + "", 4.5) - LABEL_MARGIN, y: 0, dy: FONT_SIZE / -2 + "px", "font-size": FONT_SIZE + "px", "text-anchor": "start", innerHTML: i + "" }), l = createSVG("g", { transform: "translate(0, " + e + ")" }); - return l.appendChild(o), l.appendChild(s), l; -} -function datasetBar(t7, e, n, i) { - var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : "", r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0, o = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : 0, s = arguments.length > 7 && arguments[7] !== void 0 ? arguments[7] : {}, l = getBarHeightAndYAttr(e, s.zeroLine), u = _slicedToArray(l, 2), c = u[0], h = u[1]; - h -= o, c === 0 && (c = s.minHeight, h -= s.minHeight), isValidNumber(t7) || (t7 = 0), isValidNumber(h) || (h = 0), isValidNumber(c, true) || (c = 0), isValidNumber(n, true) || (n = 0); - var d = createSVG("rect", { className: "bar mini", style: "fill: " + i, "data-point-index": r, x: t7, y: h, width: n, height: c }); - if ((a += "") || a.length) { - d.setAttribute("y", 0), d.setAttribute("x", 0); - var f = createSVG("text", { className: "data-point-value", x: n / 2, y: 0, dy: FONT_SIZE / 2 * -1 + "px", "font-size": FONT_SIZE + "px", "text-anchor": "middle", innerHTML: a }), p = createSVG("g", { "data-point-index": r, transform: "translate(" + t7 + ", " + h + ")" }); - return p.appendChild(d), p.appendChild(f), p; - } - return d; -} -function datasetDot(t7, e, n, i) { - var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : "", r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0, o = createSVG("circle", { style: "fill: " + i, "data-point-index": r, cx: t7, cy: e, r: n }); - if ((a += "") || a.length) { - o.setAttribute("cy", 0), o.setAttribute("cx", 0); - var s = createSVG("text", { className: "data-point-value", x: 0, y: 0, dy: FONT_SIZE / 2 * -1 - n + "px", "font-size": FONT_SIZE + "px", "text-anchor": "middle", innerHTML: a }), l = createSVG("g", { "data-point-index": r, transform: "translate(" + t7 + ", " + e + ")" }); - return l.appendChild(o), l.appendChild(s), l; - } - return o; -} -function getPaths(t7, e, n) { - var i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {}, r = e.map(function(e2, n2) { - return t7[n2] + "," + e2; - }).join("L"); - i.spline && (r = getSplineCurvePointsStr(t7, e)); - var o = makePath("M" + r, "line-graph-path", n); - if (i.heatline) { - var s = makeGradient(a.svgDefs, n); - o.style.stroke = "url(#" + s + ")"; - } - var l = { path: o }; - if (i.regionFill) { - var u = makeGradient(a.svgDefs, n, true), c = "M" + t7[0] + "," + a.zeroLine + "L" + r + "L" + t7.slice(-1)[0] + "," + a.zeroLine; - l.region = makePath(c, "region-fill", "none", "url(#" + u + ")"); - } - return l; -} -function translate(t7, e, n, i) { - var a = typeof e == "string" ? e : e.join(", "); - return [t7, { transform: n.join(", ") }, i, STD_EASING, "translate", { transform: a }]; -} -function translateVertLine(t7, e, n) { - return translate(t7, [n, 0], [e, 0], MARKER_LINE_ANIM_DUR); -} -function translateHoriLine(t7, e, n) { - return translate(t7, [0, n], [0, e], MARKER_LINE_ANIM_DUR); -} -function animateRegion(t7, e, n, i) { - var a = e - n, r = t7.childNodes[0]; - return [[r, { height: a, "stroke-dasharray": r.getAttribute("width") + ", " + a }, MARKER_LINE_ANIM_DUR, STD_EASING], translate(t7, [0, i], [0, n], MARKER_LINE_ANIM_DUR)]; -} -function animateBar(t7, e, n, i) { - var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 0, r = getBarHeightAndYAttr(n, (arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}).zeroLine), o = _slicedToArray$2(r, 2), s = o[0], l = o[1]; - return l -= a, t7.nodeName !== "rect" ? [[t7.childNodes[0], { width: i, height: s }, UNIT_ANIM_DUR, STD_EASING], translate(t7, t7.getAttribute("transform").split("(")[1].slice(0, -1), [e, l], MARKER_LINE_ANIM_DUR)] : [[t7, { width: i, height: s, x: e, y: l }, UNIT_ANIM_DUR, STD_EASING]]; -} -function animateDot(t7, e, n) { - return t7.nodeName !== "circle" ? [translate(t7, t7.getAttribute("transform").split("(")[1].slice(0, -1), [e, n], MARKER_LINE_ANIM_DUR)] : [[t7, { cx: e, cy: n }, UNIT_ANIM_DUR, STD_EASING]]; -} -function animatePath(t7, e, n, i, a) { - var r = [], o = n.map(function(t8, n2) { - return e[n2] + "," + t8; - }).join("L"); - a && (o = getSplineCurvePointsStr(e, n)); - var s = [t7.path, { d: "M" + o }, PATH_ANIM_DUR, STD_EASING]; - if (r.push(s), t7.region) { - var l = e[0] + "," + i + "L", u = "L" + e.slice(-1)[0] + ", " + i, c = [t7.region, { d: "M" + l + o + u }, PATH_ANIM_DUR, STD_EASING]; - r.push(c); - } - return r; -} -function animatePathStr(t7, e) { - return [t7, { d: e }, UNIT_ANIM_DUR, STD_EASING]; -} -function _toConsumableArray$1(t7) { - if (Array.isArray(t7)) { - for (var e = 0, n = Array(t7.length); e < t7.length; e++) - n[e] = t7[e]; - return n; - } - return Array.from(t7); -} -function animateSVGElement(t7, e, n) { - var i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "linear", a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : void 0, r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}, o = t7.cloneNode(true), s = t7.cloneNode(true); - for (var l in e) { - var u = void 0; - u = l === "transform" ? document.createElementNS("http://www.w3.org/2000/svg", "animateTransform") : document.createElementNS("http://www.w3.org/2000/svg", "animate"); - var c = r[l] || t7.getAttribute(l), h = e[l], d = { attributeName: l, from: c, to: h, begin: "0s", dur: n / 1e3 + "s", values: c + ";" + h, keySplines: EASING[i], keyTimes: "0;1", calcMode: "spline", fill: "freeze" }; - a && (d.type = a); - for (var f in d) - u.setAttribute(f, d[f]); - o.appendChild(u), a ? s.setAttribute(l, "translate(" + h + ")") : s.setAttribute(l, h); - } - return [o, s]; -} -function transform(t7, e) { - t7.style.transform = e, t7.style.webkitTransform = e, t7.style.msTransform = e, t7.style.mozTransform = e, t7.style.oTransform = e; -} -function animateSVG(t7, e) { - var n = [], i = []; - e.map(function(t8) { - var e2 = t8[0], a2 = e2.parentNode, r = void 0, o = void 0; - t8[0] = e2; - var s = animateSVGElement.apply(void 0, _toConsumableArray$1(t8)), l = _slicedToArray$1(s, 2); - r = l[0], o = l[1], n.push(o), i.push([r, a2]), a2 && a2.replaceChild(r, e2); - }); - var a = t7.cloneNode(true); - return i.map(function(t8, i2) { - t8[1] && (t8[1].replaceChild(n[i2], t8[0]), e[i2][0] = n[i2]); - }), a; -} -function runSMILAnimation(t7, e, n) { - if (n.length !== 0) { - var i = animateSVG(e, n); - e.parentNode == t7 && (t7.removeChild(e), t7.appendChild(i)), setTimeout(function() { - i.parentNode == t7 && (t7.removeChild(i), t7.appendChild(e)); - }, REPLACE_ALL_NEW_DUR); - } -} -function downloadFile(t7, e) { - var n = document.createElement("a"); - n.style = "display: none"; - var i = new Blob(e, { type: "image/svg+xml; charset=utf-8" }), a = window.URL.createObjectURL(i); - n.href = a, n.download = t7, document.body.appendChild(n), n.click(), setTimeout(function() { - document.body.removeChild(n), window.URL.revokeObjectURL(a); - }, 300); -} -function prepareForExport(t7) { - var e = t7.cloneNode(true); - e.classList.add("chart-container"), e.setAttribute("xmlns", "http://www.w3.org/2000/svg"), e.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"); - var n = $.create("style", { innerHTML: CSSTEXT }); - e.insertBefore(n, e.firstChild); - var i = $.create("div"); - return i.appendChild(e), i.innerHTML; -} -function _classCallCheck$3(t7, e) { - if (!(t7 instanceof e)) - throw new TypeError("Cannot call a class as a function"); -} -function _classCallCheck$2(t7, e) { - if (!(t7 instanceof e)) - throw new TypeError("Cannot call a class as a function"); -} -function _possibleConstructorReturn$1(t7, e) { - if (!t7) - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - return !e || typeof e != "object" && typeof e != "function" ? t7 : e; -} -function _inherits$1(t7, e) { - if (typeof e != "function" && e !== null) - throw new TypeError("Super expression must either be null or a function, not " + typeof e); - t7.prototype = Object.create(e && e.prototype, { constructor: { value: t7, enumerable: false, writable: true, configurable: true } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t7, e) : t7.__proto__ = e); -} -function treatAsUtc(t7) { - var e = new Date(t7); - return e.setMinutes(e.getMinutes() - e.getTimezoneOffset()), e; -} -function getYyyyMmDd(t7) { - var e = t7.getDate(), n = t7.getMonth() + 1; - return [t7.getFullYear(), (n > 9 ? "" : "0") + n, (e > 9 ? "" : "0") + e].join("-"); -} -function clone(t7) { - return new Date(t7.getTime()); -} -function getWeeksBetween(t7, e) { - var n = setDayToSunday(t7); - return Math.ceil(getDaysBetween(n, e) / NO_OF_DAYS_IN_WEEK); -} -function getDaysBetween(t7, e) { - var n = SEC_IN_DAY * NO_OF_MILLIS; - return (treatAsUtc(e) - treatAsUtc(t7)) / n; -} -function areInSameMonth(t7, e) { - return t7.getMonth() === e.getMonth() && t7.getFullYear() === e.getFullYear(); -} -function getMonthName(t7) { - var e = arguments.length > 1 && arguments[1] !== void 0 && arguments[1], n = MONTH_NAMES[t7]; - return e ? n.slice(0, 3) : n; -} -function getLastDateInMonth(t7, e) { - return new Date(e, t7 + 1, 0); -} -function setDayToSunday(t7) { - var e = clone(t7), n = e.getDay(); - return n !== 0 && addDays(e, -1 * n), e; -} -function addDays(t7, e) { - t7.setDate(t7.getDate() + e); -} -function _classCallCheck$5(t7, e) { - if (!(t7 instanceof e)) - throw new TypeError("Cannot call a class as a function"); -} -function getComponent(t7, e, n) { - var i = Object.keys(componentConfigs).filter(function(e2) { - return t7.includes(e2); - }), a = componentConfigs[i[0]]; - return Object.assign(a, { constants: e, getData: n }), new ChartComponent(a); -} -function _toConsumableArray(t7) { - if (Array.isArray(t7)) { - for (var e = 0, n = Array(t7.length); e < t7.length; e++) - n[e] = t7[e]; - return n; - } - return Array.from(t7); -} -function _classCallCheck$1(t7, e) { - if (!(t7 instanceof e)) - throw new TypeError("Cannot call a class as a function"); -} -function _possibleConstructorReturn(t7, e) { - if (!t7) - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - return !e || typeof e != "object" && typeof e != "function" ? t7 : e; -} -function _inherits(t7, e) { - if (typeof e != "function" && e !== null) - throw new TypeError("Super expression must either be null or a function, not " + typeof e); - t7.prototype = Object.create(e && e.prototype, { constructor: { value: t7, enumerable: false, writable: true, configurable: true } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t7, e) : t7.__proto__ = e); -} -function _toConsumableArray$2(t7) { - if (Array.isArray(t7)) { - for (var e = 0, n = Array(t7.length); e < t7.length; e++) - n[e] = t7[e]; - return n; - } - return Array.from(t7); -} -function _classCallCheck$6(t7, e) { - if (!(t7 instanceof e)) - throw new TypeError("Cannot call a class as a function"); -} -function _possibleConstructorReturn$2(t7, e) { - if (!t7) - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - return !e || typeof e != "object" && typeof e != "function" ? t7 : e; -} -function _inherits$2(t7, e) { - if (typeof e != "function" && e !== null) - throw new TypeError("Super expression must either be null or a function, not " + typeof e); - t7.prototype = Object.create(e && e.prototype, { constructor: { value: t7, enumerable: false, writable: true, configurable: true } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t7, e) : t7.__proto__ = e); -} -function _toConsumableArray$4(t7) { - if (Array.isArray(t7)) { - for (var e = 0, n = Array(t7.length); e < t7.length; e++) - n[e] = t7[e]; - return n; - } - return Array.from(t7); -} -function normalize(t7) { - if (t7 === 0) - return [0, 0]; - if (isNaN(t7)) - return { mantissa: -6755399441055744, exponent: 972 }; - var e = t7 > 0 ? 1 : -1; - if (!isFinite(t7)) - return { mantissa: 4503599627370496 * e, exponent: 972 }; - t7 = Math.abs(t7); - var n = Math.floor(Math.log10(t7)); - return [e * (t7 / Math.pow(10, n)), n]; -} -function getChartRangeIntervals(t7) { - var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = Math.ceil(t7), i = Math.floor(e), a = n - i, r = a, o = 1; - a > 5 && (a % 2 != 0 && (a = ++n - i), r = a / 2, o = 2), a <= 2 && (o = a / (r = 4)), a === 0 && (r = 5, o = 1); - for (var s = [], l = 0; l <= r; l++) - s.push(i + o * l); - return s; -} -function getChartIntervals(t7) { - var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = normalize(t7), i = _slicedToArray$4(n, 2), a = i[0], r = i[1], o = e ? e / Math.pow(10, r) : 0, s = getChartRangeIntervals(a = a.toFixed(6), o); - return s = s.map(function(t8) { - return t8 * Math.pow(10, r); - }); -} -function calcChartIntervals(t7) { - function e(t8, e2) { - for (var n2 = getChartIntervals(t8), i2 = n2[1] - n2[0], a2 = 0, r2 = 1; a2 < e2; r2++) - a2 += i2, n2.unshift(-1 * a2); - return n2; - } - var n = arguments.length > 1 && arguments[1] !== void 0 && arguments[1], i = Math.max.apply(Math, _toConsumableArray$4(t7)), a = Math.min.apply(Math, _toConsumableArray$4(t7)), r = []; - if (i >= 0 && a >= 0) - normalize(i)[1], r = n ? getChartIntervals(i, a) : getChartIntervals(i); - else if (i > 0 && a < 0) { - var o = Math.abs(a); - i >= o ? (normalize(i)[1], r = e(i, o)) : (normalize(o)[1], r = e(o, i).reverse().map(function(t8) { - return -1 * t8; - })); - } else if (i <= 0 && a <= 0) { - var s = Math.abs(a), l = Math.abs(i); - normalize(s)[1], r = (r = n ? getChartIntervals(s, l) : getChartIntervals(s)).reverse().map(function(t8) { - return -1 * t8; - }); - } - return r; -} -function getZeroIndex(t7) { - var e = getIntervalSize(t7); - return t7.indexOf(0) >= 0 ? t7.indexOf(0) : t7[0] > 0 ? -1 * t7[0] / e : -1 * t7[t7.length - 1] / e + (t7.length - 1); -} -function getIntervalSize(t7) { - return t7[1] - t7[0]; -} -function getValueRange(t7) { - return t7[t7.length - 1] - t7[0]; -} -function scale(t7, e) { - return floatTwo(e.zeroLine - t7 * e.scaleMultiplier); -} -function getClosestInArray(t7, e) { - var n = arguments.length > 2 && arguments[2] !== void 0 && arguments[2], i = e.reduce(function(e2, n2) { - return Math.abs(n2 - t7) < Math.abs(e2 - t7) ? n2 : e2; - }, []); - return n ? e.indexOf(i) : i; -} -function calcDistribution(t7, e) { - for (var n = Math.max.apply(Math, _toConsumableArray$4(t7)), i = 1 / (e - 1), a = [], r = 0; r < e; r++) { - var o = n * (i * r); - a.push(o); - } - return a; -} -function getMaxCheckpoint(t7, e) { - return e.filter(function(e2) { - return e2 < t7; - }).length; -} -function _toConsumableArray$3(t7) { - if (Array.isArray(t7)) { - for (var e = 0, n = Array(t7.length); e < t7.length; e++) - n[e] = t7[e]; - return n; - } - return Array.from(t7); -} -function _classCallCheck$7(t7, e) { - if (!(t7 instanceof e)) - throw new TypeError("Cannot call a class as a function"); -} -function _possibleConstructorReturn$3(t7, e) { - if (!t7) - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - return !e || typeof e != "object" && typeof e != "function" ? t7 : e; -} -function _inherits$3(t7, e) { - if (typeof e != "function" && e !== null) - throw new TypeError("Super expression must either be null or a function, not " + typeof e); - t7.prototype = Object.create(e && e.prototype, { constructor: { value: t7, enumerable: false, writable: true, configurable: true } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t7, e) : t7.__proto__ = e); -} -function _toConsumableArray$6(t7) { - if (Array.isArray(t7)) { - for (var e = 0, n = Array(t7.length); e < t7.length; e++) - n[e] = t7[e]; - return n; - } - return Array.from(t7); -} -function dataPrep(t7, e) { - t7.labels = t7.labels || []; - var n = t7.labels.length, i = t7.datasets, a = new Array(n).fill(0); - return i || (i = [{ values: a }]), i.map(function(t8) { - if (t8.values) { - var i2 = t8.values; - i2 = (i2 = i2.map(function(t9) { - return isNaN(t9) ? 0 : t9; - })).length > n ? i2.slice(0, n) : fillArray(i2, n - i2.length, 0), t8.values = i2; - } else - t8.values = a; - t8.chartType || (AXIS_DATASET_CHART_TYPES.includes(e), t8.chartType = e); - }), t7.yRegions && t7.yRegions.map(function(t8) { - if (t8.end < t8.start) { - var e2 = [t8.end, t8.start]; - t8.start = e2[0], t8.end = e2[1]; - } - }), t7; -} -function zeroDataPrep(t7) { - var e = t7.labels.length, n = new Array(e).fill(0), i = { labels: t7.labels.slice(0, -1), datasets: t7.datasets.map(function(t8) { - return { name: "", values: n.slice(0, -1), chartType: t8.chartType }; - }) }; - return t7.yMarkers && (i.yMarkers = [{ value: 0, label: "" }]), t7.yRegions && (i.yRegions = [{ start: 0, end: 0, label: "" }]), i; -} -function getShortenedLabels(t7) { - var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], n = !(arguments.length > 2 && arguments[2] !== void 0) || arguments[2], i = t7 / e.length; - i <= 0 && (i = 1); - var a = i / DEFAULT_CHAR_WIDTH, r = void 0; - if (n) { - var o = Math.max.apply(Math, _toConsumableArray$6(e.map(function(t8) { - return t8.length; - }))); - r = Math.ceil(o / a); - } - return e.map(function(t8, e2) { - return (t8 += "").length > a && (n ? e2 % r != 0 && (t8 = "") : t8 = a - 3 > 0 ? t8.slice(0, a - 3) + " ..." : t8.slice(0, a) + ".."), t8; - }); -} -function _toConsumableArray$5(t7) { - if (Array.isArray(t7)) { - for (var e = 0, n = Array(t7.length); e < t7.length; e++) - n[e] = t7[e]; - return n; - } - return Array.from(t7); -} -function _classCallCheck$8(t7, e) { - if (!(t7 instanceof e)) - throw new TypeError("Cannot call a class as a function"); -} -function _possibleConstructorReturn$4(t7, e) { - if (!t7) - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - return !e || typeof e != "object" && typeof e != "function" ? t7 : e; -} -function _inherits$4(t7, e) { - if (typeof e != "function" && e !== null) - throw new TypeError("Super expression must either be null or a function, not " + typeof e); - t7.prototype = Object.create(e && e.prototype, { constructor: { value: t7, enumerable: false, writable: true, configurable: true } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t7, e) : t7.__proto__ = e); -} -function _toConsumableArray$7(t7) { - if (Array.isArray(t7)) { - for (var e = 0, n = Array(t7.length); e < t7.length; e++) - n[e] = t7[e]; - return n; - } - return Array.from(t7); -} -function _classCallCheck$9(t7, e) { - if (!(t7 instanceof e)) - throw new TypeError("Cannot call a class as a function"); -} -function _possibleConstructorReturn$5(t7, e) { - if (!t7) - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - return !e || typeof e != "object" && typeof e != "function" ? t7 : e; -} -function _inherits$5(t7, e) { - if (typeof e != "function" && e !== null) - throw new TypeError("Super expression must either be null or a function, not " + typeof e); - t7.prototype = Object.create(e && e.prototype, { constructor: { value: t7, enumerable: false, writable: true, configurable: true } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t7, e) : t7.__proto__ = e); -} -function _classCallCheck(t7, e) { - if (!(t7 instanceof e)) - throw new TypeError("Cannot call a class as a function"); -} -function getChartByType() { - var t7 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "line", e = arguments[1], n = arguments[2]; - return t7 === "axis-mixed" ? (n.type = "line", new AxisChart(e, n)) : chartTypes[t7] ? new chartTypes[t7](e, n) : void console.error("Undefined chart type: " + t7); -} -var css_248z = '.chart-container{position:relative;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}.chart-container .axis,.chart-container .chart-label{fill:#555b51}.chart-container .axis line,.chart-container .chart-label line{stroke:#dadada}.chart-container .dataset-units circle{stroke:#fff;stroke-width:2}.chart-container .dataset-units path{fill:none;stroke-opacity:1;stroke-width:2px}.chart-container .dataset-path{stroke-width:2px}.chart-container .path-group path{fill:none;stroke-opacity:1;stroke-width:2px}.chart-container line.dashed{stroke-dasharray:5,3}.chart-container .axis-line .specific-value{text-anchor:start}.chart-container .axis-line .y-line{text-anchor:end}.chart-container .axis-line .x-line{text-anchor:middle}.chart-container .legend-dataset-text{fill:#6c7680;font-weight:600}.graph-svg-tip{position:absolute;z-index:99999;padding:10px;font-size:12px;color:#959da5;text-align:center;background:rgba(0,0,0,.8);border-radius:3px}.graph-svg-tip ol,.graph-svg-tip ul{padding-left:0;display:-webkit-box;display:-ms-flexbox;display:flex}.graph-svg-tip ul.data-point-list li{min-width:90px;-webkit-box-flex:1;-ms-flex:1;flex:1;font-weight:600}.graph-svg-tip strong{color:#dfe2e5;font-weight:600}.graph-svg-tip .svg-pointer{position:absolute;height:5px;margin:0 0 0 -5px;content:" ";border:5px solid transparent;border-top-color:rgba(0,0,0,.8)}.graph-svg-tip.comparison{padding:0;text-align:left;pointer-events:none}.graph-svg-tip.comparison .title{display:block;padding:10px;margin:0;font-weight:600;line-height:1;pointer-events:none}.graph-svg-tip.comparison ul{margin:0;white-space:nowrap;list-style:none}.graph-svg-tip.comparison li{display:inline-block;padding:5px 10px}'; -styleInject(css_248z); -var _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t7) { - return typeof t7; -} : function(t7) { - return t7 && typeof Symbol == "function" && t7.constructor === Symbol && t7 !== Symbol.prototype ? "symbol" : typeof t7; -}; -$.create = function(t7, e) { - var n = document.createElement(t7); - for (var i in e) { - var a = e[i]; - if (i === "inside") - $(a).appendChild(n); - else if (i === "around") { - var r = $(a); - r.parentNode.insertBefore(n, r), n.appendChild(r); - } else - i === "styles" ? (a === void 0 ? "undefined" : _typeof(a)) === "object" && Object.keys(a).map(function(t8) { - n.style[t8] = a[t8]; - }) : i in n ? n[i] = a : n.setAttribute(i, a); - } - return n; -}; -var BASE_MEASURES = { margins: { top: 10, bottom: 10, left: 20, right: 20 }, paddings: { top: 20, bottom: 40, left: 30, right: 10 }, baseHeight: 240, titleHeight: 20, legendHeight: 30, titleFontSize: 12 }; -var INIT_CHART_UPDATE_TIMEOUT = 700; -var CHART_POST_ANIMATE_TIMEOUT = 400; -var AXIS_DATASET_CHART_TYPES = ["line", "bar"]; -var AXIS_LEGEND_BAR_SIZE = 100; -var BAR_CHART_SPACE_RATIO = 0.5; -var MIN_BAR_PERCENT_HEIGHT = 0; -var LINE_CHART_DOT_SIZE = 4; -var DOT_OVERLAY_SIZE_INCR = 4; -var PERCENTAGE_BAR_DEFAULT_HEIGHT = 20; -var PERCENTAGE_BAR_DEFAULT_DEPTH = 2; -var HEATMAP_DISTRIBUTION_SIZE = 5; -var HEATMAP_SQUARE_SIZE = 10; -var HEATMAP_GUTTER_SIZE = 2; -var DEFAULT_CHAR_WIDTH = 7; -var TOOLTIP_POINTER_TRIANGLE_HEIGHT = 5; -var DEFAULT_CHART_COLORS = ["light-blue", "blue", "violet", "red", "orange", "yellow", "green", "light-green", "purple", "magenta", "light-grey", "dark-grey"]; -var HEATMAP_COLORS_GREEN = ["#ebedf0", "#c6e48b", "#7bc96f", "#239a3b", "#196127"]; -var DEFAULT_COLORS = { bar: DEFAULT_CHART_COLORS, line: DEFAULT_CHART_COLORS, pie: DEFAULT_CHART_COLORS, percentage: DEFAULT_CHART_COLORS, heatmap: HEATMAP_COLORS_GREEN, donut: DEFAULT_CHART_COLORS }; -var ANGLE_RATIO = Math.PI / 180; -var FULL_ANGLE = 360; -var _createClass$3 = function() { - function t7(t8, e) { - for (var n = 0; n < e.length; n++) { - var i = e[n]; - i.enumerable = i.enumerable || false, i.configurable = true, "value" in i && (i.writable = true), Object.defineProperty(t8, i.key, i); - } - } - return function(e, n, i) { - return n && t7(e.prototype, n), i && t7(e, i), e; - }; -}(); -var SvgTip = function() { - function t7(e) { - var n = e.parent, i = n === void 0 ? null : n, a = e.colors, r = a === void 0 ? [] : a; - _classCallCheck$4(this, t7), this.parent = i, this.colors = r, this.titleName = "", this.titleValue = "", this.listValues = [], this.titleValueFirst = 0, this.x = 0, this.y = 0, this.top = 0, this.left = 0, this.setup(); - } - return _createClass$3(t7, [{ key: "setup", value: function() { - this.makeTooltip(); - } }, { key: "refresh", value: function() { - this.fill(), this.calcPosition(); - } }, { key: "makeTooltip", value: function() { - var t8 = this; - this.container = $.create("div", { inside: this.parent, className: "graph-svg-tip comparison", innerHTML: '\n
If something is wrong, please create an issue here!
-Agar.io is quite a simple game to play... well, for humans it is. However is it just as simple for artificial agents? In this article I will tell you how I have constructed a genetic algorithm that evolves neural networks to play in an Agario.io-like environment. The following simulation shows agents that resulted from 1000+ generations of running the algorithm:
- - -Hover your mouse over a blob to see some more info! Source code here
-As you might have noticed, the genomes are performing quite well, but far from perfect. The genomes shows human-like traits: searching food, avoiding bigger blobs and chasing smaller blobs. However sometimes one genome just runs into a bigger blob for no reason at all. That is because each genome can only see 3 other blobs and 3 food blobs. But above all, the settings of the GA are far from optimized. That is why I invite you to optimize the settings, and perform a pull request on this repo.
-The code consists of 3 main parts: the field, the player and the genetic algorithm. In the following few paragraphs i'll go into depth on this topics, discussing my choices made. At the bottom of this article you will find a list of improvements I have thought of, but not made yet.
-If you have any questions about the code in the linked repo, please create an issue on this repo.
-The field consists of 2 different objects: food and players. Food is stationary, and has no 'brain'. Every piece of food has a static feeding value. Once food has been eaten, it just moves to a new location on the field. Players on the other hand are capable of making decisions through neural networks. They slowly decay in size when not replenished (either by eating other players or food).
-The field has no borders; when a blob hits the left wall, it will 'teleport' to the right wall. During tests with a bordered field, the entire population of genomes tended to stick to one of the walls without ever evolving to a more flexible population. However, having borderless walls comes with a problem of which a fix has not yet been implemented: genomes that are for example near the left wall, won't detect blobs that are close to the right wall - even though the distance between the blobs can be very small.
-Some (configurable) settings:
-The player is a simplified version of the player in the real game. A genome can't split and shoot - it can only move. The output of each genomes brain consists of merely a movement direction and movement speed.
-Genomes can't accelerate, they immediately adapt to the speed given by their brain. They can only eat other blobs when they are 10% bigger, and they can move freely through other blobs that are less than 10% bigger. Each genome will only see the 3 closest players and the 3 closest food blobs within a certain radius.
-Some (configurable) settings:
-The genetic algorithm is the core of the AI. In the first frame, a certain amount of players are initialized with a neural network as brain. The brains represent the population of a generation. These brains are then evolved by putting the entire population in a single playing field and letting them compete against each other. The fittest brains are moved on the next generation, the less fit brains have a high chance of being removed.
-neat.sort();
-var newPopulation = [];
-
-// Elitism
-for(var i = 0; i < neat.elitism; i++){
- newPopulation.push(neat.population[i]);
-}
-
-// Breed the next individuals
-for(var i = 0; i < neat.popsize - neat.elitism; i++){
- newPopulation.push(neat.getOffspring());
-}
-
-// Replace the old population with the new population
-neat.population = newPopulation;
-neat.mutate();
-
-neat.generation++;
-startEvaluation();
-
-
-The above code shows the code run when the evaluation is finished. It is very similar to the built-in evolve() function of Neataptic, however adapted to avoid a fitness function as all genomes must be evaluated at the same time.
-The scoring of the genomes is quite easy: when a certain amount of iterations has been reached, each genome is ranked by their area. Better performing genomes have eaten more blobs, and thus have a bigger area. This scoring is identical to the scoring in Agar.io. I have experimented with other scoring systems, but lots of them stimulated small players to finish themselves off if their score was too low for a certain amount of time.
-Some (configurable) settings:
-There are a couple of known issues. However, most of them linked are linked to a future improvement in some way or another.
-Issues:
-Future improvements:
-Classifying is something a neural network can do quite well. In this article -I will demonstrate how you can set up the evolution process of a neural network -that learns to classify colors with Neataptic.
-Colors: - - - - - - - -
- -Iteration: 0 Best-fitness: 0- -
The algorithm to this classification is actually pretty easy. One of my biggest -problem was generating the colors, however I stumbled upon this -Javascript library that allows you to generate colors randomly by name - exactly -what I needed (but it also created a problem, read below). So I used it to create -a training set:
-function createSet(){
- var set = [];
-
- for(index in COLORS){
- var color = COLORS[index];
-
- var randomColors = randomColor({ hue : color, count: PER_COLOR, format: 'rgb'});
-
- for(var random in randomColors){
- var rgb = randomColors[random];
- random = rgb.substring(4, rgb.length-1).replace(/ /g, '').split(',');
- for(var y in random) random[y] = random[y]/255;
-
- var output = Array.apply(null, Array(COLORS.length)).map(Number.prototype.valueOf, 0);
- output[index] = 1;
-
- set.push({ input: random, output: output, color: color, rgb: rgb});
- }
- }
-
- return set;
-}
-
-
-COLORS is an array storing all color names in strings. The possible colors are
-listed above. Next, we convert this rgb string to an array and normalize the
-values between 0 and 1. Last of all, we normalize the colors using
-one-hot encoding.
-Please note that the color
and rgb
object attributes are irrelevant for the algorithm.
network.evolve(set, {
- iterations: 1,
- mutationRate: 0.6,
- elisitm: 5,
- popSize: 100,
- mutation: methods.mutation.FFW,
- cost: methods.cost.MSE
-});
-
-
-Now we create the built-in genetic algorithm in neataptic.js. We define -that we want to use all possible mutation methods and set the mutation rate -higher than normal. Sprinkle in some elitism and double the default population -size. Experiment with the parameters yourself, maybe you'll find even better parameters!
-The fitness function is the most vital part of the algorithm. It basically
-calculates the Mean Squared Error
-of the entire set. Neataptic saves the programming of this fitness calculation.
-At the same time the default growth
parameter is used, so the networks will
-get penalized for being too large.
And putting together all this code will create a color classifier.
-Welcome to the articles page! Every now and then, articles will be posted here -showing for what kind of projects Neataptic could be used. Neataptic is -excellent for the development of AI for browser games for example.
-If you want to post your own article here, feel free to create a pull request -or an isse on the repo page!
-This page shows some neuro-evolution examples. Please note that not every example -may always be successful. More may be added in the future!
-This neural network gets taught to increase the input by 0.2 until 1.0 is reached, then it must decrease the input by 2.0.
- - -This neural network gets taught to wait 9 inputs of 0, to output 1 at input number 10.
- - -This neural network gets taught to classify if a letter of the alphabet is a vowel or not. The data is one-hot-encoded.
- - -Output:- -
In the simulation below, neural networks that have been evolved through roughly -100 generations try to seek a target. Their goal is to stay as close to the target -as possible at all times. If you want to see how one of these networks looks like, -check out the complete simulation.
-Click on the field to relocate the target! Source code here.
-The neural agents are actually performing really well. At least one agent will have -'solved the problem' after roughly 20 generations. That is because the base of the solution -is quite easy: one of the inputs of the neural networks is the angle to the target, so all it -has to do is output some value that is similar to this input value. This can easily be done -through the identity activation function, but surprisingly, most agents in the simulation above -tend to avoid this function.
-You can check out the topology of the networks here. -If you manage to evolve the genomes quicker or better than this simulation with different settings, please -perform a pull request on this repo.
-In the previous article I have gone more into depth on the environment of the algorithm, but in this article -I will focus more on the settings and inputs/outputs of the algorithm itself.
-If you have any questions about the code in the linked repo, please create an issue on this repo.
-The agents' task is very simple. They have to get in the vicinity of the target which is set to about -100 pixels, once they are in that vicinity, each agents' score will be increased proportionally `(100 - dist)`` -to the distance. There is one extra though: for every node in the agents' network, the score of the agent will -be decreased. This has two reasons; 1. networks shouldn't overfit the solution and 2. having smaller networks -reduces computation power.
-Agents have some kind of momentum. They don't have mass, but they do have acceleration, so it takes a small -amount of time for a agent to reach the top speed in a certain direction.
-Each agent has the following inputs:
-The output of each agent is just the desired movement direction.
-There is no kind of collision, except for the walls of the fields. In the future, it might be interesting to -add collisions between multiple agents and/or the target to reveal some new tactics. This would require the -agent to know the location of surrounding agents.
-The target is fairly easy. It's programmed to switch direction every now and then by a random amount. There -is one important thing however: the target moves with half the speed of the agents, this makes sure -that agents always have the ability to catch up with the target. Apart from that, the physics for the target -are similar to the agents' physics.
-The genetic algorithm is the core of the AI. In the first frame, a certain -amount of players are initialized with a neural network as brain. The brains -represent the population of a generation. These brains are then evolved by -putting the entire population in óne playing field and letting them compete -against each other. The fittest brains are moved on the next generation, -the less fit brains have a high chance of being removed.
-// Networks shouldn't get too big
-for(var genome in neat.population){
- genome = neat.population[genome];
- genome.score -= genome.nodes.length * SCORE_RADIUS / 10;
-}
-
-// Sort the population by score
-neat.sort();
-
-// Draw the best genome
-drawGraph(neat.population[0].graph($('.best').width(), $('.best').height()), '.best', false);
-
-// Init new pop
-var newPopulation = [];
-
-// Elitism
-for(var i = 0; i < neat.elitism; i++){
- newPopulation.push(neat.population[i]);
-}
-
-// Breed the next individuals
-for(var i = 0; i < neat.popsize - neat.elitism; i++){
- newPopulation.push(neat.getOffspring());
-}
-
-// Replace the old population with the new population
-neat.population = newPopulation;
-neat.mutate();
-
-neat.generation++;
-startEvaluation();
-
-
-The above code shows the code run when the evaluation is finished. It is very similar
-to the built-in evolve()
function of Neataptic, however adapted to avoid a fitness
-function as all genomes must be evaluated at the same time.
The scoring of the genomes is quite easy: when a certain amount of iterations has been reached, -each genome is ranked by their final score. Genomes with a higher score have a small amount of nodes -and have been close to the target throughout the iteration.
-Some (configurable) settings:
-Forks
-